PDA

View Full Version : Converting from cv::Mat to QImage quickly



bearcp
2nd August 2016, 20:13
Hey, so I have a setup with my webcam working, except that the conversion from cv::Mat to QImage is pretty slow.


QImage VideoReader::getFrame() {
Mat frame;
cap >> frame;

QImage image = QImage((uchar*)frame.data, frame.cols, frame.rows, frame.step, QImage::Format_RGB888);

return image;
}

Grabbing the frame from the camera only takes around 5 milliseconds, but the conversion to QImage takes around 15. Is there any way to cut down on this time?