18 #ifndef PIC_FILTERING_FILTER_NORMAL_HPP 19 #define PIC_FILTERING_FILTER_NORMAL_HPP 21 #include "../filtering/filter.hpp" 69 width = imgIn[0]->width;
70 height = imgIn[0]->height;
72 frames = imgIn[0]->frames;
97 int width = dst->
width;
99 int channels = src[0]->channels;
105 float *data = src[0]->data;
109 for(
int j = box->
y0; j < box->y1; j++) {
112 for(
int i = box->
x0; i < box->x1; i++) {
114 int ind2 = (ind + i) * 3;
117 int ci =
CLAMP(i + 1, width);
118 int cj =
CLAMP(j + 1, height);
119 int ci1 =
CLAMP(i - 1, width);
120 int cj1 =
CLAMP(j - 1, height);
123 int tmpc = (ind + ci) * channels;
126 tmpc = (ind + ci1) * channels;
130 tmpc = (cj * width + i) * channels;
133 tmpc = (cj1 * width + i) * channels;
143 dst->
data[ind2 ] = gradX;
144 dst->
data[ind2 + 1] = gradY;
145 dst->
data[ind2 + 2] = 1.0f;
147 float norm = gradX * gradX + gradY * gradY + 1.0f;
151 dst->
data[ind2 ] /= norm;
152 dst->
data[ind2 + 1] /= norm;
153 dst->
data[ind2 + 2] /= norm;
155 dst->
data[ind2 ] = 0.0f;
156 dst->
data[ind2 + 1] = 0.0f;
157 dst->
data[ind2 + 2] = 0.0f;
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
FilterNormal()
FilterNormal.
Definition: filter_normal.hpp:76
The Filter class.
Definition: filter.hpp:50
int colorChannel
Definition: filter_normal.hpp:31
int y0
Definition: bbox.hpp:32
The FilterNormal class.
Definition: filter_normal.hpp:28
#define PIC_INLINE
Definition: base.hpp:33
The Image class stores an image as buffer of float.
Definition: image.hpp:60
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_normal.hpp:95
virtual void f(FilterFData *data)
f
Definition: filter_radial_basis_function.hpp:69
Definition: bilateral_separation.hpp:25
#define CLAMP(x, a)
Definition: math.hpp:77
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
OutputSize.
Definition: filter_normal.hpp:67
void update(int colorChannel)
update
Definition: filter_normal.hpp:86