【发布时间】:2016-11-14 11:42:41
【问题描述】:
我正在尝试按如下方式创建一个 Mat 对象:
// ROI by creating mask for the trapezoid
Mat mask = Mat(frame.rows(), frame.cols(), CvType.CV_8UC1, new Scalar(0));
但是我得到以下编译时错误:
The method Mat(int, int, int, Scalar) is undefined for the type
而在Mat.class 文件中,我肯定可以看到以下函数签名:
//
// C++: Mat::Mat(int rows, int cols, int type, Scalar s)
//
// javadoc: Mat::Mat(rows, cols, type, s)
public Mat(int rows, int cols, int type, Scalar s)
{
nativeObj = n_Mat(rows, cols, type, s.val[0], s.val[1], s.val[2], s.val[3]);
return;
}
这是一个错误,还是?
【问题讨论】:
-
不应该是
Mat mask = new Mat(...)吗? -
你是对的,我很愚蠢,我正在将代码从 C++ 转换为 Java,因此出现了错误。如果你写它,我会接受它作为答案。谢谢。