memcpy error from char* to cv::Mat

599 views Asked by At

I am trying to convert the data from an industry camera to a cv::Mat. This is the error I get when backtracing the segmentation fault in gdb.

#0  __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:35
#1  0x000000000040cf6f in memcpy (__len=360960, __src=<optimized out>, __dest=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/string3.h:51
#2  Camera::getImage (this=this@entry=0x6f59c0, mat=...) at src/Camera.cpp:233
#3  0x000000000040d7e7 in Camera::Camera (this=0x6f59c0, dev=<optimized out>) at src/Camera.cpp:40
#4  0x00000000004327d6 in Utility::initCameras (devMgr=..., left=@0x7fffffffdea0: 0x7ffff53fa4f8, right=@0x7fffffffdea8: 0x809ff8e4)
    at src/utility.cpp:117
#5  0x0000000000407b1e in main (argc=<optimized out>, argv=<optimized out>) at trgt/obstacle.cpp:150

So I can clearly say that there is any problem with the command to memcpy:

std::memcpy(mat.ptr(),static_cast<char*>(mRequest->imageData.read()), mRequest->imageSize.read());

Now I don't really understand why the error is occuring. In another version of the program I am using it is working, but the images look very bad.

Maybe one of you has an idea what a possible error source could be.

0

There are 0 answers