From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find cursor position on an image in LabVIEW?

I use a microscope that scans atoms on a surface and I want to write a VI that gives me the coordinates of an atom when I click on the scanned image with the mouse. I use LabVIEW 8.20 (I understand newer versions of LabVIEW come with some mouse functions, but if possible I´d like to do it with the 8.20 version). Does anyone have a solution for reading the mouse coordinates on an image? Also, I´d like to make a VI that actually finds the center of the atom by looking for the maximum around the point where I click (this would give a better estimate of the atom location than s simple mouse click). Any help is appreciated.

0 Kudos
Message 1 of 4
(4,840 Views)

You could use event structure as shown in the attached VI(developed on LabVIEW 8). Please note, co-ordinates are with respect to panel origin and since I have coincided my picture control with the panel orgin hence in the VI you will get absolute coordinates.

 

How are you planning to load the image in LabVIEW ?

 

Regards

 

Javed

 

Message 2 of 4
(4,829 Views)

Hi Javed, this is useful, however I will also need to automatically read the coordinates - that is, click with the mouse on a point in the image, and then upload the  coordinates of that point (to an array for instance -  I will have to do this for several points). I´m not sure how I will load the image to LabVIEW, the factory software saves  images in an ¨sxm¨ format, I suppose I will have to convert it somehow.  

0 Kudos
Message 3 of 4
(4,826 Views)

I suggest you explore the "event structure". There is a Mouse Down event which will fire whenever you click on the picture. The co-ordinates obtained will be specify where the Mouse was clicked.

 

(don't forget to mark Kudos if you found the post helpful Smiley Wink)

 

Regards

 

Javed

Message 4 of 4
(4,823 Views)