Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge two image without losing intensity in opencv

Tags:

merge

opencv

I have two images in opencv: Image A and Image B.

Image A is output frame from camera.
Image B is alpha transparent image obtained by masking one image.
Before masking Image B it is warped with cvWarpPerspective()

  • I tried cvAddWeighted() - It looses intensity when you give alpha and beta value
  • I tried aishack - Even here you looses overall intensity of Output Image
  • I tried silveiraneto.net - Not helpful in my case

Please help me out with something where I don't lose intensity in the output image after blending.

Thanks in advance

like image 795
Wazy Avatar asked Oct 09 '22 11:10

Wazy


1 Answers

When you say, that you lose intensity... you leave the question about, how you lose it?

Do you loose intensity in the sense:

That when you add the images you hit a maximum intensity, and the rest is discarded. (Example for a 8 bit pixel addition: Pix1 = 200 i, Pix2 = 150 i. "Pix1 + Pix2 = 350" but max value at 255, so Pix1 + Pix2 = 255)

That the former values of image A is compromised by adding it to Image B, which only covers some parts of the image. (Example for an 8 bit image: Pix1 = 200 i, Pix2 = 150, (Pix1 + Pix2)/2 = 175, but when the value of a pixel of the second image is zero, Pix2 = 0. Then (Pix1 + Pix2)/2 = 100, which is half the value of the original image)

One of these observations should tell you about what you need to do. I don't quite know, in accordance to the functions you mentioned, which approach they use.

like image 111
Sonaten Avatar answered Oct 13 '22 12:10

Sonaten