add an slider to get value for activecontour

2 vues (au cours des 30 derniers jours)
Peyman Obeidy
Peyman Obeidy le 30 Mar 2017
% 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 commentaires
Peyman Obeidy
Peyman Obeidy le 30 Mar 2017
Modifié(e) : Peyman Obeidy le 30 Mar 2017
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 le 30 Mar 2017
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

Connectez-vous pour commenter.

Réponses (1)

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by