18 #ifndef PIC_FILTERING_FILTER_DIVERGENCE_HPP 19 #define PIC_FILTERING_FILTER_DIVERGENCE_HPP 21 #include "../filtering/filter.hpp" 64 int width = dst->
width;
67 float *data = src[0]->data;
70 int channels = src[0]->channels;
71 int c, ci, cj, ci1, cj1, tmpc, ind;
73 for(
int j = box->
y0; j < box->y1; j++) {
76 for(
int i = box->
x0; i < box->x1; i++) {
77 c = (ind + i) * channels;
79 ci =
CLAMP(i + 1, width);
80 cj =
CLAMP(j + 1, height);
81 ci1 =
CLAMP(i - 1, width);
82 cj1 =
CLAMP(j - 1, height);
85 tmpc = (ind + ci) * channels;
88 tmpc = (ind + ci1) * channels;
92 tmpc = (cj * width + i) * channels;
95 tmpc = (cj1 * width + i) * channels;
99 dst->
data[c] = (gradX + gradY) * 0.5
f;
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
float * data
data is the main buffer where pixel values are stored.
Definition: image.hpp:91
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
The Filter class.
Definition: filter.hpp:50
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
FilterDivergence()
FilterDivergence.
Definition: filter_divergence.hpp:44
int y0
Definition: bbox.hpp:32
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_divergence.hpp:62
#define PIC_INLINE
Definition: base.hpp:33
The Image class stores an image as buffer of float.
Definition: image.hpp:60
virtual void f(FilterFData *data)
f
Definition: filter_radial_basis_function.hpp:69
PIC_INLINE ImageVec Single(Image *img)
Single creates an std::vector which contains img; this is for filters input.
Definition: image_vec.hpp:36
Definition: bilateral_separation.hpp:25
#define CLAMP(x, a)
Definition: math.hpp:77
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: filter_divergence.hpp:55
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
The FilterDivergence class.
Definition: filter_divergence.hpp:28