0

顔検出コードを再生すると、混乱が生じます。この 2 つの文にコメントすると、次のようになります。

//cvtColor( frame, frame_gray, CV_BGR2GRAY );
//equalizeHist( frame_gray, frame_gray ); 

結果は同じです。これは、Opencv (detectMultiScale) が人の顔を正常に検出できることを意味します。カラー画像をグレー画像に変更してから、グレー画像のヒストグラムを取得するポイントは何だと思いますか?

次のようにコードの一部を添付します。

while (cvWaitKey(10) < 0)
{
Mat frame = cvQueryFrame( capture ); // get the next frame of video
cvtColor( frame, frame_gray, CV_BGR2GRAY );
equalizeHist( frame_gray, frame_gray ); 
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); // Detect faces
for( int i = 0; i < faces.size(); i++ ) // for each face found
{
Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); // location of this face
ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); // draw ellipse around this face}
imshow( "faces", frame);
}
/////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////

また:

while (cvWaitKey(10) < 0)
{
Mat frame = cvQueryFrame( capture ); // get the next frame of video
//cvtColor( frame, frame_gray, CV_BGR2GRAY );
//equalizeHist( frame_gray, frame_gray ); 
face_cascade.detectMultiScale( frame, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); // Detect faces
for( int i = 0; i < faces.size(); i++ ) // for each face found
{
Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); // location of this face
ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); // draw ellipse around this face}
imshow( "faces", frame);
}
//////////////////////////////////////////////
4

1 に答える 1

0

アルゴリズムは色なしで機能するため、彩度の低下のポイントはデータの量を減らすことです。イコライゼーションのポイントは、照明の変動を補正することです。

詳細については、OpenCVを使用した顔認識をご覧ください。

于 2013-01-03T03:41:16.687 に答える