Image inlaid

xiaoxiao2021-04-09  479

Image inlaid

aims

The basic goal of the program is to connect a series of flat images to a continuous panoramic image (inlaid image). The difficulty here is combined with some curved (deformed) images to fit the different observation angles. Just starting the practice is usually very Some stains were not strict and there were some stains between the two images. That is why we must minimize the minimum method (marquardt-levenberg) The following items are a series of questions that we have answered in the project:

1. We found projection transformations for two images?

2. How do we minus the error between two images?

3. How do we integrate images?

Some assumptions:

1. Camera follows the needle model camera (yes).

2. An object on the image is in full distance, approximation is a plane (Ignore the surface irregular surface of the object)

3. When the corresponding point is defined, the user presses the four pairs in the exact number of images in two images, and the corresponding point does not follow this assumption that the misfortune will cause miscarriage.

4. When the corresponding point is defined, the user cannot select three points in the same image and must be substantially on the same line. Because it is difficult to define three in the same line When a unique projection transform point pattern found, the dot pattern will be harmful, so this reason is.

Not in accordance with hypothesis will result in strange errors and [or] memory overflow errors

method

We are trying to do it. Basically, it is basically considering that two images have a common feature. If there is a tree in an image, then at least in another image, there is a similar part. Image is inlaid, Then, a pair image is established, one of which is already part of the inlaid image. We have an image mosaic accumulator, which is starting from the combination of two images, and the other images come in again and then we try to find A conversion, distorting an image makes the feature extraction or uses the same method. Under assumption, the two images match the characteristics of the two images are substantially on one place (eg, keep the characteristics away from the camera and pinhole camera model), this This method will be corrected in one of the images, and the combination of distorted images and features of another image are drawn on another image First, some of the definition of the purpose. Image i is We talked about the shift of that will be distorted, using the program to match the characteristics of the image I '.

1. How do we find projection transformations for two images?

To find a projection transformation, we present a pair of images to the user. Then the user is required to press the four pairs of points in two images. It is found that the conversion matrix based on four pairs of corresponding points is possible, this matrix Describe the study of geometric one-dimensional and two-dimensional research group research team through Oxford University Andrew Zisserman Robot

Assumption

Sum

At 1 <= i <= 4 is the corresponding point, then we can seek according to the 8 parameters of the shooting matrix.

And then express

Calculate

You can then generate a linear equation system, including all eight points:

H33 is assumed to be 1. In accordance with the geometric one-dimensional and two-dimensional aspect, there is a solution to H_33 equal to 0. The matrix h will be an approximate estimate of the correct conversion matrix. Just based on the user Input, transformation does not guarantee the precise match of the feature of another image. In fact, the error may be quite large. That is why we need to use Marquardt- Levenberg to minimize the value of the minimum corrective matrix generate image I make it The characteristic match of image I 'is more accurate.

2. How do we minus the error between two images?

The problem is that the number M_i of the selection of the projection conversion matrix H makes the square of the result of the result of all overlapping pixel values ​​in two hierarchical images. E = SUM ((I ')

- i

) ^ 2)

This is a non-linear minimization problem, which can be solved by the iteration method proposed by Marquardt and Levenberg.

It calculates approximation of the HESSIAN matrix in each iteration. It involves calculations on parameter error bias, which is what we have to solve, that is, M_i's (8 parameters of the conversion matrix) E_i = I '

- i

I

It is constant, the derivatives are as follows:

The division is as follows:

The value of the Hessian matrix (symmetrical) and gradient vector B is provided by all pixels by i:

A and B are specified by overlapping pixels because otherwise the best matching of the two images will occur in two images. On each step iteration, the following equation gives the answer:

Variable increment M_I's, equation on each parameter of the conversion matrix is ​​a parameter, which adjusts the speed of the algorithm to minimize the convergence of the convergence. This is useful because sometimes exceeds and skip the minimum amount This causes an error to increase, which can be found, and then the matrix returns to the original iteration and Lambda except 10, which makes the minimum value of the error at a smaller value. If the error becomes small, however, then lambda can Take a minimum with a greater increment. The final situation is that if the error is within one limit, if the maximum increment has been processed, or the value between the error and the original error is less than one limit. Double interpolation The color used to determine the pixel is converted from the non-integer pixels in the pixels into I from I ', and the images are interpolated on the vertical and horizontal gradient.

3. How do we integrate images?

Any two images are just a combination of those image pixel components. If we synthesize two images, we just assigned two image overlap, which will get a satisfactory result but unfortunately If there is a very small error on the image feature match, then the mismatch on the edge will appear to match two different images. In order to make the edge become invisible, we make the brightness of the respective images The component is reduced, and the position of the pixel is more close to their edges. Sowth, when the average sum is calculated, the final brightness value of the image is found, (brightness value = (W1 * I1 W2 * I2) / (w1 w2)) if the icon The position is close to the center of an image, but in the vicinity of the edge of another image, then the status of the primary image is near the center of its image, which will have a big help for the pixels of the two images. Under the proposal of Professor SCLAROFF, I wrote a program to synthesize two suitable target images, then create a synthetic area it focused on the center of the image and the edge of the image decreased. It made a Very nice project.

program

Let's talk about how the program works:

1. Load all images into a array

2. The number number starts from 2

3. Display image 1 and image I on the screen and let the user define four communication points.

4. Place the image 1 into the image I in the minimum program.

5. Synthesize images together to save images in array units.

6. Do a loop for i.

The minimization work is as follows:

1. Set the lambda less than 0.0001

2. When the number of times the cycle is less than 50, and its original error and the difference between the current error are greater than 500, then we cannot return to the original Delta M value, and the minimum error at this time will exceed 100.

3. Reset 0 matrix A, gradient vector B and Delta M

4. Traverse all pixel values ​​of the first image, and transform it with a conversion matrix, let the final pixel value fall in the edge of the second image.

5. If it inside the boundary, use quadratic interpolation to calculate pixel values, horizontal gradient vector values ​​and vertical gradient vector values.

6. At the same time, increase the number of overlapping pixels

7. If the position is outside the edge, jump to the next icon.

8. Description of mathematics method for calculating errors generated by A and B

9. Calculate the conjugate complex (a lambda * i), by B, by multiplying it to get the Detla M vector.

10. Clear the flag of "Restore to the original M".

11. If the error has been reduced, the LAMBDA is divided by 10.

12 If the error has increased, multiply the lambda 10, and the vector value of Delta M is not updated.

13. At the same time, set "Restore to the original M".

14. In the conversion matrix, add the value of Delta M to the position of the contact point.

15. Enter the next while loop.

Synthesis is just a program that enables the image to calculate the weighted average of pixels in the method based on the pyramid synthetic profile.

转载请注明原文地址:https://www.9cbs.com/read-133085.html

New Post(0)