I am working on face recognition using java library of open cv. I got stuck on face pre processsinf phase. here is my code.
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());
but it does not gives transformed face. please describe what's wrong I am doing.