xy* fast11_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b, int* ret_num_corners) { xy* corners; int num_corners; int* scores; xy* nonmax; corners = fast11_detect(im, xsize, ysize, stride, b, &num_corners); scores = fast11_score(im, stride, corners, num_corners, b); nonmax = nonmax_suppression(corners, scores, num_corners, ret_num_corners); free(corners); free(scores); return nonmax; }
void NxUtils::DetectCorners( float * Cotrners2D, const unsigned char * im, int xsize, int ysize, int stride, int b, int* ret_num_corners, bool nonmax_sup, NxFastCornerDetectionType Type ) { //xy * ret = fast12_detect( im, xsize, ysize, stride, b, ret_num_corners); //xy * ret = fast9_detect_nonmax( im, xsize, ysize, stride, b, ret_num_corners); xy * corners = NULL; xy * nonmax_corners = NULL; int num_corners=0, num_nonmax=0; int* scores=0; if(Type == NxFast9) corners = fast9_detect(im, xsize, ysize, stride, b, &num_corners ); else if(Type == NxFast10) corners = fast10_detect(im, xsize, ysize, stride, b, &num_corners ); else if(Type == NxFast11) corners = fast11_detect(im, xsize, ysize, stride, b, &num_corners ); else corners = fast12_detect(im, xsize, ysize, stride, b, &num_corners ); //Compute scores if(nonmax_sup) { if(Type == NxFast9) scores = fast9_score(im, stride, corners, num_corners, b); else if(Type == NxFast10) scores = fast10_score(im, stride, corners, num_corners, b); else if(Type == NxFast11) scores = fast11_score(im, stride, corners, num_corners, b); else scores = fast12_score(im, stride, corners, num_corners, b); } *ret_num_corners = num_corners; int y = 0; int numCorners= *ret_num_corners; for(int i = 0; i < numCorners; i++){ Cotrners2D[y] = corners[i].x; Cotrners2D[y+1] = corners[i].y; y += 2; } //*ret_corners = corners; //Do nonmax suppression if need be if(nonmax_sup) { nonmax_corners = nonmax_suppression(corners, scores, num_corners, & num_nonmax); *ret_num_corners = num_nonmax; int y = 0; int numCorners= *ret_num_corners; for(int i = 0; i < numCorners; i++){ Cotrners2D[y] = nonmax_corners[i].x; Cotrners2D[y+1] = nonmax_corners[i].y; y += 2; } free(corners); } free(scores); }