[OpenCV #2]이미지에서 RGB 채널 분리

OpenCV/example 2013. 2. 14. 18:42

1.Allocation of channels Red, Green,  Blud

2.Project.cpp

#include <opencv2/core/core.hpp>

#include <opencv2/highgui/highgui.hpp>

using namespace cv;


void main() {


Mat image = imread("sistar.jpg"); //Load image form disk
if(!image.data) exit(1); //Check image
//Split the original image into three channels
//channels[0],channels[1],channels[2]
vector<Mat> channels;

split(image, channels); //Partition image into three channel planes

imshow("Red", channels[2]);

imshow("Green", channels[1]);

imshow("Blue", channels[0]);

waitKey(0); //Wait for keystroke


}


반응형

'OpenCV > example' 카테고리의 다른 글

[OpenCV #4]관심 영역  (0) 2013.02.14
[OpenCV #3]Threshold  (0) 2013.02.14
[OpenCV #1]이미지 출력  (0) 2013.02.14
[OpenCV]프로젝트 속성시트 가져오기[Tip]  (0) 2013.02.08
[OpenCV]Opencv 2.4.3 설치와 설정하기  (2) 2013.02.07