Zidentyfikuj sekwencję kolorów za pomocą OpenCV
res = []
for cnt in contours:
if cv2.contourArea(cnt) > 100:
x,y,w,h = cv2.boundingRect(cnt)
cx,cy = x+w/2, y+h/2
color = hsv[cy,cx,0]
if (color < 10 or color > 170):
res.append([cx,cy,'R'])
elif(50 < color < 70):
res.append([cx,cy,'G'])
elif(20 < color <40):
res.append([cx,cy,'Y'])
elif(110 < color < 130):
res.append([cx,cy,'B'])
res = sorted(res,key = lambda res : res[0])
colors = [x[2] for x in res]
print colors
Motionless Moose