
Description
Reflecting flashlight from dust, snowflakes or raindrops can produce irritating circular artifacts. For its detecting and removing we propose process, where we use improved circle detection besides using houghCircles function. For removing detected artifacts we use morphological reduction.
Functions used
adaptiveThreshold, Canny, HoughCircles, findContours, fitEllipse, ImReconstruct
Process


Limitation: Minimal circle size (15px )- Maximal circle size(30px)
- Preprocessing – Adaptive threshold
[c language=”c++”]
medianBlur()
adaptiveThreshold()
OutputImg := InputImg + FilteredImg
[/c] - Detection with HoughCircles
[c language=”c++”]
Canny()
GaussianBlur()
HoughCircles()
Accept/ignore circles (based on size)
[/c] - Detection with Morphological reconstruction and contour analysis
[c language=”c++”]
mask := InputImg
marker := InputImg – degreeOfMorphreduct
marker := inv(marker)
morphologicalReconstruction(marker, mask)
differenceImg := marker2 – marker1
differenceImg := medianBlur(differenceImg)
differenceImg := threshold(differenceImg)
contour[] = findContours (differenceImg)
ellipse[i] := fitEllipse(contour[i])
accept/ignore circles (based on size and ellipse axes)
draw white ellipse[i]
draw black contour[i]
crop Regions Of Interest
opening(regionOfInterest[i])
if countNonZero(regionOfInterest[i]) > threshold then accept; else ignore;
[/c] - Result