MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / Qimage2mat

Method Qimage2mat

src/Frame.cpp:883–891  ·  view source on GitHub ↗

Convert Qimage to Mat

Source from the content-addressed store, hash-verified

881
882// Convert Qimage to Mat
883cv::Mat Frame::Qimage2mat( std::shared_ptr<QImage>& qimage) {
884
885 cv::Mat mat = cv::Mat(qimage->height(), qimage->width(), CV_8UC4, (uchar*)qimage->constBits(), qimage->bytesPerLine()).clone();
886 cv::Mat mat2 = cv::Mat(mat.rows, mat.cols, CV_8UC3 );
887 int from_to[] = { 0,0, 1,1, 2,2 };
888 cv::mixChannels( &mat, 1, &mat2, 1, from_to, 3 );
889 cv::cvtColor(mat2, mat2, cv::COLOR_RGB2BGR);
890 return mat2;
891}
892
893// Get pointer to OpenCV image object
894cv::Mat Frame::GetImageCV()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected