Image_tools.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @file Image_tools.h
  3. * @author Alexander Lütz
  4. * @date 18/11/2010
  5. * @brief Contains tools for Image_Processing
  6. */
  7. #ifndef _NICE_OBJREC_IMAGETOOLS
  8. #define _NICE_OBJREC_IMAGETOOLS
  9. #include "core/image/ImageT.h"
  10. #include "core/image/ColorImageT.h"
  11. // #include "core/image/Filter.h"
  12. #include <utility>
  13. namespace OBJREC {
  14. class Image_tools
  15. {
  16. protected:
  17. public:
  18. /** simple constructor */
  19. Image_tools();
  20. /** simple destructor */
  21. ~Image_tools();
  22. /** calculate gradient-images for x- and y-direction, using [1 0 -1] without smoothing*/
  23. void calculateGradients(const NICE::Image & origImage, NICE::ImageT<float> & grad_x_Image, NICE::ImageT<float> & grad_y_Image );
  24. /** calculate gradient-images for x- and y-direction, using [1 0 -1] without smoothing, considering the chanel with the greatest magnitude als resulting gradient*/
  25. void calculateGradients(NICE::ColorImage origColorImage, NICE::ImageT<float> & grad_x_Image, NICE::ImageT<float> & grad_y_Image );
  26. /** calculate gradient-orientations*/
  27. void calculateGradientOrientations(const NICE::ImageT<float> & grad_x_Image, const NICE::ImageT<float> & grad_y_Image , const int & number_Of_Bins, NICE::Image & gradient_orientations, const bool unsignedBins=true);
  28. void calculateGradientOrientations(const NICE::GrayImage16s & grad_x_Image, const NICE::GrayImage16s & grad_y_Image , const int & number_Of_Bins, NICE::Image & gradient_orientations, const bool unsignedBins=true);
  29. /** calculate gradient-magnitudes*/
  30. void calculateGradientMagnitudes(const NICE::ImageT<float> & grad_x_Image, const NICE::ImageT<float> & grad_y_Image, NICE::ImageT<float> & gradient_magnitudes);
  31. /** Normalizes the descriptor-vector of the specified block, using L2-norm*/
  32. std::vector<float> normalizeBlockDescriptor(const std::vector<float> & orig_Block_Descriptor, const float epsilon = 0.01);
  33. /** calculates the resulting HoG-Features for an image by normalizing spatial blocks und storing the resulting normalized histograms in a vector - not implemented up to now*/
  34. std::vector< std::vector<float> > calculateResultingHogFeatures(const NICE::Image & gradient_orientations, const NICE::ImageT<float> & gradient_magnitudes, const int & blocksize = 2, const int & cellsize = 8);
  35. };
  36. }
  37. #endif