00001 /* 00002 * Software License Agreement (Simplified BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2013-, Open Perception, Inc. 00006 * Copyright (c) 2012, Piotr Dollar & Ron Appel. [pdollar-at-caltech.edu] 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, this 00014 * list of conditions and the following disclaimer. 00015 * 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00027 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 * The views and conclusions contained in the software and documentation are those 00032 * of the authors and should not be interpreted as representing official policies, 00033 * either expressed or implied, of the FreeBSD Project. 00034 * 00035 * hog.h 00036 * Created on: Nov 30, 2012 00037 * Derived from Piotr Dollar's MATLAB Image&Video Toolbox Version 3.00. 00038 * Non-SSE version of the code provided by Matteo Munaro, Stefano Ghidoni and Stefano Michieletto 00039 */ 00040 00041 #ifndef PCL_PEOPLE_HOG_H_ 00042 #define PCL_PEOPLE_HOG_H_ 00043 00044 #include <pcl/pcl_macros.h> 00045 00046 namespace pcl 00047 { 00048 namespace people 00049 { 00055 class PCL_EXPORTS HOG 00056 { 00057 public: 00058 00060 HOG (); 00061 00063 virtual ~HOG (); 00064 00075 void 00076 gradMag ( float *I, int h, int w, int d, float *M, float *O ) const; 00077 00090 void 00091 gradHist ( float *M, float *O, int h, int w, int bin_size, int n_orients, bool soft_bin, float *H) const; 00092 00104 void 00105 normalization ( float *H, int h, int w, int bin_size, int n_orients, float clip, float *G ) const; 00106 00119 void 00120 compute (float *I, int h, int w, int n_channels, int bin_size, int n_orients, bool soft_bin, float *descriptor); 00121 00128 void 00129 compute (float *I, float *descriptor) const; 00130 00131 private: 00132 00136 void 00137 grad1 ( float *I, float *Gx, float *Gy, int h, int w, int x ) const; 00138 00142 float* 00143 acosTable () const; 00144 00148 void 00149 gradQuantize ( float *O, float *M, int *O0, int *O1, float *M0, float *M1, int n_orients, int nb, int n, float norm ) const; 00150 00154 void* 00155 alMalloc ( size_t size, int alignment ) const; 00156 00160 void 00161 alFree (void* aligned) const; 00162 00163 protected: 00164 00166 int h_; 00167 00169 int w_; 00170 00172 int n_channels_; 00173 00175 int bin_size_; 00176 00178 int n_orients_; 00179 00181 bool soft_bin_; 00182 00184 float clip_; 00185 00186 }; 00187 } /* namespace people */ 00188 } /* namespace pcl */ 00189 #endif /* PCL_PEOPLE_HOG_H_ */