Skip to content

Latest commit

 

History

History
85 lines (63 loc) · 4.04 KB

File metadata and controls

85 lines (63 loc) · 4.04 KB

Separate different type of blobs using OpenCV

Code snippet to seperate different type of blobs according to their radius with the help of OpenCV and Matplotlib library in python 3.

Table of contents

Introduction

Image segmentation is an essential preliminary step in most automatic pictorial pattern recognition and scene analysis applications.

Technologies

Software Used :

  • VS Code 1.60.1

Languages Used :

  • Python 3

OS used :

  • Ubuntu 20.04.3 LTS 64-bit

Setup

First you must have these libraries and languages installed on your system -

Launch

To run the code, run this commands in terminal with main.py as in current directory and images in Images folder along with main.py

$ python3 main.py

Window will pop-up with resultant images and their histograms.

Working

Method used here simply involves following steps :-

  • Converting provided image to grayscale image.
  • Applying binary threshold of value 100, if pixel value is greater han 100 it will be considered as 255 else 0.
  • Using Canny Edge Detection to seperate different blobs.
  • cv2.findContours() is helpful in retrieving contours from the binary image. The contours are a useful tool for shape analysis and object detection.
  • We then seperate all different radius from image.
  • We draw those bolbs seperately on seperate images.

Illustrations

Status

Completed

Sources

Other

This code is contributed by Abhinav Sharma.