Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 1.89 KB

File metadata and controls

45 lines (37 loc) · 1.89 KB

Image Blending

Description

Image Blending is an image processing technique where in two input images are mixed together. The output image is a combination of the corresponding pixel values of the input images. OpenCV is a very mature library and contains many out-of-the-box image processing algorithms.Image Blending can be seamlessly done using OpenCv wherein different weights are given to images so that it gives a feeling of blending or transparency.The function that is used for this is The addWeighted() function.

OpenCV-Python uses the addWeighted() function to blend images. The function and its parameters are as follows.

cv.addWeighted(src1,alpha, src2, beta, gamma[, dst[, dtype]])
  • src1- first input array.
  • alpha- weight of the first array elements.
  • src2- second input array
  • beta- weight of second array elements
  • gamma- scalar added to each sum. and two optional arguments which are not required for this demonstration.

How it works?

  • Input any two images that you want to pefrom Blending operation.
  • Reading the input images.
  • Resizing the images becuase Images have to be of the same size to be added so resize one image to the size of the other before adding.
  • Perform Blending operation on the images using addWeighted() function of OpenCv.
  • Display the final Blended image
  • Let's Look at the Sample Output

    Blended Image

    Blended Image