deepgaze icon indicating copy to clipboard operation
deepgaze copied to clipboard

NameError: name 'x_center' is not defined

Open smritijha03 opened this issue 4 years ago • 3 comments

Hi, I'm trying to run ex_particle_filter_object_tracking_video.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.

smritijha03 avatar Mar 20 '20 15:03 smritijha03

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

mpatacchiola avatar Mar 27 '20 18:03 mpatacchiola

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?

smritijha03 avatar Apr 04 '20 05:04 smritijha03

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.

mpatacchiola avatar Sep 16 '20 10:09 mpatacchiola