我正在使用open cv的java库进行人脸识别。我被困在脸上预处理阶段。这是我的代码 -
double desiredFaceHeight=70;
double desiredFaceWidth=70;
double desiredLen=(DESIRED_RIGHT_EYE_X-0.16);
try{
double dy= (face.getRightEye().y-face.getLeftEye().y);
double dx= (face.getRightEye().x-face.getLeftEye().x);
double len=Math.sqrt((dx*dx)+(dy*dy));
double scale=desiredLen*desiredFaceWidth/len;
// Get the transformation matrix for the desired angle & size.
Mat rotMat=Imgproc.getRotationMatrix2D(face.getCenterOfEyes(),face.getEyesAngle(), scale);
//Shift the center of the eyes to be the desired center.
double ex= desiredFaceWidth*0.5f-face.getCenterOfEyes().x;
double ey=desiredFaceHeight*DESIRED_LEFT_EYE_Y-face.getCenterOfEyes().y;
rotMat.put(0,2,rotMat.get(0,2)[0]+ex);//view
rotMat.put(1,2,rotMat.get(1,2)[0]+ey);//view
Mat warped = new Mat((int)desiredFaceHeight, (int)desiredFaceWidth,CvType.CV_8U,new Scalar(128));
//Mat warped=face.getFace();
Imgproc.warpAffine(face.getFace(),warped, rotMat, warped.size());
但它没有给出转化的面孔。请描述我正在做的事情或提供替代解决方案。谢谢。