2012-12-30 126 views
4

嗨,我正在学习Emgu CV。我想执行alpha混合(addWeighted)。我有以下代码Emgu CV中的Alpha混合

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

如何alpha混合这两个图像? (Bgr和Gray)

+0

[这个问题](http://stackoverflow.com/questions/11958473/opencv-emgu-cv-compositing-images-with-alpha)可能会有帮助。 –

回答

0

尝试将灰度图像转换回颜色,然后将它们混合。

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);