[TASK] Add parameters to canny edge.
This commit is contained in:
parent
04c9b4b3f4
commit
a646539719
|
@ -650,8 +650,13 @@ void ImageViewer::applyBasicFilterWithOverflowHandling() {
|
||||||
*/
|
*/
|
||||||
void ImageViewer::runCannyEdge(void) {
|
void ImageViewer::runCannyEdge(void) {
|
||||||
CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy);
|
CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy);
|
||||||
cem.setGaussFilterSize(3);
|
int filter_size = gauss_filter_size->value();
|
||||||
cem.setThresholdValues(2.5, 3.5); //TODO
|
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();
|
cem.work();
|
||||||
updateImageDisplay();
|
updateImageDisplay();
|
||||||
}
|
}
|
||||||
|
@ -919,6 +924,25 @@ void ImageViewer::generateControlPanels() {
|
||||||
run_canny_edge = new QPushButton("Run canny edge algorithm!");
|
run_canny_edge = new QPushButton("Run canny edge algorithm!");
|
||||||
QObject::connect(run_canny_edge, SIGNAL(clicked()), this, SLOT(runCannyEdge()));
|
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);
|
task_tab5_scrolllayout->addWidget(run_canny_edge);
|
||||||
|
|
||||||
tabWidget->addTab(task_tab5_widget, "Task #5");
|
tabWidget->addTab(task_tab5_widget, "Task #5");
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "fstream"
|
#include "fstream"
|
||||||
|
@ -146,6 +147,9 @@ class ImageViewer : public QMainWindow {
|
||||||
QScrollArea* task_tab5_scrollarea;
|
QScrollArea* task_tab5_scrollarea;
|
||||||
QVBoxLayout* task_tab5_scrolllayout;
|
QVBoxLayout* task_tab5_scrolllayout;
|
||||||
|
|
||||||
|
QDoubleSpinBox* gauss_filter_size;
|
||||||
|
QDoubleSpinBox* t_low_spinbox;
|
||||||
|
QDoubleSpinBox* t_high_spinbox;
|
||||||
QPushButton* run_canny_edge;
|
QPushButton* run_canny_edge;
|
||||||
|
|
||||||
// "My" space for storing data/results
|
// "My" space for storing data/results
|
||||||
|
|
Loading…
Reference in New Issue