LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Image tracking using VDM

Solved!
Go to solution

Hello, 

I am trying to create a program that allows me to track a certain object using MyRIO and a webcam, I am new at using LabVIEW so I am following along to a video that I came across in YouTube ( https://www.youtube.com/watch?v=jl1sA3IfdM4 ). I was able to replicate the VI created in the video but once I got to the point of using the Unbundle By Name Function I ended up with 9 matches (Cluster of 9 elements) as you can see in the image I provided below. 

match.pnger.png

The problem this causes is that I am unable to use the IMAQ Overlay Rectangle because it conflicts with the amount of elements allowed in the rectangle. As far as I can tell the problem might come from the vision assistant but I have no idea why, I followed the video step by step but I am not able to get it to work. After creating the Vision Assistant I placed an Array to Cluster from the Matches option in the vision assist, from the array I added the Unbundle by Name and ended up with 8 matches (as I mentioned before) compared the 4 matches in the video. 

 

vi.png

If anyone is able to assist me with my problem I would really appreciate it, I have attached the VI in case anyone wants to take a look at it as well as the image I used for the tracking in the Vision Assistant. 

 

thank you,

Oscar Contreras 

Download All
0 Kudos
Message 1 of 7
(4,497 Views)

The problem is that you ignored LabVIEW's "Type Definition" rules.  While there are, indeed, Array to Cluster and Cluster to Array functions, you can not, in general, convert an Array to a Cluster.  Go back and learn the essential differences between these two Data elements.  These include, but are not limited to:

  • Array Elements are sequentially indexed, Cluster Elements are given (arbitrary) User names.
  • All Array Elements must have identical Types, while Cluster Elements are designed to be "mixed and matched".

You also jumped into one of the most complex and (to be charitable) "under-documented" aspects of LabVIEW, namely LabVIEW Vision.  You are using an Express VI, which "hides a lot of details".  Do you understand what the output, "Matches", represents?  It is an Array of Clusters, in Pixel coordinates, representing the following:

  • Position, a Point-Cluster (X, Y) corresponding to the center of the template
  • Angle, rotation angle of template at match location
  • Scale, not used, always 1
  • Score, match "results", 0..1000 for No Match to Perfect Match
  • Bounding Box, Array of points defining boundary of template in image.

I don't know what you want to do with these data, but you can use a For loop to extract them, and then apply whatever you want to your Image.

 

Since you don't quite seem to know what to do with this, I recommend taking the output of the Vision Assistant's Matches Array, wiring it to Index Array to get a single Match element, then trying to figure out what to do with this with respect to your Image.  I've not done Pattern Matching, myself, so I can't advise you how to proceed, but can tell you not to use Array to Cluster on the Vision Assistant output.

 

Bob Schor

   

 

0 Kudos
Message 2 of 7
(4,467 Views)

 

@teameos: use the example finder, look for Pattern Matching.vi, there you shall see the "Overlay Pattern Matching Results.vi". you can use this function to draw the rectangles of the bounding rectangles.

 

or you can take a look at the snippet if you insist using "IMAQ Overlay Rectangle". Note that the "bounding box" array in the "matches" array element are XY coordinates of each individual points that forms the boundary, and the rectangle cluster requires the min and max of the X's n Y's to define the left-top-right-bottom bounds.

 

teameos0.pngteameos1.png

 

 

CY (expired CLAD)
0 Kudos
Message 3 of 7
(4,454 Views)
Solution
Accepted by topic author teameos

By default Array to Cluster sets the number of elements to 9. If you right click on Array to Cluster and select Cluster Size.. you can set it to 4.

 

 Untitled.png

0 Kudos
Message 4 of 7
(4,443 Views)

I want to know what to select to get the encircled block.

I am watching video:

https://www.youtube.com/watch?v=qmYGY3t0Ix0&index=17&list=PLbWFLQN4zMt-QOzgdbsJ2bMqaGGs67zNW

 

At 6:36 they didn't show how to get the encircled block.

 

Can someone help.

I am beginner in Labview image processing

0 Kudos
Message 5 of 7
(4,220 Views)

LabVIEW Image Processing is one of the most advanced aspects of LabVIEW!  Before venturing into the complexities of Image Acquisition and Analysis, you should have a thorough grounding in "basic LabVIEW" -- at a minimum, you should be able to pass the CLAD Certification exam (this is the lowest level exam, typically "passable" with a one-semester college course where "hands-on programming" is emphasized).

 

The circled block is one of the most recognizable "basic functions" in LabVIEW.  Open a Block Diagram, right-click on it, and study (and I mean study) the contents of the first seven sub-Palettes that pop up (i.e. Structures through Strings).  You should be able to figure out the answer from this.  If you can't, you are way out of your league.

 

Bob Schor

0 Kudos
Message 6 of 7
(4,215 Views)

it is the 'unbundled by name' under clusters.

 

it is up to you to be certified or not, but getting some lessons would definitely help 🙂

CY (expired CLAD)
0 Kudos
Message 7 of 7
(4,206 Views)