【问题标题】:Of C ++ in java (OpenCV) [duplicate]Java中的C ++(OpenCV)[重复]
【发布时间】: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,我猜。

标签: java android c++ opencv


【解决方案1】:

如果我理解正确,您想知道 java 中的 mat.at 方法是什么,对吗?如果是这样,您可以使用 Mat::get() (double[] Mat::get(int row, int col))。 Here 给出了更深入的答案。

【讨论】:

  • 谢谢!它的作品=)
猜你喜欢
  • 1970-01-01
  • 2010-10-06
  • 1970-01-01
  • 2020-06-28
  • 2021-05-15
  • 2018-09-11
  • 1970-01-01
  • 2014-03-11
  • 1970-01-01
相关资源
最近更新 更多