【发布时间】:2015-11-29 14:28:58
【问题描述】:
对不起,我的英语不好。 学习OpenCV,做android的程序,需要在眼睛的位置旋转照片,需要的代码在第8章《用实用的计算机视觉项目掌握OpenCV》一书中,我们有以下代码:
// Get the transformation matrix for the desired angle & size.
Mat rot_mat = getRotationMatrix2D(eyesCenter, angle, scale);
// Shift the center of the eyes to be the desired center.
double ex = DESIRED_FACE_WIDTH * 0.5f - eyesCenter.x;
double ey = DESIRED_FACE_HEIGHT * DESIRED_LEFT_EYE_Y –
eyesCenter.y;
rot_mat.at<double>(0, 2) += ex;
rot_mat.at<double>(1, 2) += ey;
// Transform the face image to the desired angle & size &
// position! Also clear the transformed image background to a
// default grey.
Mat warped = Mat(DESIRED_FACE_HEIGHT, DESIRED_FACE_WIDTH,
CV_8U, Scalar(128));
warpAffine(gray, warped, rot_mat, warped.size());
如何翻译一个字符串:
rot_mat.at<double>(0, 2) += ex;
rot_mat.at<double>(1, 2) += ey;
在 Java 中?
【问题讨论】:
-
为什么这个问题被标记为 Java?
-
^^ 因为实际的问题是如何将最后两行翻译成java,我猜。