How to display all selected region in the one figure?

조회 수: 2 (최근 30일)
Mei Synn Tan 2017년 1월 25일
댓글: Takuji Fukumoto 2017년 2월 7일
N = 5 ;
iwant = cell(N,1) ;
for i = 1:N
im = imshow(I);
e = imellipse(gca);% now pick ROI
setColor(e, 'red');
position = wait(e);
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

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

채택된 답변

Takuji Fukumoto 2017년 1월 25일
Here is a sample using subplot.
figure,
for i = 1:N
subplot(2,3,i),imshow(iwant{i});
end
댓글 수: 7이전 댓글 5개 표시이전 댓글 5개 숨기기
Mei Synn Tan 2017년 2월 4일
편집: Mei Synn Tan 2017년 2월 4일
Dear Takuji Fukumoto, here it is. the result showing the content of selected part is not clear, how to avoid it? how to avoid it? Thanks and have a nice day.
N = 2 ;
iwant = cell(N,1) ;
for i = 1:N
im = imshow(I);
e = imellipse(gca);% now pick ROI
setColor(e, 'red');
position = wait(e);
BW(:,:,2) = BW;
BW(:,:,3) = BW(:,:,1);
ROI = I;
ROI(BW == 0) = 255;
iwant{i} = ROI ;
end
Iout = uint8(zeros(364,236,3));
for i = 1:N
I= iwant{i};
idx= (I == 255);
I(idx) = 0;
Iout= Iout + I;
end
Iout(Iout == 0) = 255;
figure,imshow(Iout,'Border','tight');
Takuji Fukumoto 2017년 2월 7일
Is the answer from Image Analyst acceptable for you? If you need more help, let me know.

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

추가 답변 (2개)

Image Analyst 2017년 2월 4일
Mei, try the attached for a more memory efficient way of doing it. Don't be afraid, there are actually fewer lines than you and Takuja were using if you boil it down to the essentials. It's just longer because I put in tons of comments and some fancy display stuff to show your progress while drawing. I just mask the image at the end with the final mask. If you want, you can get updated images in the lower right that update after every ellipse so it would show 1 ellipse, then 2, then 3, etc.
댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

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

Image Analyst 2017년 2월 4일
Takuji: Don't make iwant a cell array. Make it your final image. Just paste in the ellipses from the source image. Adapt my attached copy and paste demo.
댓글 수: 2없음 표시없음 숨기기
Mei Synn Tan 2017년 2월 4일
Thank for answer my question. Hope Takuji Fukumoto can help me. Thanks and have a nice day
Image Analyst 2017년 2월 4일
편집: Image Analyst 2017년 2월 4일
Does that mean that you don't want me to help? I have a much better way than you or Takuja - I just didn't have time yesterday. It's in my second answer - look for it if you're interested.

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

카테고리

Help CenterFile Exchange에서 ROI-Based Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by