Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cv::Mat Widget::qImageToMat(QImage img)
- {
- cv::Mat mat;
- if (img.format() == QImage::Format_Indexed8)
- mat = cv::Mat(img.height(), img.width(), CV_8U, img.bits(), img.bytesPerLine()).clone();
- else if (img.format() == QImage::Format_RGB888)
- {
- mat = cv::Mat(img.height(), img.width(), CV_8UC3, img.bits(), img.bytesPerLine()).clone();
- cv::cvtColor(mat, mat, CV_RGB2BGR);
- }
- return mat;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement