Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 1.64 KB

README.md

File metadata and controls

27 lines (23 loc) · 1.64 KB

Object-Detection-using-OpenCV

This is an custom object detection project using OpenCV.

The object that is considered here is "Strawberry 🍓".

The functions used:

  • 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.

Steps involved:

  1. 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.
  2. Convert to correct size using resize().This will give a square image (fx=fy).
  3. Clean the image using GaussianBlur().
  4. Define the filter for the image. Here we have used two filters:
    • filter by colours
    • filter by brightness
  5. segmentation(use masks to separate the strawberries from other)
  6. Find biggest strawberry
  7. Overlay mask that we created on our image
  8. Circle the biggest strawberry
  9. Convert back to original color scheme

Output: