varying image properties Using MATLAB slider

1 vue (au cours des 30 derniers jours)
Chethan
Chethan le 31 Juil 2013
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?

Réponse acceptée

David Sanchez
David Sanchez le 31 Juil 2013
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');

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by