Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well, thanks haris for a new concept(really useful), but i use Steven code ie

    int cmin= 50;
    int cmax= 1000;        
    vector<vector<Point> >::iterator itc=contours.begin();
    while (itc!=contours.end()) {
            if (itc->size() < cmin || itc->size() > cmax){
                itc= contours.erase(itc);}
            else{
            vector<Point> pts = *itc;
            Mat pointsMatrix = Mat(pts);
            Scalar color( 0, 255, 0 );          
            Rect r0= boundingRect(pointsMatrix);
            rectangle(threshold_output,r0,color,2);

above sample code will solve my issue. But @haris and @steven thanks for immediate reply & good luck