Alaa Alwaisy
Alaa Alwaisy

Reputation: 105

How can I get rid of the reflection spots?

I have these iris images and I want get rid of the reflection spots. Are there any suggestions? I don't want to set their pixels values to zero. I'd like them to be normal as their neighborhood pixels. Thank you in advance.

An example image:

enter image description here

Upvotes: 1

Views: 220

Answers (1)

Shai
Shai

Reputation: 114866

You can use roifill function

img = imread('https://uk.mathworks.com/matlabcentral/answers/uploaded_files/31683/51-7.bmp'); 

sp = img > 240; %// find the bright spots, use some high threshold
J = roifill( img, imdilate( sp, ones(5) ) ); %// replace the bright spots

And you get (original on the left, J on the right):

enter image description here


According to kkuilla, roifill is not supported for recent Matlab versions, and regionfill should be used instead:

J = regionfill( img, imdilate( sp, ones( 5 ) ) );

Upvotes: 5

Related Questions