@@ -1670,10 +1670,11 @@ void MainWindow::mousePressEvent(QMouseEvent *eventPress) // event triggered by
1670
1670
else if ((mouseButton == Qt::RightButton) & (pos.x >= 0 ) & (pos.x < image.cols )
1671
1671
& (pos.y >= 0 ) & (pos.y < image.rows )) { // right mouse button = transparent/black pixel
1672
1672
Mat1b mask_tmp = Mat::zeros (image.rows , image.cols , CV_8UC1);
1673
- if (ui->horizontalSlider_draw_size ->value () == 0 )
1674
- mask.at <Vec3b>(pos.y , pos.x ) = Vec3b (255 , 255 , 255 ); // draw pixel in mask
1673
+ if (ui->horizontalSlider_draw_size ->value () == 0 ) {
1674
+ mask_tmp.at <uchar>(pos.y , pos.x ) = 255 ; // draw pixel in mask
1675
+ }
1675
1676
else // circle
1676
- circle (mask_tmp, pos, ui->horizontalSlider_draw_size ->value () + 1 , Vec3b ( 255 , 255 , 255 ) , -1 , LINE_8);
1677
+ circle (mask_tmp, pos, ui->horizontalSlider_draw_size ->value () + 1 , 255 , -1 , LINE_8);
1677
1678
draw_cell_mask_save.copyTo (mask, mask_tmp);
1678
1679
}
1679
1680
@@ -1764,10 +1765,11 @@ void MainWindow::mouseMoveEvent(QMouseEvent *eventMove) // first mouse click has
1764
1765
else if ((mouseButton == Qt::RightButton) & (pos.x >= 0 ) & (pos.x < image.cols )
1765
1766
& (pos.y >= 0 ) & (pos.y < image.rows )) { // right mouse button pixel unset
1766
1767
Mat1b mask_tmp = Mat::zeros (image.rows , image.cols , CV_8UC1);
1767
- if (ui->horizontalSlider_draw_size ->value () == 0 )
1768
- mask.at <Vec3b>(pos.y , pos.x ) = Vec3b (255 , 255 , 255 ); // draw pixel in mask
1768
+ if (ui->horizontalSlider_draw_size ->value () == 0 ) {
1769
+ mask_tmp.at <uchar>(pos.y , pos.x ) = 255 ; // draw pixel in mask
1770
+ }
1769
1771
else // circle
1770
- circle (mask_tmp, pos, ui->horizontalSlider_draw_size ->value (), Vec3b ( 255 , 255 , 255 ) , -1 , LINE_8);
1772
+ circle (mask_tmp, pos, ui->horizontalSlider_draw_size ->value (), 255 , -1 , LINE_8);
1771
1773
draw_cell_mask_save.copyTo (mask, mask_tmp);
1772
1774
}
1773
1775
0 commit comments