KexiArrowTip::KexiArrowTip(const QString& text, QWidget* parent) : KexiToolTip(text, parent) , m_opacity(0.0) { QPalette pal( palette() ); QColorGroup cg(pal.active()); cg.setColor(QColorGroup::Foreground, Qt::red); pal.setActive(cg); setPalette(pal); QFontMetrics fm(font()); QSize sz(fm.boundingRect(m_value.toString()).size()); sz += QSize(14, 10); //+margins m_arrowHeight = sz.height()/2; sz += QSize(0, m_arrowHeight); //+arrow height resize(sz); setAutoMask( false ); //generate mask QPixmap maskPm(size()); maskPm.fill( black ); QPainter maskPainter(&maskPm); drawFrame(maskPainter); QImage maskImg( maskPm.convertToImage() ); QBitmap bm; bm = maskImg.createHeuristicMask(); setMask( bm ); }
PTS32 _getKnockBase(Mat& srcImg, double& area, PTBOOL& isFinish,PTSysEnum&eBoard) { PTDEBUG("Enter %s\n", __FUNCTION__); Mat maskImg(srcImg.size(), CV_8UC1); //Extract the knock point using HSV _getKnockMask(srcImg, maskImg,eBoard); Point center; vector<Point> tmp_contour; //Extract the area _getMaxContoursAreaCenter(maskImg, area, center, tmp_contour); if(vKnockArea.size() < INIT_FRAME_NUM) { vKnockArea.push_back(area); } if(vKnockArea.size() == INIT_FRAME_NUM) { sort(vKnockArea.begin(), vKnockArea.end()); area = *(vKnockArea.end()-1); PTDEBUG("statisticed from %d frames, knock point std area[%f]\n", (int)vKnockArea.size(), area); isFinish = TRUE; } else { PTDEBUG("statisticed to %d frame, target %d frames\n", (int)vKnockArea.size(), INIT_FRAME_NUM); isFinish = FALSE; } PTDEBUG("Exit %s\n", __FUNCTION__); return PT_RET_OK; }