RectList DDClipper::GetRectangles(const RectList &rect_list) const
{
    RectList rects;
    for( int i=0; i!=rect_list.size(); ++i)
    {
        RectList rcs = GetRectangles( rect_list[i] );
        for( int k=0; k!=rcs.size(); ++k ) rects.push_back( rcs[k] );
    }

    return rects;
}
RectList calc_bboxes(cv::Mat &mat ) {
	RectList boxes;
	std::vector<std::vector<cv::Point> > contours;
	/* Do edge detection?? */

	/* Find contours */
	cv::findContours(mat, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_NONE);

	/* For each contour: */
	for (int i = 0; i < contours.size(); i++) { //TODO: Iterator?
		/* Check area */
		if (cv::contourArea(contours[i]) < MIN_AREA) continue;

		/* Get bounding box */
		//TODO: Maybe poly approx first?
		cv::Rect bbox = cv::boundingRect(contours[i]);

		/* Add to list */
		boxes.push_back(bbox);
	}
	return boxes;
}
Exemple #3
0
/**
 * Allocate a clipping rectangle from the free list.
 * @param pClip			clip rectangle dimensions to allocate
 */
void AddClipRect(const Common::Rect &pClip) {
	s_rectList.push_back(pClip);
}