Hello,
i want to find object from mat(blim) with use of connectedComponentsWithStats.but i dont know how to use this in java so please help me ..
C++ code:-
Mat labels, stats, centroids;
int numObjects = connectedComponentsWithStats(blIm, labels, stats, centroids);
// Draw bounding boxes for objects in the original image
// exclude background = 0
int i;
for(i=1; i(i, CC_STAT_LEFT);
int top = stats.at(i, CC_STAT_TOP);
int width = stats.at(i, CC_STAT_WIDTH);
int height = stats.at(i, CC_STAT_HEIGHT);
// draw rectangle
rectangle(image, Rect(left, top, width, height), Scalar(0,255,0), 2);
}
thanks
↧