 Paparazzi UAS  v6.0_unstable-53-gfe8bbd3-dirty Paparazzi is a free software Unmanned Aircraft System.

efficient fixed-point optical-flow calculation More...

`#include <stdlib.h>`
`#include <stdio.h>`
`#include <math.h>`
`#include <string.h>`
`#include "lucas_kanade.h"` Include dependency graph for lucas_kanade.c:

Go to the source code of this file.

## Functions

struct flow_topticFlowLK (struct image_t *new_img, struct image_t *old_img, struct point_t *points, uint16_t *points_cnt, uint16_t half_window_size, uint16_t subpixel_factor, uint8_t max_iterations, uint8_t step_threshold, uint8_t max_points, uint8_t pyramid_level, uint8_t keep_bad_points)

struct flow_topticFlowLK_flat (struct image_t *new_img, struct image_t *old_img, struct point_t *points, uint16_t *points_cnt, uint16_t half_window_size, uint16_t subpixel_factor, uint8_t max_iterations, uint8_t step_threshold, uint16_t max_points, uint8_t keep_bad_points)
Compute the optical flow of several points using the Lucas-Kanade algorithm by Yves Bouguet The initial fixed-point implementation is doen by G. More...

## Detailed Description

efficient fixed-point optical-flow calculation

Compute the optical flow of several points using the pyramidal Lucas-Kanade algorithm by Yves Bouguet The initial fixed-point implementation is done by G.

• Initial fixed-point C implementation by G. de Croon
• Algorithm: Lucas-Kanade by Yves Bouguet
• de Croon and is adapted by Freek van Tienen for the implementation in Paparazzi. Pyramids implementation and related development done by Hrvoje Brezak.

Parameters
 [in] *new_img The newest grayscale image (TODO: fix YUV422 support) [in] *old_img The old grayscale image (TODO: fix YUV422 support) [in] *points Points to start tracking from [in,out] points_cnt The amount of points and it returns the amount of points tracked [in] half_window_size Half the window size (in both x and y direction) to search inside [in] subpixel_factor The subpixel factor which calculations should be based on [in] max_iterations Maximum amount of iterations to find the new point [in] step_threshold The threshold of additional subpixel flow at which the iterations should stop [in] max_points The maximum amount of points to track, we skip x points and then take a point. [in] pyramid_level Level of pyramid used in computation (0 == no pyramids used) [in] keep_bad_points Do not filter out bad points. The error field will be set accordingly.
Returns
The vectors from the original *points in subpixels

Pyramidal implementation of Lucas-Kanade feature tracker.

Uses input images to build pyramid of padded images.

For every pyramid level:

For all points:

• (1) determine the subpixel neighborhood in the old image
• (2) get the x- and y- gradients
• (3) determine the 'G'-matrix [sum(Axx) sum(Axy); sum(Axy) sum(Ayy)], where sum is over the window
• (4) iterate over taking steps in the image to minimize the error:
• [a] get the subpixel neighborhood in the new image
• [b] determine the image difference between the two neighborhoods
• [c] calculate the 'b'-vector
• [d] calculate the additional flow step and possibly terminate the iteration
• (5) use calculated flow as initial flow estimation for next level of pyramid

## Function Documentation

 struct flow_t* opticFlowLK ( struct image_t * new_img, struct image_t * old_img, struct point_t * points, uint16_t * points_cnt, uint16_t half_window_size, uint16_t subpixel_factor, uint8_t max_iterations, uint8_t step_threshold, uint8_t max_points, uint8_t pyramid_level, uint8_t keep_bad_points )

Definition at line 74 of file lucas_kanade.c. Here is the call graph for this function: Here is the caller graph for this function:

 struct flow_t* opticFlowLK_flat ( struct image_t * new_img, struct image_t * old_img, struct point_t * points, uint16_t * points_cnt, uint16_t half_window_size, uint16_t subpixel_factor, uint8_t max_iterations, uint8_t step_threshold, uint16_t max_points, uint8_t keep_bad_points )

Compute the optical flow of several points using the Lucas-Kanade algorithm by Yves Bouguet The initial fixed-point implementation is doen by G.

de Croon and is adapted by Freek van Tienen for the implementation in Paparazzi.

Parameters
 [in] *new_img The newest grayscale image (TODO: fix YUV422 support) [in] *old_img The old grayscale image (TODO: fix YUV422 support) [in] *points Points to start tracking from in/out] points_cnt The amount of points and it returns the amount of points tracked [in] half_window_size Half the window size (in both x and y direction) to search inside [in] subpixel_factor The subpixel factor which calculations should be based on [in] max_iteration Maximum amount of iterations to find the new point [in] step_threshold The threshold at which the iterations should stop [in] max_point The maximum amount of points to track, we skip x points and then take a point.
Returns
The vectors from the original *points in subpixels

Definition at line 275 of file lucas_kanade.c.

Referenced by opticFlowLK(). Here is the call graph for this function: Here is the caller graph for this function: