crop the image and after cropping display the cropped image on axes

3 次查看(过去 30 天)
i have an image and i want to crop it i applied this code but its only cropping the image but not showing the cropped image on the axes :
I=imcrop(Iedge2);
pause(2)
imshow(I,'Parent',handles.axes2);
title('cropped image')
i want to show the message on the top of the axes area that "crop the image" when the crop process occurs and after selection of the area the cropped area will be shown to the `axes2 .some body please tell me is there is any function or method to do so?
thanks and regards`

回答(1 个)

Image Analyst
Image Analyst 2016-5-22
imshow() does not change the current axes if you specify a Parent axes, therefore title will display over the current axes, which might not be axes2. To avoid confusion, I always call axes() before doing anything with an axes. This will change the current axes and everything you do from then on (without specifically referring to an axes) will happen at the axes you just passed in to axes():
axes(handles.axes2); % Change current axes, gca, to handles.axes2
imshow(I, []); % No need to specify 'Parent' now.
title('Cropped Image', 'FontSize', 20);
  8 个评论
Image Analyst
Image Analyst 2016-6-12
I think you're right. Now I seem to remember running across this before and I called the Mathworks about it. I think they might have given me some work around but I don't remember what it might have been. Try calling them. Alternatively you could just use text() to put some text into the overlay - see if that will remain after imcrop is called. Or (this I'm pretty sure will definitely work), just use GUIDE or uicontrol() to place a static text label somewhere on the figure window.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by