Ask Your Question

Revision history [back]

you can use function connectedComponentsWithStats

Then you can find number of pixel in the components like this (for labels output CV_32S)

stats.at<int>(labels.at<int>(x,y),0)