How can I apply an automatic ROI selection for a whole set of images?

4 views (last 30 days)
Hi everyone! I'm post-processing some images where an elliptic ROI selection must be applied to build a mask for further calculations. Thanks to previous Mathworks examples I learnt how to read the images and to manually create the ROI selection. Now I would like to apply the same ROI (selected for the first image) to the whole set of images read from a folder.
Is there a way to do that or to keep a record of the shape of the ROI (like center and radius) to apply it later on in the code?
An extract from the code in attachment.
Hope someone can help me! Thanks in advance!

Accepted Answer

Image Analyst
Image Analyst on 25 Jun 2018
Simply put it in an if statement so that it only gets called the first time:
if ii == 1
roi = imellipse;
end
Subsequent iterations will use the roi you setup on the first iteration.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!