Skip to content
Advertisement

Object tracking program does not show tracked points in the output image

I need to track an object in a video frame but to do so I have to initialize good features to track my object. So, I have a .mp4 file, I retained the blue channel of the first frame and I obtained the first frame. I then went on to create my binary mask by extracting my region of interest from the first frame and it was specified that my ROI lies within [300,400] on the y-axis and [460,550] x-axis (which is the front side of the bus).

I then initialized 10 corner points by using cv2.goodFeaturesToTrack having a quality level of 0.01 and a minimum allowable distance of 10 pixels between corner points. I then tried to display these points on the RGB image however I am not getting any points. The reason as to why I do not know. This is shown here:

JavaScript

Advertisement

Answer

It creates small yellow dots in top left corner. They are similar to background color so you may not see them.

When I draw on RGB frame then I get red dots which you can see on image

enter image description here

If I convert blue_ch to RBG before drawing

JavaScript

then I see

enter image description here

You get mask = blue_ch[300:400, 460:550] so when I add

JavaScript

then I get dots in correct place

enter image description here


My code:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement