App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

TLaplaceSharpen.hpp
Go to the documentation of this file.
1
2 namespace app {
3 template <typename TPIXEL, typename TCHANNEL> class TLaplaceSharpen;
4 }
5
6 #ifndef TSMALLLPSHARPEN_HPP_
7 #define TSMALLLPSHARPEN_HPP_
8
9 #include <cstdlib>
10 #include <cstring>
11
12 #include "TFilter.hpp"
13 #include "TLinearFilter.hpp"
14
15 #include "../typedefs.hpp"
16 #include "../bitmaps/TBitmap.hpp"
17
18 namespace app {
19
20 template <typename TPIXEL, typename TCHANNEL>
21 class TLaplaceSharpen : public TLinearFilter<TPIXEL, TCHANNEL> {
22 protected:
23 static double LaPlaceSharpen[9];
24 public:
25
26 TLaplaceSharpen(double force) {
27 this->kernel = (double *) malloc( 9 * sizeof(double));
28 if (this->kernel == NULL) { return; }
29 memcpy(this->kernel, LaPlaceSharpen, 9 * sizeof(double));
30 force = (force + 1) / (1.0000001 - force);
31 for (int i = 0; i < 9; i++) {
32 this->kernel[i] *= force;
33 }
34 this->kernel[4] += 1;
35 this->kernelWidth = 3;
36 this->kernelWCenter = 1;
37 this->kernelHeight = 3;
38 this->kernelHCenter = 1;
39 this->initOk = 1;
40 }
41
42 virtual ~TLaplaceSharpen();
43 };
44
45 template <typename TPIXEL, typename TCHANNEL>
46 double TLaplaceSharpen<TPIXEL, TCHANNEL>::LaPlaceSharpen[9] = { -1, -1, -1,
47 -1, 8, -1,
48 -1, -1, -1 };
49
50 } /* namespace app */
51 #endif /* TSMALLLPSHARPEN_HPP_ */