Problem using imcrop in App Designer(2019a Version)

7 ビュー (過去 30 日間)
Shambavi Ganesh
Shambavi Ganesh 2019 年 7 月 6 日
コメント済み: Anubhuti Saha 2023 年 7 月 28 日
I've been trying to get imcrop function to work directly on a specified set of UIAXES in app designer. I have previously been able to achieve this in GUIDE GUI. I'm however not able to figure out how to specify the 'Parent' axis for imcrop function.
If I just use imcrop, without specifying a parent, a pop-up window shows up in which i can crop the figure. I don't want this however.
After scouring similar questions and answers, I have tried the following, but to no avail.
image= imread('cameraman.jpg')
imcrop('Parent', app.UIaxes, image)
imcrop(image,'Parent',app.UIaxes)
imcrop(app.UIaxes,image)
I know for sure that the interactive mouse control on UIaxes(app designer) were not available in 2017 and 2018 Matlab versions. I have been reading through matlab documentation for app designer(2019a version) and I could not figure out if "imcrop" falls into the unsupported functionality, it makes no specific mention.
I would be very grateful if someone could clear my confusion!
Thank you!

回答 (1 件)

Guillaume
Guillaume 2019 年 7 月 6 日
imcrop doesn't have an option to specify an axis, according to the docs. However, instead of an image, you can specify a handle to an Image object inside an axis, it would be something like:
img = imread('cameraman.tif');
himg = imshow(img, 'Parent', app.UIaxes);
imcrop(himg);
However, this still fails because imcrop calls uicontextmenu which is not supported by App Designer. So I'm afraid imcrop is still not supported in R2019a.
  4 件のコメント
Veronika Remenarova
Veronika Remenarova 2020 年 5 月 13 日
it opens the contextmenu, but as soon as I crop the colorbar and close the context menu I have my variable and I can continue the work
Anubhuti Saha
Anubhuti Saha 2023 年 7 月 28 日
Thanks alot.. It works perfectly.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by