3 Utils::Utils(QObject *parent) : QObject(parent)
8 cv::Scalar Utils::toScalar(QColor color)
10 return cv::Scalar(color.red(), color.green(), color.blue());
14 std::tuple<cv::Scalar, cv::Scalar> Utils::toRange(QColor color)
16 return std::make_tuple(cv::Scalar((color.hue() * 180.0/ 255.0) - 20, color.saturation() -50, color.saturation() - 50), cv::Scalar((color.hue() * 180.0/ 255.0) - 20, 255, 255));
19 QImage Utils::toImage(
const cv::Mat &m)
22 if(m.type() == CV_8UC3){
23 cv::cvtColor(m, temp, cv::COLOR_BGR2RGB);
24 return QImage(m.data, m.cols, m.rows, m.step, QImage::Format_RGB888).rgbSwapped();
26 return QImage(m.data, m.cols, m.rows, m.step, QImage::Format_Grayscale8);