Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is a valid/invalid ROI for OpenCV tracker?

I run a KCF tracker over the frames of a video in which an object appears from an arbitrary corner and moves towards another arbitrary corner and exits the frame region. The tracker is supposed to follow this object all along.

It works pretty well most of the times, but sometimes it crashes when the object's region of interest (ROI) falls out of the valid frame region, i.e., the rectangle between (0,0) and (frame.size().width-1, frame.size().height-1).

It works fine most of the times even when half of the ROI is out of the valid frame region, and it keeps tracking the object when it returns to the valid region. However, sometimes, it crashes when the ROI goes over the invalid region. Since the crash happens rarely, I don't want to impose conditions to terminate the tracker as soon as the ROI touches an invalid region, but I don't want the crash either.

I couldn't find any documentation stating the termination rule of the cv::Tracker. I wonder if anyone knows what is an acceptable ROI and what is not!e ROI and what is not!