Ask Your Question

Revision history [back]

I figured out what the problem was. I provided the Mat constructor with the image Width followed by the image Height where it should be the other way around. The following line should change from

cv::Mat mat(width, height, CV_8UC4);

to

cv::Mat mat(height, width, CV_8UC4);

Once I made this change, the programme worked as expected.