Reusing ROI for another image

8 vues (au cours des 30 derniers jours)
Chris
Chris le 22 Mai 2020
Commenté : Image Analyst le 26 Mai 2020
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],);

Réponses (1)

Image Analyst
Image Analyst le 22 Mai 2020
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 commentaires
Chris
Chris le 26 Mai 2020
I will try this solution. But is there also the possibility to get the coordinates?
Image Analyst
Image Analyst le 26 Mai 2020
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.

Connectez-vous pour commenter.

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by