Skip to content

Commit c83caaf

Browse files
v2.1: several bugs fixed
1 parent dc13e15 commit c83caaf

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# superpixels-segmentation-gui-opencv
22
## Superpixels segmentation algorithms with QT and OpenCV, with a nice GUI to manage labels and colorize the cells
3-
### v2.1 - 2018-10-13
3+
### v2.1 - 2019-05-12
44

55
![Screenshot - Global](screenshots/screenshot.jpg?raw=true)
66
<br/>
@@ -120,7 +120,7 @@ Basic operations:
120120
* "CTRL" key + left mouse click to floodfill a closed area
121121
* "CTRL" key + right mouse click to floodfill to transparent a whole contiguous cells area previously colorized
122122
* "ALT" key + left mouse button to select a label directly in the viewport, this will select it in the list
123-
* UNDO: use this button to cancel the last action
123+
* UNDO: use this button to cancel the last action (only the last action can be cancelled)
124124
* click on the "Holes" button to view every cell that hasn't been colored yet. Click again on it to hide this feature
125125

126126
* Change the view:
@@ -170,3 +170,4 @@ Basic operations:
170170

171171
### AbsurdePhoton
172172
My photographer website ''Photongénique'': www.absurdephoton.fr
173+

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# by AbsurdePhoton - www.absurdephoton.fr
66
#
7-
# v2 - 2018/09/02
7+
# v2.1 - 2019/05/12
88
#
99
#-------------------------------------------------*/
1010

mainwindow.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# by AbsurdePhoton - www.absurdephoton.fr
66
#
7-
# v2 - 2018/09/02
7+
# v2.1 - 2019/05/12
88
#
99
#-------------------------------------------------*/
1010

@@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
5252

5353
InitializeValues(); // init all indicators and zoom etc
5454

55-
basedir = "/media/DataI5/Photos/"; // base path and file
55+
basedir = "/media/"; // base path and file
5656
basefile = "";
5757
}
5858

@@ -574,7 +574,7 @@ void MainWindow::on_button_load_session_clicked() // load previous session
574574
//if (image.empty()) // image mandatory
575575
// return;
576576

577-
QString filename = QFileDialog::getOpenFileName(this, "Load session from XML file...", QString::fromStdString(basedir + basefile + "-segmentation-data.xml"), "*.xml *.XML");
577+
QString filename = QFileDialog::getOpenFileName(this, "Load session from XML file...", QString::fromStdString(basedir), "*.xml *.XML");
578578

579579
if (filename.isNull() || filename.isEmpty()) // cancel ?
580580
return;
@@ -627,7 +627,7 @@ void MainWindow::on_button_load_session_clicked() // load previous session
627627
return;
628628
}
629629

630-
Mat labels_temp(image.rows, image.cols, CV_32SC1); // labels on 1 channel
630+
Mat labels_temp(image.rows, image.cols, CV_32SC1);
631631
fs["Labels"] >> labels_temp; // load labels
632632
labels_temp.copyTo(labels);
633633
fs["LabelsMask"] >> labels_temp; // load labels mask
@@ -1590,7 +1590,6 @@ void MainWindow::DisplayThumbnail() // image thumnail with transparent viewport
15901590
p2y *= double(ui->label_thumbnail->pixmap()->height());
15911591
}
15921592

1593-
Mat thumbnail_temp;
15941593
Mat thumbnail_temp = Mat::zeros(thumbnail.rows, thumbnail.cols, CV_8UC3);
15951594
rectangle(thumbnail_temp, cv::Point(p1x, p1y), cv::Point(p2x-1, p2y-1), Scalar(92,92,92), -1); // draw filled rectangle representing the viewport position
15961595
rectangle(thumbnail_temp, cv::Point(p1x, p1y), cv::Point(p2x-1, p2y-1), Scalar(255,255,255), 2); // draw rectangle with thick border
@@ -1846,7 +1845,7 @@ void MainWindow::on_button_compute_clicked() // compute segmentation
18461845
seeds->getLabelContourMask(maskTemp, !ui->checkBox_thick->isChecked()); // contours
18471846
}
18481847

