Reusing ROI for another image
12 次查看(过去 30 天)
显示 更早的评论
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],);
0 个评论
回答(1 个)
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 个评论
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!