Lines Matching refs:quads
44 uses a graph of connected quads. It is based on the code contributed
128 static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners,
135 static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count );
137 static int icvFindConnectedQuads( CvCBQuad *quads, int quad_count,
145 CvCBQuad **quads, CvSize pattern_size );
147 static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
153 static int icvTrimCol(CvCBQuad **quads, int count, int col, int dir);
155 static int icvTrimRow(CvCBQuad **quads, int count, int row, int dir);
157 static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count,
160 static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0);
217 CvCBQuad *quads = 0, **quad_group = 0;
285 // Run multi-level quads extraction
286 // In case one-level binarization did not give enough number of quads
287 CV_CALL( quad_count = icvGenerateQuadsEx( &quads, &corners, storage, img, thresh_img, dilations, flags ));
330 CV_CALL( quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags ));
347 pt1 = quads[i].corners[k]->pt;
348 pt2 = quads[i].corners[(k+1)%4]->pt;
367 CV_CALL( icvFindQuadNeighbors( quads, quad_count ));
376 CV_CALL( count = icvFindConnectedQuads( quads, quad_count, quad_group, group_idx, storage ));
384 PRINTF("Starting ordering of inner quads\n");
385 count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners,
396 if (quads[i].group_idx == group_idx)
401 if (quads[i].ordered)
403 pt1 = quads[i].corners[k]->pt;
404 pt2 = quads[i].corners[(k+1)%4]->pt;
417 continue; // haven't found inner quads
420 // If count is more than it should be, this will remove those quads
448 cvFree( &quads );
461 cvFree( &quads );
527 // order a group of connected quads
532 // but all other quads are ordered consistently
534 // can change the number of quads in the group
535 // can add quads, so we need to have quad/corner arrays passed in
539 icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
551 if (quads[i]->count == 4)
553 start = quads[i];
577 // Recursively order the quads so that all position numbers (e.g.,
610 // just do inside quads
644 // check if there are enough inner quads
645 if (dcol < w || drow < h) // found enough inner quads?
658 quad_count = icvTrimCol(quads,quad_count,col_min,-1);
663 quad_count = icvTrimCol(quads,quad_count,col_max,+1);
674 quad_count = icvTrimRow(quads,quad_count,row_min,-1);
679 quad_count = icvTrimRow(quads,quad_count,row_max,+1);
684 // check edges of inner quads
686 // first order all inner quads
690 if (quads[i]->count == 4)
692 int col = quads[i]->col;
693 int row = quads[i]->row;
707 CvCBQuad *neighbor = quads[i]->neighbors[j];
715 icvOrderQuad(neighbor, quads[i]->corners[j], (j+2)%4);
724 // if we have found inner quads, add corresponding outer quads,
728 PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found);
731 if (quads[i]->count < 4 && quads[i]->ordered)
733 int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners);
741 // final trimming of outer quads
742 if (dcol == w && drow == h) // found correct inner quads
744 PRINTF("Inner bounds ok, check outer quads\n");
749 if (quads[i]->ordered == false)
754 if (quads[i]->neighbors[j] && quads[i]->neighbors[j]->ordered)
760 icvRemoveQuadFromGroup(quads,rcount,quads[i]);
779 icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count,
793 quads[quad_count] = q;
849 icvTrimCol(CvCBQuad **quads, int count, int col, int dir)
856 if (quads[i]->ordered)
857 PRINTF("index: %d cur: %d\n", col, quads[i]->col);
859 if (quads[i]->ordered && quads[i]->col == col)
863 if (quads[i]->neighbors[1])
865 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[1]);
868 if (quads[i]->neighbors[2])
870 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[2]);
876 if (quads[i]->neighbors[0])
878 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[0]);
881 if (quads[i]->neighbors[3])
883 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[3]);
894 icvTrimRow(CvCBQuad **quads, int count, int row, int dir)
901 if (quads[i]->ordered)
902 PRINTF("index: %d cur: %d\n", row, quads[i]->row);
904 if (quads[i]->ordered && quads[i]->row == row)
908 if (quads[i]->neighbors[2])
910 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[2]);
913 if (quads[i]->neighbors[3])
915 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[3]);
921 if (quads[i]->neighbors[0])
923 icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[0]);
926 if (quads[i]->neighbors[1])
928 quads,rcount,quads[i]->neighbors[1]);
944 icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0)
950 CvCBQuad *q = quads[i];
972 CvCBQuad *q = quads[i];
975 quads[i] = quads[count-1];
1017 // if we found too many connect quads, remove those which probably do not belong.
1030 // number of quads this pattern should contain
1152 // Recursively find a group of connected quads starting from the seed quad[i]
1450 static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count )
1459 CvCBQuad* cur_quad = &quads[idx];
1488 if( quads[k].neighbors[j] )
1491 dx = pt.x - quads[k].corners[j]->pt.x;
1492 dy = pt.y - quads[k].corners[j]->pt.y;
1497 dist <= quads[k].edge_len*thresh_scale )
1501 float ediff = cur_quad->edge_len - quads[k].edge_len;
1503 ediff > 32*quads[k].edge_len)
1509 closest_quad = &quads[k];
1539 // Check that each corner is a neighbor of different quads
1552 CvCBQuad* q = &quads[k];
1704 // Create array of quads structures
1812 //draw frame to extract edge quads
1900 // Perform clustering of extracted quads
1930 // Create array of quads structures