52 std::vector<float> &mask = *mask_input;
53 int len = mask.size();
55 for (
int i = 1; i < len; i++) {
58 sum = 2 * sum + fabs(mask[0]);
59 for (
int i = 0; i < len; i++) {
67#define MAKE_FILTER(name, fun) \
68 std::vector<float> make_##name(float sigma) { \
69 sigma = std::max(sigma, 0.01F); \
70 int len = static_cast<int>(ceil(sigma * WIDTH)) + 1; \
71 std::vector<float> mask(len); \
72 for (int i = 0; i < len; i++) { \
87 std::vector<float> mask = make_fgauss(sigma);
116 int width = src->
width();
117 int height = src->
height();
119 for (
int y = 1; y < height - 1; y++) {
120 for (
int x = 1; x < width - 1; x++) {
121 float d2x =
imRef(src, x - 1, y) +
imRef(src, x + 1, y) - 2 *
imRef(src, x, y);
122 float d2y =
imRef(src, x, y - 1) +
imRef(src, x, y + 1) - 2 *
imRef(src, x, y);
123 imRef(dst, x, y) = d2x + d2y;
int height() const
Get the height of an image
int width() const
Get the width of an image
Image< float > * image_uchar2float(Image< uchar > *input)
Transform uchar to float
T square(const T &x)
get square of value x
void convolve_even(Image< float > *src, Image< float > *dst, const std::vector< float > &mask)
convolve src with mask.
Image< float > * smooth(Image< float > *src, float sigma)
Convolve image with gaussian filter
Image< float > * laplacian(Image< float > *src)
Compute laplacian
void normalize(std::vector< float > *mask_input)
Normalize mask so it integrates to one
#define MAKE_FILTER(name, fun)
Make filters