How the change the intensity of the image in the App designer without loading it again and again?

3 次查看(过去 30 天)
Hello Everyone,
I am new to the Matlab and I am creating an app which reads an image and you have sliders to select the intensity of the image.
Right now, I am doing this as:
function MinSliderValueChanged(app, event)
min=app.MinSlider.Value;
max=app.MaxSlider.Value;
Y=app.File_Path;
Loaded_Image=imread(Y);
if(min>=max)
f = errordlg('Min cannot be greater than Max!','Error');
else
imshow(Loaded_Image,[min,max],'Parent',app.UIAxes);
end
colormap(app.UIAxes,"jet");
colorbar(app.UIAxes);
end
In this way, I am displaying the image again and again and is slow in case of large files. Is there any work around this?
Thanks a lot.

回答(1 个)

Rik
Rik 2019-11-19
This sounds like you should be able to borrow a lot of code from my WindowLevel FEX submission. The point is to change the caxes, instead of recreating the entire image.
It is always a good idea to create graphics objects only once in your GUI and handle any further modification through the properties of the underlying objects. So in the case of imshow you should be using the image object it returns.

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by