bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.41k stars 1.57k forks source link

opencv_core.gemm (-215:Assertion failed) #2113

Open Arjen-ai opened 8 months ago

Arjen-ai commented 8 months ago
package com.example.demo.service.impl;

import org.bytedeco.javacpp.DoublePointer;
import org.bytedeco.opencv.global.opencv_core;
import org.bytedeco.opencv.opencv_core.Mat;
import org.bytedeco.opencv.opencv_core.Size;

public class MatrixGemm {
    public static void main(String[] args) {

        DoublePointer srcPoints = new DoublePointer(4);
        srcPoints.put(0, 0,
                100, 0);

        Mat srcMatrix = new Mat(new Size(2, 2), opencv_core.CV_32F);
        srcMatrix.put(srcPoints);

        Mat rotationMatrixX = new Mat(new Size(2, 2), opencv_core.CV_32F);
        DoublePointer doublePointer = new DoublePointer(4);
        doublePointer.put(0, 0,
                100, 0);
        rotationMatrixX.put(doublePointer);

        Mat result = new Mat(new Size(2, 2), opencv_core.CV_32F);

        opencv_core.gemm(rotationMatrixX, srcMatrix, 1, new Mat(), 0, result);
    }
}
Arjen-ai commented 8 months ago
Exception in thread "main" java.lang.RuntimeException: OpenCV(4.6.0) D:\a\javacpp-presets\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-4.6.0\modules\core\src\matmul.dispatch.cpp:356: error: (-215:Assertion failed) (type == (((5) & ((1 << 3) - 1)) + (((1)-1) << 3)) || type == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3)) || type == (((5) & ((1 << 3) - 1)) + (((2)-1) << 3)) || type == (((6) & ((1 << 3) - 1)) + (((2)-1) << 3))) in function 'cv::gemm'

    at org.bytedeco.opencv.global.opencv_core.gemm(Native Method)
    at com.example.demo.service.impl.MatrixGemm.main(MatrixGemm.java:26)

The reason for this problem cannot be found