NvidiaOpticalFlow_1_0.calc get error: (-217:Gpu API call) invalid pitch argument in function 'upload'
iyLester opened this issue · 0 comments
iyLester commented
I tried to use NvidiaOpticalFlow_1_0 in opencv but I get the following error:
java.lang.RuntimeException: OpenCV(4.6.0) /__w/javacpp-presets/javacpp-presets/opencv/cppbuild/linux-x86_64-gpu/opencv-4.6.0/modules/core/src/cuda/gpu_mat.cu:233: error: (-217:Gpu API call) invalid pitch argument in function 'upload'
this is my code:
import org.bytedeco.cuda.global.cublas;
import org.bytedeco.cuda.global.cudnn;
import org.bytedeco.javacpp.Loader;
import org.bytedeco.opencv.opencv_core.Mat;
import org.bytedeco.opencv.opencv_core.Size;
import org.bytedeco.opencv.opencv_cudaoptflow.NvidiaOpticalFlow_1_0;
import org.bytedeco.opencv.opencv_java;
import org.bytedeco.opencv.global.opencv_imgcodecs;
....
Loader.load(opencv_java.class);
Loader.load(cudnn.class);
Loader.load(cublas.class);
Mat inputMat1 = opencv_imgcodecs.imread("/home/image/630.jpg");
Mat inputMat2 = opencv_imgcodecs.imread("/home/image/660.jpg");
int w = inputMat1.size().width();
int h = inputMat1.size().height();
Mat outputMat = new Mat();
try (NvidiaOpticalFlow_1_0 nvidiaHWOpticalFlow = NvidiaOpticalFlow_1_0.create(new Size(w, h))) {
nvidiaHWOpticalFlow.calc(inputMat1, inputMat2, outputMat, null, null,null);
} catch (Exception e) {
System.out.println(e);
}
Device: RTX 3060 ti
Env: opencv==4.6.0-1.5.8, opencv-platform==4.6.0-1.5.8, opencv-platform-gpu==4.6.0-1.5.8, cuda-platform-redist==11.8-8.6-1.5.8