LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rotate an image after clicking two times on reference points on the picture

Solved!
Go to solution

Hello Community!

 

I am looking for a solution to rotate an image by clicking on two reference points on the image. The two coordinate pairs of the mouse clicking can give me the rotation angle with simple geometry. After that I will rotate the image with the calculated angle.

 

My problem is: How can I get those two coordinate pairs? I wanted to do it with an easy MatlabScript "input: path ... imread(path) ... imshow ... ginput(2) ... calculation ...output: angle". Apparently imshow doesnt work in Labview 😞

 

I already have the Mouse Down event but I dont know how I can make Labview let me click EXACTLY and ONLY two times on my picture and store the coordinates.

Does anyone of you have a glue/ hint how to do that? 

 

Best,

Annki

(Started LabView 2 weeks ago)

0 Kudos
Message 1 of 8
(2,547 Views)

Hi Annkitranky,
 
welcome to the forum!
 
Here is one that works well: http://en.wikipedia.org/wiki/Cyanoacrylate  (Sorry, I couldn't resist...)
 
Check this out: http://forums.ni.com/t5/LabVIEW/Using-mouse-click-to-return-image-coordinates/m-p/890731 and http://forums.ni.com/t5/LabVIEW/How-to-find-cursor-position-on-an-image-in-LabVIEW/m-p/1862495 There is a suggestion not marked as a solution, but I think it is: see last posts there; User Event Structure with the position reported implicitly. Further, I would put the Event Structure in the While Loop, where I wait for user input, collect the user inputs and finish (execute rotation on a two-element array).

 
If you have a code or something, post it.
 
Cheers

0 Kudos
Message 2 of 8
(2,528 Views)

Cat Very Happy Thank you for this fabulous glue !

 

I just attached my vi that I have to far. I know that it is not working yet and f.ex. the coordinates for the Mouse down in the event-strcuture are not processed since I don't know yet how to manage to save only two subsequent clicks.

 

 

0 Kudos
Message 3 of 8
(2,515 Views)

Hi,

 

here an example of how you could get the coordinates per mouseclick.

 

 

Kind regards,

 

skusie

0 Kudos
Message 4 of 8
(2,513 Views)

Thank you Skusie, but my LabView is Version 2012 and its not possible to open yours. I get already the coordinates from the mouse and they are nicely shown, but my problem is to save exactly two clicks of the mouse.

0 Kudos
Message 5 of 8
(2,507 Views)

two clicks and no more.png

 

I thing something like this is going to work for you.

0 Kudos
Message 6 of 8
(2,502 Views)
Solution
Accepted by topic author Annkitranky

Added LV2012 version.

 

Ahhhhh, in the event data node there is already a property for the coordinates.

0 Kudos
Message 7 of 8
(2,500 Views)

Awesome Skusie! Thank you very much!

0 Kudos
Message 8 of 8
(2,494 Views)