33    Mat xsobel, ysobel, xsobel2, ysobel2, xysobel, GradMag, GrayImg;
 
   35    cvtColor(src,GrayImg, CV_RGB2GRAY,0);
 
   37    Sobel(GrayImg, xsobel, CV_32F, 1, 0, 3, 1, 0, BORDER_DEFAULT);
 
   38    Sobel(GrayImg, ysobel, CV_32F, 0, 1, 3, 1, 0, BORDER_DEFAULT);
 
   40    multiply(xsobel, xsobel, xsobel2, 1, -1 );
 
   41    multiply(ysobel, ysobel, ysobel2, 1, -1 );
 
   43    xysobel=xsobel2+ysobel2;
 
   44    sqrt(xysobel,GradMag);
 
   53    Mat xsobel2, ysobel2, xysobel, GradMag, GrayImg;
 
   55    multiply(xsobel, xsobel, xsobel2, 1, -1 );
 
   56    multiply(ysobel, ysobel, ysobel2, 1, -1 );
 
   58    xysobel=xsobel2+ysobel2;
 
   59    sqrt(xysobel,GradMag);
 
   68   Mat xsobeldiv=xsobel + 0.00001;
 
   74   divide(ysobel,xsobeldiv,div);
 
   79     for (
int n=0; n<6; n++)
 
   81       Bins[n].create(GradMag.rows,GradMag.cols,CV_32FC1);
 
   82       Bins[n] = Mat::zeros(GradMag.rows,GradMag.cols,CV_32FC1);
 
   84  for( 
int r = 0; r < div.rows; r++ )
 
   86       for( 
int c = 0; c < div.cols; c++ )
 
   89         angl = ((atan (div.at<
float>(r,c))) * (180 / 
PI)) + 90;
 
   92           Bins[0].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
   98           Bins[1].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
  103           Bins[2].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
  108           Bins[3].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
  114           Bins[4].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
  119           Bins[5].at<
float>(r,c) = GradMag.at<
float>(r,c);
 
  126   for(
int i=0; i<6; i++)
 
  128     BinVector.push_back(Bins[i]);
 
  138   Mat LUV(Img.rows, Img.cols, CV_32FC3);
 
  141   cvtColor(Img,LUV, CV_RGB2Luv,CV_32F);
 
  143   LUV.assignTo(LUV, CV_32F );
 
  145   split(LUV,LUVchannels);
 
  156   path p = folder_path;
 
  166         copy(directory_iterator(p), directory_iterator(), back_inserter(vect)); 
 
  170       cout << p << 
" is not a folder"<<endl;
 
  177   catch (
const filesystem_error& ex)
 
  179     cout << ex.what() << 
