FastFilter.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @file FastFilter.h
  3. * @brief standard filter functions e.g. gradient filters
  4. * @author Erik Rodner
  5. * @date 07/22/2008
  6. */
  7. #ifndef FastFilterINCLUDE
  8. #define FastFilterINCLUDE
  9. namespace OBJREC {
  10. /** @brief standard filter functions e.g. gradient filters */
  11. class FastFilter
  12. {
  13. public:
  14. /** calculates gradient magnitude and gradient directions quantized in a number
  15. * of bins.
  16. * @param pointer to the input image
  17. * @param xsize width of the image
  18. * @param ysize height of the image
  19. * @param gradient pointer to the destination memory for the gradient magnitude values
  20. * @param dir pointer to the destination memory for the gradient direction values
  21. * @param numBins number of bins used for the quantization of the gradient directions
  22. * @param usesigned if set put gradient directions alpha and - alpha in the same bin
  23. **/
  24. template <class GrayValueType, class GradientMagnitudeType, class GradientDirectionType>
  25. static void calcGradient (
  26. const GrayValueType *gray,
  27. int xsize, int ysize,
  28. GradientMagnitudeType *gradient,
  29. GradientDirectionType *dir,
  30. int numBins,
  31. bool usesigned );
  32. /** calculates gradient magnitude and gradient directions of a color image (use
  33. * the channel with the maximum magnitude at each pixel).
  34. * The gradient direction is quantized in a number of bins.
  35. * @param r first channel of the input image
  36. * @param g second channel of the input image
  37. * @param b third channel of the input image
  38. * @param xsize width of the image
  39. * @param ysize height of the image
  40. * @param gradient pointer to the destination memory for the gradient magnitude values
  41. * @param dir pointer to the destination memory for the gradient direction values
  42. * @param numBins number of bins used for the quantization of the gradient directions
  43. * @param usesigned if set put gradient directions alpha and - alpha in the same bin
  44. **/
  45. template <class GrayValueType, class GradientMagnitudeType, class GradientDirectionType>
  46. static void calcColorGradient (
  47. const GrayValueType *r,
  48. const GrayValueType *g,
  49. const GrayValueType *b,
  50. int xsize, int ysize,
  51. GradientMagnitudeType *gradient,
  52. GradientDirectionType *dir,
  53. int numBins,
  54. bool usesigned );
  55. template <class SrcValueType, class DstValueType>
  56. static void calcGradientY ( const SrcValueType *img, int xsize, int ysize, DstValueType *d );
  57. template <class SrcValueType, class DstValueType>
  58. static void calcGradientX ( const SrcValueType *img, int xsize, int ysize, DstValueType *d );
  59. };
  60. } // namespace
  61. #include "FastFilter.tcc"
  62. #endif