基于肤色的人脸检测与眼睛定位论文及程序
VC编程,含毕设论文,程序! 程序片段如下: void COpenbmpfileView::Onsearch() { COpenbmpfileDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); int x, y; double R,G,B,I,U,V,seta; CDC* dc = GetDC(); for( y = 0; y < bmpHeight; y++ ) { for( x = 0; x < bmpWidth; x++) { switch( bmpBitCount ) { case 1: break; case 4: break; case 8: R = pbmpPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbRed; G = pbmpPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbGreen; B = pbm pPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbBlue; U = -0.148 * R - 0.289 * G + 0.437 * B; V = 0.615 * R - 0.515 * G - 0.100 * B; I = 0.596 * R - 0.275 * G - 0.321 * B; seta=atan( V/U ); //if(I=30 && seta>=-3.14*66/180 && seta= -3.14 * 80/180 && seta SetPixel( x+500, y, RGB(255,255,255)); else dc -> SetPixel( x+500, y, RGB( pbmpPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbRed, pbmpPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbGreen, pbmpPalette[pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1) + x]].rgbBlue)); break; case 24: R = pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x + 2]; G = pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x + 1]; B = pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x] ; U = -0.148 * R - 0.289 * G + 0.437 * B; V = 0.615 * R - 0.515 * G - 0.100 * B; I = 0.596 * R - 0.275 * G - 0.321 * B; //seta=V/U; seta=atan(V/U); if(I = 20 && seta >= -3.14 * 80 / 180 && seta =-5.671282&& seta SetPixel( x + 500, y, RGB(255,255,255)); else dc -> SetPixel( x + 500, y, RGB(pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x + 2], pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x + 1], pbmpSizeImage[bmpLineByte * ( bmpHeight - y - 1 ) + 3 * x] ) ); break; default: AfxMessageBox( "Invalid color numbers!", MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION | MB_APPLMODAL ); break; } } } }
用户评论