Info

This question is closed. Reopen it to edit or answer.

What does the numerical digits in the text box stands for when i adjust my slider. For both Contrast & Brightness

1 view (last 30 days)
Brightness Slider:
% --- Executes on slider movement.
function slider_brightness_Callback(hObject, eventdata, handles)
% hObject handle to slider_brightness (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
A = get(handles.slider_brightness,'Value');
AFMimage = handles.AFM_Adjust;
a = get(hObject,'Value');
BadjAFMimage = imadd(AFMimage,a);
handles.AFM_BAdjust = BadjAFMimage;
axes(handles.axes1); imshow(BadjAFMimage);
axes(handles.axes4); imhist(BadjAFMimage);
set(handles.slider_brightness,'Value',A);
set(handles.Btext,'String',num2str(A));
imwrite(BadjAFMimage,'Enhance Image.jpg','jpg')
% Update handles structure
guidata(hObject, handles);
Contrast Slider:
% --- Executes on slider movement.
function slider_contrast_Callback(hObject, eventdata, handles)
% hObject handle to slider_contrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
A = get(handles.slider_contrast,'Value');
AFMimage = handles.AFM_Adjust;
a = get(hObject,'Value');
BadjAFMimage = imadjust(AFMimage,[],[], a);
handles.AFM_BAdjust = BadjAFMimage;
axes(handles.axes1); imshow(BadjAFMimage);
axes(handles.axes4); imhist(BadjAFMimage);
set(handles.slider_contrast,'Value',A);
set(handles.Ctext,'String',num2str(A));
imwrite(BadjAFMimage,'Enhanced contrast Image.jpg','jpg')
% Update handles structure
guidata(hObject, handles);

Answers (1)

Walter Roberson
Walter Roberson on 3 Feb 2014
For the Contrast slider: gamma. For the brightness slider, the amount to add to each component of each pixel.

Community Treasure Hunt

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

Start Hunting!