[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) {
|
void run(int a_steps, int r_steps) {
|
||||||
this->reset();
|
|
||||||
this->x_center = this->original->width()/2;
|
this->x_center = this->original->width()/2;
|
||||||
this->y_center = this->original->height()/2;
|
this->y_center = this->original->height()/2;
|
||||||
this->n_ang = a_steps;
|
this->n_ang = a_steps;
|
||||||
|
@ -84,9 +83,11 @@ class HoughMachine {
|
||||||
pixel.getHsl(&h, &s, &l);
|
pixel.getHsl(&h, &s, &l);
|
||||||
if(this->matching_threshold > 0) {
|
if(this->matching_threshold > 0) {
|
||||||
int threshold = this->matching_threshold;
|
int threshold = this->matching_threshold;
|
||||||
|
std::cout << "Comparing " << l << " < " << threshold << std::endl;
|
||||||
if(l < threshold) this->doPixel(u, v);
|
if(l < threshold) this->doPixel(u, v);
|
||||||
} else {
|
} else {
|
||||||
int threshold = -this->matching_threshold;
|
int threshold = -this->matching_threshold;
|
||||||
|
std::cout << "Comparing " << l << " > " << threshold << std::endl;
|
||||||
if(l > threshold) this->doPixel(u, v);
|
if(l > threshold) this->doPixel(u, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,14 +771,14 @@ void ImageViewer::doUnsharpMasking(void) {
|
||||||
* @brief ImageViewer::runHoughTransformation
|
* @brief ImageViewer::runHoughTransformation
|
||||||
*/
|
*/
|
||||||
void ImageViewer::runHoughTransformation(void) {
|
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();
|
renewLogging();
|
||||||
HoughMachine* hm = new HoughMachine(original, working_copy);
|
HoughMachine* hm = new HoughMachine(original, working_copy);
|
||||||
hm->setMatchingThreshold(15);
|
hm->reset();
|
||||||
|
hm->setMatchingThreshold(threshold);
|
||||||
hm->run(256, 256);
|
hm->run(256, 256);
|
||||||
|
|
||||||
hm->drawLines(10);
|
hm->drawLines(10);
|
||||||
|
|
||||||
delete hm;
|
delete hm;
|
||||||
updateImageDisplay();
|
updateImageDisplay();
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1126,15 @@ void ImageViewer::generateControlPanels() {
|
||||||
run_hough_transformation = new QPushButton("Run hough transformation!");
|
run_hough_transformation = new QPushButton("Run hough transformation!");
|
||||||
QObject::connect(run_hough_transformation, SIGNAL(clicked()), this, SLOT(runHoughTransformation()));
|
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);
|
task_tab6_scrolllayout->addWidget(run_hough_transformation);
|
||||||
|
|
||||||
tabWidget->addTab(task_tab6_widget, "Task #6");
|
tabWidget->addTab(task_tab6_widget, "Task #6");
|
||||||
|
|
|
@ -168,6 +168,7 @@ class ImageViewer : public QMainWindow {
|
||||||
QScrollArea* task_tab6_scrollarea;
|
QScrollArea* task_tab6_scrollarea;
|
||||||
QVBoxLayout* task_tab6_scrolllayout;
|
QVBoxLayout* task_tab6_scrolllayout;
|
||||||
|
|
||||||
|
QDoubleSpinBox* hough_pixel_threshold;
|
||||||
QPushButton* run_hough_transformation;
|
QPushButton* run_hough_transformation;
|
||||||
|
|
||||||
// "My" space for storing data/results
|
// "My" space for storing data/results
|
||||||
|
|
Loading…
Reference in New Issue