PICCANTE  0.4
The hottest HDR imaging library!
filter_backward_difference.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_FILTERING_FILTER_BACKWARD_DIFFERENCE_HPP
19 #define PIC_FILTERING_FILTER_BACKWARD_DIFFERENCE_HPP
20 
21 #include "../filtering/filter.hpp"
22 
23 namespace pic {
24 
29 {
30 protected:
31 
36  void f(FilterFData *data)
37  {
38  float *in = (*data->src[0])(data->x, data->y);
39  float *inXm = (*data->src[0])(data->x + 1, data->y);
40  float *inYm = (*data->src[0])(data->x, data->y + 1);
41 
42  for(int k = 0; k < data->dst->channels; k++) {
43  int tmp = k << 1;
44  data->out[tmp ] = inXm[k] - in[k];
45  data->out[tmp + 1] = inYm[k] - in[k];
46  }
47  }
48 
78 public:
83  {
84 
85  }
86 
95  void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
96  {
97  width = imgIn[0]->width;
98  height = imgIn[0]->height;
99  channels = imgIn[0]->channels * 2;
100  frames = imgIn[0]->frames;
101  }
102 
109  static Image *execute(Image *imgIn, Image *imgOut)
110  {
112  return filter.Process(Single(imgIn), imgOut);
113  }
114 };
115 
116 } // end namespace pic
117 
118 #endif /* PIC_FILTERING_FILTER_BACKWARD_DIFFERENCE_HPP */
119 
int y
Definition: filter.hpp:39
int channels
Definition: image.hpp:80
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
void OutputSize(ImageVec imgIn, int &width, int &height, int &channels, int &frames)
OutputSize.
Definition: filter_backward_difference.hpp:95
The Filter class.
Definition: filter.hpp:50
The FilterBackwardDifference class.
Definition: filter_backward_difference.hpp:28
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
Definition: filter.hpp:37
FilterBackwardDifference()
ProcessBBox.
Definition: filter_backward_difference.hpp:82
Image * dst
Definition: filter.hpp:42
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: filter_backward_difference.hpp:109
float * out
Definition: filter.hpp:40
int x
Definition: filter.hpp:39
The Image class stores an image as buffer of float.
Definition: image.hpp:60
ImageVec src
Definition: filter.hpp:43
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
void f(FilterFData *data)
f
Definition: filter_backward_difference.hpp:36