void ColorBox::setStrColor(const QString &colorStr) { if (properName(m_color) == colorStr) return; setColor(properColor(colorStr)); }
void ColorButton::paintEvent(QPaintEvent *event) { QToolButton::paintEvent(event); if (!isEnabled()) return; QColor color = properColor(m_colorString); QPainter p(this); QRect r(0, 0, width() - 2, height() - 2); p.drawTiledPixmap(r.adjusted(1, 1, -1, -1), tilePixMap(9)); if (isEnabled()) p.setBrush(color); else p.setBrush(Qt::transparent); if (color.value() > 80) p.setPen(QColor(0x444444)); else p.setPen(QColor(0x9e9e9e)); p.drawRect(r.translated(1, 1)); if (m_showArrow) { p.setRenderHint(QPainter::Antialiasing, true); QVector<QPointF> points; if (isChecked()) { points.append(QPointF(2, 3)); points.append(QPointF(8, 3)); points.append(QPointF(5, 9)); } else { points.append(QPointF(8, 6)); points.append(QPointF(2, 9)); points.append(QPointF(2, 3)); } p.translate(0.5, 0.5); p.setBrush(QColor(0xaaaaaa)); p.setPen(QColor(0x444444)); p.drawPolygon(points); } }
std::vector<cv::Rect> FaceDetector::findConfirmedFaces(std::vector<cv::Rect> raw_faces, cv::Mat frame) { std::vector<cv::Rect> confirmed_faces; for ( size_t i = 0; i < raw_faces.size(); i++ ) { cv::Point center( raw_faces[i].x + raw_faces[i].width/2, raw_faces[i].y + raw_faces[i].height/2 ); if(properColor(cv::Mat(frame, raw_faces[i]))) { confirmed_faces.push_back(raw_faces[i]); cv::ellipse( frame, center, cv::Size( raw_faces[i].width*0.5, raw_faces[i].height*0.5), 0, 0, 360, cv::Scalar( 255, 0, 0 ), 4, 8, 0 ); addConsistent(raw_faces[i]); } else { cv::ellipse( frame, center, cv::Size( raw_faces[i].width*0.5, raw_faces[i].height*0.5), 0, 0, 360, cv::Scalar( 0, 0, 0 ), 4, 8, 0 ); } } return confirmed_faces; }
QColor ColorButton::convertedColor() const { return properColor(m_colorString); }