4

Hi I am learning Emgu CV. I would like to perform alpha blend(addWeighted). I have the following codes

Image<Bgr, Byte> image = new Image<Bgr, Byte>(filename);
Image<Gray, Byte> grayImage = image.Convert<Gray, Byte>();
Image<Bgr, Byte> blendImage;

How to alpha blend these two images? (Bgr and Gray)

K Mehta
  • 10,323
  • 4
  • 46
  • 76

1 Answers1

0

Try converting the grayscale image back to color and then blend them.

Image<Bgr, Byte> grayBGRImage = grayImage.Convert<Bgr, Byte>();
double alpha = 0.5; // Or however you would like to blend them
double beta = 1 - alpha;
double gamma = 0;
Image<Bgr, Byte> blendImage = image.AddWeighted(grayBGRImage, alpha, beta, gamma);
Oskar Birkne
  • 803
  • 7
  • 18