code: def st_filter(st_mask, cid_tids, cid_tid_dict):
      count = len(cid_tids)
      for i in range(count):
          i_tracklet = cid_tid_dict[cid_tids[i]]
          i_cid = i_tracklet["cam"]
          i_dire = get_dire(i_tracklet["zone_list"], i_cid)
          i_iot = i_tracklet["io_time"]
          for j in range(count):
              j_tracklet = cid_tid_dict[cid_tids[j]]
              j_cid = j_tracklet["cam"]
              j_dire = get_dire(j_tracklet["zone_list"], j_cid)
              j_iot = j_tracklet["io_time"]
  
              match_dire = True
              cam_dist = CAM_DIST[i_cid - 41][j_cid - 41]
              # if time overlopped
              if (
                  i_iot[0] - cam_dist < j_iot[0]
                  and j_iot[0] < i_iot[1] + cam_dist
              ):
                  match_dire = False
              if (
                  i_iot[0] - cam_dist < j_iot[1]
                  and j_iot[1] < i_iot[1] + cam_dist
              ):
                  match_dire = False
  
              # not match after go out
              if i_dire[1] in [1, 2]:  # i out
                  if i_iot[0] < j_iot[1] + cam_dist:
                      match_dire = False
  
              if i_dire[1] in [1, 2]:
                  if i_dire[0] in [3] and i_cid > j_cid:
                      match_dire = False
                  if i_dire[0] in [4] and i_cid < j_cid:
                      match_dire = False
  
              if i_cid in [41] and i_dire[1] in [4]:
                  if i_iot[0] < j_iot[1] + cam_dist:
                      match_dire = False
                  if i_iot[1] > 199:
                      match_dire = False
              if i_cid in [46] and i_dire[1] in [3]:
                  if i_iot[0] < j_iot[1] + cam_dist:
                      match_dire = False
  
              # match after come into
              if i_dire[0] in [1, 2]:
                  if i_iot[1] > j_iot[0] - cam_dist:
                      match_dire = False
  
              if i_dire[0] in [1, 2]:
                  if i_dire[1] in [3] and i_cid > j_cid:
                      match_dire = False
                  if i_dire[1] in [4] and i_cid < j_cid:
                      match_dire = False
  
              is_ignore = False
              if (i_dire[0] == i_dire[1] and i_dire[0] in [3, 4]) or (
                  j_dire[0] == j_dire[1] and j_dire[0] in [3, 4]
              ):
                  is_ignore = True
  
              if not is_ignore:
                  # direction conflict
                  if (i_dire[0] in [3] and j_dire[0] in [4]) or (
                      i_dire[1] in [3] and j_dire[1] in [4]
                  ):
                      match_dire = False
                  # filter before going next scene
                  if i_dire[1] in [3] and i_cid < j_cid:
                      if i_iot[1] > j_iot[1] - cam_dist:
                          match_dire = False
                  if i_dire[1] in [4] and i_cid > j_cid:
                      if i_iot[1] > j_iot[1] - cam_dist:
                          match_dire = False
  
                  if i_dire[0] in [3] and i_cid < j_cid:
                      if i_iot[0] < j_iot[0] + cam_dist:
                          match_dire = False
                  if i_dire[0] in [4] and i_cid > j_cid:
                      if i_iot[0] < j_iot[0] + cam_dist:
                          match_dire = False
                  ## 3-30
                  ## 4-1
                  if i_dire[0] in [3] and i_cid > j_cid:
                      if i_iot[1] > j_iot[0] - cam_dist:
                          match_dire = False
                  if i_dire[0] in [4] and i_cid < j_cid:
                      if i_iot[1] > j_iot[0] - cam_dist:
                          match_dire = False
                  # filter before going next scene
                  ## 4-7
                  if i_dire[1] in [3] and i_cid > j_cid:
                      if i_iot[0] < j_iot[1] + cam_dist:
                          match_dire = False
                  if i_dire[1] in [4] and i_cid < j_cid:
                      if i_iot[0] < j_iot[1] + cam_dist:
                          match_dire = False
              else:
                  if i_iot[1] > 199:
                      if i_dire[0] in [3] and i_cid < j_cid:
                          if i_iot[0] < j_iot[0] + cam_dist:
                              match_dire = False
                      if i_dire[0] in [4] and i_cid > j_cid:
                          if i_iot[0] < j_iot[0] + cam_dist:
                              match_dire = False
                      if i_dire[0] in [3] and i_cid > j_cid:
                          match_dire = False
                      if i_dire[0] in [4] and i_cid < j_cid:
                          match_dire = False
                  if i_iot[0] < 1:
                      if i_dire[1] in [3] and i_cid > j_cid:
                          match_dire = False
                      if i_dire[1] in [4] and i_cid < j_cid:
                          match_dire = False
  
              if not match_dire:
                  st_mask[i, j] = 0.0
                  st_mask[j, i] = 0.0
      return st_mask
  
file_path: PaddleDetection/deploy/pptracking/python/mot/mtmct/camera_utils.py
imports: import numpy
  from .utils import get_dire, get_match, get_cid_tid, combin_feature, combin_cluster
  from .utils import normalize, intracam_ignore, visual_rerank
label_desc: Use image node_id 1 for calling a global function with example usage: st_filter(st_mask, cid_tids, cid_tid_dict) and returns: st_mask