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; }