Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Last Event - Click Event returned coordinates incorrect

Hi

I need to get the pixel a user clicks on in my IMAQ image. We are not using an IMAQ camera. Our old method had to do a lot of maths with co-ordinates on mouse click, image position and working out relative positions. 

 

This example is exactly what I want to do, and works on my computer beautifully. 

https://forums.ni.com/t5/Example-Programs/How-to-use-the-IMAQ-quot-Get-Last-Event-quot-property/ta-p...

 

As my image is in a VI in a subpanel I wrapped the above example in a subpanel and it still works. 

 

However when I try to use this in my application it doesn't work with the mouse up event.

My image size is 1280 x 1024.

The point click event returns one of 4 values pairs depending on the quadrant clicked [0,0]  [640,0]  [0,511] or [640,511]. Interesting this is 1/2 image size. 

Mouse location returns corrects co-ordinates. Zoom tool returns correct co-ordinates. So not sure what is wrong. 

Co-ordinates code.pngCoordinates panel.png

Any suggestions?

 I will use mouse location in the meantime as its probably close enough, but it would be nice to know why the coordinates event is not working. 

 

LabVIEW 2018. 

Cheers

 

Download All
Message 1 of 5
(2,956 Views)

Confirmed its not due to IMAQ Array to Image... which is how I am loading the camera data in the program. 

 

IMAQ JPEG Load.pngDisplay image is the only control with a mouse event in my application. So can't see how other events should be confusing it. 

 

0 Kudos
Message 2 of 5
(2,932 Views)

Let's try to check this forum:

https://forums.ni.com/t5/LabVIEW/Return-pixel-coordinates-from-Imaq-image-with-mouse-click-event/td-...

 

I think it's very helpful in this situation

 

 

0 Kudos
Message 3 of 5
(2,921 Views)

thanks @capuy for suggestion. I had found that thread, and I have re-read / tried their code again for clues, but I can't see anything helpful there for my issue.

Its seems the issue there was the OP was looking for events from selection tool vs point tool. I definitely have point tool selected and click events for point tool. Scrolling works fine. 

As mentioned I am following the example - and I modified the example to match my application by using it in a subpanel and without IMAQ camera. Was still ok. 

 

After some testing the Last Mouse Position is more accurate than what we had, but I think it would be better to use the event coordinates if I could get it working properly. 

0 Kudos
Message 4 of 5
(2,915 Views)
Image->Property Node->ROI to get the Pixel location Point clicked on image.
Thanks
uday
Message 5 of 5
(2,884 Views)