[Python] How to use setInitialMask on TrackerCSRT?

Discussão em 'Python' iniciado por Stack, Agosto 19, 2025.

  1. Stack

    Stack Membro Participativo

    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:

    tracker = cv2.TrackerCSRT_create()
    tracker.init(frame, region_of_interest)


    The region of interest include my object, but it also include irrelevant pixels from the background or other objects.

    I would like to use a mask to refine which pixels I'm interested in. Looking over the documentation, I can see method setInitialMask on the C++ version, but I cannot find the equivalent method in the Python wrapper.

    How do I set a mask in TrackerCSRT on openCV for Python?

    Continue reading...

Compartilhe esta Página