Example Code

Object Tracking using LabVIEW and Vision Development Module

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Vision Development Module
  • LabVIEW

    Driver

  • NI Vision Acquisition Software

Code and Documents

Attachment

Overview
This VI takes one image from a camera and tracks the object using pattern matching by selecting the ROI or object. 


Description

This VI does pattern matching to track the object. The user is able to take one image coming from the camera and then select the ROI or object that they would like to track. 


Requirements

  • LabVIEW Base Development System 2012 (or compatible)
  • Vision Development Module


Steps to Implement or Execute Code

  1. Unzip the attached folder “Object Tracking V2 2012 NIVerified.zip”
  2. Open the VI "Object Tracking V2 2012 NIVerified.vi"
  3. Run the program

 

Additional Information or References

VI Front Panel

Front Panel.PNG

 

VI Block Diagram

b.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Brandon L.
Automation Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
mcnearymw
Member
Member
on

I have LV2012 and would like to open this vi but get error code 9... any idea why I get this error?

mcnearymw
F.Parkar
Member
Member
on

How do you extend this further so it can 'learn' and track more than one pattern/image at the same time? For example, it learns/stores 2 images simultaneously so when running the program, if either pattern/image is presented, it can track both.

Brandon-L
Member
Member
on

One way you could do this would be to use Geometric Pattern Matching and have an array of template images. http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_learn_multiple_geometric_patterns...

Brandon L.
Automation Engineer
F.Parkar
Member
Member
on
Thank you for you reply. I don't understand where to use this function and whether I have to replace an existing function to substitute with the Geometric Pattern Matching one. Also, is there a function I can use to let the camera track the object at different projections or angles?
Brandon-L
Member
Member
on

Unfortunately, I have not had time to implement this, but my idea was to do something similar to what you suggest. It would involve geometric pattern matching and have an array of template images. The program would "learn" new template images programmatically based on the first image selected by the user. This would allow the program better determine the object at different projection or angles. You would need to manage the array of template images so that it does not grow to large if you are programmatically adding to it. Also, you would need to make sure the images you are adding to the array are of good quality so it does not negatively impact the geometric matching.

I hope this helps, but the short answer is yes you can implement a better tracking algorithm, but it will take some editing of the current program.

Brandon L.
Automation Engineer
Brandon-L
Member
Member
on

mcnearymw wrote:


                       

I have LV2012 and would like to open this vi but get error code 9... any idea why I get this error?


                   

I have not been able to recreate this error that you are receiving.

Brandon L.
Automation Engineer
asdasda
Member
Member
on

icon.PNG

Hi I was looking at your code, and i am confused to what this icon is. Please Help

muthukumarm
Member
Member
on

Pls add tutorial video of object tracking that will be helpful

rreal34
Member
Member
on

程序很棒 很好用

Ibrahim.M
Member
Member
on

Hello sir.

Thank you so much for your good effort.

I'v just done the object tracking successfully, thank you.

One major problem is remaining to me asking help for it.

How can I interface LabVIEW x,y,z parameters caused by object tracking ( using above nice sketch ) with Arduino (serial etc )to be as a coming input to control servo motor later.

Actually I want to achieve project below

http://youtu.be/0DqcnHE6r9M

Any support or suggestion pls

Best Regards

Ibrahim

DC20
Member
Member
on

In labview 2015, the snap image doesn't appear. Nothing happended when the Snap button is pressed. Any idea?

tomloobyEE
Member
Member
on

I have implemented a similar tracking technique, however, it seems that this is not really "tracking," but rather "matching."  It appears to me that the image is matched in each respective frame rather than tracked between frames.  When I utilize this technique on a UGV in the field, it can only identify the correct patterns at the distance that the template was recorded at.  I feed the offset between the x coordinate pixel location of the centroid of the tracking target, and the longitudinal axis of the vehicle, to a PID controller that actuates a steering servo.  As the vehicle hones in on the target, and the distance between the camera and the target decreases, the target is lost, because the template image size becomes larger (occupies more pixels). If the distance between the camera and the target will remain constant, this approach is a good choice.  If the camera or target will be moving in the z-direction (orthogonal to lens plane), then "object tracking VI" will need to be implemented.  Else, an array of template images for several distances will be required.

SPUR
Member
Member
on

Thanks!

aman2426
Member
Member
on

hey can anyone help me regarding the above given vi i wanna add some kind of alarm system that works whenever the objected is detected 

Plzz is someone can help