access violation in copyTo

asked 2016-12-10 10:57:12 -0600

Humam Helfawi gravatar image

I am reading an image from IPCamera (using VLC API). I store this image in cv::Mat called ipCameraImage. Then I am doing deep-copy for this Mat into another Mat using:

auto frame=ipCameraImage.clone();

Everything seems fine. However, after around 1 hour of successful streaming, I got error access violation in the cloning process exactly inside copyTo function.. at the line:

memcpy( dptr, sptr, len );

It says that dptr point to NULL !

I am sure that ipCameraImageis not empty and it is contains valid image (I debug it and show it using ImageWatch tool with VS.NET).

It seems like a bug for me.. is it? Any suggestion?

edit retag flag offensive close merge delete


It's difficult to understand your problem without a small example. May you shoul try to manange memory using this method

LBerger gravatar imageLBerger ( 2016-12-10 12:06:28 -0600 )edit

Thanks for reply.. I tired sth similar..I create a matheader and allocate the memory then tried to use copyto.. till now no crash but I can no be positive since sometimes it took 1 hour till crashing.. anyway.. there is no much thing to show.. a simple clone method is causing the problem.. it is the first statement after reading from ipcamera and it work for long time before crashing... :/

Humam Helfawi gravatar imageHumam Helfawi ( 2016-12-10 12:11:33 -0600 )edit

try with a webcam

LBerger gravatar imageLBerger ( 2016-12-10 12:16:52 -0600 )edit