作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/
#include <cv.h> #include <highgui.h> int main(void) { IplImage *Image1; IplImage *RedImage,*GreenImage,*BlueImage,*Merged; IplImage *Channel1,*Channel2,*Channel3; CvSize Size1; Image1=cvLoadImage("lena.jpg",1); Size1=cvGetSize(Image1); Channel1=cvCreateImage(Size1,IPL_DEPTH_8U,1); Channel2=cvCreateImage(Size1,IPL_DEPTH_8U,1); Channel3=cvCreateImage(Size1,IPL_DEPTH_8U,1); cvSplit(Image1,Channel1,Channel2,Channel3,0); BlueImage=cvCreateImage(Size1,IPL_DEPTH_8U,3); GreenImage=cvCreateImage(Size1,IPL_DEPTH_8U,3); RedImage=cvCreateImage(Size1,IPL_DEPTH_8U,3); Merged=cvCreateImage(Size1,IPL_DEPTH_8U,3); cvMerge(Channel1,0,0,0,BlueImage); cvMerge(0,Channel2,0,0,GreenImage); cvMerge(0,0,Channel3,0,RedImage); cvMerge(Channel1,Channel3,Channel1,0,Merged); cvNamedWindow("Red pic",1); cvShowImage("Red pic",RedImage); cvNamedWindow("Green pic",1); cvShowImage("Green pic",GreenImage); cvNamedWindow("Blue pic",1); cvShowImage("Blue pic",BlueImage); cvNamedWindow("Merged pic",1); cvShowImage("Merged pic",Merged); cvWaitKey(0); }
作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/
除非另有声明,本网站采用知识共享“署名 2.5 中国大陆”许可协议授权。