[TASK] Add further controls for usm.

This commit is contained in:
Jan Philipp Timme 2016-01-05 18:06:45 +01:00
parent e3fedb76ad
commit e498146c7e
3 changed files with 23 additions and 3 deletions

View File

@ -311,6 +311,10 @@ class CannyEdgeMachine {
this->showEdges(); this->showEdges();
}; };
int* getBinaryEdgePixels(void) {
return this->binary_edge_pixels;
};
}; };
#endif #endif

View File

@ -717,12 +717,14 @@ void ImageViewer::runCannyEdgeThirdStep(void) {
} }
/** /**
* Apply results of canny edge using unsharp masking. * Do generic usm.
* *
* @brief ImageViewer::doUnsharpMasking * @brief ImageViewer::doUnsharpMasking
*/ */
void ImageViewer::doUnsharpMasking(void) { 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(); renewLogging();
updateImageDisplay(); updateImageDisplay();
} }
@ -1016,6 +1018,14 @@ void ImageViewer::generateControlPanels() {
t_high_spinbox->setDecimals(5); t_high_spinbox->setDecimals(5);
t_high_spinbox->setValue(4.0); 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!"); run_usm = new QPushButton("Apply unsharp masking!");
QObject::connect(run_usm, SIGNAL(clicked()), this, SLOT(doUnsharpMasking())); 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(t_high_spinbox);
task_tab5_scrolllayout->addWidget(run_canny_edge_third_step); task_tab5_scrolllayout->addWidget(run_canny_edge_third_step);
task_tab5_scrolllayout->addWidget(run_canny_edge); 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); task_tab5_scrolllayout->addWidget(run_usm);
tabWidget->addTab(task_tab5_widget, "Task #5"); tabWidget->addTab(task_tab5_widget, "Task #5");

View File

@ -156,6 +156,8 @@ class ImageViewer : public QMainWindow {
QPushButton* run_canny_edge_second_step; QPushButton* run_canny_edge_second_step;
QPushButton* run_canny_edge_third_step; QPushButton* run_canny_edge_third_step;
QPushButton* run_usm; QPushButton* run_usm;
QDoubleSpinBox* usm_sharpening;
QDoubleSpinBox* usm_gauss_width;
// "My" space for storing data/results // "My" space for storing data/results
LazyImage* original; LazyImage* original;