add an slider to get value for activecontour

조회 수: 8 (최근 30일)
Peyman Obeidy
Peyman Obeidy 2017년 3월 30일
답변: Peyman Obeidy 2017년 4월 5일
% Display segmented image
BWsIbf = activecontour(ImCh1,BWCh1, 400, 'edge');
% FinalImwithMask=imfuse(BWsIbf,ImCh1);
% imshow(FinalImwithMask);
% figure, imshow(ImCh1);
%title('Segmented Image');
[B,L] = bwboundaries(BWsIbf,'noholes');
imshow(ImCh1,[]);%label2rgb(L, @jet, [.5 .5 .5]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2);
end
  댓글 수: 7
Peyman Obeidy
Peyman Obeidy 2017년 3월 30일
편집: Peyman Obeidy 2017년 3월 30일
I used ceil , thanks.
There is another problem, I need the image to get updated. At the moment, it get the value and open another figure.
Peyman Obeidy
Peyman Obeidy 2017년 3월 30일
function making_SliderForIm(ImCh1,BWCh1)
global I
global Imask
Imask=BWCh1;
I=ImCh1;
imshow(I,[]);
%create a slider
sld=uicontrol('Style', 'slider',...
'Min',1,'Max',50,'Value',41,...
'Position', [400 20 120 20],...
'Callback', @SliderVal);
function SliderVal(source,event)
val=ceil(source.Value);
% Display segmented image
BWsIbf = activecontour(I,Imask, 1+val, 'edge');
[B,L] = bwboundaries(BWsIbf,'noholes');
imshow(I,[]);%label2rgb(L, @jet, [.5 .5 .5]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'r', 'LineWidth', 2);
end
end
end

댓글을 달려면 로그인하십시오.

답변 (1개)

Peyman Obeidy
Peyman Obeidy 2017년 4월 5일
The final code is provided here:
https://au.mathworks.com/matlabcentral/answers/332877-update-image-in-gui-without-guide

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by