BlurFoveator.H

Go to the documentation of this file.
00001 /*!@file Foveator/BlurFoveator.H Foveator class that performs progressive blurring */
00002 
00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Foveator/BlurFoveator.H $
00004 // $Id: BlurFoveator.H 4663 2005-06-23 17:47:28Z rjpeters $
00005 
00006 #ifndef BLURFOVEATOR_H_DEFINED
00007 #define BLURFOVEATOR_H_DEFINED
00008 
00009 #include "Foveator/Foveator.H"
00010 
00011 //! A class that does space-variant processing with progressive blurring.
00012 /*! A Gaussian blur is applied throughout the image, with small blur radius
00013 near the foveation origin, which increases as we go further into the periphery.
00014 This causes the image to appear sharp near the origin while blurry toward the
00015 outer edges.
00016 
00017 Testing has revealed that BlurFoveator is not as efficient as PyrFoveator or
00018 LPTFoveator but can still achieve the desired result.
00019 */
00020 
00021 class BlurFoveator : public Foveator
00022 {
00023 private:
00024   //! An inner class that defines a gaussian blur matrix
00025   /*! This class is used for obtaining blurred RGB pixels at different blur
00026     radii. */
00027   class GaussianBlurMatrix
00028   {
00029   private:
00030     float *weights;
00031     int halfFilter;
00032     int size;
00033 
00034   public:
00035     //! Construct a blur matrix with specified filter size
00036     GaussianBlurMatrix( int filterSize );
00037     //! Construct a GaussianBlurMatrix from another
00038     GaussianBlurMatrix( const GaussianBlurMatrix& gbm );
00039     //! Construct a GaussianBlurMatrix equal to another
00040     GaussianBlurMatrix& operator=( const GaussianBlurMatrix& gbm );
00041     //! Destructor
00042     ~GaussianBlurMatrix();
00043 
00044     //! Calculate a blurred pixel
00045     /* Returns a blurred RGB pixel after Gaussian filter is applied.
00046        @param x horizontal coordinate of pixel to be blurred
00047        @param y vertical coordinate of pixel to be blurred
00048        @param img image from which pixel is taken
00049     */
00050     PixRGB<byte> blurPixel( int x, int y,
00051                             const Image< PixRGB<byte> >& img ) const;
00052     //! Set the Gaussian blur radius
00053     void setBlurRadius( const float& r );
00054   };
00055 
00056   GaussianBlurMatrix **gbms;
00057   int matrices;
00058   static float radius( int x, int y, int area );
00059 
00060 public:
00061   //! Construct a BlurFoveator for an image
00062   /*! This constructor will create a BlurFoveator that handles img and all
00063     other images of the same dimensions.
00064     @param img image to be foveated
00065     @param filterSize size of blur filter to be applied
00066   */
00067   BlurFoveator( const Image< PixRGB<byte> >& img, int filterSize );
00068   //! Construct a BlurFoveator from another
00069   BlurFoveator( const BlurFoveator& bf );
00070   //! Construct a BlurFoveator equal to another
00071   BlurFoveator& operator=( const BlurFoveator& bf );
00072   //! Destructor
00073   ~BlurFoveator();
00074 
00075   //! Perform blur foveation and return resulting image
00076   Image< PixRGB<byte> > foveate( void );
00077 
00078   //! Perform one blur foveation without a BlurFoveator
00079   /*! This function is for foveating ONE image with a call such as
00080     BlurFoveator::foveate().  It is not optimized for foveating multiple
00081     images.
00082     @param img image to be foveated
00083     @param filterSize size of blur filter to be applied
00084     @param x horizontal coordinate of origin
00085     @param y vertical coordinate of origin
00086   */
00087   static Image< PixRGB<byte> > foveate( const Image< PixRGB<byte> >& img,
00088                                         int filterSize, int x, int y );
00089 };
00090 
00091 #endif
00092 
00093 // ######################################################################
00094 /* So things look consistent in everyone's emacs... */
00095 /* Local Variables: */
00096 /* indent-tabs-mode: nil */
00097 /* End: */
Generated on Sun May 8 08:04:47 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3