09-05-2014 05:00 AM
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)
Solved! Go to Solution.
09-05-2014 06:34 AM - edited 09-05-2014 06:36 AM
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
09-05-2014 07:08 AM
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.
09-05-2014 07:10 AM
Hi,
here an example of how you could get the coordinates per mouseclick.
Kind regards,
skusie
09-05-2014 07:15 AM
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.
09-05-2014 07:21 AM
I thing something like this is going to work for you.
09-05-2014 07:24 AM - edited 09-05-2014 07:26 AM
Added LV2012 version.
Ahhhhh, in the event data node there is already a property for the coordinates.
09-05-2014 07:30 AM
Awesome Skusie! Thank you very much!