What is a valid/invalid ROI for OpenCV tracker?

asked 2017-07-24 18:05:41 -0500

mhaghighat gravatar image

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!

edit retag flag offensive close merge delete

Comments

can you give us the exact error msg ?

berak gravatar imageberak ( 2017-07-25 01:25:17 -0500 )edit

p was a nullptr!

mhaghighat gravatar imagemhaghighat ( 2017-07-25 19:31:05 -0500 )edit