# Image processing: Removal of two spots in fundus images

I have many hundreds fundus images of the human eye. The yellow arrow points to two spots which I I want to remove. The final result should be a perfect circle.

The removed area should be black.

I need this for image preprocessing for a machine learning project.

Any help would be great.

Find the largest morphological component:

m = SelectComponents[MorphologicalComponents[img, 0.1], "Area", -1]; Get the bounding circle (with radius multiplied by 0.98 to remove the blips)

circ = Flatten[{#[], .98 #[]} & /@
Show[img, Graphics[{Red, Thick, Circle[circ[], circ[]]}]] mask = Show[Image[ConstantArray[0, Dimensions[ImageData[img]]]],
Graphics[{White, Disk[circ[], circ[]]}]] newimg = ImageMultiply[img, mask] I think it may be interesting to preprocess the image before using @Melago's approach.
This permits to get rid of the 0.98 coefficient.

One may say that the following preprocessing introduces a new "magic" coefficient (erosionRadius = 30), but this new coefficient is less critical than the 0.98.

img00 = Import["https://i.stack.imgur.com/kUebf.jpg"]

img01 = MorphologicalBinarize[img00]

erosionRadius = 30;

m = Dilation[img02, DiskMatrix[erosionRadius]]


Note that the top and the bottom are slightly flattened. This should not have effect on the extracted "BoundingDiskRadius"

Beyong this point, @Melago's approach is used :

circ = Flatten[{#[], (* 0.98 : Removed *) #[]} & /@ 