How to program a slider tool to adjust image contrast?

7 visualizaciones (últimos 30 días)
Louise Cullen
Louise Cullen el 12 de Ag. de 2019
Respondida: Bhargavi Maganuru el 20 de Ag. de 2019
I have designed an app using GUIDE and I have just added a slider tool. I want it to be able to adjust the contrast of an image that has been imported and displayed on the app, like what the imcontrast function can do. Does anyone have any idea how to do this or can point me in the direction of some helpful documentation? I have not found anything so far.
  3 comentarios
Louise Cullen
Louise Cullen el 19 de Ag. de 2019
I am unsure how to create a slider callback! At the moment, I have found a way to program a button with imcontrast() so it opens a new window that can adjust the contrast of the image, but it would be much more ideal if there was no need for a new window, and instead the slider tool was on the GUI.
Adam
Adam el 19 de Ag. de 2019
A slider callback will be created for you in GUIDE. Then you can add your code in there.
Exactly what code you put in there depends on how you are doing the contrast and what you are doing with the result.
get( hObject, 'Value' )
in the callback will give you your slider value to work with though.

Iniciar sesión para comentar.

Respuestas (1)

Bhargavi Maganuru
Bhargavi Maganuru el 20 de Ag. de 2019
You can edit slider_callback in order to adjust contrast of the image using slider value.
get(hObject,'Value') command returns the value of the slider.
You can add following lines of code:
In Opening function:
I=imread('image.jpg');
handles.I=I;
guidata(hObject, handles);
axes(handles.axes1);
imshow(I);
In slider callback function:
I=handles.I;
I=I*get(hObject,'Value');
axes(handles.axes1);
imshow(I);
Hope this helps.

Categorías

Más información sobre Migrate GUIDE Apps 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