Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::flip keeps throwing bad ptr exceptions

No matter which flip code I call with cv::flip, I keep getting bad ptr exceptions. For flipcode <1, it errors out at flipVert (copy.cpp, l.418) on src1. const uchar* src1 is defined at l.405 with a simple equation, not sure why that should be an issue. For flipcode==1, the error is in flipHoriz (copy.cpp, l.395).

I am calling cv::flip(imgcv,imgcv2,flipcode) after I convert a QImage into a Mat using:

Mat imgcv = QImage2Mat(img); Mat imgcv2; cv::flip(imgcv,imgcv2,flipcode);

/static/ Mat DisplayVideoQt::QImage2Mat(QImage const& src) { QImage temp = src.copy(); Mat res(temp.height(),temp.width(),CV_8UC3,(uchar*)temp.bits(),temp.bytesPerLine()); cvtColor(res,res, CV_BGR2RGB); return res; }

click to hide/show revision 2
No.2 Revision

updated 2017-03-16 11:02:58 -0600

berak gravatar image

cv::flip keeps throwing bad ptr exceptions

No matter which flip code I call with cv::flip, I keep getting bad ptr exceptions. For flipcode <1, it errors out at flipVert (copy.cpp, l.418) on src1. const uchar* src1 is defined at l.405 with a simple equation, not sure why that should be an issue. For flipcode==1, the error is in flipHoriz (copy.cpp, l.395).

I am calling cv::flip(imgcv,imgcv2,flipcode) after I convert a QImage into a Mat using:

Mat imgcv = QImage2Mat(img);
Mat imgcv2;
cv::flip(imgcv,imgcv2,flipcode);

cv::flip(imgcv,imgcv2,flipcode);

/static/ /*static*/ Mat DisplayVideoQt::QImage2Mat(QImage const& src) { QImage temp = src.copy(); Mat res(temp.height(),temp.width(),CV_8UC3,(uchar*)temp.bits(),temp.bytesPerLine()); cvtColor(res,res, CV_BGR2RGB); return res; }

}