'\n';
 
  189   Mat xsobel, ysobel, GradMag, GrayImg;
 
  192   cvtColor (Image, GrayImg, CV_RGB2GRAY, 0);
 
  194   Sobel (GrayImg, xsobel, CV_32FC1, 1, 0, 3, 1, 0, BORDER_DEFAULT);
 
  195   Sobel (GrayImg, ysobel, CV_32FC1, 0, 1, 3, 1, 0, BORDER_DEFAULT);
 
  204   Mat ToBeMergedChannels[] =
 
  205       { GradMag, BinVect[0], BinVect[1], BinVect[2], BinVect[3], BinVect[4],
 
  206       BinVect[5], LUVchannels[0], LUVchannels[1], LUVchannels[2]
 
  211     merge (ToBeMergedChannels, 
CHANNELNR, MergedChannels);
 
  250   for (
int n=0; n<NrFtrs; n++)
 
  261     Params.
x=rng.uniform(0,region.width-Params.
width+1);
 
  262     Params.
y=rng.uniform(0,region.height-Params.
height+1);
 
  264     randparams.push_back(Params);
 
  277   Size currSize=Image.size();
 
  278   float scaledown = pow(2,(-1.0/nPerOct)), scaleup = pow(2,1.0/nPerOct);
 
  280   Mat currScaledImg=Image , IntegralChns;
 
  284   while (currSize.width>=minSize.width && currSize.height>=minSize.height)
 
  287     Mat MergedChannels (currScaledImg.rows, currScaledImg.cols, CV_32FC (
CHANNELNR));
 
  291     integral (MergedChannels, IntegralChns, CV_32FC (
CHANNELNR));
 
  294     currSize.width *=scaledown; currSize.height *=scaledown; 
 
  295     resize(Image, currScaledImg, currSize, 0, 0, INTER_LINEAR);
 
  303     currSize = Image.size();
 
  306     maxSize.width = currSize.width+currSize.width*0.5*nOctUp;
 
  307     maxSize.height = currSize.height+currSize.height*0.5*nOctUp;
 
  310     while (currSize.width<maxSize.width && currSize.height<maxSize.height)
 
  312     currSize.width *=scaleup; currSize.height *=scaleup; 
 
  313     resize(Image, currScaledImg, currSize, 0, 0, INTER_LINEAR); 
 
  315     Mat MergedChannels (currScaledImg.rows, currScaledImg.cols, CV_32FC (
CHANNELNR));
 
  319     integral (MergedChannels, IntegralChns, CV_32FC (
CHANNELNR));
 
  334   Size currSize=Image.size();
 
  335   float scaledown = pow(2,(-1.0/nPerOct)), scaleup = pow(2,1.0/nPerOct);
 
  337   Mat currScaledImg=Image , IntegralChns;
 
  341   while (currSize.width>=minSize.width && currSize.height>=minSize.height)
 
  344     Mat MergedChannels (currScaledImg.rows, currScaledImg.cols, CV_32FC (
CHANNELNR));
 
  348     integral (MergedChannels, IntegralChns, CV_32FC (
CHANNELNR));
 
  351     currSize.width *=scaledown; currSize.height *=scaledown; 
 
  352     resize(Image, currScaledImg, currSize, 0, 0, INTER_LINEAR);
 
  360     currSize = Image.size();
 
  363     maxSize.width = currSize.width+currSize.width*0.5*nOctUp;
 
  364     maxSize.height = currSize.height+currSize.height*0.5*nOctUp;
 
  367     while (currSize.width<maxSize.width && currSize.height<maxSize.height)
 
  369     currSize.width *=scaleup; currSize.height *=scaleup; 
 
  370     resize(Image, currScaledImg, currSize, 0, 0, INTER_LINEAR); 
 
  372     Mat MergedChannels (currScaledImg.rows, currScaledImg.cols, CV_32FC (
CHANNELNR));
 
  376     integral (MergedChannels, IntegralChns, CV_32FC (
CHANNELNR));
 
  393   for (Rows=0; Rows<IntegralChannels.rows-region.height-1; Rows+=
STEP)
 
  396     for (Cols=0; Cols<IntegralChannels.cols-region.width-1; Cols+=
STEP)
 
  400       region.x=Cols ; region.y=Rows;
 
  412     for (Cols=0 ; Cols<IntegralChannels.cols-region.width-1; Cols+=
STEP)
 
  415     region.x=Cols; region.y=IntegralChannels.rows-region.height-1;
 
  423     for (Rows=0 ; Rows<IntegralChannels.rows-region.height-1; Rows+=
STEP)
 
  426     region.y=Rows; region.x=IntegralChannels.cols-region.width-1;
 
  433     region.y=IntegralChannels.rows-region.height-1; region.x=IntegralChannels.cols-region.width-1;
 
  446   for (Rows=0; Rows<IntegralChannels.rows-region.height-1; Rows+=
STEP)
 
  449     for (Cols=0; Cols<IntegralChannels.cols-region.width-1; Cols+=
STEP)
 
  453       region.x=Cols ; region.y=Rows;
 
  465     for (Cols=0 ; Cols<IntegralChannels.cols-region.width-1; Cols+=
STEP)
 
  468     region.x=Cols; region.y=IntegralChannels.rows-region.height-1;
 
  476     for (Rows=0 ; Rows<IntegralChannels.rows-region.height-1; Rows+=
STEP)
 
  479     region.y=Rows; region.x=IntegralChannels.cols-region.width-1;
 
  485     region.y=IntegralChannels.rows-region.height-1; region.x=IntegralChannels.cols-region.width-1;
 
  496   vec10d tl, tr, bl, br , sum;
 
  497   int sR=Params.
y+region.y, sC=Params.
x+region.x, eR=sR+Params.
height, eC=sC+Params.
width;
 
  499   tl= IntegralChannels.at<
vec10d>(sR,sC);
 
  500   tr= IntegralChannels.at<
vec10d>(sR,eC);
 
  501   bl= IntegralChannels.at<
vec10d>(eR,sC);
 
  502   br= IntegralChannels.at<
vec10d>(eR,eC);
 
  508   features.push_back(sum[n]);  
 
  524   for (
int n=0; n< Params[0].nFtrs ; n++)
 
  536    Test.at<
float>(0,n)=features[features.size()-NRFEATURE+n];
 
  543   float x = boost_classifier.predict(Test,Mat(),Range::all(),
false,
true);
 
  554     ROI.
Scale=IntegralChannels.size();
 
  555     PedRect.push_back(ROI);
 
  587   for (
int n=0; n< Params[0].nFtrs ; n++)
 
  596    aux.push_back(features[features.size()-NRFEATURE+n]);
 
  599   WindowFtrs.push_back(aux);
 
vector< PedRoi > PedRoiVec
 
Mat GradientMagnitude(Mat src)
 
void GetChnFtrsOverWindow(Mat IntegralChannels, vector< float > &features, FtrVecParams2 Params, CvRect region, PedRoiVec &PedRect, CvBoost &boost_classifier)
 
void GetIntegralSum(Mat IntegralChannels, vector< float > &features, FtrParams2 Params, CvRect region)
 
void GetChnFtrsOverImagePyramid(Mat Image, CvRect ®ion, vector< float > &features, int nOctUp, Size minSize, int nPerOct, FtrVecParams2 Params, PedRoiVec &PedRect, CvBoost &boost_classifier)
 
void PostProcess(Mat Img, vector< Rect > PedRect, FtrVecParams2 randparams, CvBoost &boost_classifier, PedRoiVec &PedRect_Post)
 
Vec< float, CHANNELNR > vec10d
 
void GetRandParams(int seed, int NrFtrs, FtrVecParams2 &randparams, Rect region)
 
void GetFileList(string folder_path, PVector &vect)
 
void GetChnFtrsOverImage(Mat IntegralChannels, CvRect ®ion, vector< float > &features, FtrVecParams2 Params, PedRoiVec &PedRect, CvBoost &boost_classifier)
 
vector< FtrParams2 > FtrVecParams2
 
MatVector LUVcolourchannels(Mat Img)
 
void ComputeChannels(Mat Image, Mat &MergedChannels)
 
MatVector OrientedGradientsDiagram(Mat GradMag, Mat xsobel, Mat ysobel)