How can i access to the stats of the connectedComponentsWithStats function?

i cant access the stats by following the description! or at method from the internet .help me please!

please, no screeshots of code here (replace with TXT), thank you.

also, where is the actual problem ?

sorry for that .

i noticed the discription in function declaration.
param stats statistics output for each label, including the background label. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S

but when i use
stats(i, cv::CC_STAT_AREA)
to access the value as the description, it can not works.
error in vs2019 :
no matching overload function “cv::Mat::operater()” instance parameters types (int, cv::ConnectedComponentsTypes),object type is cv::Mat

please use:

stats.at<int>(i, cv::CC_STAT_AREA)

and have a look at the tutorials

1 Like