Screen grab of figure axes.
4 次查看(过去 30 天)
显示 更早的评论
I'm developing a GUI that deals with image processing. When I want to view results with greater detail I have the 2 output images popup in a new figure, side by side, each within its own imscrollpanel and then a immagbox and imoverviewpanel. I can zoom in/out and pan in either subplot and the other syncs nicely. But now I'd like to take a snapshot of the area I'm seeing and I'm trying
frame = getframe(h);
image = frame2im(frame);
but it's not working as expected. if I do figure, imshow(image);
I get gibberish. getframe behavior seems erratic and often It captures not only the intented axes but also a lot more around it or only to one side of it... I am using opengl hardware and opengl renderer. I'm forced to do this because I need transparency and correct rendering in large images...
Anyone else having this problem or have any suggestions? Thanks in advance.
0 个评论
回答(2 个)
Jan
2012-4-26
I had some success by adding a pause(0.02) before getframe(). This seems to allow some syncronizations of the underlying Java objects. drawnow was not sufficient, because it fails sometimes to update the display fast enough.
2 个评论
Jan
2012-4-26
Does this mean that you have tried the PAUSE command and it does not help? I had success with PAUSE(0.02) even for objects which have been drawn minutes before.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!