Tracking Contours from a ROI

asked 2016-02-27 13:03:45 -0600

Swooshftw gravatar image

So I am trying to create a program where the user can select a ROI from streaming video and then contours will only be taken from that ROI. The way I am only displaying contours within the ROI is to simply not display contours whose coordinates are not within the ROI. All that is working, however, I want to be able to track those contours found without using color. That means I can't use the camshift or meanshift algorithm on the "main" frame directly. I can't think of a way to track these contours that will "move" the ROI with them so they are still displayed. I thought of copying my "main" frame and making it all black and then displaying the contours on the black frame and then using camshift. However, once the contours are moved out of the ROI they will not be displayed so the camshift will get nothing.

I think the real dilemma here is how to "lock onto" the contours in the ROI once the user is happy with them and then removing the ROI boundaries.

If you any ideas please throw them out there cause I am out of them.

edit retag flag offensive close merge delete

Comments

I don't entirely understand what you can and can't do. You're finding all the contours in each frame, but only displaying the ones in the ROI, right? Why don't you just use matchShapes to find the contour in the new frame that best matches?

Tetragramm gravatar imageTetragramm ( 2016-02-28 09:27:41 -0600 )edit

What I can't do is track my contours because they are bounded to the coordinates of my ROI. For example, once my contour leaves the ROI it will no longer be displayed. But yes, I am only displaying the ones in the ROI. That could very well work since the contours found that best matches wouldn't be bound by me ROI coordinates. I will try that out tonight, thanks!

Swooshftw gravatar imageSwooshftw ( 2016-02-28 13:18:10 -0600 )edit