OpenCV, How to pass parameters into cv2.TrackerMedianFlow_create function?

后端 未结 2 448
借酒劲吻你
借酒劲吻你 2021-01-22 02:10

I\'m trying to create MEDIANFLOW tracker with OpenCV3.3 using opencv-python with Python3.6. I need to pass some arguments into the constructor according to this page of OpenCV d

2条回答
  •  花落未央
    2021-01-22 02:44

    You can customize Tracker parameters via FileStorage interface.

    import cv2
    
    # write
    tracker = cv2.TrackerMedianFlow_create()
    tracker.save('params.json')
    
    # write (another way)
    fs = cv2.FileStorage("params.json", cv2.FileStorage_WRITE)
    tracker.write(fs)
    fs.release()
    
    # read
    tracker2 = cv2.TrackerMedianFlow_create()
    fs = cv2.FileStorage("params.json", cv2.FileStorage_READ)
    tracker2.read(fs.getFirstTopLevelNode())
    

提交回复
热议问题