Recognize the raindrops in digital images and count the quantity.
- Read an image.
- Convert it into a gray image.
- Use anisotropic diffusion to erase noise.
- Calculate the sobel derivatives.
- Convert it into a binary image with a threshold.
- Opening operation to seperate interference from raindrops and weaken it.
- Remove small connected components.
- Closing operation to make the edges of raindrops more continuous.
- Remove the long straight edges interference and clear the numbers and characters on the top left corner.
- Closing operation again.
- Fill the holes inside the raindrops.
- Calculate fittest ellipses for contours. Count the quantity of contours. Draw the ellipses with labels and quantity on the image. Save the result image with the same name in result file folder.
The source image files are in images\
, and the result files with corresponding names are saved in results\
.