mpatacchiola / deepgaze

Computer Vision library for human-computer interaction. It implements Head Pose and Gaze Direction Estimation Using Convolutional Neural Networks, Skin Detection through Backprojection, Motion Detection and Tracking, Saliency Map.
MIT License
1.78k stars 479 forks source link

NameError: name 'x_center' is not defined #93

Open smritijha03 opened 4 years ago

smritijha03 commented 4 years ago

Hi, I'm trying to run _ex_particle_filter_object_trackingvideo.py file on another sample video. I have changed the template.png image with another subframe as per my sample video for the filter. But, I am unable to find the contour with largest area using the binary mask and obtain its centre coordinates. I am getting the following error:

Traceback (most recent call last): File "ex_particle_filter_object_tracking_video.py", line 110, in <module> my_particle.update(x_center, y_center) NameError: name 'x_center' is not defined

Any idea how this can be resolved.

mpatacchiola commented 4 years ago

Hi @smritijha369 which version of Deepgaze are you using? Is the resolution of the video the same of the example (1920x1080) ?

smritijha03 commented 4 years ago

Hi, @mpatacchiola I am using Deepgaze 2.0. My video resolution is 720x480. Do you think this could be an issue? Does it work for 1920x1080 only?

mpatacchiola commented 4 years ago

This error should be due to the fact that you are using a different video.

For a different video you need to set new versions of the images template.png. The template.png should be a sub-frame of the target you want to follow. You can get the template by simply using a cropping tool on your video to cut a portion of the target element you want to track. If the template has not been set then it is not be possible for the detector to find the target color in the image, and as a consequence it will not be able to find center_x and center_y (centers of the target) resulting in the error that you got.