Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 2.63 KB

README.md

File metadata and controls

73 lines (59 loc) · 2.63 KB

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