Apply suggestions from code review

Applying suggestions from @jonoomph
This commit is contained in:
Brenno
2020-10-29 00:21:28 -03:00
parent 01c9397b03
commit b48025cd1f
14 changed files with 220 additions and 327 deletions

View File

@@ -968,13 +968,13 @@ 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);
QImage qimg((uchar*) img.data, img.cols, img.rows, img.step, QImage::Format_RGBA8888_Premultiplied);
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);
if (imgIn->format() != QImage::Format_RGBA8888_Premultiplied)
*imgIn = imgIn->convertToFormat(QImage::Format_RGBA8888_Premultiplied);
return imgIn;
}