I have two cv::Mat
objects:
cv::Mat *frameLeftRemap;
cv::Mat frameLeft2;
Data streams into *frameLeftRemap from a camera. I need to copy the data to frameLeft2, then delete frameLeftRemap, to avoid the frame artifacts I am seeing. (This was suggested by the camera manufacturer support desk.)
the function is:
void ProcessImageLeft(AVT::VmbAPI::FramePtr pFrame)
{
VmbUchar_t *pBuffer;
VmbUint32_t FrameWidth;
VmbUint32_t FrameHeight;
//prepare frame information:
pFrame->GetWidth(FrameWidth);
pFrame->GetHeight(FrameHeight);
pFrame->GetImage(pBuffer);
//edited
Mat1b imageL(FrameHeight, FrameWidth, (uchar*)pBuffer);
cv::remap(imageL, *frameLeftRemap, mx1, my1, cv::INTER_LINEAR);
frameLeft2 = frameLeftRemap->clone();
//frameLeftRemap->copyTo(frameLeft2);
cv::imshow("right", frameLeft2);
cv::waitKey(1);
delete frameLeftRemap;
}
both copyTo and clone give an error:
this is nullPtr. read access violation
What am I doing wrong here?
frameL= frameLeftRemap->clone();
should work correctly. It seems you have problem in frameL
. Try to show it using cv::imshow
or cv::imwrite
to make sure it was corrupted before cloning it. Then fix the original problem. If you posted code, we would help you more.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.