How to use setInitialMask on TrackerCSRT?

前端 未结 4 800
小鲜肉
小鲜肉 2021-01-21 07:00

I am using TrackerCSRT for object tracking in a video, and currently I use the init method on the tracker to set the region of interest



        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-21 07:53

    At the moment, you can't. But you could do it if you are prepared to rebuild OpenCV.

    The creation of Python bindings for OpenCV C++ modules is controlled by markup in the C++ files, as documented here. At the time of writing, the C++ declaration of setInitialMask() does not have the markup which causes a Python binding to be created for it, so it is inaccessible. I expect that is because the TrackerCSRT implementation is only a few months old, and that Python bindings will follow as it matures.

    However, if you are prepared to rebuild OpenCV on your system (which can be a little challenging if you haven't done it before), making setInitialMask() accessible from Python should be as simple as adding the CV_WRAP macro to that declaration (as explained in the above documentation) and rebuilding.

    There are quite a few guides online for how to build OpenCV, but since I haven't done this myself in a while and the methods are somewhat platform dependent, I won't recommend one.

    Hope this helps.

提交回复
热议问题