Reusing ROI for another image

조회 수: 9 (최근 30일)
Chris
Chris 2020년 5월 22일
댓글: Image Analyst 2020년 5월 26일
Hey,
I have two images that I want to mask. My desired region is the same size on both images, so I want two masks of the same size. However, since the region is shifted in X and Y coordinates, I want to align it by hand. My idea is to create a mask on the first image and export the ROI to the second, so I just have to move it to the right position and create the mask. I tried using roipoly() on the first picture and importing the coordinates to the roipoly() of the second image, but nothing happens. I can't even draw anything on the second roipoly(). I also tried to use drawpolygon(), this one shows me my ROI of my first image, but I still can't save any new ROI or export any coordinates. Do you have any tips?
[Mask,xi,yi] = roipoly(Image1);
imwrite[...]
Mask2 = roipoly(Image2,xi,yi); %or Mask2 = drawpolygon('Position',[xi yi],);

답변 (1개)

Image Analyst
Image Analyst 2020년 5월 22일
You could plot xi, yi over your image and have two scrollbars on your GUI to let them nudge the outline up, down, left, or right.
  댓글 수: 2
Chris
Chris 2020년 5월 26일
I will try this solution. But is there also the possibility to get the coordinates?
Image Analyst
Image Analyst 2020년 5월 26일
Sure. You could pass the xi and yi from one function to another, or save to disk with save() and recall with load() if you have to. See the FAQ.

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by