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
medianBlur() adaptiveThreshold() OutputImg := InputImg + FilteredImg
- Detection with HoughCircles
Canny() GaussianBlur() HoughCircles() Accept/ignore circles (based on size)
- Detection with Morphological reconstruction and contour analysis
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;
- Result