44 int len = mask.size();
46 for (
int i = 1; i < len; i++) {
49 sum = 2*sum + fabs(mask[0]);
50 for (
int i = 0; i < len; i++) {
56 #define MAKE_FILTER(name, fun) \
57 static std::vector<float> make_ ## name (float sigma) { \
58 sigma = std::max(sigma, 0.01F); \
59 int len = (int)ceil(sigma * WIDTH) + 1; \
60 std::vector<float> mask(len); \
61 for (int i = 0; i < len; i++) { \
71 std::vector<float> mask = make_f0(sigma);
93 int width = src->
width();
94 int height = src->
height();
97 for (
int y = 1; y < height-1; y++) {
98 for (
int x = 1; x < width-1; x++) {
99 float d2x =
imRef(src, x-1, y) +
imRef(src, x+1, y) -
101 float d2y =
imRef(src, x, y-1) +
imRef(src, x, y+1) -
103 imRef(dst, x, y) = d2x + d2y;
static void convolve_even(image< float > *src, image< float > *dst, std::vector< float > &mask)
static image< float > * laplacian(image< float > *src)
static void normalize(std::vector< float > &mask)
static image< float > * smooth(image< float > *src, float sigma)
MAKE_FILTER(f0, exp(-0.5 *square(i/sigma)))
static image< float > * smooth(image< uchar > *src, float sigma)
Class and structs in single-thread CPU bp implementation by Pedro Felzenwalb available at https://cs....