Ask Your Question
1

“Functional-style cast from id to double is not allowed” when building opencv with aruco on iOS

asked 2017-04-17 11:54:22 -0600

keyblade95 gravatar image

I'm trying to make an iOS app that can detect Aruco markers. So, I downloaded opencv2.framework for iOS, but I realized that Aruco is not included in that. Following this page http:// docs.opencv.org/2.4/doc/tutorials/introduction/ios_install/ios_install.html

I compiled manually adding opencv_contrib: https:// github.com/opencv/opencv_contrib module folder into the opencv module folder. This process worked fine and in Xcode I can access Aruco functions. But I also get this strange error: https:// i.stack.imgur.com/S8s4V.png

I've tried debugging and runtime v is passed as a double variable. The explicit cast (double)v is not valid too. How can I fix this?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-04-19 14:52:29 -0600

keyblade95 gravatar image

I found the problem. It was another piece of code that called the operator , without explicit cast the params. It was:

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] );

Just casted [camMatrix[0] doubleValue] like so:

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] );
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-04-17 11:54:22 -0600

Seen: 372 times

Last updated: Apr 17 '17