Ask Your Question

Revision history [back]

Instead of questioning cv::resize, I would look at your displayMat. I never use MFC, but Gdiplus::Bitmap(INT width,INT height,INT stride,PixelFormat format, BYTE *bits) looks similar to yours. In RGB24, the length of the stride is equal (or larger if "strided" data) 3 * width bytes and not 4 * height. Maybe you should nevertheless check that the CV type is actually CV_8UC3 before expecting it. In OpenCV 2-D images the stride is always given in img.step.p[0]. Best, -V

Instead of questioning cv::resize, I would look at your displayMat. I never use MFC, but Gdiplus::Bitmap(INT width,INT height,INT stride,PixelFormat format, BYTE *bits) looks similar to yours. In RGB24, the length of the stride is equal (or larger if "strided" data) 3 * width bytes and not 4 * height. Maybe you should nevertheless check that the CV type is actually CV_8UC3 before expecting it. In OpenCV 2-D images the stride is always given in img.step.p[0]. Best,
Best,
-V