Fixed crashing problem and added cut compatibility with opencv effects

This commit is contained in:
Brenno
2020-07-21 21:42:09 -03:00
parent b2721c09f5
commit 3b2acab284
5 changed files with 137 additions and 120 deletions

View File

@@ -948,7 +948,7 @@ cv::Mat Frame::GetImageCV()
// Fill with black
AddColor(width, height, color);
//if (imagecv.empty())
// if (imagecv.empty())
// Convert Qimage to Mat
imagecv = Qimage2mat(image);
@@ -958,7 +958,9 @@ cv::Mat Frame::GetImageCV()
std::shared_ptr<QImage> Frame::Mat2Qimage(cv::Mat img){
cv::cvtColor(img, img, cv::COLOR_BGR2RGB);
QImage qimg((uchar*) img.data, img.cols, img.rows, img.step, QImage::Format_RGB888);
std::shared_ptr<QImage> imgIn = std::make_shared<QImage>(qimg.copy());
// Always convert to RGBA8888 (if different)
if (imgIn->format() != QImage::Format_RGBA8888)
*imgIn = imgIn->convertToFormat(QImage::Format_RGBA8888);