01-20-2010 01:27 PM
Thank you very much!
I put the position output and convert the pixel to realworld in the end of your code. It only output the pixel value rather than real millimeter. can you help me check that?
01-21-2010 11:57 AM - edited 01-21-2010 11:57 AM
Hey guangli,
I am glad that you found the modified example helpful. In regards to taking your measurements in terms of real world units instead of pixel values you will have to do a calibration. Essentially, you need to tell LabVIEW how many pixels equals how many millimeters. This is because LabVIEW has no way of knowing (on its own) how zoomed in your camera is, how far objects are, etc.
There is, however, an entire pallet of calibration VI's (Functions»Visions and Motion»Vision Utilities»Calibration) that will allow you to calibrate your image and give you the conversions from pixels to millimeters that you are looking for. Check out the detailed help for all of those calibration VI's to see which one fits your application the best. Also, check out the Vision Concepts Manual, more notably, chapter 3 for more information on calibration.
01-21-2010 12:14 PM
BCHo,
Thank you very much!
Your code is really helpful. Many thanks!
All the Best!
Guangli
01-24-2010 10:39 PM
Hi, ECHO,
How are you recently?
I come back because i didn't learn the code you modified so well. I think I didn't complete understand how to use property Node.
I try to build the similar code by myself. When I did, I only can search one time when I set the first Proper Node as two visibles. Later, I want to use your Property Node as one visible and one value. It doesn't work for me. Can you help me see what's my problem?
Thank you very much!
Guangli
01-25-2010 10:23 AM
I mean I cannot search the template real time. I'm only able to search it when I press search button.
Thank you!
01-25-2010 10:45 AM
Hey Guangli,
It looks like you have used the property node correctly. The only reason I put them in my example is because it makes the program a little more complete. Here is a link to a LabVIEW Help article on property nodes. You can also do a search on ni.com for property nodes, to get a little more information. Essentially, they allow you to access properties of objects programmatically. In this case we are accessing the 'value' and 'visible' properties.
In regards to your last post. The reason why you have to press the 'Search' button everytime is because of the mechanical action of your boolean. You have it set to Latch, when you want to use a switch. You can change this by right clicking on the "Search" button and selecting "Mechanical Action." Check out the shipping example Help»Find Examples»Building User Interfaces»General»Mechanical Action of Booleans.vi for more information regarding the differences between the different modes.
01-25-2010 08:29 PM
Hi, BCHo,
Thank you very much again!
That's exactly what I want. You are really good teacher!
All the Best!
Guangli
01-29-2010 12:38 PM
Hi, BCHo,
How are you recently?
I came back with one question. I can track the template using ROI. That mean the rectangle can following the braiding point. But, the centroid only output the position of background rather than the centroid of rectangle. I use white paper as my background. The braiding point is not in background. that means only ROI move. The attached file is not with white background.
Should background move with ROI? If not, do you have some idea to get the position of ROI?
Thank you very much!
Guangli
01-31-2010 09:59 AM
I think I get the position of ROI now. But I cannot feedback this position to motion control loop.
Maybe the data type is not compatible. The data output from IMAQ Match Pattern 2 cannot wire to input of velocity override. I didn't get it resloved yet.
I need to figure out it. I don't know if you know it?
Thank you!
01-31-2010 11:53 PM - edited 01-31-2010 11:54 PM
Hey guangli,
There are a number of ways you can get the location of the ROI. One would be a property node of the image display control that you are using to view your image. With this, you would use a series of Unbundle by Name functions to extract the ROI coordinates. Alternatively, you could use the IMAQ Match Pattern 2 VI that you are already using to pass out the location of the match. If you check out the LabVIEW Help for that function, you will find that the 'Match' data type contains the centroid of the template match. You would then use a series of Unbundle by names and index array functions to extract the x and y position of the match centroid. Check out the picture below for a little more info.
In regards to passing this information to your motion control system. I would imaging that you would need to convert the position of the match to some sort of real world measurements. Perhaps convert the x position of the match to an equivalent number of steps for a stepper motor to move. However, after following the steps listed in the image below, you will be able to get the x and y position of your match in a numeric data type. You then need to take this pixel measurement and convert it to the appropriate units for your motion control feedback loop.
Also, I am not quite sure how your motion system plays into all of this. What is the correlation between where your pattern is found and what your motion system needs to do?