Ask Your Question

Revision history [back]

You should use connectedComponentsWithStat You will have rect, area and center in stats

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),oint(stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),oint(stat.at<int>(i,CC_STAT_HEIGHT)));
}
// you can draw all rect

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),oint(stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),oint(stat.at<int>(i,CC_STAT_HEIGHT)));
),stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),stat.at<int>(i,CC_STAT_HEIGHT)));
}
// you can draw all rect

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
Mat stat,centroid;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),stat.at<int>(i,CC_STAT_HEIGHT)));
}
// you can draw all rect

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

Mat stat,centroid;
int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
Mat stat,centroid;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),stat.at<int>(i,CC_STAT_HEIGHT)));
}
// you can draw all rect

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

Mat stat,centroid;
int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),stat.at<int>(i,CC_STAT_HEIGHT)));

cout<<stat.at<int>(i,CC_STAT_AREA) } // you can draw all rect rect

eliminate what does it means?

You should use connectedComponentsWithStat You will have rect, area and center in stats

Mat stat,centroid;
int nLabels = connectedComponents(bw, labelImage, stat,centroid,8);
vector<Rect> rComp;
for (int i=0;i<nLabels;i++)
{
    rComp.push_back(Rect(Point(stat.at<int>(i,CC_STAT_LEFT Rect r(Rect(Point(stat.at<int>(i,CC_STAT_LEFT ),stat.at<int>(i,CC_STAT_TOP)),Size(stat.at<int>(i,CC_STAT_WIDTH ),stat.at<int>(i,CC_STAT_HEIGHT)));

cout<<stat.at<int>(i,CC_STAT_AREA) ),stat.at<int>(i,CC_STAT_HEIGHT))) } rComp.push_back(r); rectangle(bw,r,Scalar::all(255),1); cout<<stat.at<int>(i,CC_STAT_AREA); } // you can draw all rect

rect

eliminate what does it means?