Matlab App Designer - Image Editing

15 visualizaciones (últimos 30 días)
john deZon
john deZon el 7 de Mayo de 2020
Comentada: black el 7 de Mayo de 2023
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 comentarios
Bilal Mudasar
Bilal Mudasar el 10 de Jun. de 2021
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 el 7 de Mayo de 2023
same here
could u make one

Iniciar sesión para comentar.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 7 de Mayo de 2020
Editada: Cris LaPierre el 7 de Mayo de 2020
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.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by