From e498146c7e787a43f5fb7df7833773f4631a609a Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 5 Jan 2016 18:06:45 +0100 Subject: [PATCH] [TASK] Add further controls for usm. --- canny_edge_machine.cpp | 4 ++++ imageviewer-qt4.cpp | 20 +++++++++++++++++--- imageviewer-qt4.h | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/canny_edge_machine.cpp b/canny_edge_machine.cpp index d67de1b..c11bbfc 100644 --- a/canny_edge_machine.cpp +++ b/canny_edge_machine.cpp @@ -311,6 +311,10 @@ class CannyEdgeMachine { this->showEdges(); }; + int* getBinaryEdgePixels(void) { + return this->binary_edge_pixels; + }; + }; #endif diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 5f79071..e9f97b7 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -717,12 +717,14 @@ void ImageViewer::runCannyEdgeThirdStep(void) { } /** - * Apply results of canny edge using unsharp masking. + * Do generic usm. * * @brief ImageViewer::doUnsharpMasking */ void ImageViewer::doUnsharpMasking(void) { - logFile << "Doing USM ..." << std::endl; + double alpha = usm_sharpening->value(); + int gauss_width = usm_gauss_width->value(); + logFile << "Doing USM using gauss width of " << gauss_width << " and alpha of " << alpha << std::endl; renewLogging(); updateImageDisplay(); } @@ -1016,6 +1018,14 @@ void ImageViewer::generateControlPanels() { t_high_spinbox->setDecimals(5); t_high_spinbox->setValue(4.0); + usm_sharpening = new QDoubleSpinBox(); + usm_sharpening->setDecimals(5); + usm_sharpening->setValue(1.0); + + usm_gauss_width = new QDoubleSpinBox(); + usm_gauss_width->setDecimals(5); + usm_gauss_width->setValue(3); + run_usm = new QPushButton("Apply unsharp masking!"); QObject::connect(run_usm, SIGNAL(clicked()), this, SLOT(doUnsharpMasking())); @@ -1031,7 +1041,11 @@ void ImageViewer::generateControlPanels() { task_tab5_scrolllayout->addWidget(t_high_spinbox); task_tab5_scrolllayout->addWidget(run_canny_edge_third_step); task_tab5_scrolllayout->addWidget(run_canny_edge); - task_tab5_scrolllayout->addWidget(new QLabel("Unsharp masking")); + task_tab5_scrolllayout->addWidget(new QLabel(" --- Unsharp masking --- "); + task_tab5_scrolllayout->addWidget(new QLabel("Sharpening factor alpha")); + task_tab5_scrolllayout->addWidget(usm_sharpening); + task_tab5_scrolllayout->addWidget(new QLabel("Gauss filter width sigma")); + task_tab5_scrolllayout->addWidget(usm_gauss_width); task_tab5_scrolllayout->addWidget(run_usm); tabWidget->addTab(task_tab5_widget, "Task #5"); diff --git a/imageviewer-qt4.h b/imageviewer-qt4.h index 65aa314..0ac5226 100644 --- a/imageviewer-qt4.h +++ b/imageviewer-qt4.h @@ -156,6 +156,8 @@ class ImageViewer : public QMainWindow { QPushButton* run_canny_edge_second_step; QPushButton* run_canny_edge_third_step; QPushButton* run_usm; + QDoubleSpinBox* usm_sharpening; + QDoubleSpinBox* usm_gauss_width; // "My" space for storing data/results LazyImage* original;