[TASK] Parameterize gauss filter size.

This commit is contained in:
Jan Philipp Timme 2015-12-20 17:24:40 +01:00
parent 09c9390f42
commit 04c9b4b3f4
2 changed files with 9 additions and 4 deletions

View File

@ -26,6 +26,7 @@ class CannyEdgeMachine {
int* gradient_y;
// Params
int filter_size;
double t_low;
double t_high;
@ -53,6 +54,10 @@ class CannyEdgeMachine {
free(this->gradient_y);
};
void setGaussFilterSize(int filter_size) {
this->filter_size = filter_size;
};
void setThresholdValues(double t_low, double t_high) {
this->t_low = t_low;
this->t_high = t_high;
@ -68,7 +73,7 @@ class CannyEdgeMachine {
}
};
void doGaussBlur(int filter_width=3) {
void doGaussBlur(int filter_width) {
// build the gauss filter
int* filter = (int*) malloc(sizeof(int) * filter_width * filter_width);
int sum_weights = 0;
@ -266,7 +271,7 @@ class CannyEdgeMachine {
void work() {
this->reset();
this->doGaussBlur();
this->doGaussBlur(this->filter_size);
this->doGradiants();
this->doGradiantMagnitude();
this->filterLocalMaxima();

View File

@ -649,8 +649,8 @@ void ImageViewer::applyBasicFilterWithOverflowHandling() {
* @brief ImageViewer::runCannyEdge
*/
void ImageViewer::runCannyEdge(void) {
//TODO
CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy);
cem.setGaussFilterSize(3);
cem.setThresholdValues(2.5, 3.5); //TODO
cem.work();
updateImageDisplay();