Fix crash brightness

This will prevent a crash when the brightness is calculated and the source has no output (yet).
This commit is contained in:
Erik van der Veen 2023-05-07 20:53:32 +02:00 committed by WarmUpTill
parent 5ae1f38ea8
commit c551953283

View File

@ -102,6 +102,10 @@ std::vector<cv::Rect> matchObject(QImage &img, cv::CascadeClassifier &cascade,
uchar getAvgBrightness(QImage &img)
{
if (img.isNull()) {
return 0;
}
auto i = QImageToMat(img);
cv::Mat hsvImage, rgbImage;
cv::cvtColor(i, rgbImage, cv::COLOR_RGBA2RGB);