30 #include "../../opticflow/opticflow_calculator.h"
33 #define MAX_AGENTS FAST9_MAX_CORNERS
62 min_gradient = (min_gradient == 0) ? 1 : min_gradient;
72 float GRID_ROWS = (int) ceil(sqrtf((
float)
n_agents));
73 float step_size_x = (img->
w - 2 * init_border) / (GRID_ROWS - 1);
74 float step_size_y = (img->
h - 2 * init_border) / (GRID_ROWS - 1);
78 for (
int c = 0; c < GRID_ROWS; c++) {
79 for (
int r = 0; r < GRID_ROWS; r++) {
83 px = ((float)(rand() % 10000) + 1) / 10000.0f;
84 py = ((float)(rand() % 10000) + 1) / 10000.0f;
85 pnorm = sqrtf(px * px + py * py);
86 struct agent_t ag = { (border + c * step_size_x), (border + r * step_size_y), 1, px / pnorm, py / pnorm};
89 if (a == n_agents) {
break; }
93 if (a == n_agents) {
break; }
120 int gradient = (abs(dx) + abs(dy)) / 2;
121 if (abs(gradient) >= min_gradient) {
123 float norm_factor = sqrtf((
float)(dx * dx + dy * dy));
124 agents[a].
x += (dy / norm_factor) * short_step;
125 agents[a].
y += (dx / norm_factor) * short_step;
134 if (
agents[a].x > img->
w - border) {
136 }
else if (
agents[a].x < border) {
139 if (
agents[a].y > img->
h - border) {
141 }
else if (
agents[a].y < border) {
uint32_t x
The x coordinate of the point.
Finds corners in an image by actively scanning the image.
int fast9_detect_pixel(struct image_t *img, uint8_t threshold, uint16_t x, uint16_t y)
Do a FAST9 corner detection for a single pixel.
Image helper functions like resizing, color filter, converters...
void image_gradient_pixel(struct image_t *img, struct point_t *loc, int method, int *dx, int *dy)
Get the gradient at a pixel location.
void act_fast(struct image_t *img, uint8_t fast_threshold, uint16_t *num_corners, struct point_t **ret_corners, uint16_t n_agents, uint16_t n_time_steps, float long_step, float short_step, int min_gradient, int gradient_method)
Do an ACT-FAST corner detection.
uint32_t y
The y coordinate of the point.
struct agent_t agents[MAX_AGENTS]