2016.2.27 Px4 Flow Analysis

Source: Internet
Author: User

Px4 Flow Analysis

Code Address Https://github.com/PX4/Flow

mainly to analyze the last function Compute Flow

the optical flow algorithm of the original code is mainly usedhisthistogram algorithm, this code can be divided into two parts, the first part is to generate a histogram, the second part is based on the histogram to calculate the displacement vector. Because it is the light flow, then is the aircraft bottom of the camera with time to move a trend, then must be at least two pictures of the data, respectively,frame1and theframe2.

the first stepJ,Iof the forThe loop is the loop of the sampling point,JJ,IIthe loop is sampled for a small neighborhood. The sampling point is fromframe1based on the coordinates of the sample points.frame2of-Winminto theWinminA small rectangular species to find the most similar point, simply, is to find the sample point in the corresponding position of two pictures.

param_bottom_flow_feature_threshold variable to determine the quality requirements for feature point sampling, the larger the more stringent. Indicates whether the current point can be used as a point for calculating the light flow. The original function calculates the gradient and so on.

sad (sumof absolute difference) param_bottom_flow_value_threshold is the similarity of a threshold, the smaller the more similar, the greater the more stringent, if not meet this condition, two pictures can not find the corresponding point, then no, then look at the next sample point bar.

If you're lucky,frame1The sample points that can be computed are found in theframe2The corresponding points are also found, then you can calculatexand theythe difference in direction, or a moving vector, calculated separately .xand theymove in two directions so you can get a moving vector, where two directionsxand theyThe number of moves is recorded in an array of histograms.

so eventually x and the y the histogram array is recorded for all heroes with two levels of challenge, recording the size and direction of the move.

the above is forhistthe production of, in addition tohistThere is another thing that is the moving data of the corresponding point, that is, the direction and size of the movement of all the sampling points,dirsand theSubdirs,dirsThe recording is pixel-level movement,SubdirsThe recording is sub-pixel, that is, the movement of a half pixel point.

with thehistand thedirs, then usehistand thedirsdata represents the original data, you don't have toframe1and theframe2, can be honored retired, because there is a more able to express a way-histogram and direction vector.

The first step is to determine whether a small parameter Filter , this feeling does not affect very much, the effect is similar, do not know other people is not so.

if it isParam_bottom_flow_hist_filter, then it is forhisttreatment, if not, thendirsand theSubdirscalculation, simple sum and then the number of effective sampling points can be.

Final Fusion Gyro to adjust the information.

G106groupbuaascse

flow.c Source code:

Https://github.com/PX4/Flow/blob/master/src/modules/flow/flow.c

2016.2.27 Px4 Flow Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.