How can I use the GINPUT function to select a point on an image in MATLAB along with the ZOOM function?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 2 Okt. 2009
Bearbeitet: MathWorks Support Team
am 1 Aug. 2017
How can I use the GINPUT function to select a point on an image in MATLAB along with the ZOOM function?
I want to zoom in on an image using the ZOOM function. When the image is zoomed in at the desired level, I wish to use the GINPUT function to pickup and process a point. How can I do this programmatically?
Akzeptierte Antwort
MathWorks Support Team
am 1 Aug. 2017
Bearbeitet: MathWorks Support Team
am 1 Aug. 2017
You can use the WAITFORBUTTONPRESS function for using the GINPUT function to select a point on my image after using the ZOOM function. The following code illustrates the solution:
% Display a file
I = imread('rice.png');
imshow(I);
% use mouse button to zoom in or out
% Press Enter to get out of the zoom mode
zoom on;
'CurrentCharacter' contains the most recent key which was pressed after opening the figure.
% Wait for the most recent key to become the return/enter key
waitfor(gcf, 'CurrentCharacter', char(13))
zoom reset
zoom off
[c,r,but] = ginput(1)
1 Kommentar
Michael Abboud
am 1 Aug. 2017
Thank you for pointing out this change due to the new behavior in the R2014b release! The article has been updated to include your feedback
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!