Stereo Matching: Dynamic attribution

Source: Internet
Author: User
Tags dashed line

1 the primitive problem of shortest path problem

1.1 Problem Description

The shortest distance between A00 and A40 is determined by a path between them, which is the shortest distance from A00 to A40.

1.2 Solution Ideas

(1) to calculate the shortest distance from A00 to A40 mindist (4,0), it can be converted to the shortest distance A00 (A30) and A31 (mindist) of 3,0 and Mindist, 3,1 ( 4, 0) = Min{mindist (3,0) +5, Mindist (3,1) +2}

(2) calculate Mindist (3,0) For example, Mindist (3,1) calculation is similar.

To calculate the shortest distance mindist (3,0) from A00 to A30, you can convert the shortest distance A00 (A20), A21 (A22), and Mindist (2,0) mindist to 2,1, Mindist and 2,2, respectively, Mindist ( 3,0) =min{mindist (2,0) +3, Mindist (2,1) +6, Mindist (2,2) +8}

(3) calculate mindist (2,0) For example, Mindist (2,1) and mindist (2,2) calculations are similar.

To calculate the shortest distance mindist (2,0) from A00 to A20, you can convert to A00, A10, and A11 (mindist), 1,0 (+) and (12), Mindist (. 2,0) =min{mindist (1,0) +12, Mindist (+6), Mindist (+13}

(4) calculate Mindist (1,0) For example, Mindist (and mindist) calculations are similar.

Leaning, also calculating a fur,mindist (1,0) =2

As can be seen, the core formula for the above problem is:

Among them, trandist (x, I, J) and Mindist (0, 0) are known and mindist (0, 0) = 0.

2 the extension problem of shortest path problem

2.1 Problem Description

Determining a path between the A0 column and the A4 column makes the shortest distance between them, which is the shortest distance from the A0 column to the A4 column.

2.2 Solution Ideas

Virtual out A-10 and A50, and then according to "the shortest path problem of the original problem" to deal with. The trandist on the dashed line are all 0,mindist ( -1,0) = 0.

2.3 The decision variable, transfer cost, state variable and state transition equation of the shortest path problem pushed back by knapsack problem

The decision variable di in the shortest path problem should be the selection of the path from AIJ to a (i-1) column, and if the four paths to the A (i-1) column are numbered 0, 1, 2, 3, the decision variable di may have a value of 0, 1, 2, 3. Each path length is the transfer cost corresponding to the corresponding decision variable. The role of state variables and state transition equations in the shortest distance problem is weakened (or useless at all) because the decision variables are not subject to any limitations.

30-m knapsack problem

3.1 Problem Description

[1] there are n=4 items and groups from 1~4;[2] each group has m=2 items and numbered from one to the other;[3] article J of Group I is heavy wij;[4] The value of article J in Group I is CIJ;[5] There is a backpack, can be loaded t;[6] in order to take items, each group to take up to 1 kinds of items, ask in the case of the backpack is not overloaded with which groups of what number of items to make the value of the most valuable items in the backpack.

Note: If there are no 4 items in a group, for example, there are only 2 items, the weight and value of items numbered 2 and 3 will be set to 0.

3.2 Solution Ideas

According to the topic, we have to operate 4 times, each time to take what kind of item is the decision variable di, the value is 0, 1, 2. 0 means no one is taken. The value of the item number of the corresponding item is the transfer cost of the corresponding decision variable.

As shown, it can be converted to a solution process similar to the shortest path. Among them, A-10 and A50 are virtual.

One of the differences from the shortest path is that the maximum distance between A-10 and A50 is calculated here.

and the shortest path is different from the second is the decision-making variable can not be arbitrary value, and is subject to the rest of the backpack load ( state variables ), the remaining weight of the load is less than the item can not take this item. The relationship between the residual load of two times before and after the backpack is the state transfer equation . If the 4th time to take a heavy x items, the 3rd time to take the remaining load is t-x. At this time, if the t-x is smaller than the weight of an item in group 3rd, the item cannot be taken.

4 Stereo matching line scan 4.1 Problem Description

Same as extended problem with shortest path problem

4.2 Solution Ideas

5 dynamic attribution of stereo matching

is equivalent to a line sweep algorithm that adds a restriction condition. The following restrictions apply:

(1) If the current state is (x, i,0), then the previous state is (x-1,i, 0) or (x-1, i-1, 1) or (X-1, I, 2)

(2) If the current state is (x, i,1), then the previous state is (x-1,i, 0) or (x-1, i-1, 1)

(3) If the current state is (x, i,2), then the previous state is (x,i+1, 0) or (x, i+1, 2)

Where: x represents the current point, x-1 represents the previous point, I represents Parallax, 0 is visible in the left and right image, 1 indicates that the point is only visible in the image of the picture, and 2 indicates that the point is visible only in the image. The image can be expressed as:

Among them, m=0, l=1, r=2 respectively represents the previous point of three states, that is visible in the left and right images, only visible in the image, only visible in the image. M=0, l=1, r=2 represent three states of the current point. And the position relationship between the ends of the segment, indicating the position relationship between the current state and the previous state. Horizontal indicates that the previous state is a parallax of equal value from the previous column, and the diagonal indicates that the previous state is a parallax from the previous column with a value less than 1, and that the previous state is a parallax with a value above 1 from the same column.

Although on the surface, so is a dynamic cols*channels on the two-dimensional matrix of the Cols*channels*3, DP is dynamically classified on the three-dimensional matrix of the second, but due to the strict limitation of DP to the previous state. So, in fact, the timeliness of DP is much higher than so.

Assume that the maximum parallax is D. For the so algorithm, the front node number of each parallax is D, that is, the D time is to be calculated. And for the DP algorithm, each state of the pre-state is (3+2+2)/3=2.33, each parallax is divided into 3 states, so for each parallax total operation 2.33*3=7 Times. Usually d is dozens of, so the DP speed is so many times.

The relevant calculation formula for DP is as follows:

The cur in the formula represents the current state, and the pre represents the previous state.

Stereo Matching: Dynamic attribution

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.