add drawing object box with label
Signed-off-by: Yu-Ren Zhang <e8035669@gmail.com>
This commit is contained in:
parent
160a8cc3e8
commit
037276bc01
@ -269,13 +269,19 @@ void label_img::drawObjectBoxes(QPainter& painter, int thickWidth)
|
|||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setWidth(thickWidth);
|
pen.setWidth(thickWidth);
|
||||||
|
QFont font = painter.font();
|
||||||
|
font.setPixelSize(12);
|
||||||
|
font.setBold(true);
|
||||||
|
painter.setFont(font);
|
||||||
|
|
||||||
for(ObjectLabelingBox boundingbox: m_objBoundingBoxes)
|
for(ObjectLabelingBox boundingbox: m_objBoundingBoxes)
|
||||||
{
|
{
|
||||||
pen.setColor(m_drawObjectBoxColor.at(boundingbox.label));
|
pen.setColor(m_drawObjectBoxColor.at(boundingbox.label));
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
|
|
||||||
painter.drawRect(cvtRelativeToAbsoluteRectInUi(boundingbox.box));
|
QRect rectUi = cvtRelativeToAbsoluteRectInUi(boundingbox.box);
|
||||||
|
painter.drawRect(rectUi);
|
||||||
|
painter.drawText(rectUi.topLeft() + QPoint(5, 14 + 14 * boundingbox.label), m_objList.at(boundingbox.label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ public:
|
|||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
QVector<QColor> m_drawObjectBoxColor;
|
QVector<QColor> m_drawObjectBoxColor;
|
||||||
|
QStringList m_objList;
|
||||||
|
|
||||||
int m_uiX;
|
int m_uiX;
|
||||||
int m_uiY;
|
int m_uiY;
|
||||||
|
@ -250,6 +250,7 @@ void MainWindow::load_label_list_data(QString qstrLabelListFile)
|
|||||||
|
|
||||||
ui->label_image->m_drawObjectBoxColor.push_back(labelColor);
|
ui->label_image->m_drawObjectBoxColor.push_back(labelColor);
|
||||||
}
|
}
|
||||||
|
ui->label_image->m_objList = m_objList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user