mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-02 13:27:32 +08:00
Fixed requested changes
This commit is contained in:
@@ -49,7 +49,8 @@ static void fast_make_offsets(int32_t *pixel, uint16_t row_stride, uint8_t pixel
|
|||||||
* @param[in] **ret_corners pointer to the array which contains the corners that were detected.
|
* @param[in] **ret_corners pointer to the array which contains the corners that were detected.
|
||||||
* @param[in] *roi array of format [x0 y0 x1 y1] describing the region of interest in the image where the corners will be detected. If null, the whole image is used.
|
* @param[in] *roi array of format [x0 y0 x1 y1] describing the region of interest in the image where the corners will be detected. If null, the whole image is used.
|
||||||
*/
|
*/
|
||||||
void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uint16_t x_padding, uint16_t y_padding, uint16_t *num_corners, uint16_t *ret_corners_length, struct point_t **ret_corners, uint16_t *roi) {
|
void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uint16_t x_padding, uint16_t y_padding, uint16_t *num_corners, uint16_t *ret_corners_length, struct point_t **ret_corners, uint16_t *roi)
|
||||||
|
{
|
||||||
|
|
||||||
uint16_t corner_cnt = 0;
|
uint16_t corner_cnt = 0;
|
||||||
int pixel[16];
|
int pixel[16];
|
||||||
@@ -62,13 +63,12 @@ void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uin
|
|||||||
pixel_size = 2;
|
pixel_size = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!roi){
|
if (!roi) {
|
||||||
x_start = 3 + x_padding;
|
x_start = 3 + x_padding;
|
||||||
y_start = 3 + y_padding;
|
y_start = 3 + y_padding;
|
||||||
x_end =img->w - 3 - x_padding;
|
x_end = img->w - 3 - x_padding;
|
||||||
y_end =img->h - 3 - y_padding;
|
y_end = img->h - 3 - y_padding;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
x_start = roi[0] > 0 ? roi[0] : 3 + x_padding;
|
x_start = roi[0] > 0 ? roi[0] : 3 + x_padding;
|
||||||
y_start = roi[1] > 0 ? roi[1] : 3 + y_padding;
|
y_start = roi[1] > 0 ? roi[1] : 3 + y_padding;
|
||||||
x_end = roi[2] < (img->w - 3 - x_padding) ? roi[2] : img->w - 3 - x_padding;
|
x_end = roi[2] < (img->w - 3 - x_padding) ? roi[2] : img->w - 3 - x_padding;
|
||||||
@@ -82,7 +82,7 @@ void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uin
|
|||||||
// Go trough all the pixels (minus the borders and inside the requested roi)
|
// Go trough all the pixels (minus the borders and inside the requested roi)
|
||||||
for (y = y_start; y < y_end; y++) {
|
for (y = y_start; y < y_end; y++) {
|
||||||
|
|
||||||
if (min_dist > 0) y_min = y - min_dist;
|
if (min_dist > 0) { y_min = y - min_dist; }
|
||||||
|
|
||||||
for (x = x_start; x < x_end; x++) {
|
for (x = x_start; x < x_end; x++) {
|
||||||
// First check if we aren't in range vertical (TODO: fix less intensive way)
|
// First check if we aren't in range vertical (TODO: fix less intensive way)
|
||||||
@@ -95,13 +95,14 @@ void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uin
|
|||||||
|
|
||||||
|
|
||||||
// Go through the previous corners until y goes out of range
|
// Go through the previous corners until y goes out of range
|
||||||
i = corner_cnt-1;
|
i = corner_cnt - 1;
|
||||||
while( i >= 0) {
|
while (i >= 0) {
|
||||||
|
|
||||||
// corners are stored with increasing y,
|
// corners are stored with increasing y,
|
||||||
// so if we go from the last to the first, then their y-coordinate will go out of range
|
// so if we go from the last to the first, then their y-coordinate will go out of range
|
||||||
if((*ret_corners)[i].y < y_min)
|
if ((*ret_corners)[i].y < y_min) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (x_min < (*ret_corners)[i].x && (*ret_corners)[i].x < x_max) {
|
if (x_min < (*ret_corners)[i].x && (*ret_corners)[i].x < x_max) {
|
||||||
need_skip = 1;
|
need_skip = 1;
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "lib/vision/image.h"
|
#include "lib/vision/image.h"
|
||||||
|
|
||||||
void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uint16_t x_padding, uint16_t y_padding, uint16_t *num_corners,uint16_t *ret_corners_length, struct point_t **ret_corners, uint16_t *roi);
|
void fast9_detect(struct image_t *img, uint8_t threshold, uint16_t min_dist, uint16_t x_padding, uint16_t y_padding, uint16_t *num_corners, uint16_t *ret_corners_length, struct point_t **ret_corners, uint16_t *roi);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ void calc_fast9_lukas_kanade(struct opticflow_t *opticflow, struct opticflow_sta
|
|||||||
opticflow->fast9_padding, opticflow->fast9_padding, &result->corner_cnt,
|
opticflow->fast9_padding, opticflow->fast9_padding, &result->corner_cnt,
|
||||||
&opticflow->fast9_rsize,
|
&opticflow->fast9_rsize,
|
||||||
&opticflow->fast9_ret_corners,
|
&opticflow->fast9_ret_corners,
|
||||||
0);
|
NULL);
|
||||||
|
|
||||||
// Adaptive threshold
|
// Adaptive threshold
|
||||||
if (opticflow->fast9_adaptive) {
|
if (opticflow->fast9_adaptive) {
|
||||||
|
|||||||
Reference in New Issue
Block a user