varying image properties Using MATLAB slider

1 次查看(过去 30 天)
I'm not using slider for viewing image/graph on axes by sliding it. Code shown below is a part of my m-file.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
%eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fname = getappdata(0, 'fname');
[a, map] = imread(fname);
x = ind2rgb(a, map);
b = get(handles.slider2,'value');
j = imadjust(x,[],[],b);
axes(handles.axes1);
imshow(j);
b in above code is a variable. The moment I slide the slider image brightness changes but at first when I run the code slider's initial point will be in extreme left. But for above code slider should be at the center.
How can i set values( to increase/decrease brightness) to that slider? How can i go for it?

采纳的回答

David Sanchez
David Sanchez 2013-7-31
To make sure your slider initialize in any value of your liking, place the set function on the start-up function of your GUI.
set(handles.slider2,'value','your_value_here');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by