Clean up AGAST.
typedef struct {
uint16_t x;
uint16_t y;
- int16_t nms;
uint16_t score;
} corner_t;
@@ -30,7 +29,7 @@ static corner_t *agast58_detect(image_t *img, int b, int* num_corners, rectangle
static int agast58_score(const unsigned char* p, int bstart);
static void nonmax_suppression(corner_t *corners, int num_corners, array_t *keypoints);
-static kp_t *alloc_keypoint(uint16_t x, uint16_t y, int score)
+static kp_t *alloc_keypoint(uint16_t x, uint16_t y, uint16_t score)
{
// Note must set keypoint descriptor to zeros
kp_t *kpt = xalloc0(sizeof*kpt);
@@ -71,25 +70,6 @@ void agast_detect(image_t *image, array_t *keypoints, int threshold, rectangle_t
}
// Non-max suppression
nonmax_suppression(corners, num_corners, keypoints);
-
- //gc_info_t info;
- //for(int i=0; i<num_corners; i++) {
- // corner_t pos = corners[i];
- // gc_info(&info);
- // #define MIN_MEM (10*1024)
- // // Allocate keypoints until we're almost out of memory
- // if (info.free < MIN_MEM) {
- // // Try collecting memory
- // gc_collect();
- // // If it didn't work break
- // gc_info(&info);
- // if (info.free < MIN_MEM) {
- // break;
- // }
- // }
- // #undef MIN_MEM
- // array_push_back(keypoints, alloc_keypoint(pos.x, pos.y, pos.score));
- //}
}
// Free corners;
@@ -133,7 +113,7 @@ static void nonmax_suppression(corner_t *corners, int num_corners, array_t *keyp
for(int i=0; i<sz; i++) {
corner_t pos = corners[i];
- int score = pos.score;
+ uint16_t score = pos.score;
/*Check left */
if (i > 0) {
@@ -230,7 +210,7 @@ static corner_t *agast58_detect(image_t *img, int b, int* num_corners, rectangle
width=s_width;
//int max_corners = fb_avail()/sizeof(corner_t);
- int max_corners = 20000;
+ int max_corners = 5000;
corner_t *corners = (corner_t*) fb_alloc(max_corners * sizeof(corner_t));
for(y=roi->y+1; y < ysizeB; y++)
