{"id":20164829,"url":"https://github.com/px4/px4-opticalflow","last_synced_at":"2025-06-15T01:32:36.464Z","repository":{"id":61902056,"uuid":"77207624","full_name":"PX4/PX4-OpticalFlow","owner":"PX4","description":"This repository contains different algorithms to calculate the optical flow. It can be used as input for a position estimator","archived":false,"fork":false,"pushed_at":"2020-10-01T16:56:43.000Z","size":45,"stargazers_count":172,"open_issues_count":1,"forks_count":124,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-02T19:09:11.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PX4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-23T07:38:08.000Z","updated_at":"2025-02-05T07:07:13.000Z","dependencies_parsed_at":"2022-10-23T09:00:49.977Z","dependency_job_id":null,"html_url":"https://github.com/PX4/PX4-OpticalFlow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2FPX4-OpticalFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2FPX4-OpticalFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2FPX4-OpticalFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PX4%2FPX4-OpticalFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PX4","download_url":"https://codeload.github.com/PX4/PX4-OpticalFlow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113160,"owners_count":21049795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T00:35:50.186Z","updated_at":"2025-04-09T21:23:41.615Z","avatar_url":"https://github.com/PX4.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PX4 Optical Flow repository\nThis package provides different algorithms to calculate the optical flow. Currently, there is the PX4Flow algorithm (SAD-block-matching) and an OpenCV based (KLT) version.\n\nPlease feel free to improve the current algorithms or add new versions.\n\n## Usage\n### PX4Flow version\nThe constructor `OpticalFlowPX4()` needs the following parameters (in this order):\n* Focal length in X-Direction [pixels]\n* Focal length in Y-Direction [pixels]\n* Output rate [Hz] (Optional, default = 15Hz) If smaller than frame rate, flow gets integrated. set to `-1` to use the image frame rate\n* Image width [pixels] (Optional, default = 64)\n* Image height [pixels] (Optional, default = 64)\n* Search size [pixels] (Optional, default = 6)\n* Flow feature threshold (Optional, default = 30)\n* Flow value threshold (Optional, default = 3000)\n\nFor the actual flow calculation the function `calcFlow()` has to be used. It is the same for both versions and needs the following arguments:\n\nInput:\n* Image array [* uint8_t]\n* Image time stamp [us, uint32_t]\n\nOutput:\n* Delta time [us, int]\n* Angular flow in X-Direction [rad/s, float]\n* Angular flow in Y-Direction [rad/s, float]\n\nReturn:\n* Flow quality [int], 0-255, -1 if it should not be used yet (output rate)\n\n### OpenCV version\nThe constructor `OpticalFlowOpenCV()` needs the following parameters (in this order):\n* Focal length in X-Direction [pixels]\n* Focal length in Y-Direction [pixels]\n* Output rate [Hz] (Optional, default = 15Hz) If smaller than frame rate, flow gets integrated. set to `-1` to use the image frame rate\n* Image width [pixels] (Optional, default = 64)\n* Image height [pixels] (Optional, default = 64)\n* Number of tracked features (Optional, default = 20)\n* Confidence multiplier for outlier rejection (Optional, default = 1.645, 90% confidence interval)\n\nFor the actual flow calculation the function `calcFlow()` has to be used. It is the same for both versions and needs the following arguments:\n\nInput:\n* Image array [* uint8_t]\n* Image time stamp [us, uint32_t]\n\nOutput:\n* Delta time [us, int]\n* Angular flow in X-Direction [rad/s, float]\n* Angular flow in Y-Direction [rad/s, float]\n\nReturn:\n* Flow quality [int], 0-255, -1 if it should not be used yet (output rate)\n\nIf you have a camera calibration, you can [undistort](http://docs.opencv.org/3.1.0/da/d54/group__imgproc__transform.html#ga55c716492470bfe86b0ee9bf3a1f0f7e) 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.\n\n`setCameraMatrix()` needs the following arguments:\n* Focal length in X-Direction [pixels]\n* Focal length in Y-Direction [pixels]\n* Principal point in X-Direction [pixels]\n* Principal point in Y-Direction [pixels]\n\n`setCameraDistortion()` needs the following arguments (see [here](http://docs.opencv.org/3.1.0/da/d54/group__imgproc__transform.html#ga55c716492470bfe86b0ee9bf3a1f0f7e)):\n* Radial coefficient k1\n* Radial coefficient k2\n* Radial coefficient k3\n* Tangential coefficient p1\n* Tangential coefficient p2\n\nAn example can be found [here](https://github.com/PX4/sitl_gazebo/blob/master/src/gazebo_opticalFlow_plugin.cpp#L141-L195).\n\n## Code style\nFor code formatting [astyle](http://astyle.sourceforge.net/astyle.html) should be used with the `.astylerc` options file.\n```\nastyle \u003cfile\u003e --options=.astylerc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpx4%2Fpx4-opticalflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpx4%2Fpx4-opticalflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpx4%2Fpx4-opticalflow/lists"}