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
the IMAQ Overlay Multiple Lines 2 function
Solved! Go to Solution.
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).
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!