Matlab App Designer - Image Editing
显示 更早的评论
Hi, I have a project I need some help with. I need to make a matlab app in app designer that can upload an image, change the brightness, contrast, and saturation using sliders, and save the image. I made a button, a UIAxis, and 3 sliders. Here is the code for the button and contrast slider.
function UploadImageButtonPushed(app, event)
[filename,filepath] = uigetfile({'*.*;*.jpg;*.png;*.bmp;*.oct'}, 'Select File to Open');
fullname = [filepath, filename];
ImageFile = imread(fullname);
imshow(ImageFile, 'Parent', app.UIAxes);
end
% Value changed function: ContrastSlider
function ContrastSliderValueChanged(app, event)
contrastVal = app.ContrastSlider.Value;
newImage = uint8(double(ImageFile*contrastVal))
imshow(newImage,'Parent',app.UIAxes)
the upload image works, but the contrast doesn't, ImageFile is not recognized. I would also appreciate help in how to implement brightness and saturation changes. Thanks.
2 个评论
Bilal Mudasar
2021-6-10
hey i have the same project rn , can you tell me if you were able to finish your code ?
thanks a lot mate
black
2023-5-7
same here
could u make one
回答(1 个)
Cris LaPierre
2020-5-7
编辑:Cris LaPierre
2020-5-7
0 个投票
Have you considered variable scope? Each callback is a function. Once you leave a function, the variables created inside it no longer exist. The normal way around this is to return the variables you want to keep as outputs of the function.
App designer has implemented a way of doing this - using properties. This page will show you how to share data within App Designer apps.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Preview and Device Configuration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!