ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

ncnn interact with opencv Mat got core dumped

Open lucasjinreal opened this issue 5 years ago • 6 comments

With master brance ncnn, they always error when convert image data from cv::Mat from ncnn

(gdb) run
Starting program: //face_recognize/build/face_recognize 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00000000004a9622 in ncnn::Interp::forward(ncnn::Mat const&, ncnn::Mat&, ncnn::Option const&) const ()

lucasjinreal avatar Apr 07 '19 05:04 lucasjinreal

error comes from here:

ncnn::Mat ncnn_img = ncnn::Mat::from_pixels(frame_in.data,
                                                ncnn::Mat::PIXEL_BGR2RGB, frame_in.cols, frame_in.rows);

With previouly version ncnn, it can run successfully, but with master branch fail. Besides, I found when I change PIXEL_BGR2RGB to PIXEL_BGR, previous version ncnn also core dumped. So I suppose it was a bug or unhandled exception when process cvMat?

lucasjinreal avatar Apr 07 '19 05:04 lucasjinreal

I also encountered this problem. My problem is on ubuntu 18.04. At first, I thought it was the version of opencv, but it is not.

teleger avatar Apr 13 '19 07:04 teleger

@teleger Have you solved the problem?

DolbyYu avatar May 31 '19 02:05 DolbyYu

For conversion between opencv and ncnn Mat, see https://github.com/Tencent/ncnn/wiki/use-ncnn-with-opencv

nihui avatar Mar 01 '20 12:03 nihui

same problem at ncnn::Mat ncnn_in = ncnn::Mat::from_pixels_resize(img.data, ncnn::Mat::PIXEL_BGR2RGB, img.cols, img.rows, 512, 512);

magicse avatar Aug 11 '22 10:08 magicse

With previouly version ncnn, it can run successfully, but with master branch fail. Besides, I found when I change PIXEL_BGR2RGB to PIXEL_BGR, previous version ncnn also core dumped. So I suppose it was a bug or unhandled exception when process cvMat?

Hi. Did you resolve this issue. I have the same problem on windows after use something like this ncnn::Mat ncnn_in = ncnn::Mat::from_pixels_resize(img.data, ncnn::Mat::PIXEL_BGR2RGB, img.cols, img.rows, 512, 512); I get core dump

magicse avatar Aug 12 '22 22:08 magicse