# Blending Images for Fun

by 4hathacker  |  in Image Processing at  11:41 PM

Hello once again...!!!

This article is for fun lovers who love to play with images and enjoys mixing of multiple images to create artistic effects.

Till date, the articles have covered the basic knowledge of image processing, some common image analysis techniques and fundamentals of image processing. But in this post, an advanced concept is touched in a very gentle manner.

The mixing or blending or fusing of two or multiple images is done to create a new artistic image. The artistic image so obtained will then be used to unveil some hidden details. Enhancing the information to detect regions of interest (ROI) is the main agenda of mixing images which is more often used in medical imaging applications, such as CT/MRI, etc. One more reason behind image blending is to end up with a resulting image with a high dynamic range. Some panoramic effects can also be created with image blending.

In this article, a gentle introduction is provided about image blending with key steps involved in image blending. The test images taken were A(BMW-S1000R), one of the my favorite bikes and B, a cloudy view with grasses. The blending aimed to achieve the image A in image B.

Firstly, read the images in MATLAB using imread() function. Then, crop both A and B were cropped such that a rough height of Bike in image B came easily in image A. Here cropping was done twice for both the images but it was not mandatory. After that, in order for proper fusing, the size of images to be entertained must be the same. This was achieved by using imresize() function.

The area under the Bike in image B was masked properly using roipoly(). And also the equivalent area in image A is made equal to zero. Note that 3D masking was done for every channel to be masked properly by concatenating the mask matrix. Then, each mask multiplied element-by-element with the image that was to be masked. The type conversion to single has been made to make make multiplication easy and feasible. The result was then converted to uint8.

Finally, imadjust() is used for contrast regaining and blended image is displayed using imtool() as shown below.

The aim of article is to show blending of images, the result obtained has its own limitations but after properly practicing with the roipoly() for cropping the mask, one should master the blending.