One step beyond – blending selected image regions

In the previous section, we examined ways to produce a composite image from two pictures, without applying any preprocessing to them. Now, it is time to bring forward some of the techniques covered in previous chapters, so that we make our resulting images more sophisticated. Let's start with an easy example. We will try to blend two images of the same size, by first setting a part of their pixels to zero. We will use two pictures taken in a subway station of Berlin. Let's first load and see them:

>> A = imread('bench1.jpg'),
>> B = imread('bench2.jpg'),
>> imshowpair(A,B,'montage')   
One step beyond – blending selected image regions

As you can observe in the montage of these images, the closer bench (in the right picture) seems to have its upper edge just above the railway ridge of the left picture. If we place a Data Cursor (tenth icon) at its upper edge, we see that it is located at approximately the 796th row. Now, we can try our trick: we will make all pixels below the 796th row of the left image equal to zero and also make all the pixels above the 795th row of the right image equal to zero. Then, we will blend the two images and display the result:

>> A(796:end,:,:)=0;
>> B(1:795,:,:)=0;
>> C = imfuse(A,B,'blend'),
>> figure,imshow(C);
One step beyond – blending selected image regions

The result is quite pleasing to the eye, but because of the blending, its intensity is low. We can easily fix this by multiplying the result with two:

>> C = C*2; imshow(C)
One step beyond – blending selected image regions

The result is quite good for such an easy process. But this time, we got lucky. The two images were meant for each other. But what happens when we want to accomplish a harder compositing task? What if the areas we want to mix are not so easily distinguishable? We will see such an example in the next exercise.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset