Skip to content

vasantvohra/Color-Segmentation

Repository files navigation

Color-Segmentation forthebadge made-with-python forthebadge Python 3.6

Color_Segment.py

TASK

  • Count the number of segregated colored trash bags

Algorithm

Step 1
- Input image 
- convert BGR to HSV
- finding fixed colors, Blue, Yellow , Red, Green
- Specifying RGB/HSV Boundaries : lower / upper

Step 2
- creating mask of image by cv2.inRange(image, lower, upper)
- Applying the masking to residual img by cv2.bitwise_and

Step 3
- RGB Channels split & convert HSV 2 Gray
- Gaussian Blur

Step 4
Corner Edge Detection
- Canny edge detection
Morphological Transformations
- Dilation
- Erosion

Step 5
- find and count countours on edged image
- Defining Countour AREA
- Convex hull boundaries
- Draw contours i.e. mark all findings with different colors

Usage


python color_segment.py -i garbagebags2.jpg -o output.png -c hsv
python color_segment.py -i garbagebags2.jpg -o output.png -c rgb

Input

input

Output

output


Result Screenshot

Demo


Other Example

input output result

Next steps:

Try Panoptic / Instance segmentation

input


Applications

Automatic Color Segmentation of Images with Application to Detection of Variegated Coloring in Skin Tumors

Color Image Segmentation for Multimedia Applications

forthebadge

About

Automatically counts the items which differ by color. My usecase involved Automatic counting of segregated trashbags.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages