03-22-2013 09:15 AM - edited 03-22-2013 09:18 AM
I need to find Vertical distance in an image-
First of all, I select a region using a rectangle box. Then i choose the scan direction : Left to right OR Top to Bottom.
For the Left to right scan direction, I use a IMAQ Clamp max function to calculate distance between the furthest opposite edges. It works fine when the measurement is done horizontal (See Figure 1).
Now I need to do the measurement in Vertical direction. i.e from top to bottom. I see that i cannot use the IMAQ Clamp max function since measurement is done horizontal in IMAQ Clamp Max. So i used a IMAQ Clamp Vertical Max VI to calculate distance in vertical direction. But now the problem is: If the image is a bit tilted, it gives a wrong result. (See Figure 2)
I also tried using IMAQ Clamp Vertical Min. But then it ignores the max point. If there is a variation ( bulge outwards or inwards) I need to have result depending on it.
Is there any ideas to correct the tilt?
03-25-2013 10:08 AM
Hi Nghtcrwlr!
You can use the Max Clamp function with the setting "Vertical" in the Vision Assistant. Make sure that the ROI encloses the entire object in the image. The "Angle Range" parameter controls tolerance of the angle by which the edge can be rotated. If you set the parameter to a small value the algorithm will find the maximum dimension of the object along the vertical axis. However if you allow the algorithm to adapt to a slightly tilted image by setting the value to a higher value it will find the edges of the object and will determine the dimension perpendicular to those edges.
Hope that helps,
Georg
04-03-2013 03:35 AM
Hello georgJ
Actually I had tried using the Max Clamp function with the setting "Vertical" with higher angle value. It didnt work. Also I dont want to enclose the ROI the entire object in the image. At times only a part of the image is to be measured. The image is not a uniform object. So covering the whole image ROI may give wrong result.
04-03-2013 06:34 AM
Also, in NI Vision Assitant you have the option in Clapm Parameters to select the Search Direction. But you dont have that in NI Vision Development Module lvlib:IMAQ Clamp Max. Why is it that? Is there an option to choose the search direction in that function on LV``?
04-04-2013 09:04 AM
Hi!
Maybe it would help to attach an actual image you want to measure to understand better how the algorithm is supposed to work.
The search direction of the MAX Clamp function is given by the rotation of the ROI. As an example I attached the ROI descriptor
for the MAX Clamp function, one time set with search direction horizontal and one time set to vertical.
Regards,
Georg
04-08-2013 08:43 AM
Hi GeorgJ
Thanks for the explanation. Now I got a better idea. thanks a lot