I am trying to classify a connected component in a video based on its location. I am using the connectedComponentsWithStats function from opencv 3. I am trying to access values from the stats matrix which is a 1x5 matrix. When i use the following code I access the area of the connected component successfully.
connectedComponentsWithStats(median_difference3, labels, stats, centroids, 8, CV_16U);
int area= stats.at<int>(0,4);
cout << area << endl;
When i try to access the first value of the matrix using
int x= stats.at<int>(0,0);
All the values I get are zero.
Just to confirm when I output the full stats matrix the values in the 0,0 location of the matrix are not always zero so they should vary the same way the area matrix does. The values in the stat matrix are always integers also.
I would appreciate some help if you can see what i have done wrong!