Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assertion Failed Core.solve in Java

The app I am working on, using OpenCV, is crashing with the following exception:

05-06 15:24:50.877: E/org.opencv.core(28997): core::solve_10() caught cv::Exception: /home/reports/ci/slave_desktop/50-SDK/opencv/modules/core/src/lapack.cpp:1197: error: (-215) type == _src2.type() && (type == CV_32F || type == CV_64F) in function bool cv::solve(cv::InputArray, cv::InputArray, cv::OutputArray, int)

Here is the code I am using:

    A = new Mat(4,3,CvType.CV_32F);
    double[] A_values = {
        u.x * p1.get(2, 0)[0]-p1.get(0, 0)[0],   u.x * p1.get(2, 1)[0]-p1.get(0, 1)[0],    u.x * p1.get(2, 2)[0]-p1.get(0, 2)[0],           
        u.y * p1.get(2, 0)[0]-p1.get(1, 0)[0],   u.y * p1.get(2, 1)[0]-p1.get(1, 1)[0],    u.y * p1.get(2, 2)[0]-p1.get(1, 2)[0],           
        v.x * p2.get(2, 0)[0]-p2.get(0, 0)[0],   v.x * p2.get(2, 1)[0]-p2.get(0, 1)[0],    v.x * p2.get(2, 2)[0]-p2.get(0, 2)[0],           
        v.y * p2.get(2, 0)[0]-p2.get(1, 0)[0],   v.y * p2.get(2, 1)[0]-p2.get(1, 1)[0],    v.y * p2.get(2, 2)[0]-p2.get(1, 2)[0]                
    };
    A.put(0, 0, A_values);

    B = new Mat(4,1,A.type());
    double[] B_values = {
            -(u.x * p1.get(2, 3)[0] - p1.get(0, 3)[0]),
            -(u.y * p1.get(2, 3)[0] - p1.get(1, 3)[0]),
            -(v.x * p2.get(2, 3)[0] - p2.get(0, 3)[0]),
            -(v.y * p2.get(2, 3)[0] - p2.get(1, 3)[0]),             
    };
    B.put(0, 0, B_values);

        Mat X = new Mat(3,1, A.type());
        Core.solve(A, B, X, Core.DECOMP_SVD);

Can someone tell me please why it crashes?