# 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.

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[{#[[1]], (* 0.98 : Removed *) #[[2]]} & /@
2]], 1];
Show[img00, Graphics[{Red,Thick,Circle[circ[[1]], circ[[2]]]}]]


Related

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[{#[[1]], .98 #[[2]]} & /@

mask = Show[Image[ConstantArray[0, Dimensions[ImageData[img]]]],

newimg = ImageMultiply[img, mask]