Reusing ROI for another image
显示 更早的评论
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
2020-5-22
0 个投票
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
2020-5-26
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.
类别
在 帮助中心 和 File Exchange 中查找有关 ROI-Based Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!