1 Star 0 Fork 0

重剑无锋/OpticalFlow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

PX4 Optical Flow repository

This package provides different algorithms to calculate the optical flow. Currently, there is the PX4Flow algorithm (SAD-block-matching) and an OpenCV based (KLT) version.

Please feel free to improve the current algorithms or add new versions.

Usage

PX4Flow version

The constructor OpticalFlowPX4() needs the following parameters (in this order):

  • Focal length in X-Direction [pixels]
  • Focal length in Y-Direction [pixels]
  • Output rate [Hz] (Optional, default = 15Hz) If smaller than frame rate, flow gets integrated. set to -1 to use the image frame rate
  • Image width [pixels] (Optional, default = 64)
  • Image height [pixels] (Optional, default = 64)
  • Search size [pixels] (Optional, default = 6)
  • Flow feature threshold (Optional, default = 30)
  • Flow value threshold (Optional, default = 3000)

For the actual flow calculation the function calcFlow() has to be used. It is the same for both versions and needs the following arguments:

Input:

  • Image array [* uint8_t]
  • Image time stamp [us, uint32_t]

Output:

  • Delta time [us, int]
  • Angular flow in X-Direction [rad/s, float]
  • Angular flow in Y-Direction [rad/s, float]

Return:

  • Flow quality [int], 0-255, -1 if it should not be used yet (output rate)

OpenCV version

The constructor OpticalFlowOpenCV() needs the following parameters (in this order):

  • Focal length in X-Direction [pixels]
  • Focal length in Y-Direction [pixels]
  • Output rate [Hz] (Optional, default = 15Hz) If smaller than frame rate, flow gets integrated. set to -1 to use the image frame rate
  • Image width [pixels] (Optional, default = 64)
  • Image height [pixels] (Optional, default = 64)
  • Number of tracked features (Optional, default = 20)
  • Confidence multiplier for outlier rejection (Optional, default = 1.645, 90% confidence interval)

For the actual flow calculation the function calcFlow() has to be used. It is the same for both versions and needs the following arguments:

Input:

  • Image array [* uint8_t]
  • Image time stamp [us, uint32_t]

Output:

  • Delta time [us, int]
  • Angular flow in X-Direction [rad/s, float]
  • Angular flow in Y-Direction [rad/s, float]

Return:

  • Flow quality [int], 0-255, -1 if it should not be used yet (output rate)

If you have a camera calibration, you can undistort the tracked features (only for OpenCV version). To use that functionality you have to set the camera matrix setCameraMatrix() AND distortion parameters setCameraDistortion() after calling the constructor.

setCameraMatrix() needs the following arguments:

  • Focal length in X-Direction [pixels]
  • Focal length in Y-Direction [pixels]
  • Principal point in X-Direction [pixels]
  • Principal point in Y-Direction [pixels]

setCameraDistortion() needs the following arguments (see here):

  • Radial coefficient k1
  • Radial coefficient k2
  • Radial coefficient k3
  • Tangential coefficient p1
  • Tangential coefficient p2

An example can be found here.

Code style

For code formatting astyle should be used with the .astylerc options file.

astyle <file> --options=.astylerc

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

语言

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sdkmsdn_admin/OpticalFlow.git
git@gitee.com:sdkmsdn_admin/OpticalFlow.git
sdkmsdn_admin
OpticalFlow
OpticalFlow
master

搜索帮助