MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / vis_feature

Function vis_feature

tutorials/cstrack/tracker.py:422–547  ·  view source on GitHub ↗
(frame_id,seq_num,img,track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track,max_num=5, out_path='/home/XX/')

Source from the content-addressed store, hash-verified

420 return resa, resb
421
422def vis_feature(frame_id,seq_num,img,track_features, det_features, cost_matrix, cost_matrix_det, cost_matrix_track,max_num=5, out_path='/home/XX/'):
423 num_zero = ["0000","000","00","0"]
424 img = cv2.resize(img, (778, 435))
425
426 if len(det_features) != 0:
427 max_f = det_features.max()
428 min_f = det_features.min()
429 det_features = np.round((det_features - min_f) / (max_f - min_f) * 255)
430 det_features = det_features.astype(np.uint8)
431 d_F_M = []
432 cutpff_line = [40]*512
433 for d_f in det_features:
434 for row in range(45):
435 d_F_M += [[40]*3+d_f.tolist()+[40]*3]
436 for row in range(3):
437 d_F_M += [[40]*3+cutpff_line+[40]*3]
438 d_F_M = np.array(d_F_M)
439 d_F_M = d_F_M.astype(np.uint8)
440 det_features_img = cv2.applyColorMap(d_F_M, cv2.COLORMAP_JET)
441 feature_img2 = cv2.resize(det_features_img, (435, 435))
442 #cv2.putText(feature_img2, "det_features", (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
443 else:
444 feature_img2 = np.zeros((435, 435))
445 feature_img2 = feature_img2.astype(np.uint8)
446 feature_img2 = cv2.applyColorMap(feature_img2, cv2.COLORMAP_JET)
447 #cv2.putText(feature_img2, "det_features", (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
448 feature_img = np.concatenate((img, feature_img2), axis=1)
449
450 if len(cost_matrix_det) != 0 and len(cost_matrix_det[0]) != 0:
451 max_f = cost_matrix_det.max()
452 min_f = cost_matrix_det.min()
453 cost_matrix_det = np.round((cost_matrix_det - min_f) / (max_f - min_f) * 255)
454 d_F_M = []
455 cutpff_line = [40]*len(cost_matrix_det)*10
456 for c_m in cost_matrix_det:
457 add = []
458 for row in range(len(c_m)):
459 add += [255-c_m[row]]*10
460 for row in range(10):
461 d_F_M += [[40]+add+[40]]
462 d_F_M = np.array(d_F_M)
463 d_F_M = d_F_M.astype(np.uint8)
464 cost_matrix_det_img = cv2.applyColorMap(d_F_M, cv2.COLORMAP_JET)
465 feature_img2 = cv2.resize(cost_matrix_det_img, (435, 435))
466 #cv2.putText(feature_img2, "cost_matrix_det", (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
467 else:
468 feature_img2 = np.zeros((435, 435))
469 feature_img2 = feature_img2.astype(np.uint8)
470 feature_img2 = cv2.applyColorMap(feature_img2, cv2.COLORMAP_JET)
471 #cv2.putText(feature_img2, "cost_matrix_det", (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)
472 feature_img = np.concatenate((feature_img, feature_img2), axis=1)
473
474 if len(track_features) != 0:
475 max_f = track_features.max()
476 min_f = track_features.min()
477 track_features = np.round((track_features - min_f) / (max_f - min_f) * 255)
478 track_features = track_features.astype(np.uint8)
479 d_F_M = []

Callers 1

updateMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected