项目作者: vasantvohra

项目描述 :
Automatically counts the items which differ by color. My usecase involved Automatic counting of segregated trashbags.
高级语言: Python
项目地址: git://github.com/vasantvohra/Color-Segmentation.git
创建时间: 2019-08-27T11:15:37Z
项目社区:https://github.com/vasantvohra/Color-Segmentation

开源协议:

下载


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

Color_Segment.py

TASK

> * Count the number of segregated colored trash bags

Algorithm

  1. Step 1
  2. - Input image
  3. - convert BGR to HSV
  4. - finding fixed colors, Blue, Yellow , Red, Green
  5. - Specifying RGB/HSV Boundaries : lower / upper
  6. Step 2
  7. - creating mask of image by cv2.inRange(image, lower, upper)
  8. - Applying the masking to residual img by cv2.bitwise_and
  9. Step 3
  10. - RGB Channels split & convert HSV 2 Gray
  11. - Gaussian Blur
  12. Step 4
  13. Corner Edge Detection
  14. - Canny edge detection
  15. Morphological Transformations
  16. - Dilation
  17. - Erosion
  18. Step 5
  19. - find and count countours on edged image
  20. - Defining Countour AREA
  21. - Convex hull boundaries
  22. - Draw contours i.e. mark all findings with different colors

Usage


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

Input

input

Output

output


Result Screenshot

Demo


Other Example

input output

" class="reference-link">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