add an slider to get value for activecontour

2 ビュー (過去 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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by