1849-
labels_mask = Mat::zeros(labels.rows, labels.cols, CV_8UC3); // new labels mask
1848+
labels_mask = Mat::zeros(labels.rows, labels.cols, CV_32SC1); // new labels mask
18501849

18511850
// contours for displaying : grid & mask initialization
18521851
cv::cvtColor(maskTemp, mask, CV_GRAY2RGB); // at first the mask contains the grid, need to convert labels from gray to RGB

mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# by AbsurdePhoton - www.absurdephoton.fr
66
#
7-
# v2 - 2018/09/02
7+
# v2.1 - 2019/05/12
88
#
99
#-------------------------------------------------*/
1010

mainwindow.ui

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3823,7 +3823,7 @@ QToolTip {
38233823
</rect>
38243824
</property>
38253825
<property name="toolTip">
3826-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Current label and used color to colorize the segmentation cells.&lt;/p&gt;&lt;p&gt;Click on the image:&lt;/p&gt;&lt;p&gt; * Left button: set the cell color&lt;/p&gt;&lt;p&gt; * Right button: delete (set to transparent)&lt;/p&gt;&lt;p&gt; * Drag the mouse while holding the mouse buttons to colorize several cells&lt;/p&gt;&lt;p&gt; * use &amp;lt;CTRL&amp;gt; key + left click to fill a closed area. Be careful, one pixel missing and you have to use the Undo function!&lt;/p&gt;&lt;p&gt;* hold the middle button of the mouse to navigate in the image&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3826+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Current label and used color to colorize the segmentation cells.&lt;/p&gt;&lt;p&gt;Click on the image:&lt;/p&gt;&lt;p&gt;* Left mouse button: set the cell color&lt;/p&gt;&lt;p&gt;* Right mouse button: delete (set to transparent)&lt;/p&gt;&lt;p&gt;* Drag the mouse while holding the mouse buttons to colorize several cells&lt;/p&gt;&lt;p&gt;* use &amp;lt;CTRL&amp;gt; key + mouse click (left = color, right= delete) to fill a closed area. Be careful, one pixel missing and you have to use the Undo function!&lt;/p&gt;&lt;p&gt;* use &amp;lt;ALT&amp;gt; key + left mouse button to select a label&lt;/p&gt;&lt;p&gt;* hold the middle button of the mouse to navigate in the image&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
38273827
</property>
38283828
<property name="styleSheet">
38293829
<string notr="true">background-color:rgb(255,0,0);border: 3px solid black;</string>
@@ -3930,14 +3930,14 @@ QToolTip {
39303930
<widget class="QLabel" name="label_18">
39313931
<property name="geometry">
39323932
<rect>
3933-
<x>9</x>
3933+
<x>3</x>
39343934
<y>29</y>
3935-
<width>25</width>
3936-
<height>16</height>
3935+
<width>31</width>
3936+
<height>20</height>
39373937
</rect>
39383938
</property>
39393939
<property name="toolTip">
3940-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;* v0: launch&lt;/p&gt;&lt;p&gt;* v1: added contours + several improvements&lt;/p&gt;&lt;p&gt;* v2: tabbed workflow + labels management + PSD and TIFF export + create cells&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
3940+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;* v0: launch&lt;/p&gt;&lt;p&gt;* v1: added contours + several improvements&lt;/p&gt;&lt;p&gt;* v2: tabbed workflow + labels management + PSD and TIFF export + create cells&lt;/p&gt;&lt;p&gt;* v2.1: several bugs fixed&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
39413941
</property>
39423942
<property name="frameShape">
39433943
<enum>QFrame::Box</enum>
@@ -3946,7 +3946,7 @@ QToolTip {
39463946
<enum>QFrame::Sunken</enum>
39473947
</property>
39483948
<property name="text">
3949-
<string>v2</string>
3949+
<string>v2.1</string>
39503950
</property>
39513951
<property name="scaledContents">
39523952
<bool>false</bool>

superpixels-segmentation-gui-opencv.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# by AbsurdePhoton - www.absurdephoton.fr
66
#
7-
# v2 - 2018/09/02
7+
# v2.1 - 2019/05/12
88
#
99
#-------------------------------------------------
1010

0 commit comments

Comments
 (0)