add cropped image save option
This commit is contained in:
parent
32c05d2ca5
commit
43ce2bd7c0
@ -24,6 +24,7 @@ public:
|
|||||||
void mousePressEvent(QMouseEvent *ev);
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
|
|
||||||
QImage m_inputImg;
|
QImage m_inputImg;
|
||||||
QImage m_inputImgCopy;//for drawing
|
QImage m_inputImgCopy;//for drawing
|
||||||
|
|
||||||
|
@ -168,6 +168,16 @@ void MainWindow::save_label_data()const
|
|||||||
|
|
||||||
ObjectLabelingBox objBox = ui->label_image->m_objBoundingBoxes[i];
|
ObjectLabelingBox objBox = ui->label_image->m_objBoundingBoxes[i];
|
||||||
|
|
||||||
|
if(ui->checkBox_cropping->isChecked())
|
||||||
|
{
|
||||||
|
QImage cropped = ui->label_image->m_inputImgCopy.copy(objBox.box);
|
||||||
|
|
||||||
|
string strImgFile = m_fileList.at(m_fileIndex).toStdString();
|
||||||
|
strImgFile = strImgFile.substr( strImgFile.find_last_of('/') + 1,
|
||||||
|
strImgFile.find_last_of('.') - strImgFile.find_last_of('/') - 1);
|
||||||
|
|
||||||
|
cropped.save(QString().fromStdString(strImgFile) + "_cropped_" + QString::number(i) + ".png");
|
||||||
|
}
|
||||||
double midX = static_cast<double>(objBox.box.center().x()) / ui->label_image->m_inputImg.width();
|
double midX = static_cast<double>(objBox.box.center().x()) / ui->label_image->m_inputImg.width();
|
||||||
double midY = static_cast<double>(objBox.box.center().y()) / ui->label_image->m_inputImg.height();
|
double midY = static_cast<double>(objBox.box.center().y()) / ui->label_image->m_inputImg.height();
|
||||||
double width = static_cast<double>(objBox.box.width()) / ui->label_image->m_inputImg.width();
|
double width = static_cast<double>(objBox.box.width()) / ui->label_image->m_inputImg.width();
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>ArrowCursor</cursorShape>
|
<cursorShape>CrossCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
<property name="mouseTracking">
|
<property name="mouseTracking">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -342,7 +342,7 @@ border-color: rgb(0, 255, 255);</string>
|
|||||||
<widget class="QPushButton" name="pushButton_open_files">
|
<widget class="QPushButton" name="pushButton_open_files">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>291</width>
|
<width>271</width>
|
||||||
<height>91</height>
|
<height>91</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -386,7 +386,7 @@ border-color: rgb(0, 255, 255);</string>
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>291</width>
|
<width>271</width>
|
||||||
<height>91</height>
|
<height>91</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -429,6 +429,34 @@ border-color: rgb(0, 255, 255);</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_cropping">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>90</width>
|
||||||
|
<height>21</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>ArrowCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color : rgb(0, 0, 17);color : rgb(0, 255, 255);
|
||||||
|
border-style: outset;
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: rgb(0, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>with crop</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -632,7 +660,7 @@ QTableView {
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="horizontalHeaderVisible">
|
<attribute name="horizontalHeaderVisible">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="horizontalHeaderHighlightSections">
|
<attribute name="horizontalHeaderHighlightSections">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -684,6 +712,7 @@ QTableView {
|
|||||||
<attribute name="toolBarBreak">
|
<attribute name="toolBarBreak">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<addaction name="separator"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user