Exemplo n.º 1
0
def get_frame1(video_name):
    images = dataLoader_img(video_name,'007') #focal
    for img in images:
        frame = cv2.imread(img)
        yield frame
Exemplo n.º 2
0
    PATH_TO_DATA = os.path.join(CWD_PATH, modeldir)
    modelpth = glob.glob(PATH_TO_DATA + '/*')[0]  #pretrained
    print(modelpth)

#ROI를 지정한 첫번째 이미지를 불러옵니다.
first_window = root + '/000/images/' + firstframe + '.png'
anno = []
img = cv2.imread(first_window)

cv2.namedWindow(first_window)
cv2.imshow(first_window, img)
img = cv2.putText(img, str(first_window.split('/')[-1]), (30, 30),
                  cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2)

# setting ROI
rect = cv2.selectROI(first_window, img, fromCenter=False, showCrosshair=True)
anno.append(
    rect)  # left, top, w, h = x, y, w, h  첫번째 꼭지점 (x,y) 두번째 꼭지점 (x+w,y+h)
cv2.destroyWindow(first_window)

if __name__ == '__main__':
    print('start')
    images = dataLoader_img(
        root, firstframe
    )  #root는 데이터 폴더 NonVideo4_tiny폴더이고 firstframe : lf 027번째 위치 focal
    show = None
    tracker = TrackerSiamFC(net_path=modelpth)
    tracker.track(
        img, images, show, anno[0], visualize=True
    )  #img는 첫 선택사진, images는 focal이미지, show는 보여줄 이미지, anno[0]은 첫 bbox
def get_plenframe(video_name, loc):
    images = dataLoader_img(video_name,loc)
    for img in images:
        frame = cv2.imread(img)
        yield frame
Exemplo n.º 4
0
root = args.video_name
lf = args.location

CWD_PATH = os.getcwd()

if modeldir:
    PATH_TO_DATA = os.path.join(CWD_PATH, modeldir)
    modelpth = glob.glob(PATH_TO_DATA + '/*')[0]  #pretrained
    print(modelpth)

first_window = root + '/000/images/' + lf + '.png'  #007.png
anno = []
img = cv2.imread(first_window)
img = cv2.putText(img, str(first_window.split('/')[-1]), (30, 30),
                  cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2)
cv2.namedWindow(first_window)
cv2.imshow(first_window, img)

# setting ROI
rect = cv2.selectROI(first_window, img, fromCenter=False, showCrosshair=True)
anno.append(rect)
print(anno[0])
cv2.destroyWindow(first_window)

if __name__ == '__main__':
    print('start')
    show = dataLoader_img(root, lf)
    focals = AllfocalLoader(root)
    tracker = TrackerSiamFC(net_path=modelpth)
    tracker.track(img, focals, show, anno[0], visualize=False)