This is an custom object detection project using OpenCV.
The object that is considered here is "Strawberry 🍓".
- show(image) : this is used to show the new image in which our object is detected.
- overlay(mask, image) : this function is used to create the overlay for the image by adding the weights of the masks with the weights of the image.
- find_biggest_contour(image): this function is used to find the biggest strawberry from all present in the image.
- circle_contour(image, contour) : this function is used for defining the size of the ellipse (around the image detected).
- find_strawberries(image): This is the main function to detect the strawberries in the given image.
- Convert to correct colour scheme from BGR to RGB by using cvtColor().This is done because when any transformation is done on the image, it follows some particular color schema.
- Convert to correct size using resize().This will give a square image (fx=fy).
- Clean the image using GaussianBlur().
- Define the filter for the image. Here we have used two filters:
- filter by colours
- filter by brightness
- segmentation(use masks to separate the strawberries from other)
- Find biggest strawberry
- Overlay mask that we created on our image
- Circle the biggest strawberry
- Convert back to original color scheme