[TASK] Parametrize hough transformation matching threshold.
This commit is contained in:
parent
229aaf8d5d
commit
4dd5fea5aa
|
@ -59,7 +59,6 @@ class HoughMachine {
|
|||
};
|
||||
|
||||
void run(int a_steps, int r_steps) {
|
||||
this->reset();
|
||||
this->x_center = this->original->width()/2;
|
||||
this->y_center = this->original->height()/2;
|
||||
this->n_ang = a_steps;
|
||||
|
@ -84,9 +83,11 @@ class HoughMachine {
|
|||
pixel.getHsl(&h, &s, &l);
|
||||
if(this->matching_threshold > 0) {
|
||||
int threshold = this->matching_threshold;
|
||||
std::cout << "Comparing " << l << " < " << threshold << std::endl;
|
||||
if(l < threshold) this->doPixel(u, v);
|
||||
} else {
|
||||
int threshold = -this->matching_threshold;
|
||||
std::cout << "Comparing " << l << " > " << threshold << std::endl;
|
||||
if(l > threshold) this->doPixel(u, v);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -771,14 +771,14 @@ void ImageViewer::doUnsharpMasking(void) {
|
|||
* @brief ImageViewer::runHoughTransformation
|
||||
*/
|
||||
void ImageViewer::runHoughTransformation(void) {
|
||||
logFile << "Let's run a hough transformation!" << std::endl;
|
||||
int threshold = hough_pixel_threshold->value();
|
||||
logFile << "Let's run a hough transformation! Threshold is " << threshold << std::endl;
|
||||
renewLogging();
|
||||
HoughMachine* hm = new HoughMachine(original, working_copy);
|
||||
hm->setMatchingThreshold(15);
|
||||
hm->reset();
|
||||
hm->setMatchingThreshold(threshold);
|
||||
hm->run(256, 256);
|
||||
|
||||
hm->drawLines(10);
|
||||
|
||||
delete hm;
|
||||
updateImageDisplay();
|
||||
}
|
||||
|
@ -1126,7 +1126,15 @@ void ImageViewer::generateControlPanels() {
|
|||
run_hough_transformation = new QPushButton("Run hough transformation!");
|
||||
QObject::connect(run_hough_transformation, SIGNAL(clicked()), this, SLOT(runHoughTransformation()));
|
||||
|
||||
task_tab6_scrolllayout->addWidget(new QLabel("Task #6 and stuff"));
|
||||
hough_pixel_threshold = new QDoubleSpinBox();
|
||||
hough_pixel_threshold->setDecimals(0);
|
||||
hough_pixel_threshold->setMinimum(-255);
|
||||
hough_pixel_threshold->setMaximum(255);
|
||||
hough_pixel_threshold->setValue(15);
|
||||
|
||||
task_tab6_scrolllayout->addWidget(new QLabel("Pixel threshold for hough transformation:"));
|
||||
task_tab6_scrolllayout->addWidget(new QLabel("[negative value -> intensity < threshold matches]"));
|
||||
task_tab6_scrolllayout->addWidget(hough_pixel_threshold);
|
||||
task_tab6_scrolllayout->addWidget(run_hough_transformation);
|
||||
|
||||
tabWidget->addTab(task_tab6_widget, "Task #6");
|
||||
|
|
|
@ -168,6 +168,7 @@ class ImageViewer : public QMainWindow {
|
|||
QScrollArea* task_tab6_scrollarea;
|
||||
QVBoxLayout* task_tab6_scrolllayout;
|
||||
|
||||
QDoubleSpinBox* hough_pixel_threshold;
|
||||
QPushButton* run_hough_transformation;
|
||||
|
||||
// "My" space for storing data/results
|
||||
|
|
Loading…
Reference in New Issue