示例#1
0
void debugWindow (std::vector<ImgPrep::FaceLandmark>& lms)
{
	// grayscale img matching transform resolution
	cv::Mat imgLms =
		cv::Mat::zeros (ImgPrep::Transform::resolution+1,
		                ImgPrep::Transform::resolution+1,
						CV_8UC1);

	debugDrawShape (lms, 0, 15, imgLms);		// Head
	debugDrawShape (lms, 16, 21, imgLms);		// Left eyebrow
	debugDrawLine (lms, 21, 50, imgLms);		// Left eyebrow to nose
	debugDrawShape (lms, 22, 27, imgLms);		// Right eyebrow
	debugDrawLine (lms, 22, 48, imgLms);		// Right eyebrow to nose

												// 28 and 29; point between eye and eyebrow

	debugDrawShape (lms, 30, 37, imgLms);		// Left eye
	debugDrawPoint (lms, 38, imgLms);			// Left eye middle
	debugDrawPoint (lms, 39, imgLms);			// Right eye middle
	debugDrawShape (lms, 40, 47, imgLms);		// Right eye

	debugDrawPoint (lms, 49, imgLms);			// Nose 1
	debugDrawLine (lms, 48, 54, imgLms);		// Nose 2
	debugDrawLine (lms, 50, 58, imgLms);		// Nose 3
	debugDrawMultiLine (lms, 54, 58, imgLms);	// Nose 4

	debugDrawPoint (lms, 51, imgLms);			// Left Nostril
	debugDrawPoint (lms, 52, imgLms);			// Nose Middle
	debugDrawPoint (lms, 53, imgLms);			// Rigth Nostril

	debugDrawShape (lms, 59, 68, imgLms);		// Upper lip
	debugDrawShape (lms, 69, 76, imgLms);		// Bottom lip

	cv::imshow ("Debug Window", imgLms);
	cv::waitKey ();
}
void EdgelDetector::drawArrow( int x1, int y1, int x2, int y2, float xn, float yn, int r, int g, int b, int t ) {
	debugDrawLine(x1, y1, x2, y2, r, g, b, t);
	
	debugDrawLine( x2, y2, x2 + ( 5.0f* ( -xn + yn ) ), y2 + ( 5.0f* ( -yn - xn ) ), 0, 255, 0, t );
	debugDrawLine( x2, y2, x2 + ( 5.0f* ( -xn - yn ) ), y2 + ( 5.0f* ( -yn + xn ) ), 0, 255, 0, t );
}
void EdgelDetector::drawLine( int x1, int y1, int x2, int y2, int r, int g, int b, int t ) {
	debugDrawLine(x1, y1, x2, y2, r, g, b, t);
}