I want to adjust the brightness of an image using slider.What can I do to make the slider start at middle position. What function should I use to make the image brighter if slider moved to the right and darker to the left?

2 views (last 30 days)
%this is my current slider callback
axes(handles.axes2);
hChildAxes2 = get(handles.axes2,'Children');
a=get(hChildAxes2(1),'CData');
b=get(hObject,'Value');
c=imadd(a,b);
imshow(c);

Answers (1)

SCOTT LIM
SCOTT LIM on 24 Feb 2017
In the GUIDE builder there is a slider icon. You can adjust the settings of the slider when you double click on the slider. You can change: 'Value' which is the starting position. 'Max' ' Min' which are your boundaries.
Im = imread('mypic.jpg');
offset = get(hObject,'Value');
Im = Im + offset ; %but u have to change the offset values to the correct data type as Im. e.g. uint8 or uint16(offset)

Community Treasure Hunt

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

Start Hunting!