zoukankan      html  css  js  c++  java
  • 图像的通道切割和融合

    #include "highgui.h"
    #include "cv.h"
    #pragma comment(lib, "cv.lib")  
    #pragma comment(lib, "cxcore.lib")  
    #pragma comment(lib, "highgui.lib") 
    int main( )
    {
     IplImage *src = cvLoadImage( "0.jpg", 1);
     
     IplImage *dst;
     IplImage *dst1;
     IplImage *dst2;
     IplImage *dst3;
     dst1 = cvCreateImage(cvSize(src->width, src->height), IPL_DEPTH_8U, 1);
     dst2 = cvCreateImage(cvSize(src->width, src->height), IPL_DEPTH_8U, 1);
     dst3 = cvCreateImage(cvSize(src->width, src->height), IPL_DEPTH_8U, 1);
     dst = cvCreateImage(cvSize(src->width, src->height), IPL_DEPTH_8U, 3);
     cvSplit(src, dst1, dst2, dst3, 0);//分离RGB通道。分别得到BGR的单通道图像
     cvMerge(dst1, dst2, dst3, 0, dst);//逆运算,将三通道图像融合得到彩色图像
    
    
     cvNamedWindow("dst1",1);
     cvShowImage("dst1",dst1);
     cvNamedWindow("dst2",1);
     cvShowImage("dst2",dst2);
     cvNamedWindow("dst3",1);
     cvShowImage("dst3",dst3);
     cvNamedWindow("dst",1);
     cvShowImage("dst",dst);
     cvMoveWindow("dst1",100,100);
     cvMoveWindow("dst2",200,200);
     cvMoveWindow("dst3",300,300);
     cvWaitKey(0);
     //cvReleaseImage(&src);
     cvReleaseImage(&dst1);
     cvReleaseImage(&dst2);
     cvReleaseImage(&dst3);
     cvReleaseImage(&dst);
     return 0;
    }

  • 相关阅读:
    uva 11078
    hdu1520(树状dp)
    从Markov Process到Markov Decision Process
    剑指Offer系列编程题详解全集
    L1正则和L2正则的区别详解
    协方差详解
    牛顿法和梯度下降法的比较
    C++ const各种用法总结
    Exploration and Exploitation
    RL Algorithm Components
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5170915.html
Copyright © 2011-2022 走看看