Re: [Interest] Problem with cv::Mat grayscale to QImage

2019-06-21 Thread Allan Jensen
On Friday, 21 June 2019 15:52:55 CEST Jason H wrote: > It seems that there is some word/dword/byte-alignment magic going on and the > skew is proportional to that. Yes, scan-lines are 32bit aligned. So for non-32bit images we add padding to each line to make them align. 'Allan __

Re: [Interest] Problem with cv::Mat grayscale to QImage

2019-06-21 Thread Jason H
It seems that there is some word/dword/byte-alignment magic going on and the skew is proportional to that.    Sent: Friday, June 21, 2019 at 9:40 AM From: "Jason H" To: "René Hansen" Cc: "interestqt-project.org" Subject: Re: [Interest] Problem with cv::Mat grays

Re: [Interest] Problem with cv::Mat grayscale to QImage

2019-06-21 Thread Jason H
ot;Jason H" Cc: "interestqt-project.org" Subject: Re: [Interest] Problem with cv::Mat grayscale to QImage You might need to set the bytesPerLine of the QImage to match the step of cv::Mat. I seem to recall having a similar issue once, converting between a four and three bytes per

Re: [Interest] Problem with cv::Mat grayscale to QImage

2019-06-20 Thread René Hansen
You might need to set the bytesPerLine of the QImage to match the step of cv::Mat. I seem to recall having a similar issue once, converting between a four and three bytes per pixel formats, e.g. if the cv::Mat is in CV_8UC4. /René On Thu, 20 Jun 2019 at 23:05, Jason H wrote: > Simple code: > >

[Interest] Problem with cv::Mat grayscale to QImage

2019-06-20 Thread Jason H
Simple code: cv::Mat left_image = cv::imread(filename, cv::IMREAD_COLOR ); cv::cvtColor(mat, mat, cv::COLOR_BGR2GRAY); cv::imwrite("dummy_gray_cv.png", left_image); // ok QImage test((unsigned char*) left_image.data, left_image.cols, left_image.rows, QImage::Format_Grayscale8); test.save("dummy_g