FAST/AGAST: Allocate MAX_CORNERS or the actual max corners.

This commit is contained in:
iabdalkader 2017-01-08 19:05:25 +02:00
parent b956935550
commit f1f38f3c74
2 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#include "gc.h"
#define MAX_ROW (480)
#define MAX_CORNERS (2000)
#define Compare(X, Y) ((X)>=(Y))
typedef struct {
@ -195,8 +196,8 @@ static corner_t *agast58_detect(image_t *img, int b, int* num_corners, rectangle
offset7=s_offset7;
width=s_width;
//int max_corners = fb_avail()/sizeof(corner_t);
int max_corners = 5000;
// Try to alloc MAX_CORNERS or the actual max corners we can alloc.
int max_corners = IM_MIN(MAX_CORNERS, (fb_avail() / sizeof(corner_t)));
corner_t *corners = (corner_t*) fb_alloc(max_corners * sizeof(corner_t));
for(y=roi->y+1; y < ysizeB; y++)

View File

@ -5,6 +5,7 @@
#include "gc.h"
#define MAX_ROW (480)
#define MAX_CORNERS (2000)
#define Compare(X, Y) ((X)>=(Y))
typedef struct {
@ -3109,8 +3110,8 @@ static void fast9_score(image_t *image, corner_t *corners, int num_corners, int
static corner_t *fast9_detect(image_t *image, rectangle_t *roi, int *n_corners, int b)
{
int num_corners = 0;
//int max_corners = fb_avail()/sizeof(corner_t);
int max_corners = 20000;
// Try to alloc MAX_CORNERS or the actual max corners we can alloc.
int max_corners = IM_MIN(MAX_CORNERS, (fb_avail() / sizeof(corner_t)));
corner_t *corners = (corner_t*) fb_alloc(max_corners * sizeof(corner_t));
for(int y=roi->y+3; y<roi->y+roi->h-3; y++) {