00001 /*!@file Features/JunctionHOG.H */ 00002 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00006 // by the University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: Daniel Parks <danielfp@usc.edu> 00035 // $HeadURL$ 00036 // $Id$ 00037 // 00038 00039 #ifndef JunctionHOG_H_DEFINED 00040 #define JunctionHOG_H_DEFINED 00041 00042 #include "Util/Types.H" 00043 #include "Image/Image.H" 00044 #include "Image/Pixels.H" 00045 #include "Image/ImageSet.H" 00046 #include "Features/HistogramOfGradients.H" 00047 #include "SIFT/FeatureVector.H" 00048 00049 #include <vector> 00050 #include <string> 00051 00052 00053 class JunctionHOG : public HistogramOfGradients 00054 { 00055 public: 00056 //! Default Constructor 00057 JunctionHOG(); 00058 00059 JunctionHOG(bool normalize, Dims cellDims = Dims(8,8), bool fixedCells=false, int numOrientations=9, bool signedOrient=false, int numContinuityBins=3, float neighborDistance=1.2F); 00060 00061 //! Destructor 00062 virtual ~JunctionHOG(); 00063 00064 void initializeNeighbors(std::vector<Point2D<int> >& neighbors, std::vector<float>& perpAngles, std::vector<float>& parallelAngles, float angle); 00065 00066 //! Calculate histogram using a gradient 00067 virtual std::vector<float> createHistogramFromGradient(const Image<float>& gradmag, const Image<float>& gradang); 00068 00069 //! Calculate junction continuity histogram using the gradient 00070 std::vector<float> calculateJunctionHistogram(Image<float> gradmag, Image<float> gradang); 00071 00072 protected: 00073 int itsContinuityBins; 00074 float itsNeighborDistance; 00075 private: 00076 // Parallel/Perpendicular Matching is treated as an unsigned process 00077 // Create fixed mask for each orientation 00078 std::vector<Point2D<int> > itsRelevantNeighbors[8]; 00079 // Orientation angle and tolerance for a particular neighbor that are considered perpendicular 00080 std::vector<float> itsPerpAngles[8]; 00081 // Orientation angle and tolerance for a particular neighbor that are considered parallel 00082 std::vector<float> itsParallelAngles[8]; 00083 00084 }; 00085 00086 00087 // ###################################################################### 00088 /* So things look consistent in everyone's emacs... */ 00089 /* Local Variables: */ 00090 /* indent-tabs-mode: nil */ 00091 /* End: */ 00092 00093 #endif //