varying image properties Using MATLAB slider

1 回表示 (過去 30 日間)
Chethan
Chethan 2013 年 7 月 31 日
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 Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by