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
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
black 2023년 5월 7일
same here
could u make one

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

답변 (1개)

Cris LaPierre
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.

질문:

2020년 5월 7일

댓글:

2023년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by