How to use Vislabels() function in app designer to show the labels in an image?

조회 수: 2 (최근 30일)
I want to show a labeled image in a app.UIAxes object. I have tried several codes to fit the vislabels function so that I can see the labeling in my app's interface. Following is one of the examples which did not work as well.
vislabels(ImageName, 'Parent', app.UIAxesLabeledImage);

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 28일
편집: Walter Roberson 2020년 12월 28일
Assuming you are using the File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/19665-visualize-output-of-bwlabel then that contribution does not permit you to choose the output location. You would need to upgrade the code to permit an output location.
Note: the way that code uses imshow(), imshow() will delete the current axes if it detects that the current axes occupies the entire figure -- unless the axes has "hold" set on. Therefore you cannot just modify it to do
if nargin == 1
axesHandle = gca;
else
axesHandle = InputAxes;
end
imageHandle = imshow(I, 'InitialMagnification', 'fit');
because invoked like that, it will look for the current axes of a traditional figure, and (probably) delete that.
However, you can use
if nargin == 1
axesHandle = gca;
else
axesHandle = InputAxes;
end
imageHandle = imshow(I, 'InitialMagnification', 'fit', 'Parent', axesHandle);
because imshow() does not delete the current axes if you pass it as the parent.
  댓글 수: 1
Anjan Goswami
Anjan Goswami 2020년 12월 28일
Thanks for your reply, sir. Yes, I have used the vislabels() function that you have mentioned. I have modified the vislabels() function with your recommendations and named it as vislabelsModified() function. Now, how should I call the function to show a labeled image in app.designer? What should be the command line to fit the image with the vislabelsModified() function to show it in app.UIAxes ? Sorry, for my ignorance if I could not catch you correctly,sir.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by