Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Overlay Line Positioning Accuracy and function inconsistency

Solved!
Go to solution

I had been hoping to be able to mark an image location with subpixel accuracy using an overlay constructed from a short pair of crossed lines (a "+" mark).  I first looked at the IMAQ Overlay Line function, but when I saw that it accepted only I32 coordinates for its inputs, I went looking for another solution. I eventually found the IMAQ Overlay Multiple Lines 2 function and when I saw that it accepted DBL coordinates for its inputs, I thought that I had found my solution and the HELP topic for the function didn't say anything to dissuaded me.  But after I got to using the function, I found that it cannot position the lines that it draws with subpixel accuracy, instead rounding them, to what appears to me to be boundary positions between pixels. I found that to be both disheartening (no subpixel solution) and odd (line location). I built a test VI (attached, LabVIEW 2014, IMAQ Vision library required) to confirm the behavior and to compare it with what the IMAQ Overlay Line function did as far as line placement goes. It turns out that the lines drawn by the IMAQ Overlay Line function do align with whole pixel locations like I was expecting.  None of this behavior is documented in any NI documentation that I've been able to find so I thought that it would be worth mentioning here for others that might stumble into this behavior as well.  Below are screenshots from the attached Test VI showing the resultant 1-pixel-wide overlay line position for the same DBL X ("4.67" here) position.

 

the IMAQ Overlay Line function

WNM_0-1658333075696.png

 

 

the IMAQ Overlay Multiple Lines 2 function

WNM_1-1658333115265.png

 

 

0 Kudos
Message 1 of 3
(1,701 Views)
Solution
Accepted by topic author WNM

Not sure if this is what you desire, but setting Maintain Width? to True will move the overly in screen pixels (but not image pixels).

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 2 of 3
(1,668 Views)

 Based on this description of that parameter's function, I did not suspect that it would impact the granularity of the positioning of the line on the display, but I tried setting it to TRUE and it does indeed allow the line to be positioned to fractions of an image pixel.

 

Maintain Width? specifies whether you want the overlay measured in screen pixels or image pixels. Overlays measured in screen pixels maintain the same width as you zoom in on the image. Overlays measured in image pixels will scale with the image and appear to increase in width as you zoom in on the image. Set this value to TRUE if you want the overlay measured in screen pixels. Set this value to FALSE (default) if you want the overlay measured in image pixels.

 

Good suggestion! Thanks!

0 Kudos
Message 3 of 3
(1,661 Views)