diff --git a/.gitignore b/.gitignore index 6df9758..0c0b49d 100755 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pro.user* +.git* +.git.*/ + diff --git a/README.md b/README.md index 491b297..b819816 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ Image viewer powered by Qt 5.8.0 +[QPhoto](https://github.com/seahime/QPhoto)是该项目的重制版,当前完成度还很低。 + +> 友情提示:该项目为作者本科时的课程作业,代码比较乱,参考需慎重。 + + ## 功能(按完成时间排序) 1. 基本的图像查看 @@ -11,7 +16,7 @@ Image viewer powered by Qt 5.8.0 5. 调节亮度 6. 添加相框 7. 金属纹理 -8. 语言切换(中/英)支持 +8. 语言切换(中/英)支持(已删除) 9. 直方图(包括灰度直方图和各通道直方图) 10. 线性灰度变换 11. 函数图像绘制 @@ -27,5 +32,9 @@ Image viewer powered by Qt 5.8.0 ## 截图 -![1](http://i2.muimg.com/567571/e133813c5cc8bb6b.png) +![1](./screenshots/Snipaste_2019-05-30_15-32-42.png) + +![2](./screenshots/Snipaste_2019-05-30_15-33-15.png) + +![3](./screenshots/Snipaste_2019-05-30_15-33-28.png) diff --git a/default.qrc b/default.qrc deleted file mode 100755 index 34ce95e..0000000 --- a/default.qrc +++ /dev/null @@ -1,39 +0,0 @@ - - - src/avatar-default.png - src/document-save.png - src/document-save-as.png - src/frame_3.png - src/frame_1.png - src/frame_2.png - src/logo_1.png - src/logo_2.png - src/metal.png - src/chinese.png - src/english.png - src/right.png - src/horizontal.png - src/vertical.png - src/left.png - src/restore.png - src/histogram.png - src/brightness.svg - src/save.svg - src/zoom.png - src/lineGrey.gif - src/quill_72px.png - src/log.png - src/fun_exp.png - src/line_graphic_72p.png - src/Line_Chart_72px.png - src/temperature_72px.png - src/blur_on_72px.png - src/Open_folder_full_48px_1186194_easyicon.net.png - src/settings_backup_restore_48px_1182197_easyicon.net.png - src/clear_gtk_72px_43338_easyicon.net.png - src/Final_Cut_Pro_X_96px_1134672_easyicon.net.png - - - cn.qm - - diff --git a/imViewer.pro b/imViewer.pro index 2bcaeb6..f78d88e 100755 --- a/imViewer.pro +++ b/imViewer.pro @@ -4,19 +4,24 @@ # #------------------------------------------------- -QT += core gui concurrent +TEMPLATE = subdirs -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport +SUBDIRS += src -TARGET = imViewer -TEMPLATE = app -CONFIG += C++11 + +#QT += core gui concurrent + +#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + +#TARGET = imViewer +#TEMPLATE = app +#CONFIG += C++11 # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS +#DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. @@ -24,49 +29,49 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -SOURCES += main.cpp\ - mainwindow.cpp \ - tools.cpp \ - dialog_gaussianblur.cpp \ - histogram.cpp \ - dialog_linear_gray.cpp \ - qcustomplot.cpp \ - dialog_log_grey.cpp \ - dialog_power_grey.cpp \ - dialog_exp_transform.cpp \ - dialog_two_threshold_transform.cpp \ - dialog_stretch_transform.cpp \ - gaussianblur.cpp \ - medianfilter.cpp \ - graphicsview.cpp +#SOURCES += main.cpp\ +# mainwindow.cpp \ +# tools.cpp \ +# dialog_gaussianblur.cpp \ +# histogram.cpp \ +# dialog_linear_gray.cpp \ +# qcustomplot.cpp \ +# dialog_log_grey.cpp \ +# dialog_power_grey.cpp \ +# dialog_exp_transform.cpp \ +# dialog_two_threshold_transform.cpp \ +# dialog_stretch_transform.cpp \ +# gaussianblur.cpp \ +# medianfilter.cpp \ +# graphicsview.cpp -HEADERS += mainwindow.h \ - tools.h \ - dialog_gaussianblur.h \ - histogram.h \ - dialog_linear_gray.h \ - qcustomplot.h \ - dialog_log_grey.h \ - dialog_power_grey.h \ - dialog_exp_transform.h \ - dialog_two_threshold_transform.h \ - dialog_stretch_transform.h \ - gaussianblur.h \ - medianfilter.h \ - graphicsview.h +#HEADERS += mainwindow.h \ +# tools.h \ +# dialog_gaussianblur.h \ +# histogram.h \ +# dialog_linear_gray.h \ +# qcustomplot.h \ +# dialog_log_grey.h \ +# dialog_power_grey.h \ +# dialog_exp_transform.h \ +# dialog_two_threshold_transform.h \ +# dialog_stretch_transform.h \ +# gaussianblur.h \ +# medianfilter.h \ +# graphicsview.h -FORMS += mainwindow.ui \ - gaussianblurdialog.ui \ - dialog_linear_gray.ui \ - dialog_log_grey.ui \ - dialog_power_grey.ui \ - dialog_exp_transform.ui \ - dialog_two_threshold_transform.ui \ - dialog_stretch_transform.ui +#FORMS += mainwindow.ui \ +# gaussianblurdialog.ui \ +# dialog_linear_gray.ui \ +# dialog_log_grey.ui \ +# dialog_power_grey.ui \ +# dialog_exp_transform.ui \ +# dialog_two_threshold_transform.ui \ +# dialog_stretch_transform.ui -RESOURCES += \ - default.qrc +#RESOURCES += \ +# default.qrc -TRANSLATIONS += cn.ts +#TRANSLATIONS += cn.ts -DISTFILES += +#DISTFILES += diff --git a/screenshots/Snipaste_2019-05-30_15-32-42.png b/screenshots/Snipaste_2019-05-30_15-32-42.png new file mode 100644 index 0000000..5411f57 Binary files /dev/null and b/screenshots/Snipaste_2019-05-30_15-32-42.png differ diff --git a/screenshots/Snipaste_2019-05-30_15-33-15.png b/screenshots/Snipaste_2019-05-30_15-33-15.png new file mode 100644 index 0000000..a891679 Binary files /dev/null and b/screenshots/Snipaste_2019-05-30_15-33-15.png differ diff --git a/screenshots/Snipaste_2019-05-30_15-33-28.png b/screenshots/Snipaste_2019-05-30_15-33-28.png new file mode 100644 index 0000000..1f79d34 Binary files /dev/null and b/screenshots/Snipaste_2019-05-30_15-33-28.png differ diff --git a/src/Open_folder_full_48px_1186194_easyicon.net.png b/src/Open_folder_full_48px_1186194_easyicon.net.png deleted file mode 100644 index 5682cd3..0000000 Binary files a/src/Open_folder_full_48px_1186194_easyicon.net.png and /dev/null differ diff --git a/src/avatar-default.png b/src/avatar-default.png deleted file mode 100755 index c07d172..0000000 Binary files a/src/avatar-default.png and /dev/null differ diff --git a/src/brightness.svg b/src/brightness.svg deleted file mode 100755 index 8642bc1..0000000 --- a/src/brightness.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/src/clear_gtk_72px_43338_easyicon.net.png b/src/clear_gtk_72px_43338_easyicon.net.png deleted file mode 100644 index 0ce9028..0000000 Binary files a/src/clear_gtk_72px_43338_easyicon.net.png and /dev/null differ diff --git a/dialog_exp_transform.cpp b/src/dialog/dialog_exp_transform.cpp old mode 100755 new mode 100644 similarity index 99% rename from dialog_exp_transform.cpp rename to src/dialog/dialog_exp_transform.cpp index 063174c..1f00779 --- a/dialog_exp_transform.cpp +++ b/src/dialog/dialog_exp_transform.cpp @@ -18,6 +18,7 @@ DialogExpTransform::~DialogExpTransform() void DialogExpTransform::on_buttonBox_accepted() { emit sendData(ui->bDoubleSpinBox->value(), ui->cDoubleSpinBox->value(), ui->aDoubleSpinBox->value()); + } void DialogExpTransform::paintFunctionImage(double b, double c, double a) diff --git a/dialog_exp_transform.h b/src/dialog/dialog_exp_transform.h old mode 100755 new mode 100644 similarity index 91% rename from dialog_exp_transform.h rename to src/dialog/dialog_exp_transform.h index 3825a77..ed3857b --- a/dialog_exp_transform.h +++ b/src/dialog/dialog_exp_transform.h @@ -12,7 +12,7 @@ class DialogExpTransform : public QDialog Q_OBJECT public: - explicit DialogExpTransform(QWidget *parent = 0); + explicit DialogExpTransform(QWidget *parent = nullptr); ~DialogExpTransform(); private: diff --git a/dialog_exp_transform.ui b/src/dialog/dialog_exp_transform.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_exp_transform.ui rename to src/dialog/dialog_exp_transform.ui diff --git a/dialog_gaussianblur.cpp b/src/dialog/dialog_gaussianblur.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_gaussianblur.cpp rename to src/dialog/dialog_gaussianblur.cpp diff --git a/dialog_gaussianblur.h b/src/dialog/dialog_gaussianblur.h old mode 100755 new mode 100644 similarity index 100% rename from dialog_gaussianblur.h rename to src/dialog/dialog_gaussianblur.h diff --git a/dialog_linear_gray.cpp b/src/dialog/dialog_linear_gray.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_linear_gray.cpp rename to src/dialog/dialog_linear_gray.cpp diff --git a/dialog_linear_gray.h b/src/dialog/dialog_linear_gray.h old mode 100755 new mode 100644 similarity index 90% rename from dialog_linear_gray.h rename to src/dialog/dialog_linear_gray.h index 5083e23..64f89a0 --- a/dialog_linear_gray.h +++ b/src/dialog/dialog_linear_gray.h @@ -14,7 +14,7 @@ class LinearGrayDialog : public QDialog Q_OBJECT public: - explicit LinearGrayDialog(QWidget *parent = 0); + explicit LinearGrayDialog(QWidget *parent = nullptr); ~LinearGrayDialog(); private: diff --git a/dialog_linear_gray.ui b/src/dialog/dialog_linear_gray.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_linear_gray.ui rename to src/dialog/dialog_linear_gray.ui diff --git a/dialog_log_grey.cpp b/src/dialog/dialog_log_grey.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_log_grey.cpp rename to src/dialog/dialog_log_grey.cpp diff --git a/dialog_log_grey.h b/src/dialog/dialog_log_grey.h old mode 100755 new mode 100644 similarity index 100% rename from dialog_log_grey.h rename to src/dialog/dialog_log_grey.h diff --git a/dialog_log_grey.ui b/src/dialog/dialog_log_grey.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_log_grey.ui rename to src/dialog/dialog_log_grey.ui diff --git a/dialog_power_grey.cpp b/src/dialog/dialog_power_grey.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_power_grey.cpp rename to src/dialog/dialog_power_grey.cpp diff --git a/dialog_power_grey.h b/src/dialog/dialog_power_grey.h old mode 100755 new mode 100644 similarity index 100% rename from dialog_power_grey.h rename to src/dialog/dialog_power_grey.h diff --git a/dialog_power_grey.ui b/src/dialog/dialog_power_grey.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_power_grey.ui rename to src/dialog/dialog_power_grey.ui diff --git a/dialog_stretch_transform.cpp b/src/dialog/dialog_stretch_transform.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_stretch_transform.cpp rename to src/dialog/dialog_stretch_transform.cpp diff --git a/dialog_stretch_transform.h b/src/dialog/dialog_stretch_transform.h old mode 100755 new mode 100644 similarity index 100% rename from dialog_stretch_transform.h rename to src/dialog/dialog_stretch_transform.h diff --git a/dialog_stretch_transform.ui b/src/dialog/dialog_stretch_transform.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_stretch_transform.ui rename to src/dialog/dialog_stretch_transform.ui diff --git a/dialog_two_threshold_transform.cpp b/src/dialog/dialog_two_threshold_transform.cpp old mode 100755 new mode 100644 similarity index 100% rename from dialog_two_threshold_transform.cpp rename to src/dialog/dialog_two_threshold_transform.cpp diff --git a/dialog_two_threshold_transform.h b/src/dialog/dialog_two_threshold_transform.h old mode 100755 new mode 100644 similarity index 100% rename from dialog_two_threshold_transform.h rename to src/dialog/dialog_two_threshold_transform.h diff --git a/dialog_two_threshold_transform.ui b/src/dialog/dialog_two_threshold_transform.ui old mode 100755 new mode 100644 similarity index 100% rename from dialog_two_threshold_transform.ui rename to src/dialog/dialog_two_threshold_transform.ui diff --git a/gaussianblurdialog.ui b/src/dialog/gaussianblurdialog.ui old mode 100755 new mode 100644 similarity index 100% rename from gaussianblurdialog.ui rename to src/dialog/gaussianblurdialog.ui diff --git a/src/document-save-as.png b/src/document-save-as.png deleted file mode 100755 index 1aaf74b..0000000 Binary files a/src/document-save-as.png and /dev/null differ diff --git a/src/document-save.png b/src/document-save.png deleted file mode 100755 index f372ad6..0000000 Binary files a/src/document-save.png and /dev/null differ diff --git a/main.cpp b/src/main.cpp old mode 100755 new mode 100644 similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/graphicsview.cpp b/src/mainwindow/graphicsview.cpp similarity index 100% rename from graphicsview.cpp rename to src/mainwindow/graphicsview.cpp diff --git a/graphicsview.h b/src/mainwindow/graphicsview.h similarity index 88% rename from graphicsview.h rename to src/mainwindow/graphicsview.h index 3f4e0ef..1cf2bb4 100644 --- a/graphicsview.h +++ b/src/mainwindow/graphicsview.h @@ -11,7 +11,7 @@ class GraphicsView : public QGraphicsView int factor; public: - GraphicsView(QWidget* parent = 0); + GraphicsView(QWidget* parent = nullptr); ~GraphicsView(); int getFactor(); diff --git a/mainwindow.cpp b/src/mainwindow/mainwindow.cpp old mode 100755 new mode 100644 similarity index 88% rename from mainwindow.cpp rename to src/mainwindow/mainwindow.cpp index b697e32..caa237a --- a/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -9,15 +9,16 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); + leftScene = new QGraphicsScene; rightScene = new QGraphicsScene; + leftPixmapItem = new QGraphicsPixmapItem(); + rightPixmapItem = new QGraphicsPixmapItem(); size = new QLabel; - - - info = NULL; + info = nullptr; leftScene->setBackgroundBrush(QColor::fromRgb(224,224,224)); ui->leftGraphicsView->setScene(leftScene); @@ -33,7 +34,6 @@ MainWindow::MainWindow(QWidget *parent) : setActionStatus(false); setWindowTitle("ImageQt"); - ui->actionEnglish->setEnabled(false); } void MainWindow::createToolBar() @@ -46,27 +46,14 @@ void MainWindow::createToolBar() ui->toolBar->addAction(ui->actionHistogram); ui->toolBar->addSeparator(); - ui->toolBar->addAction(ui->actionChinese); - - ui->toolBar->addSeparator(); - ui->toolBar->addAction(finalEx); } void MainWindow::createAction() { - finalEx = new QAction(QIcon(":/img/src/Final_Cut_Pro_X_96px_1134672_easyicon.net.png"), tr("Final"), this); - connect(finalEx, SIGNAL(triggered(bool)), this, SLOT(on_actionFinal_triggered())); -} -void MainWindow::on_actionFinal_triggered() -{ +} - QPixmap rightImage = rightPixmapItem->pixmap(); - QImage newImage = Tools::Final(rightImage.toImage()); - rightImage.convertFromImage(newImage); - updateRightImage(rightImage); -} MainWindow::~MainWindow() { @@ -75,13 +62,13 @@ MainWindow::~MainWindow() if (leftScene) { delete leftScene; - leftScene = NULL; + leftScene = nullptr; } if (size) { delete size; - size = NULL; + size = nullptr; } @@ -89,7 +76,7 @@ MainWindow::~MainWindow() if (rightScene) { delete leftScene; - leftScene = NULL; + leftScene = nullptr; } } @@ -99,11 +86,8 @@ MainWindow::~MainWindow() *****************************************************************************/ void MainWindow::updateRightImage(QPixmap &pixmap) { - rightPixmapItem->setPixmap(pixmap); rightScene->setSceneRect(QRectF(pixmap.rect())); - - qDebug() << "repaintRightScene" << rightScene->items().count(); } /****************************************************************************** @@ -171,7 +155,6 @@ void MainWindow::setActionStatus(bool status) ui->actionVertical->setEnabled(status); ui->actionClassic_frame->setEnabled(status); ui->actionAdjust_brightness->setEnabled(status); - ui->actionRight->setEnabled(status); ui->zoomAction->setEnabled(status); } @@ -312,10 +295,6 @@ void MainWindow::on_actionOpen_triggered() // upload image info = new QFileInfo(imagePath); - - - - QPixmap leftPixmap(imagePath); leftPixmapItem = leftScene->addPixmap(leftPixmap); leftScene->setSceneRect(QRectF(leftPixmap.rect())); @@ -324,15 +303,6 @@ void MainWindow::on_actionOpen_triggered() rightPixmapItem = rightScene->addPixmap(rightPixmap); rightScene->setSceneRect(QRectF(rightPixmap.rect())); - qDebug()<<"depth:"<setWindowTitle(info->fileName() + " - ImageQt"); @@ -340,9 +310,6 @@ void MainWindow::on_actionOpen_triggered() size->setText(QString::number(leftPixmapItem->pixmap().width()) + " x " + QString::number(leftPixmapItem->pixmap().height())); - - - } } @@ -510,7 +477,7 @@ void MainWindow::on_actionHistogram_triggered() Histogram * hstgrm = new Histogram(scrollArea); hstgrm->computeHstgrm(rightPixmapItem->pixmap().toImage()); - if (hstgrm == NULL) + if (hstgrm == nullptr) return; @@ -531,15 +498,13 @@ void MainWindow::on_actionHistogram_triggered() } - - /****************************************************************************** * Add frame *****************************************************************************/ void MainWindow::on_actionMovie_frame_triggered() { QPixmap rightImage = rightPixmapItem->pixmap(); - QImage frame = QImage(":/img/src/frame_3.png"); + QImage frame = QImage(":/img/frame_3.png"); QImage newImage = Tools::DrawFrame(rightImage.toImage(), frame); rightImage.convertFromImage(newImage); @@ -549,7 +514,7 @@ void MainWindow::on_actionMovie_frame_triggered() void MainWindow::on_actionClassic_frame_triggered() { QPixmap rightImage = rightPixmapItem->pixmap(); - QImage frame = QImage(":/img/src/frame_1.png"); + QImage frame = QImage(":/img/frame_1.png"); QImage newImage = Tools::DrawFrame(rightImage.toImage(), frame); rightImage.convertFromImage(newImage); @@ -559,7 +524,7 @@ void MainWindow::on_actionClassic_frame_triggered() void MainWindow::on_actionFlower_frame_triggered() { QPixmap rightImage = rightPixmapItem->pixmap(); - QImage frame = QImage(":/img/src/frame_2.png"); + QImage frame = QImage(":/img/frame_2.png"); QImage newImage = Tools::DrawFrame(rightImage.toImage(), frame); rightImage.convertFromImage(newImage); @@ -646,52 +611,6 @@ void MainWindow::on_actionMeida_Filter_triggered() } } -/****************************************************************************** - * Rotate Left - *****************************************************************************/ -void MainWindow::on_actionLeft_triggered() -{ - - bool ok; - int factor = QInputDialog::getInt(this, tr("旋转"), "请输入要旋转的角度",0,-360,360,10,&ok); - if (ok) - { - if (factor != 0) - { - QPixmap rightImage = rightPixmapItem->pixmap(); - - QImage *imgRotate = new QImage; - QMatrix matrix; - matrix.rotate(factor); - *imgRotate = rightImage.toImage().transformed(matrix); - QPixmap newPixmap; - newPixmap = QPixmap::fromImage(*imgRotate); - updateRightImage(newPixmap); - } - else - { - return; - } - } - -} - -/****************************************************************************** - * Rotate Right - *****************************************************************************/ -void MainWindow::on_actionRight_triggered() -{ - //ui->rightGraphicsView->rotate(90); - QPixmap rightImage = rightPixmapItem->pixmap(); - - QImage *imgRotate = new QImage; - QMatrix matrix; - matrix.rotate(90); - *imgRotate = rightImage.toImage().transformed(matrix); - QPixmap newPixmap; - newPixmap = QPixmap::fromImage(*imgRotate); - updateRightImage(newPixmap); -} /****************************************************************************** * on Action tools->zoom triggered @@ -897,34 +816,11 @@ void MainWindow::on_actionNormal_triggered() void MainWindow::on_actionAbout_triggered() { QMessageBox message(QMessageBox::NoIcon, tr(WINDOW_ABOUT), "

ImageQt

" - "Powered By Qt 5.7.1."); - message.setIconPixmap(QPixmap(":/img/src/logo_1.png")); + "Powered By Qt 5.12.0."); + message.setIconPixmap(QPixmap(":/img/logo_1.png")); message.exec(); } -/****************************************************************************** - * 语言支持 - *****************************************************************************/ - -void MainWindow::on_actionChinese_triggered() -{ - QTranslator translator; - translator.load(":/language/cn.qm"); - qApp->installTranslator(&translator); - ui->retranslateUi(this); - ui->actionChinese->setEnabled(false); - ui->actionEnglish->setEnabled(true); -} - -void MainWindow::on_actionEnglish_triggered() -{ - QTranslator translator; - translator.load(":/language/cn.qm"); - qApp->removeTranslator(&translator); - ui->retranslateUi(this); - ui->actionEnglish->setEnabled(false); - ui->actionChinese->setEnabled(true); -} /****************************************************************************** * 获得当前用户的用户名 @@ -945,15 +841,15 @@ QString MainWindow::getUserPath() return userPath; } -void MainWindow::on_actionT_triggered() -{ - QLabel* l = new QLabel; - if (!rightPixmapItem->pixmap().isNull()) { - qDebug() << "hello"; - l->setPixmap(rightPixmapItem->pixmap()); - l->show(); - } -} +//void MainWindow::on_actionT_triggered() +//{ +// QLabel* l = new QLabel; +// if (!rightPixmapItem->pixmap().isNull()) { +// qDebug() << "hello"; +// l->setPixmap(rightPixmapItem->pixmap()); +// l->show(); +// } +//} /****************************************************************************** * Prewitt边缘检测 @@ -999,10 +895,6 @@ void MainWindow::on_actionArea_triggered() message->show(); } -void MainWindow::on_actionConnected_domain_triggered() -{ - -} void MainWindow::on_actionCircumference_triggered() { @@ -1077,39 +969,63 @@ void MainWindow::on_actionClosing_triggered() * **************************************************************************/ void MainWindow::on_actionThinning_triggered() { - QPixmap rightImage = rightPixmapItem->pixmap(); - QImage newImage = Tools::Thinning(rightImage.toImage()); - rightImage.convertFromImage(newImage); +// QPixmap rightImage = rightPixmapItem->pixmap(); +// QImage newImage = Tools::Thinning(rightImage.toImage()); +// rightImage.convertFromImage(newImage); - updateRightImage(rightImage); +// updateRightImage(rightImage); + qDebug() << "TODO"; } -void MainWindow::on_actionRGB2HSV_triggered() -{ - QPixmap rightImage = rightPixmapItem->pixmap(); - QImage newImage = Tools::RGB2HSV(rightImage.toImage()); - rightImage.convertFromImage(newImage); +//void MainWindow::on_actionRGB2HSV_triggered() +//{ +// QPixmap rightImage = rightPixmapItem->pixmap(); +// QImage newImage = Tools::RGB2HSV(rightImage.toImage()); +// rightImage.convertFromImage(newImage); - updateRightImage(rightImage); -} +// updateRightImage(rightImage); +//} +//void MainWindow::on_actionRGB2HSL_triggered() +//{ +// QPixmap rightImage = rightPixmapItem->pixmap(); +// QImage newImage = Tools::RGB2HSL(rightImage.toImage()); +// rightImage.convertFromImage(newImage); +// updateRightImage(rightImage); +//} -void MainWindow::on_actionRGB2HSL_triggered() -{ - QPixmap rightImage = rightPixmapItem->pixmap(); - QImage newImage = Tools::RGB2HSL(rightImage.toImage()); - rightImage.convertFromImage(newImage); +//void MainWindow::on_actionRGB2Cmyk_triggered() +//{ +// QPixmap rightImage = rightPixmapItem->pixmap(); +// QImage newImage = Tools::RGB2CMYK(rightImage.toImage()); +// rightImage.convertFromImage(newImage); - updateRightImage(rightImage); -} +// updateRightImage(rightImage); +//} -void MainWindow::on_actionRGB2Cmyk_triggered() +void MainWindow::on_actionRotate_triggered() { - QPixmap rightImage = rightPixmapItem->pixmap(); - QImage newImage = Tools::RGB2CMYK(rightImage.toImage()); - rightImage.convertFromImage(newImage); + bool ok; + int factor = QInputDialog::getInt(this, tr("旋转"), "请输入要旋转的角度(正数向右,负数向左)",0,-360,360,10,&ok); + if (ok) + { + if (factor != 0) + { + QPixmap rightImage = rightPixmapItem->pixmap(); - updateRightImage(rightImage); + QImage *imgRotate = new QImage; + QMatrix matrix; + matrix.rotate(factor); + *imgRotate = rightImage.toImage().transformed(matrix); + QPixmap newPixmap; + newPixmap = QPixmap::fromImage(*imgRotate); + updateRightImage(newPixmap); + } + else + { + return; + } + } } diff --git a/mainwindow.h b/src/mainwindow/mainwindow.h old mode 100755 new mode 100644 similarity index 81% rename from mainwindow.h rename to src/mainwindow/mainwindow.h index 70927a0..b23d3dd --- a/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -11,17 +12,17 @@ #include #include #include "graphicsview.h" -#include "dialog_gaussianblur.h" -#include "tools.h" -#include "histogram.h" -#include "medianfilter.h" -#include "gaussianblur.h" -#include "dialog_linear_gray.h" -#include "dialog_log_grey.h" -#include "dialog_power_grey.h" -#include "dialog_exp_transform.h" -#include "dialog_two_threshold_transform.h" -#include "dialog_stretch_transform.h" +#include "../dialog/dialog_gaussianblur.h" +#include "../utils/tools.h" +#include "../utils/histogram.h" +#include "../utils/gaussianblur.h" +#include "../utils/medianfilter.h" +#include "../dialog/dialog_linear_gray.h" +#include "../dialog/dialog_log_grey.h" +#include "../dialog/dialog_power_grey.h" +#include "../dialog/dialog_exp_transform.h" +#include "../dialog/dialog_two_threshold_transform.h" +#include "../dialog/dialog_stretch_transform.h" #define WINDOW_TITLE "ImageQt" #define WINDOW_CRITICAL "Error - ImageQt" @@ -37,7 +38,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0); + explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); void updateRightImage(QPixmap &pixmap); @@ -82,8 +83,6 @@ private slots: void on_actionGauss_triggered(); void on_actionMeida_Filter_triggered(); - void on_actionLeft_triggered(); // Rotate Left: 90^ - void on_actionRight_triggered(); // Rotate Right:90^ void on_zoomAction_triggered(); // Zoom action with dialog void on_actionHorizontal_triggered(); void on_actionVertical_triggered(); @@ -100,10 +99,8 @@ private slots: void on_actionAbout_triggered(); // Show "About" dialog - void on_actionChinese_triggered(); - void on_actionEnglish_triggered(); - void on_actionT_triggered(); +// void on_actionT_triggered(); void on_actionLaplace_triggered(); @@ -119,8 +116,6 @@ private slots: void on_actionArea_triggered(); - void on_actionConnected_domain_triggered(); - void on_actionCircumference_triggered(); @@ -134,13 +129,11 @@ private slots: void on_actionThinning_triggered(); - void on_actionRGB2HSV_triggered(); - - - void on_actionRGB2HSL_triggered(); +// void on_actionRGB2HSV_triggered(); +// void on_actionRGB2HSL_triggered(); +// void on_actionRGB2Cmyk_triggered(); - void on_actionRGB2Cmyk_triggered(); - void on_actionFinal_triggered(); + void on_actionRotate_triggered(); private: QAction *finalEx; diff --git a/mainwindow.ui b/src/mainwindow/mainwindow.ui old mode 100755 new mode 100644 similarity index 67% rename from mainwindow.ui rename to src/mainwindow/mainwindow.ui index e2f5193..30ea4ff --- a/mainwindow.ui +++ b/src/mainwindow/mainwindow.ui @@ -6,16 +6,16 @@ 0 0 - 978 - 604 + 1196 + 711 ImageQt - - :/img/src/logo_2.png:/img/src/logo_2.png + + :/img/logo_2.png:/img/logo_2.png @@ -41,13 +41,13 @@ 0 0 - 978 - 23 + 1196 + 26 - Fi&le + 文件(&F) @@ -58,7 +58,7 @@ - Edit + 编辑 @@ -67,21 +67,13 @@ - Help + 帮助 - - - &Language - - - - - - &Grey Transfrom + 灰色变换(&G) @@ -94,33 +86,27 @@ - Geo&metric Transform + 几何变换 - + - &Rotate - - - - - - - &Flip + 翻转 + - - + + - Artistic Effect + 艺术效果 - &Frame + 相框 @@ -128,16 +114,16 @@ - &Texture + 纹理 - T&emperature + 色温 - + :/img/src/temperature_72px.png:/img/src/temperature_72px.png @@ -149,7 +135,7 @@ - Smoothi&ng and Sharpen + 模糊与锐化 @@ -160,7 +146,7 @@ - Contour Extraction + 轮廓提取 @@ -170,7 +156,7 @@ - Morphology + 形态学 @@ -178,14 +164,6 @@ - - - Color Space - - - - - @@ -194,7 +172,6 @@ - @@ -210,11 +187,14 @@ - - :/img/src/Open_folder_full_48px_1186194_easyicon.net.png:/img/src/Open_folder_full_48px_1186194_easyicon.net.png + + :/img/open.svg:/img/open.svg - &Open... + 打开(&O) + + + 打开一张图片 Ctrl+O @@ -222,20 +202,20 @@ - - :/img/src/clear_gtk_72px_43338_easyicon.net.png:/img/src/clear_gtk_72px_43338_easyicon.net.png + + :/img/clear.svg:/img/clear.svg - &Close + 关闭图片 - - :/img/src/save.svg:/img/src/save.svg + + :/img/save.svg:/img/save.svg - &Save... + 保存(&S) Ctrl+S @@ -243,12 +223,12 @@ - Sa&ve As... + 另存为 - &Exit + 退出 Ctrl+Q @@ -256,11 +236,11 @@ - - :/img/src/avatar-default.png:/img/src/avatar-default.png + + :/img/about.svg:/img/about.svg - &About + 关于 @@ -275,43 +255,34 @@ - - :/img/src/restore.png:/img/src/restore.png + + :/img/restore.png:/img/restore.png - R&estore + 恢复 - + :/img/src/left.png:/img/src/left.png &Left - - - - :/img/src/right.png:/img/src/right.png - - - &Right - - - + :/img/src/zoom.png:/img/src/zoom.png - &Zoom + 缩放 - G&rayscale + 灰度图像 @@ -326,163 +297,145 @@ - &Movie frame + 电影 - &Classic frame + 经典 - &Flower frame + 小花 - &Metal + 金属 - - :/img/src/brightness.svg:/img/src/brightness.svg - - - &Adjust brightness - - - - - - :/img/src/chinese.png:/img/src/chinese.png + + :/img/brightness.svg:/img/brightness.svg - &Chinese - - - - - - :/img/src/english.png:/img/src/english.png - - - &English + 亮度 - + :/img/src/horizontal.png:/img/src/horizontal.png - &Horizontal + 水平 - + :/img/src/vertical.png:/img/src/vertical.png - &Vertical + 垂直 - - :/img/src/histogram.png:/img/src/histogram.png + + :/img/histogram.png:/img/histogram.png - &Histogram + 直方图 - + :/img/src/line_graphic_72p.png:/img/src/line_graphic_72p.png - &Linear transform + 线性变换 - L&ogarithm transform + 对数变换 - &Power transform + 幂次变换 - + :/img/src/Line_Chart_72px.png:/img/src/Line_Chart_72px.png - &Exp transfrom + 指数变换 - &Two thresholds transform + 双阈值变换 - &Stretch transformation + 拉伸变换 - &Simple + 简单模糊 - + :/img/src/blur_on_72px.png:/img/src/blur_on_72px.png - &Gauss + 高斯模糊 - Meida Filter + 中值滤波 - Laplace + 拉普拉斯锐化 - Sobel + Sobel 边缘检测 - Binaryzation + 二值化 - Prewitt + Prewitt 边缘检测 - Contour extraction + 轮廓提取 - Edge following + 边缘跟踪 @@ -495,39 +448,29 @@ Circumference - - - Connected domain - - - Dilate + 腐蚀 - Expansion + 膨胀 - Opening + 开运算 - Closing + 闭运算 - Thinning - - - - - RGB2HSV + 细化处理 @@ -535,14 +478,9 @@ Equalization - - - RGB2HSL - - - + - RGB2Cmyk + 旋转 @@ -555,7 +493,7 @@ - + diff --git a/src/Line_Chart_72px.png b/src/res/Line_Chart_72px.png old mode 100755 new mode 100644 similarity index 100% rename from src/Line_Chart_72px.png rename to src/res/Line_Chart_72px.png diff --git a/src/Final_Cut_Pro_X_96px_1134672_easyicon.net.png b/src/res/Open_folder_full_48px_1186194_easyicon.net.png similarity index 100% rename from src/Final_Cut_Pro_X_96px_1134672_easyicon.net.png rename to src/res/Open_folder_full_48px_1186194_easyicon.net.png diff --git a/src/res/about.svg b/src/res/about.svg new file mode 100644 index 0000000..f5a128a --- /dev/null +++ b/src/res/about.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/blur_on_72px.png b/src/res/blur_on_72px.png old mode 100755 new mode 100644 similarity index 100% rename from src/blur_on_72px.png rename to src/res/blur_on_72px.png diff --git a/src/res/brightness.svg b/src/res/brightness.svg new file mode 100644 index 0000000..d70534d --- /dev/null +++ b/src/res/brightness.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/chinese.png b/src/res/chinese.png old mode 100755 new mode 100644 similarity index 100% rename from src/chinese.png rename to src/res/chinese.png diff --git a/src/res/clear.svg b/src/res/clear.svg new file mode 100644 index 0000000..3274b0b --- /dev/null +++ b/src/res/clear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cn.qm b/src/res/cn.qm old mode 100755 new mode 100644 similarity index 100% rename from cn.qm rename to src/res/cn.qm diff --git a/cn.ts b/src/res/cn.ts old mode 100755 new mode 100644 similarity index 100% rename from cn.ts rename to src/res/cn.ts diff --git a/src/res/default.qrc b/src/res/default.qrc new file mode 100644 index 0000000..402ac70 --- /dev/null +++ b/src/res/default.qrc @@ -0,0 +1,35 @@ + + + frame_3.png + frame_1.png + frame_2.png + logo_1.png + logo_2.png + metal.png + chinese.png + english.png + right.png + horizontal.png + vertical.png + left.png + restore.png + histogram.png + brightness.svg + save.svg + zoom.png + lineGrey.gif + quill_72px.png + log.png + fun_exp.png + line_graphic_72p.png + Line_Chart_72px.png + temperature_72px.png + blur_on_72px.png + open.svg + clear.svg + about.svg + + + cn.qm + + diff --git a/src/english.png b/src/res/english.png old mode 100755 new mode 100644 similarity index 100% rename from src/english.png rename to src/res/english.png diff --git a/src/frame_1.png b/src/res/frame_1.png old mode 100755 new mode 100644 similarity index 100% rename from src/frame_1.png rename to src/res/frame_1.png diff --git a/src/frame_2.png b/src/res/frame_2.png old mode 100755 new mode 100644 similarity index 100% rename from src/frame_2.png rename to src/res/frame_2.png diff --git a/src/frame_3.png b/src/res/frame_3.png old mode 100755 new mode 100644 similarity index 100% rename from src/frame_3.png rename to src/res/frame_3.png diff --git a/src/fun_exp.png b/src/res/fun_exp.png old mode 100755 new mode 100644 similarity index 100% rename from src/fun_exp.png rename to src/res/fun_exp.png diff --git a/src/histogram.png b/src/res/histogram.png old mode 100755 new mode 100644 similarity index 100% rename from src/histogram.png rename to src/res/histogram.png diff --git a/src/horizontal.png b/src/res/horizontal.png old mode 100755 new mode 100644 similarity index 100% rename from src/horizontal.png rename to src/res/horizontal.png diff --git a/src/left.png b/src/res/left.png old mode 100755 new mode 100644 similarity index 100% rename from src/left.png rename to src/res/left.png diff --git a/src/lineGrey.gif b/src/res/lineGrey.gif old mode 100755 new mode 100644 similarity index 100% rename from src/lineGrey.gif rename to src/res/lineGrey.gif diff --git a/src/line_graphic_72p.png b/src/res/line_graphic_72p.png old mode 100755 new mode 100644 similarity index 100% rename from src/line_graphic_72p.png rename to src/res/line_graphic_72p.png diff --git a/src/log.png b/src/res/log.png old mode 100755 new mode 100644 similarity index 100% rename from src/log.png rename to src/res/log.png diff --git a/src/logo_1.png b/src/res/logo_1.png old mode 100755 new mode 100644 similarity index 100% rename from src/logo_1.png rename to src/res/logo_1.png diff --git a/src/logo_2.png b/src/res/logo_2.png old mode 100755 new mode 100644 similarity index 100% rename from src/logo_2.png rename to src/res/logo_2.png diff --git a/src/metal.png b/src/res/metal.png old mode 100755 new mode 100644 similarity index 100% rename from src/metal.png rename to src/res/metal.png diff --git a/src/res/open.svg b/src/res/open.svg new file mode 100644 index 0000000..b92d003 --- /dev/null +++ b/src/res/open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/quill_72px.png b/src/res/quill_72px.png old mode 100755 new mode 100644 similarity index 100% rename from src/quill_72px.png rename to src/res/quill_72px.png diff --git a/src/restore.png b/src/res/restore.png old mode 100755 new mode 100644 similarity index 100% rename from src/restore.png rename to src/res/restore.png diff --git a/src/right.png b/src/res/right.png old mode 100755 new mode 100644 similarity index 100% rename from src/right.png rename to src/res/right.png diff --git a/src/res/save.svg b/src/res/save.svg new file mode 100644 index 0000000..ff21b33 --- /dev/null +++ b/src/res/save.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/temperature_72px.png b/src/res/temperature_72px.png old mode 100755 new mode 100644 similarity index 100% rename from src/temperature_72px.png rename to src/res/temperature_72px.png diff --git a/src/vertical.png b/src/res/vertical.png old mode 100755 new mode 100644 similarity index 100% rename from src/vertical.png rename to src/res/vertical.png diff --git a/src/zoom.png b/src/res/zoom.png old mode 100755 new mode 100644 similarity index 100% rename from src/zoom.png rename to src/res/zoom.png diff --git a/src/save.svg b/src/save.svg deleted file mode 100755 index 0776c87..0000000 --- a/src/save.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - diff --git a/src/settings_backup_restore_48px_1182197_easyicon.net.png b/src/settings_backup_restore_48px_1182197_easyicon.net.png deleted file mode 100644 index 697ebf9..0000000 Binary files a/src/settings_backup_restore_48px_1182197_easyicon.net.png and /dev/null differ diff --git a/src/src.pro b/src/src.pro new file mode 100644 index 0000000..63d2bb9 --- /dev/null +++ b/src/src.pro @@ -0,0 +1,61 @@ +QT += core gui concurrent + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + +TARGET = imViewer +TEMPLATE = app +CONFIG += C++11 + +TEMPLATE = app + +INCLUDEPATH += ./ \ + dialog/ \ + utils/ \ + mainwindow/ + +HEADERS += dialog/dialog_exp_transform.h \ + dialog/dialog_linear_gray.h \ + dialog/dialog_log_grey.h \ + dialog/dialog_power_grey.h \ + dialog/dialog_stretch_transform.h \ + dialog/dialog_two_threshold_transform.h \ + mainwindow/mainwindow.h \ + mainwindow/graphicsview.h \ + dialog/dialog_gaussianblur.h \ + mainwindow/graphicsview.h \ + utils/histogram.h \ + utils/medianfilter.h \ + utils/tools.h \ + utils/qcustomplot.h \ + + + +SOURCES += dialog/dialog_exp_transform.cpp \ + dialog/dialog_gaussianblur.cpp \ + dialog/dialog_linear_gray.cpp \ + dialog/dialog_log_grey.cpp \ + dialog/dialog_power_grey.cpp \ + dialog/dialog_stretch_transform.cpp \ + dialog/dialog_two_threshold_transform.cpp \ + mainwindow/mainwindow.cpp \ + mainwindow/graphicsview.cpp \ + utils/gaussianblur.cpp \ + utils/histogram.cpp \ + utils/medianfilter.cpp \ + utils/qcustomplot.cpp \ + utils/tools.cpp \ + main.cpp + +FORMS += mainwindow/mainwindow.ui \ + dialog/gaussianblurdialog.ui \ + dialog/dialog_linear_gray.ui \ + dialog/dialog_log_grey.ui \ + dialog/dialog_power_grey.ui \ + dialog/dialog_exp_transform.ui \ + dialog/dialog_two_threshold_transform.ui \ + dialog/dialog_stretch_transform.ui + +RESOURCES += \ + res/default.qrc + +TRANSLATIONS += res/cn.ts diff --git a/gaussianblur.cpp b/src/utils/gaussianblur.cpp old mode 100755 new mode 100644 similarity index 100% rename from gaussianblur.cpp rename to src/utils/gaussianblur.cpp diff --git a/gaussianblur.h b/src/utils/gaussianblur.h old mode 100755 new mode 100644 similarity index 100% rename from gaussianblur.h rename to src/utils/gaussianblur.h diff --git a/histogram.cpp b/src/utils/histogram.cpp old mode 100755 new mode 100644 similarity index 100% rename from histogram.cpp rename to src/utils/histogram.cpp diff --git a/histogram.h b/src/utils/histogram.h old mode 100755 new mode 100644 similarity index 96% rename from histogram.h rename to src/utils/histogram.h index e5b44ba..9be3383 --- a/histogram.h +++ b/src/utils/histogram.h @@ -9,7 +9,7 @@ class Histogram : public QLabel { public: - Histogram(QWidget* parent = 0); + Histogram(QWidget* parent = nullptr); Histogram(QWidget*, Histogram*); void computeHstgrm(QImage img); diff --git a/medianfilter.cpp b/src/utils/medianfilter.cpp old mode 100755 new mode 100644 similarity index 100% rename from medianfilter.cpp rename to src/utils/medianfilter.cpp diff --git a/medianfilter.h b/src/utils/medianfilter.h old mode 100755 new mode 100644 similarity index 100% rename from medianfilter.h rename to src/utils/medianfilter.h diff --git a/qcustomplot.cpp b/src/utils/qcustomplot.cpp old mode 100755 new mode 100644 similarity index 100% rename from qcustomplot.cpp rename to src/utils/qcustomplot.cpp diff --git a/qcustomplot.h b/src/utils/qcustomplot.h old mode 100755 new mode 100644 similarity index 100% rename from qcustomplot.h rename to src/utils/qcustomplot.h diff --git a/tools.cpp b/src/utils/tools.cpp old mode 100755 new mode 100644 similarity index 85% rename from tools.cpp rename to src/utils/tools.cpp index 59c21a8..bc4ea58 --- a/tools.cpp +++ b/src/utils/tools.cpp @@ -1,4 +1,4 @@ -#include "tools.h" +#include "tools.h" #include "medianfilter.h" #define min2(a,b) (a)<(b)?(a):(a) @@ -112,6 +112,7 @@ QImage Tools::Brightness(int delta, QImage origin) // Check if the new values are between 0 and 255 r = qBound(0, r, 255); g = qBound(0, g, 255); + b = qBound(0, b, 255); newImage->setPixel(x,y, qRgb(r,g,b)); } @@ -483,6 +484,7 @@ QImage Tools::LaplaceSharpen(const QImage &origin) int sumB = 0; //对每一个像素使用模板 + for(int m=x-1; m<= x+1; m++) for(int n=y-1; n<=y+1; n++) { @@ -539,7 +541,11 @@ QImage Tools::SobelEdge(const QImage &origin) int width = grayImage.width(); QImage newImage = QImage(width, height,QImage::Format_RGB888); - float sobel_norm[width*height]; + /* 改写下面这行解决:某些编译器下不支持“变长数组”的问题 */ + // float sobel_norm[width*height]; + + + float *sobel_norm = new float[width * height]; float max = 0.0; QColor my_color; @@ -558,7 +564,6 @@ QImage Tools::SobelEdge(const QImage &origin) value_gx += Gx[p*3+k] * qRed(pixel); value_gy += Gy[p*3+k] * qRed(pixel); } -// sobel_norm[x+y*width] = sqrt(value_gx*value_gx + value_gy*value_gy)/1.0; sobel_norm[x+y*width] = abs(value_gx) + abs(value_gy); max=sobel_norm[x+y*width]>max ? sobel_norm[x+y*width]:max; @@ -572,6 +577,7 @@ QImage Tools::SobelEdge(const QImage &origin) newImage.setPixel(i,j,my_color.rgb()); } } + delete[] sobel_norm; return newImage; } @@ -735,11 +741,6 @@ QImage Tools::ContourExtraction(const QImage &origin) } -QImage Tools::ConnectedDomain(const QImage &origin) -{ - -} - /***************************************************************************** * 全方位腐蚀 @@ -834,158 +835,66 @@ QImage Tools::Closing(const QImage &origin) return afterDilate; } -/***************************************************************************** - * 图像细化 - * **************************************************************************/ - -QImage Tools::Thinning(const QImage &origin) -{ - QImage binImg = Binaryzation(origin); - int width = binImg.width(); - int height = binImg.height(); - - int neighbor[8]; - QImage mark = QImage(width, height, QImage::Format_RGB888); - mark.fill(Qt::black); - - bool loop = true; - - int markNum = 0; - while(loop) - { - loop = false; - markNum = 0; - for(int y=1; y6) continue; - - // 3 - int sp = 0; - for(int i=1; i<8; i++) - { - if(neighbor[i] - neighbor[i-1] == 255) - sp++; - - } - if(neighbor[0] - neighbor[7] == 255) - sp++; - if (sp!=1) continue; - - // 4 - if(neighbor[2]&neighbor[0]&neighbor[4]!=0) - continue; - //条件5:p2*p6*p4==0 - if(neighbor[2]&neighbor[6]&neighbor[4]!=0) - continue; - - //标记删除 - mark.setPixel(x,y,qRgb(1,1,1)); - markNum ++; - loop = true; - } - } - - // 将标记删除的点置为背景色 - - for(int y=0; y