25 #include "CensusTransform.hh"
27 #include <Base/Image/ImageBase.hh>
28 #include <Base/Image/ImageIO.hh>
29 #include <Base/Image/ImageConvert.hh>
30 #include <Base/Common/BIASpragma.hh>
41 template<
class InputStorageType,
class OutputStorageType>
43 :
FilterNToN<InputStorageType,OutputStorageType>()
47 template<
class InputStorageType,
class OutputStorageType>
50 :
FilterNToN<InputStorageType, OutputStorageType>(other)
54 template<
class InputStorageType,
class OutputStorageType>
59 template<
class InputStorageType,
class OutputStorageType>
64 BIASERR(
"Source Image is not grey scaled");
70 BIASERR(
"Source Image is not grey scaled");
81 BIASERR(
"Source and Destination Image dimension mismatch");
88 for (
unsigned int y=1; y<height-1;y++) {
89 for (
unsigned int x=1; x<width-1;x++) {
91 out[y][x] = (in[y-1][x-1] < in[y][x]) ? (1 << 7) : 0;
92 out[y][x] += (in[y-1][x] < in[y][x]) ? (1 << 6) : 0;
93 out[y][x] += (in[y-1][x+1] < in[y][x]) ? (1 << 5) : 0;
94 out[y][x] += (in[y][x-1] < in[y][x]) ? (1 << 4) : 0;
95 out[y][x] += (in[y][x+1] < in[y][x]) ? (1 << 3) : 0;
96 out[y][x] += (in[y+1][x-1] < in[y][x]) ? (1 << 2) : 0;
97 out[y][x] += (in[y+1][x] < in[y][x]) ? (1 << 1) : 0;
98 out[y][x] += (in[y+1][x+1] < in[y][x]) ? 1 : 0;
105 template <
class InputStorageType,
class OutputStorageType>
109 BIASERR(
"FilterInt makes no sense here, using general Filter interface.");
110 return Filter(src, dst);
113 template <
class InputStorageType,
class OutputStorageType>
117 BIASERR(
"FilterFloat makes no sense here, using general Filter interface.");
118 return Filter(src, dst);
121 template <
class InputStorageType,
class OutputStorageType>
125 BIASERR(
"No parameter support");
133 #define FILTER_INSTANTIATION_CLASS CensusTransform
134 #include "Filterinst.hh"
unsigned int GetWidth() const
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
base class for simple n->n filter implementations
unsigned int GetHeight() const
enum EColorModel GetColorModel() const
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase