[TASK] Parameterize gauss filter size.
This commit is contained in:
parent
09c9390f42
commit
04c9b4b3f4
|
@ -26,6 +26,7 @@ class CannyEdgeMachine {
|
||||||
int* gradient_y;
|
int* gradient_y;
|
||||||
|
|
||||||
// Params
|
// Params
|
||||||
|
int filter_size;
|
||||||
double t_low;
|
double t_low;
|
||||||
double t_high;
|
double t_high;
|
||||||
|
|
||||||
|
@ -53,6 +54,10 @@ class CannyEdgeMachine {
|
||||||
free(this->gradient_y);
|
free(this->gradient_y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setGaussFilterSize(int filter_size) {
|
||||||
|
this->filter_size = filter_size;
|
||||||
|
};
|
||||||
|
|
||||||
void setThresholdValues(double t_low, double t_high) {
|
void setThresholdValues(double t_low, double t_high) {
|
||||||
this->t_low = t_low;
|
this->t_low = t_low;
|
||||||
this->t_high = t_high;
|
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
|
// build the gauss filter
|
||||||
int* filter = (int*) malloc(sizeof(int) * filter_width * filter_width);
|
int* filter = (int*) malloc(sizeof(int) * filter_width * filter_width);
|
||||||
int sum_weights = 0;
|
int sum_weights = 0;
|
||||||
|
@ -266,7 +271,7 @@ class CannyEdgeMachine {
|
||||||
|
|
||||||
void work() {
|
void work() {
|
||||||
this->reset();
|
this->reset();
|
||||||
this->doGaussBlur();
|
this->doGaussBlur(this->filter_size);
|
||||||
this->doGradiants();
|
this->doGradiants();
|
||||||
this->doGradiantMagnitude();
|
this->doGradiantMagnitude();
|
||||||
this->filterLocalMaxima();
|
this->filterLocalMaxima();
|
||||||
|
|
|
@ -649,8 +649,8 @@ void ImageViewer::applyBasicFilterWithOverflowHandling() {
|
||||||
* @brief ImageViewer::runCannyEdge
|
* @brief ImageViewer::runCannyEdge
|
||||||
*/
|
*/
|
||||||
void ImageViewer::runCannyEdge(void) {
|
void ImageViewer::runCannyEdge(void) {
|
||||||
//TODO
|
|
||||||
CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy);
|
CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy);
|
||||||
|
cem.setGaussFilterSize(3);
|
||||||
cem.setThresholdValues(2.5, 3.5); //TODO
|
cem.setThresholdValues(2.5, 3.5); //TODO
|
||||||
cem.work();
|
cem.work();
|
||||||
updateImageDisplay();
|
updateImageDisplay();
|
||||||
|
|
Loading…
Reference in New Issue