Tracking an object using AVM
Dawson from Malaysia  [173 posts]
10 year

I programmed RR to loop a video file (avi) and AVM to track an object. I set the variable NV_WR_OBJ_IDX to 0 once to initialize learning (VB). AVM loses tracking at certain places probably due to lighting or object orientation. However i notice AVM gets better (strangely) at tracking the more i run the program.

I have this idea of setting this variable to 0 every 0.5 seconds or so to re-learn the object and thus maintain a smooth tracking (hopefully) of the object. But in order for this to work, the new learned data should replace the old data instead of creating a new index and associating to same object as it currently does. Is my idea workable?
EDV  [328 posts] 10 year
NV_WR_OBJ_IDX - the object index for writing

This variable provides single writing (one picture) to AVM with object index that was specified by user and further it will be switched to -1.

>> I have this idea of setting this variable to 0 every 0.5 seconds

It is good idea but you should also localize the learn object in the interest area by variables NV_WR_OBJ_RECT_X,
NV_WR_OBJ_RECT_Y, NV_WR_OBJ_RECT_W, NV_WR_OBJ_RECT_H. Also you should keep in mind that the aspect ratio of variables NV_WR_OBJ_RECT_W and NV_WR_OBJ_RECT_H must correspond to key image size (80x80 -> 1:1 -> W:H 80x80, 84x84, 90x90, 100x100 etc).
Dawson from Malaysia  [173 posts] 10 year
Yes i intend to do the following;

If NV_ARR_OBJ_IDX(0) = 0 and trigger=1 Then

Get existing coordinates  of bounding box if W>=80

IF W<80
X1&4 = cogX-40
X3&2 = cogX+40
Y1&2 = cogY-40
Y3&4 = cogY+40

re- learn (set NV_WR_OBJ_IDX=0)

So tracking is maintained.

The re-learn data should replace old data. but currently it creates new index ie

NV_ARR_OBJ_IDX (0, 0) and shows two boxes but i only want to show one box for the new data. Could this be done?
EDV  [328 posts] 10 year
Every switching of variable NV_WR_OBJ_IDX from -1 to 0 just add new image to AVM search tree and previously stored images (that was written before) still there.

You could clear AVM tree automatically only if you load it from file by variable NV_LOAD_DATA:
Dawson from Malaysia  [173 posts] 10 year
Ok thanks. I got it to work as I wanted.
EDV  [328 posts] 10 year
Navigator package is updated now and you can download next modification of AVM Navigator v0.7.5.1 from your account link.

  - NV_REMOVE_IDX - the object index for removing

This variable provides removing of recognition data from AVM with object index that was specified by user and further it will be switched to -1.
Dawson from Malaysia  [173 posts] 10 year
Ok great.
Dawson from Malaysia  [173 posts] 10 year

Do i set the NV_REMOVE_IDX to 0 to clear data? when i need it to learn a new object, do i give coordinates and set NV_WR_OBJ_IDX to 0 or is there a different sequence? i did this but it is not learning new object.
EDV  [328 posts] 10 year
You should set variable NV_REMOVE_IDX to zero only one time (single shot) for clearing of the recognition data that was associated with index 0. If you would try to keep zero value in NV_REMOVE_IDX variable during long time then it could lead to clearing data without nonstop and in this case learning would not work.
Dawson from Malaysia  [173 posts] 10 year

I have uploaded 2 programs. I found the issue is in line 14. The first program I get the last value of X and Y and try to re-learn from the new position but it does not work.

In the second program I use the same start initialization point (fixed point) and it seems to work.

I think the problem is that NV_WR_OBJ_RECT_X and NV_WR_OBJ_RECT_Y can only be set once and is still not cleared when NV_REMOVE_IDX is set to 0.

PS. I did not upload any video. you could use any video as long as the object to track is in the right place.
Dawson from Malaysia  [173 posts] 10 year

Ultimately i would like to implement 2 senario's

Senario 1: assume same object being tracked
learn new sample at new location without clearing previous data.

Senario 2: assume different(new) object
clear previous data and learn new sample.
EDV  [328 posts] 10 year
It's interestingly.
And can you show some results (demo video, pictures etc)?
Dawson from Malaysia  [173 posts] 10 year
I set the NV_WR_OBJ_RECT_X and NV_WR_OBJ_RECT_Y to a different value (100, 100) and it works (so my previous post that it is only set once is wrong.. sorry about that). So my actual question now is how to get the previous values of NV_ARR_OBJ_RECT_X and NV_ARR_OBJ_RECT_Y. If you see my program at line 21, I store the last values to x1 and y1 and retrieve it at line 14 but it does not work. But if I give fixed values ie x=210 y=110 or x=100 y=100 it works.
Dawson from Malaysia  [173 posts] 10 year

I realize that actually my code was logically wrong. I was trying to use the previous position to maintain tracking when tracking was lost. This is logically not correct as the object may no longer be in view. Sorry about that.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index