当前位置: 代码迷 >> 综合 >> pyrlk.cpp:240: error Assertion failed) prevImg.type in function 'dense'
  详细解决方案

pyrlk.cpp:240: error Assertion failed) prevImg.type in function 'dense'

热度:72   发布时间:2023-12-15 17:22:17.0

使用: cuda::DensePyrLKOpticalFlow时报错。

报错:
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.2) /home/xxx/Downloads/opencv-3.4.2/modules/cudaoptflow/src/pyrlk.cpp:240: error: (-215:Assertion failed) prevImg.type() == (((0) & ((1 << 3) - 1)) + (((1)-1) << 3)) in function 'dense'

Aborted (core dumped)
 

解决:

不要做浮点转换。去掉以下代码:

                        GpuMat d_frame0f;GpuMat d_frame1f;d_frame0.convertTo(d_frame0f, CV_32F, 1.0 / 255.0);d_frame1.convertTo(d_frame1f, CV_32F, 1.0 / 255.0);

 

  相关解决方案