Image Fusion Poisson edit (Poisson Editing) (1): Abbreviated language Overview algorithm

Source: Internet
Author: User

Original Author: Chris tralie:http://blog.csdn.net/u011534057/article/details/68922197 Introduction

Poisson image editing is a fully automated technology for "seamlessly fusing" two images, by Patrick Perez,michel Gangnet of Microsoft Research UK, and Andrew Blake in the paper "Poisson image Editing "was first proposed. To better understand the problem it solves, let's look at the following example:

If we want to take this picture of the classmate photo ...

With great white shark images ...

To blend together:

Direct Fusion obviously has a bad effect, and the problem is that it looks too fake. Both images have water, but the shadow of the water is different, a bluish one is green, and the edge of the cutting image is so obvious. We can make some simple attempts in Photoshop or GIMP to brighten the jaws, but no matter how they are adjusted, the borders are clearly visible. Is there a way to automatically flatten the two images seamlessly, and then get this effect:

Of course, since I've already written this, the answer is Poisson image editing. The goal in this tutorial is to interpret the algorithm in a simple and actionable way. Without further ado, let's start by discussing some of the mathematical principles behind the Poisson image editing. gradient matching under boundary conditions

The entire contents of the Poisson edit can be attributed to a very simple idea. To better illustrate, let's first define our problem carefully: The image we change is a (background image), and the image we cut and paste is B (foreground image):

When you paste the foreground image B into the background image A, our appeal is to allow image B to change color, but still retain the full "detail" of B. Details include all edges in image B, corner points, excessive, and so on. If you have studied Digital image processing courses, you already know some of the ways to extract these details from images, the first step of which is to calculate the gradient of the image. The gradient of an image is a mathematical representation of the image, which describes the relative changes in pixels to neighboring pixels (essentially the difference between pixels and their neighboring pixels). What we need to look for is relative descriptors, because the disunity between image A and image B is mainly due to the absolute difference in their color. Therefore, the goal of a more stringent Poisson image editing is to allow the change of absolute information (the color of image B), but to preserve the relative information (image gradients) of image B as much as possible after pasting. Here is the gradient of the shark image, the relative information probably looks like this:

If you look at the image gradient in isolation, it is a lack of constraints. Make an analogy, I let you draw a path on the paper, only tell you: "Go forward 2cm, turn left 30 degrees, go forward 300cm", but I did not tell you the starting position. The route you draw may start in any direction in any position and still meet my description. The relative information with gradient constraints is a reason for this. We need to fix the RGB values of the specified pixels and then solve our problem in order to make our image B more like image A. We fixed the edge pixels of image B, whose pixel value is the pixel value of image A, then solves the remaining pixel values within the selection, and the constraint is to maintain the original gradient of image B. In the next section I will give some specific formulas, how to solve the specific derivation, I hope now you at least know what we need to do. discretization and implementation based on sparse matrix

Now let me list the formulas to solve this problem. Convention: The pasted image is a, cut and paste is the image B, the solution obtained by the new paste image is H (H is the upgrade of B, can be better with a fusion). The simplest part: boundary limit. As we have mentioned before, the boundary of H should be exactly the same as the boundary of a, so we can match the internal pixels, merge them to the mainland, and mathematically say:

H (x, y) =a (x, y) ∀ (x, y) ∈∂b

We already know the solution of the H boundary (also the boundary of B).

Now we need to solve the pixel values inside H. We want the gradient value of the internal pixel to be equal to the gradient value of the inner pixel of B. a simple definition of the gradient of an image at a point: the difference between the pixel and all pixels.

|∇b (x, y) |=4b (x, y) –B (x−1,y) –B (x+1,y) –B (x,y−1

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.