LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Return pixel coordinates from Imaq image with mouse click event

Solved!
Go to solution

Hello,

 

I am trying to get the pixel coordinates from an Imaq image based on a mouse-click event, similar to this post and this post. The problem is that with the first post, I get the coordinates within the image control frame and am hesitant to trust them, these seem to have the origin centered, can return negative coordinates, and do not represent the actual size of the detector I am using (512x512). It also returns coordinates outside of the actual data when the image control frame is clicked. The second method simply returns null coordinates. What I want are the pixel coordinates displayed when hovering the mouse over the imaq image control frame.

 

What baffles me is that I have tried to the second method with a stock png file and it works fine, it is only when I create an image from my camera's data that the coordinates are returned null. Note the camera data displays in the image control frame just fine.

 

Any ideas would be helpful. Attached is a picture of the offending code and the front panel to show the camera data is coming in (I know it needs some cleaning). 

 

Thanks,

Tyler

Download All
0 Kudos
Message 1 of 10
(5,653 Views)
Solution
Accepted by topic author tmccrack

for better help you have to send your vi

but I think this example vi is your solution

check this vi

0 Kudos
Message 2 of 10
(5,633 Views)

I was able to figure it out. I had to use the correct imaq selection tool... It seems the selection tool does not fire the event, switching to the point tool does. I am using a non-imaq compatible camera that makes use of a dll for retrieving the data so my vi won't be of much use. Let me know you would like it still though. I also tried the 'Get Last Mouse Position' property node nested in a mouse click event structure that seemed work. Thanks for the help hatef.

0 Kudos
Message 3 of 10
(5,615 Views)

A basic vi showing the functionallity it attached.

0 Kudos
Message 4 of 10
(5,587 Views)
Get Last Mouse Position' property node work with mouse position in your image indicator not with image size so if your image do not fill all indicator it will give your wrong data
also my labview is 2014 I could not open your vi
0 Kudos
Message 5 of 10
(5,571 Views)

I am not sure the distinction you are making. I added both to the attached vi and saved for labview 2014. 'Get last mouse position' tracks the the pixel coordinates displayed by the imaq image control (what I want) regardless if the image is oversized (has scroll bars) or undersized and does not fill the image control area. 'Get last event' only fires if the imaq point tool is selected (at least for the 'click event' I have specified for the invoke node.

0 Kudos
Message 6 of 10
(5,566 Views)

Would you please convert this example to LV2011 as well? Thank you.

0 Kudos
Message 7 of 10
(4,998 Views)
0 Kudos
Message 8 of 10
(4,988 Views)

You beat me to it, thanks G-IV!

0 Kudos
Message 9 of 10
(4,978 Views)

Smiley Happy

0 Kudos
Message 10 of 10
(4,975 Views)