BGR 이니까.. 블루값에 Hue 성분이 들어갔으려나?
나중에 색상 조절해서 채널별로 출력을 해봐야겠다
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
VideoCapture cap(0);
if(!cap.isOpened())
{
cout << "No camera detected" << endl;
return -1;
}
else
{
cout << "In capture ..." << endl;
}
namedWindow( "Display window", WINDOW_AUTOSIZE );
for(;;)
{
Mat frame;
Mat hsv;
if(!cap.read(frame)) break;
cvtColor(frame,hsv, CV_BGR2HSV);
imshow("Display window", frame);
imshow("HSV window", hsv);
if(waitKey(30) >= 0) break;
}
return 0;
}
|
imgproc.hpp에 다음과 같이 정의 되어 있으며
cvtColor()는 독립된 함수로 되어있다.(클래스 랩핑이 안되어 있다)
enum
{
COLOR_BGR2HSV =40, COLOR_RGB2HSV =41,
COLOR_COLORCVT_MAX = 135
};
//! converts image from one color space to another
CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn=0 ); |
'Programming > openCV' 카테고리의 다른 글
opencv2 VideoCapture::get() / set() - 웹캠 설정 읽어오기 (2) | 2014.07.03 |
---|---|
opencv2 채널분리하기(split) (0) | 2014.07.03 |
openCV2 2.3.1 ubuntu 컴파일하기 (0) | 2014.07.01 |
openCV2 2.4.9 + VS2008 좌충우돌 프로젝트 생성하기 (0) | 2014.07.01 |
openCV visual studio 프로젝트 생성하기 (0) | 2014.06.30 |