PICCANTE  0.4
The hottest HDR imaging library!
filter_laplacian.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_LAPLACIAN_HPP
19 #define PIC_FILTERING_FILTER_LAPLACIAN_HPP
20 
21 #include "../filtering/filter.hpp"
22 
23 namespace pic {
24 
28 class FilterLaplacian: public Filter
29 {
30 protected:
31 
38  void ProcessBBox(Image *dst, ImageVec src, BBox *box)
39  {
40  int channels = src[0]->channels;
41 
42  Image *in = src[0];
43 
44  for(int j = box->y0; j < box->y1; j++) {
45 
46  for(int i = box->x0; i < box->x1; i++) {
47 
48  float *cur = (*in)(i, j);
49  float *out = (*dst)(i, j);
50 
51  //neighbors
52  float *N = (*in)(i , j + 1);
53  float *S = (*in)(i , j - 1);
54  float *E = (*in)(i + 1, j);
55  float *W = (*in)(i - 1, j);
56 
57  for(int k = 0; k < channels; k++) {
58  out[k] = (-4.0f * cur[k]) + N[k] + S[k] + E[k] + W[k];
59  }
60  }
61  }
62  }
63 
64 public:
69  {
70 
71  }
72 
79  static Image *execute(Image *imgIn, Image *imgOut)
80  {
81  FilterLaplacian filter;
82  return filter.Process(Single(imgIn), imgOut);
83  }
84 };
85 
86 } // end namespace pic
87 
88 #endif /* PIC_FILTERING_FILTER_LAPLACIAN_HPP */
89 
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
int x0
Definition: bbox.hpp:32
The FilterLaplacian class.
Definition: filter_laplacian.hpp:28
The Filter class.
Definition: filter.hpp:50
FilterLaplacian()
FilterLaplacian.
Definition: filter_laplacian.hpp:68
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: filter_laplacian.hpp:79
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_laplacian.hpp:38
int y0
Definition: bbox.hpp:32
The Image class stores an image as buffer of float.
Definition: image.hpp:60
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