Log in or register to post comments

Region of interest for object detection

February 10, 2018 - 7:49pm #1


      If there are many image targets on the screen - for example, 4 Image targets on A4 page, Vuforia detects one the targets randomly. I've attached picture for easier explanation. Let's say there is A4 page with targets "Image Target 1", "Image Target 2", "Image Target 3", "Image Target 4". "Max Simaltaneous Tracked Images"=1. When Vuforia see whole page it starts to track one of the images randomly. 

      I need Vuforia to detect object in the center of the screen - region of interest (ROI). So when it sees more then one image targets, it starts to track the one in region of interest. If there is no image target in the ROI Vuforia has to wait until the one appears in ROI. For example, on the attached picture "Image Target 3" is inside ROI, so Vuforia can start to track only "Image Target 3".

      I haven't found ROI parameter in Vuforia's API, so I'm trying to implement ROI by myself. I'm using Vuforia for Unity.

I'm using DefaultTrackableEventHandler. My idea is:

1. "OnTrackableStateChanged" check the object coordinates on the sceen.

2. if theobject is inside defined ROI, then Vuforia can track this object as usual and function OnTrackingFound() is called. Now the object can be tracked (even if it moves outside from ROI), until it dissapears from the screen.

3. if the object is not inside ROI all tracking information is reseted

4. Vuforia stops tracking detected object and tries to detect an object again. on new detected object go to "step 1"


I've implemented step 1 and step 2. However, i don't understand how to reset tracking information.

I've tried to stop and start ObjectTracker, but it doesn't reset tracking info and Vuforia keeps tracking detected object.



Image icon ROI.png10.54 KB

Region of interest for object detection

February 12, 2018 - 3:44pm #2

I've solved the problem by myself.

In case, someone has to solve same problem here is the solution:

0.1 enable simultaneous object tracking (in my case 4 - i had up to 4 objects on one A4 page)

0.2 use two global variables isDetected=false, DetectedObjectName=""

1. On tracking state change  - check  if(object is in ROI && isDetected=false)

1.1 Yes 

 - call OnTrackingFound()

   - and isDetected=true;

   - change DetectedObjectName.

1.2 No

 - do nothing

 -OnTrackingFound() is not called

2. Add Update() function

do same check there - check  if(object is in ROI && isDetected=false)

2.1 Yes

- call OnTrackingFound()

   - and isDetected=true;

   - change DetectedObjectName.

2.2 No

- do nothing

3. On Tracking Lost - check if(isDetected=true && DetectedObjectName=current object)

3.1 yes - disable object

3.2 no - do nothing

In this way Vuforia will track all objects on the screen, but will enable only the first object appeared in ROI.

Log in or register to post comments