I have image with separate objects, which have one color.
example image:
I want to get all the pixels from each object. I use Python and CV2. But I do not know how to do it.
example that i want to get:
- object1 : [(x1,y1), (x2,y2) ... (xn1,yn1)] where n1 - count all pixels in object1
- object2 : [(x1,y1), (x2,y2) ... (xn2,yn2)] where n2 - count all pixels in object2
- ...
- objectm : [(x1,y1), (x2,y2) ... (xnm,ynm)] where nm - count all pixels in objectm
UPD: This can be done with cv2.connectedComponents(). See this connected component labeling in python. Thanks beaker