WaveFilter.h
Go to the documentation of this file.
00001 /*
00002 * This file is part of Parallel SURF, which implements the SURF algorithm
00003 * using multi-threading.
00004 *
00005 * Copyright (C) 2010 David Gossow
00006 *
00007 * It is based on the SURF implementation included in Pan-o-matic 0.9.4,
00008 * written by Anael Orlinski.
00009 *
00010 * Parallel SURF is free software; you can redistribute it and/or modify
00011 * it under the terms of the GNU General Public License as published by
00012 * the Free Software Foundation; either version 3 of the License, or
00013 * (at your option) any later version.
00014 *
00015 * Parallel SURF is distributed in the hope that it will be useful,
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 * GNU General Public License for more details.
00019 *
00020 * You should have received a copy of the GNU General Public License
00021 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 
00024 #ifndef __parallelsurf_wavefilter_h
00025 #define __parallelsurf_wavefilter_h
00026 
00027 #include "Image.h"
00028 
00029 namespace parallelsurf
00030 {
00031 
00032 class WaveFilter
00033 {
00034   public:
00035     
00036     WaveFilter ( double iBaseSize, Image& iImage );
00037 
00038     double getWx ( unsigned int x, unsigned int y );
00039     double getWy ( unsigned int x, unsigned int y );
00040 
00041     bool checkBounds ( int x, int y ) const;
00042 
00043   private:
00044 
00045     // orig image info
00046     double**  _ii;
00047     unsigned int _im_width;
00048     unsigned int _im_height;
00049 
00050     // internal values
00051     int _wave_1;
00052 };
00053 
00054 
00055 inline WaveFilter::WaveFilter ( double iBaseSize, Image& iImage )
00056 {
00057   _ii = iImage.getIntegralImage();
00058   _im_width = iImage.getWidth();
00059   _im_height = iImage.getHeight();
00060 
00061   _wave_1 = ( int ) iBaseSize;
00062 }
00063 
00064 
00065 #define CALC_INTEGRAL_SURFACE(II, STARTX, ENDX, STARTY, ENDY) \
00066   (II[ENDY+1][ENDX+1] + II[STARTY][STARTX] - II[ENDY+1][STARTX] - II[STARTY][ENDX+1])
00067 
00068 
00069 inline double WaveFilter::getWx ( unsigned int x, unsigned int y )
00070 {
00071   return - CALC_INTEGRAL_SURFACE ( _ii, x - _wave_1, x,    y - _wave_1, y + _wave_1 )
00072          + CALC_INTEGRAL_SURFACE ( _ii, x,    x + _wave_1, y - _wave_1, y + _wave_1 );
00073 }
00074 
00075 
00076 inline double WaveFilter::getWy ( unsigned int x, unsigned int y )
00077 {
00078   return + CALC_INTEGRAL_SURFACE ( _ii, x - _wave_1, x + _wave_1, y - _wave_1, y )
00079          - CALC_INTEGRAL_SURFACE ( _ii, x - _wave_1, x + _wave_1, y,    y + _wave_1 );
00080 }
00081 
00082 inline bool WaveFilter::checkBounds ( int x, int y ) const
00083 {
00084   return ( x > _wave_1 && x + _wave_1 < ( int ) _im_width - 1
00085            && y > _wave_1 && y + _wave_1 < ( int ) _im_height - 1 );
00086 }
00087 
00088 } // namespace parallelsurf
00089 
00090 #endif //__parallelsurf_wavefilter_h


or_libs
Author(s): raphael
autogenerated on Mon Oct 6 2014 02:53:18