What's new

Automatically detect and select a circle/circular area

I'm looking for a way to batch process thousands of images.

Is there a way for Photoshop to automatically detect the circular area I need select? The problem is that the images are different sizes and the circle is not going to be in the exact same spot every time. Also, as you will see in the attached image, there are objects covering parts of the circle, so the border may be hard to to detect. Any ideas? Thanks!

I need everything INSIDE (not including) the large thick circle


Tom Mann

Yup: Generate the spatial cross correlation between each of your images and a (centered) annular region of roughly the right size. The peak of the xc function will give you the offset of your circle from the center of your image. Using that information, translate your image in x and y by the offset values you just determined. As the final step, convert your image to polar coordinates and integrate over all angles. The graph of the brightness (or lack of saturation, or any other suitable metric) as a function of, r, the remaining coordinate, should show a strong peak at the average radius of the circle. So now, you have it's position and scaling (ie, size).

However, here's the catch -- as I mentioned in earlier discussions, you are trying to shoehorn what amounts to an image processing project using software (ie, Photoshop) that was never, every intended to be used for mathematical image processing. All of the above steps could be done in probably fewer than 10 lines of Matlab code.

Tom M