Zooming and record previous picture pixel points, Keep constant zoom
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I want to display a series of images to a user. For each image request input from the user in the form of a mouse click on the image. Store the coordinates of each click in a matrix. Thus, in end having a matrix of dimension num_images x 2.
function main()
clc;
global agent_pos;
....
for i=1:numel(img_names),
imname = [ path_img img_names{i}];
im0 = imread(imname);
imageHandle =imshow(im0);%_____________displays the image
set(gcf,'units','normalized','outerposition',[0 0 1 1])
set(imageHandle,'ButtonDownFcn',@ImageClickCallback);
uiwait(gcf);
end
end
function coordinates=ImageClickCallback ( objectHandle , eventData )
axesHandle = get(objectHandle,'Parent');
coordinates = get(axesHandle,'CurrentPoint');
coordinates = coordinates(1,1:2);
global agent_pos;
agent_pos=[agent_pos;coordinates]; %___ add these coordinates for each image
uiresume;
end
What I want to do is to zoom into a part of the picture using the `GUI` and click on the image. When I do so, `matlab` should record the pixel points' location with respect to the unzoomed image. Also, once the select the zoom location in the first image. It should the same in coming up ones.
- When I try do the zoom through `GUI` in the first image now, and then change back the pointer to a cursor, it somehow stops and doesn't either record my click or go to the next image.Warning: figure JavaFrame property will be obsoleted in a future release. For more information see the JavaFrame resource on the MathWorks web site.
- I tried to use imtools instead of imshow, but it show below warning with opening 2 images at a time and not record the clicks.
In main at 20
java.lang.NullPointerException
at com.mathworks.hg.peer.FigureFrameProxy.setMaximized(FigureFrameProxy.java:302)
at com.mathworks.hg.peer.FigureMediator.setMaximized(FigureMediator.java:468)
at com.mathworks.hg.peer.FigurePeer.doSetMaximized(FigurePeer.java:3414)
at com.mathworks.hg.peer.FigurePeer$26.run(FigurePeer.java:3403)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runit(HGPeerQueue.java:294)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runNotThese(HGPeerQueue.java:326)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.run(HGPeerQueue.java:342)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Operation terminated by user during uiwait (line 81)
1 comentario
Respuestas (0)
Ver también
Categorías
Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!