I have searched on the internet but I cannot find a method of converting a QImage
(or QPixmap
) to a OpenCV Mat
. How would I do this?.
Any help is appreciated.
See Question&Answers more detail:osI have searched on the internet but I cannot find a method of converting a QImage
(or QPixmap
) to a OpenCV Mat
. How would I do this?.
Any help is appreciated.
See Question&Answers more detail:osOne year after you issued this question there've been great answers on the internet:
But the way I see it, if you're working with Qt and OpenCV at the same time then type QImage
is probably just for displaying, that case you might want to use QPixmap
since it's optimized for displaying. So this is what I do:
cv::Mat
, if you'd like to display the image, convert to QPixmap
using the non-copy method introduced in the second article.cv::Mat
.Mat2QPixmap()
to get realtime result.QPixmap
to cv::Mat
, there's no sense doing it considering the purpose of each type.