It's using imellipse that does the job for 5 region, but only the last region is displayed. How to do for each region save to array, for each array draw it out, then for each object in array draw it out. Thanks

1 回表示 (過去 30 日間)
N = 5 ;
I = imread('13170.jpg');
im = imshow(I);
for i = 1:N
e = imellipse(gca);% now pick ROI
setColor(e, 'red');
position = wait(e);
BW = createMask(e,im);% get BW mask for that ROI
BW(:,:,2) = BW;
BW(:,:,3) = BW(:,:,1);
ROI = I;
ROI(BW == 0) = 255;
end
figure(i)
imshow(ROI,'Border','tight');

採用された回答

KSSV
KSSV 2017 年 1 月 24 日
clc; clear all;
N = 5 ;
I = imread('junk.jpg');
iwant = cell(N,1) ;
for i = 1:N
im = imshow(I);
e = imellipse(gca);% now pick ROI
setColor(e, 'red');
% position = wait(e);
BW = createMask(e,im);% get BW mask for that ROI
BW(:,:,2) = BW;
BW(:,:,3) = BW(:,:,1);
ROI = I;
ROI(BW == 0) = 255;
iwant{i} = ROI ;
end
for i = 1:N
figure
imshow(iwant{i},'Border','tight');
end
  2 件のコメント
Mei Synn Tan
Mei Synn Tan 2017 年 1 月 24 日
Thanks for helping me. How can I show total 5 region in the same figure?

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by