Image not updating after processing parameters are changed.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
My code looks like this...
% --- Executes on selection change in popupmenu_contrast.
function popupmenu_contrast_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu_contrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_contrast contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu_contrast
global slider1value; global slider2value; global slider3value; global slider4value; global slider5value
%
str = get(hObject, 'String');
val = get(hObject, 'Value');
% set current contrast operation to the user-selected
switch str{val};
case 'imadjust';
slider1value = 0
slider2value = 1
slider3value = 0
slider4value = 1
slider5value = 1
handles.current_contrast = @imadjust;
set(handles.slider1, ...
'visible', 'on',...
'min', 0, 'max', 1, 'value', slider1value,...
'sliderstep', [0.05, 0.1]);
set(handles.slider2, ...
'visible', 'on',...
'min', 0, 'max', 1, 'value', slider2value,...
'sliderstep', [0.05, 0.1]);
set(handles.slider3, ...
'visible', 'on',...
'min', 0, 'max', 1, 'value', slider3value,...
'sliderstep', [0.05, 0.1]);
set(handles.slider4, ...
'visible', 'on',...
'min', 0, 'max', 1, 'value', slider4value,...
'sliderstep', [0.05, 0.1]);
set(handles.slider5, ...
'visible', 'on',...
'min', 0, 'max', 10, 'value', slider5value,...
'sliderstep', [0.05, 0.1]);
case 'histeq';
handles.current_contrast = @histeq;
set(handles.slider1, ...
'visible', 'on',...
'min', 1, 'max', 255, 'value', 64,...
'sliderstep', [0.000393701, 0.001574803]);
set(handles.text1, 'visible', 'on', 'string', '# Bins');
set(handles.slider2, ...
'visible', 'off',...
'min', 0, 'max', 1, 'value', 1,...
'sliderstep', [0.05, 0.1]);
set(handles.slider3, ...
'visible', 'off',...
'min', 0, 'max', 1, 'value', 0,...
'sliderstep', [0.05, 0.1]);
set(handles.slider4, ...
'visible', 'off',...
'min', 0, 'max', 1, 'value', 1,...
'sliderstep', [0.05, 0.1]);
set(handles.slider5, ...
'visible', 'off',...
'min', 0, 'max', 10, 'value', 1,...
end
if handles.current_contrast == @imadjust
handles.image2 = imadjust(handles.image,[slider1value; slider2value], [slider3value; slider4value], slider5value);
end
imshow(handles.image2, 'Parent', handles.axes2);
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (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
global slider1value;
slider1value = get(handles.slider1, 'value')
drawnow
% update handles structure
guidata(hObject,handles)
I know there's a bunch going on there. All I want to know is if someone can figure out why handles.image2 doesn't update when the slider values are changed.
0 Commenti
Risposta accettata
Image Analyst
il 23 Lug 2012
Because the function slider1_Callback doesn't do anything with handles.image2. Only your popup callback changes handles.image2.
8 Commenti
Image Analyst
il 25 Lug 2012
Where do you actually want to do the various functions? In the popup callback? Well if that resets the slider limits, and then does the function, then how are you going to give the user the ability to move/adjust the slider?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!