Plotting in GUI from an external function using imagesc()
古いコメントを表示
So I've got an image file loaded in using image = imread(app.ImageName) and I am trying to send it off to an external function to do a fourier transform on it then show it on the gui using imagesc..
How do I use imagesc in a way that might be similar to imshow(img,'parent',app.UIaxes)??
Just to see if I could get something working, I also tried using imshow(img,'parent',app.UIaxes) within this external function to see if I could plot to the gui using that and it is not working either... giving me an error. I need to use imagesc but figured I'd mess around with imshow to see if I could get anything working. Heres whats happening
in GUI:
app.baseImg = imread(app.Input);
imshow(app.baseImg,'Parent',app.UIAxes)
doFourier(app.baseImg,app.RunMode,app.flareAngle,app.stepSize) %calls external function doFourier.m, plugging in the image
in external function, doFourier.m:
imshow(I,'parent',FourierApp.UIAxes2); %I is a modified image of the input image, app.baseImg
and heres the error it is giving me
The property 'UIAxes2' in class 'FourierApp' must be accessed from a class instance because it is not a Constant property.
Error in doFourier (line 5)
imshow(I,'parent',FourierApp.UIAxes2);
EDIT: If I tyoe
FourierApp()
before the imshow() in doFourier it works because it calls the class or something, but then it opens up another instance of the app... I need to call the class somehow at the beginning of the external function so that I can use it to modify things in the FourierApp class.
8 件のコメント
Walter Roberson
2020 年 5 月 6 日
It is not clear where it is getting FourierApp from? You are not passing in the app explicitly ?
Darren Miller
2020 年 5 月 6 日
Darren Miller
2020 年 5 月 6 日
編集済み: Darren Miller
2020 年 5 月 6 日
Mohammad Sami
2020 年 5 月 6 日
You need to pass it in when you are calling the function. It should not be created inside the external function.
function externalfunc(a,b,c,app)
% UIAxes2 must be a public property in the FourierApp
imshow(I,'parent',app.UIAxes2);
end
Mohammad Sami
2020 年 5 月 6 日
編集済み: Mohammad Sami
2020 年 5 月 6 日
You can also pass in the uiaxes itself, rather then the app
function externalfunc(a,b,c,uiax)
imshow(I,'parent',uiax);
end
Darren Miller
2020 年 5 月 6 日
Mohammad Sami
2020 年 5 月 6 日
You can specify the Parent property when calling imagesc
imagesc(C,'Parent',uiax)
Walter Roberson
2020 年 5 月 6 日
or for many of the plotting routines you can pass the handle to the container object as the first parameter
imagesc(uiax, C)
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Display Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!