import cv2
import numpy as np
img = cv2.imread('img.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(gray,127,255,1)
contours,h = cv2.findContours(thresh,1,2)
for cnt in contours:
approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True)
if len(approx)==3:
print('Triangle')
elif len(approx)==4:
print('Sq')
elif len(approx)==5:
print('Pen')
elif len(approx) ==6:
print('Hex')
else:
print('Cir')
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
**How to we can find the color of detected shapes in just BRG colors.This code is able to find shapes but I do not have any idea to detect color of this detected shapes. **


