コード例 #1
0
ファイル: moustachizer.cpp プロジェクト: drjou/Unlogo
// ------------------------------
int Moustachizer::init(const char* argstr) {

	faceTracker.init();
	
	const char* fileName = "images/moustache4.jpg";
	stache = imread(fileName, 1);
	
	// OpenCV can't load 4 channel images, which is a huge pain
	// so I am pulling out the Value channel from the moustache image
	// to use as a mask for drawing the moustache into the main frame.
	Mat hsvimg;
	cvtColor(stache, hsvimg, CV_RGB2HSV);
	vector<Mat> hsvchannels;
	split(hsvimg, hsvchannels);	
	bitwise_not(hsvchannels[2], mask); 
	erode(mask, mask, Mat(), Point(-1,-1), 4);
	dilate(mask, mask, Mat(), Point(-1,-1), 2);
	
	return 0;
}