Example
of a good image Blending.
The goal of the project is to blend the image in gradient domain, in this specific project, we explore the effect of “Poisson blending”, and the shortcomings of it. And besides that, we discuss the decision in implementing the “Poisson blending”, and some discussions on the result image and the images from my own collection.
1.generating the matrix A:
Firstly I used 'speye' function to generate
the sparse matrix to present A, and for the position that was not in
value 1, like some positions that were under the mask, than I gave
the correct value(4 if not the border) to the position in a for loop,
and some related positions that should be reduced( the nearby pixels
that around the mask point) to give an average value. The effect of
the blending for the first 5 pictures are good, but the time that
spent on the processing was long, about half or more minute per
image, and some were longer if the masks were big in the picture.
Than I tried using the sparse function in the matlab to generate the
sparse matrix,which spent less time on generating and changing some
values of the matrix. For the sparse function, I 'pre-generated' the
vector parameters that we would use in the generating process before.
The process time was reduced significantly.
2.Border
detection:
For the sixth example of the test image,
some of the rainbow was on the edge of the target image, which makes
the formula: 4*p(center)-p(left)-p(right)-p(up)-p(down) incorrect
because for the pixels that on edge, they do not have full neighbors,
and I decided to use the row and col number as a judgment and if the
pixel was the border of the image, than the count for neighbors will
reduced and whole average on the position will not minus the neighbor
that he did not have.
|
|
|
|
|
|
|
|
For the last image, I did the offset manually, and the size of the target image is so big that I have to scale it in PS to meet the face from the source image, which is the constraint.