peddetect.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 
28 #ifndef _PEDDETECT_H_
29 #define _PEDDETECT_H_
30 
31 #include <ros/ros.h>
32 #include <image_transport/image_transport.h>
33 #include <opencv/cvwimage.h>
34 #include <opencv/highgui.h>
35 #include <cv_bridge/cv_bridge.h>
36 #include <sensor_msgs/image_encodings.h>
37 #include <cv.h>
38 #include <ros/package.h>
39 #include <boost/filesystem.hpp>
40 #include <boost/thread.hpp>
41 #include <iostream>
42 #include <iterator>
43 #include <algorithm>
44 #include <vector>
45 #include <math.h>
46 #include "opencv/ml.h"
47 #include <fstream>
48 #include <cstdlib>
49 
50 
51 #define PI 3.14159265359
52 #define CHANNELNR 10
53 #define STEP 4
54 #define NRFEATURE 15000
55 #define NRFEATURE2 NRFEATURE/CHANNELNR
56 #define DWHEIGHT 128
57 #define DWWIDTH 64
58 #define SEED 1234
59 #define MINAREA 8
60 #define MAXAREAWIDTH 64
61 #define MAXAREAHEIGHT 48
62 #define THRESHOLD 7
63 #define NOCTUP 0
64 #define SCALEPOCT 8
65 
66 using namespace boost::filesystem;
67 using namespace std;
68 using namespace cv;
69 namespace enc = sensor_msgs::image_encodings;
70 
71 typedef struct
72 {
73  int nFtrs;
74  int width;
75  int height;
76  int x;
77  int y;
78 } FtrParams2;
79 
80 typedef struct
81 {
82  int x;
83  int y;
84  Size Scale;
85 } PedRoi;
86 
87 
88 
89 
90 
91 typedef vector<PedRoi> PedRoiVec;
92 typedef vector<path> PVector;
93 typedef vector<Mat> MatVector;
94 typedef Vec<float, CHANNELNR> vec10d;
95 typedef vector<vec10d> d10Vector;
96 typedef vector<FtrParams2> FtrVecParams2;
97 typedef vector<float> DVector;
98 
99 
100 
101 void GetFileList(string folder_path, PVector & dest_vect);
102 
103 Mat GradientMagnitude(Mat src);
104 Mat GradientMagnitude(Mat xsobel, Mat ysobel);
105 
106 
107 MatVector OrientedGradientsDiagram(Mat GradMag, Mat xsobel, Mat ysobel);
108 
110 
111 
112 void GetChnFtrsOverImagePyramid(Mat Image , CvRect & region , vector<float> & features, int nOctUp, Size minSize, int nPerOct, FtrVecParams2 Params, PedRoiVec & PedRect, CvBoost & boost_classifier);
113 void GetChnFtrsOverImagePyramid(Mat Image , CvRect & region , vector<float> & features, vector<DVector> & WindowFtrs, int nOctUp, Size minSize, int nPerOct, FtrVecParams2 Params);
114 
115 
116 void GetChnFtrsOverImage(Mat IntegralChannels , CvRect & region ,vector<float> & features, FtrVecParams2 Params, PedRoiVec & PedRect,CvBoost & boost_classifier);
117 void GetChnFtrsOverImage(Mat IntegralChannels , CvRect & region ,vector<float> & features,vector<DVector> & WindowFtrs, FtrVecParams2 Params);
118 
119 void GetChnFtrsOverWindow(Mat IntegralChannels , vector<float> & features ,FtrVecParams2 Params, CvRect region,PedRoiVec & PedRect,CvBoost & boost_classifier);
120 void GetChnFtrsOverWindow(Mat IntegralChannels , vector<float> & features,vector<DVector> & WindowFtrs ,FtrVecParams2 Params, CvRect region);
121 
122 void GetIntegralSum(Mat IntegralChannels, vector<float> & features, FtrParams2 Params,CvRect region);
123 
124 void ComputeChannels(Mat Image, Mat & MergedChannels);
125 
126 void GetRandParams(int seed, int NrFtrs, FtrVecParams2 & RandParams, Rect region);
127 
128 void GetChnFtrsOverWindow(Mat IntegralChannels , vector<float> & features, FtrVecParams2 Params, CvRect region,PedRoiVec & PedRect);
129 void GetChnFtrsOverWindow(Mat IntegralChannels , vector<float> & features,vector<DVector> & WindowFtrs, FtrVecParams2 Params);
130 
131 
132 void GetIntegralSum(Mat IntegralChannels, vector<float> & features, FtrParams2 Params,CvRect region);
133 
134 void PostProcess(Mat Img, vector<Rect> PedRect, FtrVecParams2 randparams, CvBoost & boost_classifier, PedRoiVec & PedRect_Post);
135 
136 #endif
vector< PedRoi > PedRoiVec
Definition: peddetect.h:91
void GetRandParams(int seed, int NrFtrs, FtrVecParams2 &RandParams, Rect region)
Definition: pedfuncs.cpp:216
vector< Mat > MatVector
Definition: peddetect.h:93
void GetChnFtrsOverImagePyramid(Mat Image, CvRect &region, vector< float > &features, int nOctUp, Size minSize, int nPerOct, FtrVecParams2 Params, PedRoiVec &PedRect, CvBoost &boost_classifier)
Definition: pedfuncs.cpp:273
void ComputeChannels(Mat Image, Mat &MergedChannels)
Definition: pedfuncs.cpp:186
int nFtrs
Definition: peddetect.h:73
void GetChnFtrsOverImage(Mat IntegralChannels, CvRect &region, vector< float > &features, FtrVecParams2 Params, PedRoiVec &PedRect, CvBoost &boost_classifier)
Definition: pedfuncs.cpp:328
vector< vec10d > d10Vector
Definition: peddetect.h:95
Size Scale
Definition: peddetect.h:84
MatVector LUVcolourchannels(Mat Img)
Definition: pedfuncs.cpp:136
void GetIntegralSum(Mat IntegralChannels, vector< float > &features, FtrParams2 Params, CvRect region)
Definition: pedfuncs.cpp:420
int x
Definition: peddetect.h:82
vector< float > DVector
Definition: peddetect.h:97
int height
Definition: peddetect.h:75
Vec< float, CHANNELNR > vec10d
Definition: peddetect.h:94
MatVector OrientedGradientsDiagram(Mat GradMag, Mat xsobel, Mat ysobel)
Definition: pedfuncs.cpp:66
Mat GradientMagnitude(Mat src)
Definition: pedfuncs.cpp:30
void GetChnFtrsOverWindow(Mat IntegralChannels, vector< float > &features, FtrVecParams2 Params, CvRect region, PedRoiVec &PedRect, CvBoost &boost_classifier)
Definition: pedfuncs.cpp:446
void GetFileList(string folder_path, PVector &dest_vect)
Definition: pedfuncs.cpp:153
int width
Definition: peddetect.h:74
vector< path > PVector
Definition: peddetect.h:92
vector< FtrParams2 > FtrVecParams2
Definition: peddetect.h:96
int y
Definition: peddetect.h:83
void PostProcess(Mat Img, vector< Rect > PedRect, FtrVecParams2 randparams, CvBoost &boost_classifier, PedRoiVec &PedRect_Post)
Definition: pedfuncs.cpp:511


multimodal_pedestrian_detect
Author(s): Rui Azevedo
autogenerated on Mon Mar 2 2015 01:32:27