What is the range of values for full front face detection using euler angles ?

asked 2018-06-23 15:15:19 -0600

ashuezy gravatar image
    cv::Mat dist_coeffs = cv::Mat::zeros(4, 1, cv::DataType<double>::type);
    cv::solvePnP(model_points, image_points, camera_matrix, dist_coeffs, rotation_vector, translation_vector);
    nose_end_point3D.push_back(cv::Point3d(0, 0, 1000.0));
    cv::projectPoints(nose_end_point3D, rotation_vector, translation_vector, camera_matrix, dist_coeffs, nose_end_point2D);
    cv::line(*mat, image_points[0], nose_end_point2D[0], cv::Scalar(255, 0, 0), 2);
    cout << "Rotation Vector: " << endl << rotation_vector << endl;

    cv::Rodrigues(rotation_vector, rotation_matrix); //convert 3x1 to 3x3
    double* r = rotation_matrix.ptr<double>();
    printf("rotation mat: \n %.3f %.3f %.3f\n%.3f %.3f %.3f\n%.3f %.3f %.3f\n", r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8]);
    double projMatrix[12] = {r[0],r[1],r[2],0,r[3],r[4],r[5],0,r[6],r[7],r[8],0};

    cv::Mat cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ;
    cv::Vec3d eulerAngles;
    cv::decomposeProjectionMatrix(cv::Mat(3, 4, CV_64FC1, projMatrix),
        cameraMatrix,
        rotMatrix,
        transVect,
        rotMatrixX,
        rotMatrixY,
        rotMatrixZ,
        eulerAngles);
    printf("Face Rotation Angle:  %.5f %.5f %.5f\n", eulerAngles[0], eulerAngles[1], eulerAngles[2]);//up-down angle, left-right angle, close-far angle

Q1. Are the values inside eulerAngles variable eulerAngles[0], eulerAngles[1], eulerAngles[2]) mean up-down face angle, left-right face movement angle, close-far angle respectively ?

Q2. What is the range of values for full front face detection as i am trying to determine a full front face only for recognition ? So seeking your advice regarding optimization.

Q3. The side face is also giving me 22 degrees on eulerAngles[2] ? but i only want to detect front face only ?

Q4. Can i use eulerAngles to calculate distance of the object from the camera or is there another technique ?

I am sorry if i am asking basic questions but i have just started working with opencv.

Thanks.

edit retag flag offensive close merge delete

Comments

face detection and pose (from solvePnP) are entirely unrelated. your question does not make much sense.

berak gravatar imageberak ( 2018-06-23 20:48:30 -0600 )edit

what exactly are you using for the face detection ?

berak gravatar imageberak ( 2018-06-23 21:33:07 -0600 )edit

I am using dlib for face detection and face recognition. but the problem is it is also detecting side faces and i want to skip it. So when the front face is perfectly aligned then only i will invoke face recognition.

ashuezy gravatar imageashuezy ( 2018-06-24 02:14:15 -0600 )edit