如何将3个opencv Ipl图像合并为一个?

时间:2010-11-19 18:41:43

标签: c++ c opencv

所以我的代码如下:

    IplImage* redchannel = cvCreateImage(cvGetSize(destination), 8, 1);
                    IplImage* greenchannel = cvCreateImage(cvGetSize(destination), 8, 1);
                    IplImage* bluechannel = cvCreateImage(cvGetSize(destination), 8, 1);
cvSplit(source, bluechannel, greenchannel, redchannel, NULL);
// code...
//now I need to join them back

如何将bluechannel,greenchannel和redchannel加入一些IplImage *目的地?

1 个答案:

答案 0 :(得分:2)

void cvMerge(const CvArr * src0,const CvArr * src1,const CvArr * src2,const CvArr * src3,CvArr * dst);

Here is the documentation.

修改

从文档中: 你必须打电话:

cvMerge(bluechannel, greenchannel, redchannel, NULL, target);

假设您的目标图片也只有3个频道。