使用opencv添加两个图像

时间:2016-01-03 20:13:36

标签: c++ opencv image-processing

我需要从RGB帧中提取L(照明元件)并获得反转的照明图像(L)。
将反转图像添加到原始L图像。

我的问题是我如何添加两个图像(实验室和倒置图像的L通道)? 哪个功能可以做到?

1 个答案:

答案 0 :(得分:0)

我认为http://answers.opencv.org/question/81947是你的问题。所以,就我理解你的问题,我试图修改它。希望它会有所帮助。

来源:enter image description here

结果:enter image description here

#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

void split_lab( Mat planes )
{
    Mat lab, blurredL;
    cvtColor( planes, lab, CV_BGR2Lab );

    vector <Mat> splits;
    split(lab, splits);

    medianBlur( splits[0], blurredL, 31);

    blurredL = 255 - blurredL;

    cvtColor( blurredL, blurredL, CV_GRAY2BGR );
    planes = planes + ( blurredL * 0.5 );

}

int main(int argc, char** argv)
{
    Mat src= imread( argv[1] );

    split_lab(src);
    imshow( "result", src );
    waitKey();

    return 0;
}