[TASK] Seperate generation of gauss blur filters.
This commit is contained in:
parent
66e2ae8d30
commit
3ce2be6e3d
@ -81,12 +81,12 @@ class CannyEdgeMachine {
|
||||
}
|
||||
};
|
||||
|
||||
void doGaussBlur(void) {
|
||||
int filter_width = this->filter_size;
|
||||
double sigma = this->filter_sigma;
|
||||
// build the gauss filter
|
||||
/**
|
||||
* Do not forget to free the filter generated by this method!
|
||||
*/
|
||||
double* generateGaussFilter(int filter_width, double sigma, double& sum_weights) {
|
||||
double* filter = (double*) malloc(sizeof(double) * filter_width * filter_width);
|
||||
double sum_weights = 0;
|
||||
sum_weights = 0;
|
||||
std::cout << "Using gauss filter: " << std::endl;
|
||||
for(int x=0; x<filter_width; x++) {
|
||||
int i = x - (filter_width/2);
|
||||
@ -99,6 +99,15 @@ class CannyEdgeMachine {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl << "Sum weights: " << sum_weights << std::endl;
|
||||
return filter;
|
||||
};
|
||||
|
||||
void doGaussBlur(void) {
|
||||
int filter_width = this->filter_size;
|
||||
// build the gauss filter
|
||||
double sum_weights = 0.0;
|
||||
double* filter = this->generateGaussFilter(this->filter_size, this->filter_sigma, sum_weights);
|
||||
std::cout << sum_weights << std::endl;
|
||||
// apply gauss filter
|
||||
int filter_offset = (filter_width+1)/2;
|
||||
for(int x=(0+filter_offset); x<(this->width-filter_offset); x++) {
|
||||
|
Loading…
Reference in New Issue
Block a user