i want to use two sliders as max and min value of bwareaopen(img,[min max]) so whenever i dragg the first slider it just getting value one time not continually getting value so how i can get continous change in subplot by getting value of slider and update the subplot 2nd image …code is below
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\
newwimg=handles.image;slideimg=imbinarize(newwimg);min=get(hObject,'Value');BW3=bwareafilt(slideimg,[min 500]);axes(handles.axes1);subplot(2,1,1)imshow(handles.image);title('Partially segmented')subplot(2,1,2);imshow(BW3);title('Segmentation using slider')guidata(hObject,handles)% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)% hObject handle to slider1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]);end% addlistener(hObject, 'ContinuousValueChange', @(hObject, eventdata) slider1_Callback(hObject, eventdata, handles));
% --- Executes on slider movement.
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)% Hints: get(hObject,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.function slider2_CreateFcn(hObject, eventdata, handles)% hObject handle to slider2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]);end
Best Answer