diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index 316b6f6..88fe15e 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -650,8 +650,13 @@ void ImageViewer::applyBasicFilterWithOverflowHandling() { */ void ImageViewer::runCannyEdge(void) { CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy); - cem.setGaussFilterSize(3); - cem.setThresholdValues(2.5, 3.5); //TODO + int filter_size = gauss_filter_size->value(); + double t_low = t_low_spinbox->value(); + double t_high = t_high_spinbox->value(); + logFile << "Canny-Edge using N*N filter size: " << filter_size << ", and thresholds: " << t_low << ", " << t_high << std::endl; + renewLogging(); + cem.setGaussFilterSize(filter_size); + cem.setThresholdValues(t_low, t_high); cem.work(); updateImageDisplay(); } @@ -919,6 +924,25 @@ void ImageViewer::generateControlPanels() { run_canny_edge = new QPushButton("Run canny edge algorithm!"); QObject::connect(run_canny_edge, SIGNAL(clicked()), this, SLOT(runCannyEdge())); + gauss_filter_size = new QDoubleSpinBox(); + gauss_filter_size->setDecimals(0); + gauss_filter_size->setMinimum(3); + gauss_filter_size->setValue(3); + + t_low_spinbox = new QDoubleSpinBox(); + t_low_spinbox->setDecimals(5); + t_low_spinbox->setValue(2.0); + + t_high_spinbox = new QDoubleSpinBox(); + t_high_spinbox->setDecimals(5); + t_high_spinbox->setValue(4.0); + + task_tab5_scrolllayout->addWidget(new QLabel("Gauss filter size (NxN)")); + task_tab5_scrolllayout->addWidget(gauss_filter_size); + task_tab5_scrolllayout->addWidget(new QLabel("Low threshold value")); + task_tab5_scrolllayout->addWidget(t_low_spinbox); + task_tab5_scrolllayout->addWidget(new QLabel("High threshold value")); + task_tab5_scrolllayout->addWidget(t_high_spinbox); task_tab5_scrolllayout->addWidget(run_canny_edge); tabWidget->addTab(task_tab5_widget, "Task #5"); diff --git a/imageviewer-qt4.h b/imageviewer-qt4.h index 05aad74..a139fee 100644 --- a/imageviewer-qt4.h +++ b/imageviewer-qt4.h @@ -49,6 +49,7 @@ #include #include #include +#include #include #include "fstream" @@ -145,7 +146,10 @@ class ImageViewer : public QMainWindow { QWidget* task_tab5_scrollwidget; QScrollArea* task_tab5_scrollarea; QVBoxLayout* task_tab5_scrolllayout; - + + QDoubleSpinBox* gauss_filter_size; + QDoubleSpinBox* t_low_spinbox; + QDoubleSpinBox* t_high_spinbox; QPushButton* run_canny_edge; // "My" space for storing data/results