2

我正在尝试制作一个可以检测 Aruco 标记的 iOS 应用程序。所以,我下载了适用于 iOS 的 opencv2.framework,但我意识到 Aruco 并不包含在其中。在此页面之后,我手动编译将 opencv_contrib( https://github.com/opencv/opencv_contrib.git) 模块文件夹添加到 opencv 模块文件夹中。这个过程运行良好,在 Xcode 中我可以访问 Aruco 函数。但我也得到了这个奇怪的错误: function-style cast xcode error

我试过调试,运行时 v 作为双变量传递。显式转换(double)v也无效。我怎样才能解决这个问题?

4

1 回答 1

0

我发现了问题。这是另一段调用操作符的代码,没有显式转换参数。它是:

NSArray *camMatrix = ...
...
Mat cameraMatrix = (Mat_<double>(3,3) << camMatrix[0], camMatrix[1], camMatrix[2],
                camMatrix[3], camMatrix[4], camMatrix[5],
                camMatrix[6], camMatrix[7], camMatrix[8] );

像这样投射 [camMatrix[0] doubleValue] :

NSArray *camMatrix = ...
...
Mat cameraMatrix = (Mat_<double>(3,3) << [camMatrix[0] doubleValue], [camMatrix[1] doubleValue], [camMatrix[2] doubleValue],
                [camMatrix[3] doubleValue], [camMatrix[4] doubleValue], [camMatrix[5] doubleValue],
                [camMatrix[6] doubleValue], [camMatrix[7] doubleValue], [camMatrix[8] doubleValue] );
于 2017-04-17T19:22:32.177 回答