18 #ifndef PIC_FILTERING_FILTER_GRADIENT_HPP 19 #define PIC_FILTERING_FILTER_GRADIENT_HPP 21 #include "../filtering/filter.hpp" 75 width = imgIn[0]->width;
76 height = imgIn[0]->height;
78 frames = imgIn[0]->frames;
146 for(
int j = box->
y0; j < box->y1; j++) {
147 for(
int i = box->
x0; i < box->x1; i++) {
151 for(
int k = -1; k < 2; k++) {
152 float val =
mask[k + 1];
154 gradX += val * (*img)(i + 1, j + k)[channel];
155 gradX -= val * (*img)(i - 1, j + k)[channel];
157 gradY += val * (*img)(i + k, j + 1)[channel];
158 gradY -= val * (*img)(i + k, j - 1)[channel];
161 float *dst_data = (*dst)(i, j);
165 dst_data[2] = sqrtf(gradX * gradX + gradY * gradY);
FilterGradient()
FilterGradient.
Definition: filter_gradient.hpp:97
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
OutputSize.
Definition: filter_gradient.hpp:73
int channels
Definition: image.hpp:80
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
GRADIENT_TYPE type
Definition: filter_gradient.hpp:34
The Filter class.
Definition: filter.hpp:50
GRADIENT_TYPE
Definition: filter_gradient.hpp:25
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
void update(int colorChannel, GRADIENT_TYPE type)
update
Definition: filter_gradient.hpp:108
static Image * execute(Image *imgIn, Image *imgOut=NULL, GRADIENT_TYPE type=G_SOBEL, int colorChannel=0)
execute
Definition: filter_gradient.hpp:89
int y0
Definition: bbox.hpp:32
#define PIC_INLINE
Definition: base.hpp:33
int colorChannel
Definition: filter_gradient.hpp:33
The Image class stores an image as buffer of float.
Definition: image.hpp:60
Definition: filter_gradient.hpp:25
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_gradient.hpp:139
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
The FilterGradient class.
Definition: filter_gradient.hpp:30
Definition: filter_gradient.hpp:25
float mask[3]
Definition: filter_gradient.hpp:35
Definition: filter_gradient.hpp:25