{"action":"created","comment":{"url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/comments/31868197","id":31868197,"diff_hunk":"@@ -0,0 +1,538 @@\n+/*M///////////////////////////////////////////////////////////////////////////////////////\n+ //\n+ //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\n+ //\n+ //  By downloading, copying, installing or using the software you agree to this license.\n+ //  If you do not agree to this license, do not download, install,\n+ //  copy or use the software.\n+ //\n+ //\n+ //                           License Agreement\n+ //                For Open Source Computer Vision Library\n+ //\n+ // Copyright (C) 2013, OpenCV Foundation, all rights reserved.\n+ // Third party copyrights are property of their respective owners.\n+ //\n+ // Redistribution and use in source and binary forms, with or without modification,\n+ // are permitted provided that the following conditions are met:\n+ //\n+ //   * Redistribution's of source code must retain the above copyright notice,\n+ //     this list of conditions and the following disclaimer.\n+ //\n+ //   * Redistribution's in binary form must reproduce the above copyright notice,\n+ //     this list of conditions and the following disclaimer in the documentation\n+ //     and/or other materials provided with the distribution.\n+ //\n+ //   * The name of the copyright holders may not be used to endorse or promote products\n+ //     derived from this software without specific prior written permission.\n+ //\n+ // This software is provided by the copyright holders and contributors \"as is\" and\n+ // any express or implied warranties, including, but not limited to, the implied\n+ // warranties of merchantability and fitness for a particular purpose are disclaimed.\n+ // In no event shall the Intel Corporation or contributors be liable for any direct,\n+ // indirect, incidental, special, exemplary, or consequential damages\n+ // (including, but not limited to, procurement of substitute goods or services;\n+ // loss of use, data, or profits; or business interruption) however caused\n+ // and on any theory of liability, whether in contract, strict liability,\n+ // or tort (including negligence or otherwise) arising in any way out of\n+ // the use of this software, even if advised of the possibility of such damage.\n+ //\n+ //M*/\n+\n+#include \"precomp.hpp\"\n+#include \"featureColorName.cpp\"\n+#include <complex>\n+\n+/*---------------------------\n+|  TrackerKCFModel\n+|---------------------------*/\n+namespace cv{\n+   /**\n+  * \\brief Implementation of TrackerModel for MIL algorithm\n+  */\n+  class TrackerKCFModel : public TrackerModel{\n+  public:\n+    TrackerKCFModel(TrackerKCF::Params /*params*/){}\n+    ~TrackerKCFModel(){}\n+  protected:\n+    void modelEstimationImpl( const std::vector<Mat>& /*responses*/ ){}\n+    void modelUpdateImpl(){}\n+  };\n+} /* namespace cv */\n+\n+\n+/*---------------------------\n+|  TrackerKCF\n+|---------------------------*/\n+namespace cv{\n+  \n+  /*\n+ * Prototype\n+ */\n+  class TrackerKCFImpl : public TrackerKCF {\n+  public:\n+    TrackerKCFImpl( const TrackerKCF::Params &parameters = TrackerKCF::Params() );\n+    void read( const FileNode& /*fn*/ );\n+    void write( FileStorage& /*fs*/ ) const;\n+      \n+  protected:\n+     /*\n+    * basic functions and vars\n+    */\n+    bool initImpl( const Mat& /*image*/, const Rect2d& boundingBox );\n+    bool updateImpl( const Mat& image, Rect2d& boundingBox );\n+    \n+    TrackerKCF::Params params;\n+    \n+    /*\n+    * KCF functions and vars\n+    */\n+    void createHanningWindow(OutputArray _dst, const cv::Size winSize, const int type) const;\n+    void inline fft2(const Mat src, Mat & dest) const;\n+    void inline ifft2(const Mat src, Mat & dest) const ;  \n+    bool getSubWindow(const Mat img, const Rect roi, Mat& patch) const;\n+    void extractCN(Mat _patch, Mat & cnFeatures) const;\n+    void denseGaussKernel(const double sigma, const Mat _x, const Mat _y, Mat & _k) const;\n+    void calcResponse(const Mat _alphaf, const Mat _k, Mat & _response) const;\n+    \n+    void shiftRows(Mat& mat) const; \n+    void shiftRows(Mat& mat, int n) const;\n+    void shiftCols(Mat& mat, int n) const;\n+    \n+  private:\n+    double output_sigma;\n+    Rect2d roi;\n+    Mat hann; \t//hann window filter\n+    \n+    Mat y,yf; \t// training response and its FFT\n+    Mat x,xf; \t// observation and its FFT\n+    Mat k,kf;\t// dense gaussian kernel and its FFT\n+    Mat new_alphaf, alphaf;\t// learning rate\n+    Mat z, new_z;\n+    Mat response; // detection result\n+    \n+    bool resizeImage; // resize the image whenever needed and the patch size is large\n+    \n+    int frame;\n+  };\n+    \n+  /*\n+ * Constructor\n+ */\n+  Ptr<TrackerKCF> TrackerKCF::createTracker(const TrackerKCF::Params &parameters){\n+      return Ptr<TrackerKCFImpl>(new TrackerKCFImpl(parameters));\n+  }\n+  TrackerKCFImpl::TrackerKCFImpl( const TrackerKCF::Params &parameters ) :\n+      params( parameters )\n+  {\n+    isInit = false;\n+    resizeImage = false;\n+  }\n+  \n+  void TrackerKCFImpl::read( const cv::FileNode& fn ){\n+    params.read( fn );\n+  }\n+\n+  void TrackerKCFImpl::write( cv::FileStorage& fs ) const{\n+    params.write( fs );\n+  }\n+  \n+  /*\n+   * Initialization: \n+   * - creating hann window filter\n+   * - ROI padding\n+   * - creating a gaussian response for the training ground-truth\n+   * - perform FFT to the gaussian response\n+   */\n+  bool TrackerKCFImpl::initImpl( const Mat& /*image*/, const Rect2d& boundingBox ){\n+    frame=0;\n+    roi = boundingBox;\n+    \n+    //calclulate output sigma\n+    output_sigma=sqrt(roi.width*roi.height)*params.output_sigma_factor;\n+    output_sigma=-0.5/(output_sigma*output_sigma);\n+    \n+    //resize the ROI whenever needed\n+    if(params.resize && roi.width*roi.height>params.max_patch_size){\n+      resizeImage=true;\n+      roi.x/=2.0;\n+      roi.y/=2.0;\n+      roi.width/=2.0;\n+      roi.height/=2.0;\n+    }    \n+    \n+    // add padding to the roi\n+    roi.x-=roi.width/2;\n+    roi.y-=roi.height/2+1;\n+    roi.width*=2;\n+    roi.height*=2;\n+    \n+    // initialize the hann window filter\n+    createHanningWindow(hann, roi.size(), CV_64F);\n+    if(params.descriptor==CN){\n+      Mat layers[] = {hann, hann, hann, hann, hann, hann, hann, hann, hann, hann};\n+      merge(layers, 10, hann); \n+    }\n+    if(params.descriptor != GRAY){printf(\"The choosen descriptor mode is not available! Please use GRAY descriptor, other descriptors will be avaiable soon.\\n\");return false;}//temporary, will be updated soon\n+    \n+    // create gaussian response\n+    y=Mat::zeros((int)roi.height,(int)roi.width,CV_64F);\n+    for(unsigned i=0;i<roi.height;i++){\n+      for(unsigned j=0;j<roi.width;j++){\n+\ty.at<double>(i,j)=(i-roi.height/2+1)*(i-roi.height/2+1)+(j-roi.width/2+1)*(j-roi.width/2+1);\n+      }\n+    }\n+    \n+    y*=(double)output_sigma;\n+    cv::exp(y,y);\n+    \n+    // perform fourier transfor to the gaussian response\n+    fft2(y,yf);\n+  \n+    model=Ptr<TrackerKCFModel>(new TrackerKCFModel(params));\n+    \n+    // TODO: return true only if roi inside the image\n+    return true;\n+  }\n+  \n+  /*\n+   * Main part of the KCF algorithm\n+   */\n+  bool TrackerKCFImpl::updateImpl( const Mat& image, Rect2d& boundingBox ){\n+    double minVal, maxVal;\t// min-max response\n+    Point minLoc,maxLoc;\t// min-max location\n+    \n+    Mat img=image.clone();\n+    // check the channels of the input image, grayscale is preferred\n+    CV_Assert(image.channels() == 1 || image.channels() == 3);\n+    \n+    // resize the image whenever needed\n+    if(resizeImage)resize(img,img,Size(img.cols/2,img.rows/2));\n+    \n+    // extract and pre-process the patch\n+    if(!getSubWindow(img,roi, x))return false;\n+    \n+    // detection part\n+    if(frame>0){\n+       denseGaussKernel(params.sigma,x,z,k);\n+       calcResponse(alphaf,k,response);\n+       minMaxLoc( response, &minVal, &maxVal, &minLoc, &maxLoc );\n+       roi.x+=(maxLoc.x-roi.width/2+1);roi.y+=(maxLoc.y-roi.height/2+1);\n+       \n+       // update the bounding box\n+       boundingBox.x=(resizeImage?roi.x*2:roi.x)+boundingBox.width/2;\n+       boundingBox.y=(resizeImage?roi.y*2:roi.y)+boundingBox.height/2;\n+    }\n+    \n+    // extract the patch for learning purpose\n+    if(!getSubWindow(img,roi, x))return false;\n+    \n+    // Kernel Regularized Least-Squares, calculate alphas\n+    denseGaussKernel(params.sigma,x,x,k);\n+    fft2(k,kf);\n+    kf=kf+params.lambda;\n+    \n+    /* TODO: optimize this element-wise division\n+     * new_alphaf=yf./kf\n+     * z=[(ax+bd)+i(bc-ad)]/(c^2+d^2)\n+     */ \n+    new_alphaf=Mat_<Vec2d >(yf.rows, yf.cols); \n+    std::complex<double> temp;\n+    for(int i=0;i<yf.rows;i++){\n+      for(int j=0;j<yf.cols;j++){\n+\ttemp=std::complex<double>(yf.at<Vec2d>(i,j)[0],yf.at<Vec2d>(i,j)[1])/(std::complex<double>(kf.at<Vec2d>(i,j)[0],kf.at<Vec2d>(i,j)[1])/*+complex<float>(0.0000000001,0.0000000001)*/);\n+\tnew_alphaf.at<Vec2d >(i,j)[0]=temp.real();\n+\tnew_alphaf.at<Vec2d >(i,j)[1]=temp.imag();\n+      }\n+    }\n+    \n+    // update the learning model\n+    new_z=x.clone();\n+    if(frame==0){\n+      alphaf=new_alphaf.clone();\n+      z=x;\n+    }else{\n+      alphaf=(1.0-params.interp_factor)*alphaf+params.interp_factor*new_alphaf;\n+      z=(1.0-params.interp_factor)*z+params.interp_factor*new_z;\n+    }\n+  \n+    frame++;\n+    return true;\n+  }\n+  \n+  \n+  /*-------------------------------------\n+  |  implementation of the KCF functions\n+  |-------------------------------------*/\n+  \n+  /* \n+   * hann window filter\n+   */\n+  void TrackerKCFImpl::createHanningWindow(OutputArray _dst, const cv::Size winSize, const int type)const{\n+      CV_Assert( type == CV_32FC1 || type == CV_64FC1 );\n+\n+      _dst.create(winSize, type);\n+      Mat dst = _dst.getMat();\n+\n+      int rows = dst.rows, cols = dst.cols;\n+\n+      AutoBuffer<double> _wc(cols);\n+      double * const wc = (double *)_wc;\n+\n+      double coeff0 = 2.0 * CV_PI / (double)(cols - 1), coeff1 = 2.0f * CV_PI / (double)(rows - 1);\n+      for(int j = 0; j < cols; j++)\n+\t  wc[j] = 0.5 * (1.0 - cos(coeff0 * j));\n+\n+      if(dst.depth() == CV_32F)\n+      {\n+\t  for(int i = 0; i < rows; i++)\n+\t  {\n+\t      float* dstData = dst.ptr<float>(i);\n+\t      double wr = 0.5 * (1.0 - cos(coeff1 * i));\n+\t      for(int j = 0; j < cols; j++)\n+\t\t  dstData[j] = (float)(wr * wc[j]);\n+\t  }\n+      }\n+      else\n+      {\n+\t  for(int i = 0; i < rows; i++)\n+\t  {\n+\t      double* dstData = dst.ptr<double>(i);\n+\t      double wr = 0.5 * (1.0 - cos(coeff1 * i));\n+\t      for(int j = 0; j < cols; j++)\n+\t\t  dstData[j] = wr * wc[j];\n+\t  }\n+      }\n+\n+      // perform batch sqrt for SSE performance gains\n+      //cv::sqrt(dst, dst); //matlab do not use the square rooted version\n+  }\n+  \n+  /*\n+   * simplification of fourier transoform function in opencv\n+   */\n+  void inline TrackerKCFImpl::fft2(const Mat src, Mat & dest)const {\n+    Mat planes[] = {Mat_<double>(src), Mat::zeros(src.size(), CV_64F)};\n+    merge(planes, 2, dest); \n+    dft(dest,dest,DFT_COMPLEX_OUTPUT);\n+  }\n+\n+  /*\n+   * simplification of inverse fourier transoform function in opencv\n+   */\n+  void inline TrackerKCFImpl::ifft2(const Mat src, Mat & dest)const {\n+    idft(src,dest,DFT_SCALE+DFT_REAL_OUTPUT);\n+  }\n+  \n+  /*\n+   * obtain the patch and apply hann window filter to it\n+   */\n+  bool TrackerKCFImpl::getSubWindow(const Mat img, const Rect _roi, Mat& patch) const{\n+\n+    Rect region=_roi;\n+  \n+    // return false if roi is outside the image\n+    if((_roi.x+_roi.width<0)\n+      ||(_roi.y+_roi.height<0)\n+      ||(_roi.x>=img.cols)\n+      ||(_roi.y>=img.rows)\n+    )return false;\n+    \n+    // extract patch inside the image \n+    if(_roi.x<0){region.x=0;region.width+=_roi.x;}\n+    if(_roi.y<0){region.y=0;region.height+=_roi.y;}\n+    if(_roi.x+_roi.width>img.cols)region.width=img.cols-_roi.x;\n+    if(_roi.y+_roi.height>img.rows)region.height=img.rows-_roi.y;\n+    if(region.width>img.cols)region.width=img.cols;\n+    if(region.height>img.rows)region.height=img.rows;\n+\n+    patch=img(region).clone();\n+    \n+    // add some padding to compensate when the patch is outside image border\n+    int addTop,addBottom, addLeft, addRight;\n+    addTop=region.y-_roi.y;\n+    addBottom=(_roi.height+_roi.y>img.rows?_roi.height+_roi.y-img.rows:0);\n+    addLeft=region.x-_roi.x;\n+    addRight=(_roi.width+_roi.x>img.cols?_roi.width+_roi.x-img.cols:0);\n+\n+    copyMakeBorder(patch,patch,addTop,addBottom,addLeft,addRight,BORDER_REPLICATE);\n+\n+    // extract the desired descriptors\n+    switch(params.descriptor){\n+      case GRAY:\n+\tif(img.channels()>1)cvtColor(patch,patch, CV_BGR2GRAY);\n+\tbreak;\n+      case CN:\n+\tCV_Assert(img.channels() == 3);\n+\textractCN(patch,patch);\n+\tbreak;\n+      default:\n+\tif(patch.channels()>1)cvtColor(patch,patch, CV_BGR2GRAY);\n+\tbreak;\n+    }\n+    \n+    patch.convertTo(patch,CV_64F);\n+\n+    patch=patch/255.0-0.5; // normalize to range -0.5 .. 0.5\n+    patch=patch.mul(hann); // hann window filter\n+    \n+    return true;\n+    \n+  }\n+  \n+  /* Convert BGR to ColorNames\n+   */\n+  void TrackerKCFImpl::extractCN(Mat _patch, Mat & cnFeatures) const {\n+    Vec3b & pixel = _patch.at<Vec3b>(0,0);\n+    unsigned index;\n+    \n+    Mat temp = Mat::zeros(_patch.rows,_patch.cols,CV_64FC(10));\n+    \n+    for(int i=0;i<_patch.rows;i++){\n+      for(int j=0;j<_patch.cols;j++){\n+\tpixel=_patch.at<Vec3b>(i,j);\n+\tindex=(unsigned)(floor(pixel[2]/8)+32*floor(pixel[1]/8)+32*32*floor(pixel[0]/8));\n+\t\n+\t//copy the values\n+\tfor(int _k=0;_k<10;_k++){\n+\t  temp.at<Vec<double,10> >(i,j)[_k]=ColorNames[index][_k];\n+\t}\n+      }\n+    }\n+    \n+    cnFeatures=temp.clone();\n+  }\n+  \n+  /*\n+   *  dense gauss kernel function\n+   */\n+  void TrackerKCFImpl::denseGaussKernel(const double sigma, const Mat _x, const Mat _y, Mat & _k)const{\n+    Mat _xf, _yf, xyf,xy;\n+    double normX, normY;\n+    \n+    fft2(_x,_xf);\n+    fft2(_y,_yf);\n+    normX=norm(_x);\n+    normX*=normX;\n+    normY=norm(_y);\n+    normY*=normY;\n+    \n+    mulSpectrums(_xf,_yf,xyf,0,true);\n+      \n+    ifft2(xyf,xyf);\n+    shiftRows(xyf, _x.rows/2);\n+    shiftCols(xyf,_x.cols/2);\n+\n+    //(xx + yy - 2 * xy) / numel(x)\n+    xy=(normX+normY-2*xyf)/(_x.rows*_x.cols);\n+\n+\n+    // TODO: check wether we really need thresholding or not\n+    //threshold(xy,xy,0.0,0.0,THRESH_TOZERO);//max(0, (xx + yy - 2 * xy) / numel(x))\n+    for(int i=0;i<xy.rows;i++){\n+      for(int j=0;j<xy.cols;j++){\n+\tif(xy.at<double>(i,j)<0.0)xy.at<double>(i,j)=0.0;\n+      }\n+    }\n+    \n+    double sig=-1.0/(sigma*sigma);\n+    xy=sig*xy;\n+    exp(xy,_k);\n+\n+  }\n+  \n+  /* CIRCULAR SHIT Function\n+   * http://stackoverflow.com/questions/10420454/shift-like-matlab-function-rows-or-columns-of-a-matrix-in-opencv\n+   */\n+  // circular shift one row from up to down\n+  void TrackerKCFImpl::shiftRows(Mat& mat) const {\n+\n+      Mat temp;\n+      Mat m;\n+      int _k = (mat.rows-1);\n+      mat.row(_k).copyTo(temp);\n+      for(; _k > 0 ; _k-- ) {\n+\t  m = mat.row(_k);\n+\t  mat.row(_k-1).copyTo(m);\n+      }\n+      m = mat.row(0);\n+      temp.copyTo(m);\n+\n+  }\n+\n+  // circular shift n rows from up to down if n > 0, -n rows from down to up if n < 0\n+  void TrackerKCFImpl::shiftRows(Mat& mat, int n) const {\n+\n+      if( n < 0 ) {\n+\n+\t  n = -n;\n+\t  flip(mat,mat,0);\n+\t  for(int _k=0; _k < n;_k++) {\n+\t      shiftRows(mat);\n+\t  }\n+\t  flip(mat,mat,0);\n+\n+      } else {\n+\n+\t  for(int _k=0; _k < n;_k++) {\n+\t      shiftRows(mat);\n+\t  }\n+      }\n+\n+  }\n+\n+  //circular shift n columns from left to right if n > 0, -n columns from right to left if n < 0\n+  void TrackerKCFImpl::shiftCols(Mat& mat, int n) const {\n+\n+      if(n < 0){\n+\n+\t  n = -n;\n+\t  flip(mat,mat,1);\n+\t  transpose(mat,mat);\n+\t  shiftRows(mat,n);\n+\t  transpose(mat,mat);\n+\t  flip(mat,mat,1);\n+\n+      } else {\n+\n+\t  transpose(mat,mat);\n+\t  shiftRows(mat,n);\n+\t  transpose(mat,mat);\n+      }\n+  }\n+\n+  /*\n+   * calculate the detection response\n+   */\n+  void TrackerKCFImpl::calcResponse(const Mat _alphaf, const Mat _k, Mat & _response)const {\n+    //alpha f--> 2channels ; k --> 1 channel; \n+    Mat _kf;\n+    fft2(_k,_kf);\n+    Mat spec;\n+    mulSpectrums(_alphaf,_kf,spec,0,false);\n+    ifft2(spec,_response);\n+  }\n+  /*----------------------------------------------------------------------*/\n+  \n+  /*\n+ * Parameters\n+ */\n+  TrackerKCF::Params::Params(){\n+      sigma=0.2;\n+      lambda=0.01;\n+      interp_factor=0.075;\n+      output_sigma_factor=1.0/16.0;\n+      resize=true;\n+      max_patch_size=80*80;\n+      descriptor=GRAY;\n+  }\n+\n+  void TrackerKCF::Params::read( const cv::FileNode& /*fn*/ ){","path":"modules/tracking/src/trackerKCF.cpp","position":530,"original_position":530,"commit_id":"df9adff57719fcb30aba123f370da83f993991cc","original_commit_id":"df9adff57719fcb30aba123f370da83f993991cc","user":{"login":"iglesias","id":1158006,"avatar_url":"https://avatars.githubusercontent.com/u/1158006?v=3","gravatar_id":"","url":"https://api.github.com/users/iglesias","html_url":"https://github.com/iglesias","followers_url":"https://api.github.com/users/iglesias/followers","following_url":"https://api.github.com/users/iglesias/following{/other_user}","gists_url":"https://api.github.com/users/iglesias/gists{/gist_id}","starred_url":"https://api.github.com/users/iglesias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iglesias/subscriptions","organizations_url":"https://api.github.com/users/iglesias/orgs","repos_url":"https://api.github.com/users/iglesias/repos","events_url":"https://api.github.com/users/iglesias/events{/privacy}","received_events_url":"https://api.github.com/users/iglesias/received_events","type":"User","site_admin":false},"body":"Minor suggestion. In this function and the one below, if you plan to leave their implementation empty, then I suggest to finish them with {} in one line (easier to grep). Otherwise, write TODO or something equivalent.","created_at":"2015-06-06T13:52:48Z","updated_at":"2015-06-06T13:52:48Z","html_url":"https://github.com/Itseez/opencv_contrib/pull/245#discussion_r31868197","pull_request_url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245","_links":{"self":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/comments/31868197"},"html":{"href":"https://github.com/Itseez/opencv_contrib/pull/245#discussion_r31868197"},"pull_request":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245"}}},"pull_request":{"url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245","id":36801361,"html_url":"https://github.com/Itseez/opencv_contrib/pull/245","diff_url":"https://github.com/Itseez/opencv_contrib/pull/245.diff","patch_url":"https://github.com/Itseez/opencv_contrib/pull/245.patch","issue_url":"https://api.github.com/repos/Itseez/opencv_contrib/issues/245","number":245,"state":"open","locked":false,"title":"Added KCF Tracker Framework","user":{"login":"kurnianggoro","id":4920587,"avatar_url":"https://avatars.githubusercontent.com/u/4920587?v=3","gravatar_id":"","url":"https://api.github.com/users/kurnianggoro","html_url":"https://github.com/kurnianggoro","followers_url":"https://api.github.com/users/kurnianggoro/followers","following_url":"https://api.github.com/users/kurnianggoro/following{/other_user}","gists_url":"https://api.github.com/users/kurnianggoro/gists{/gist_id}","starred_url":"https://api.github.com/users/kurnianggoro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurnianggoro/subscriptions","organizations_url":"https://api.github.com/users/kurnianggoro/orgs","repos_url":"https://api.github.com/users/kurnianggoro/repos","events_url":"https://api.github.com/users/kurnianggoro/events{/privacy}","received_events_url":"https://api.github.com/users/kurnianggoro/received_events","type":"User","site_admin":false},"body":"This tracker can be tested using the code provided in modules/tracking/samples/tracker.cpp or bencmark.cpp.\r\nThe sample dataset is available at\r\nhttps://github.com/Itseez/opencv_extra/tree/master/testdata/cv/tracking\r\nthose videos can be used in bencmark.cpp with a little modifications.\r\nsince the bounding box format is different with the dataset, please change line 46-49 in bencmark.cpp to the following:\r\n  res.x=nums[0];\r\n  res.y=nums[1];\r\n  res.width=nums[2];\r\n  res.height=nums[3];\r\nplease use \"dudek\" or \"faceocc2\" since the groundtruth data in \"david\" cannot be used directly (the ground-truth is started from 300th frame).\r\n\r\nThe the benchmark program can be called using this kind of format:\r\n./benchmark  faceocc2.webm gt.txt KCF \"118 57 82 98\" MIL \"118 57 82 98\"\r\n\r\nCurrently, the only available descriptor is GRAY, if other descriptor is set, error message will be appeared.","created_at":"2015-06-03T06:14:21Z","updated_at":"2015-06-06T13:52:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74d09c68dee114e68b0187f508b6c31d5d1a85df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245/commits","review_comments_url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245/comments","review_comment_url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Itseez/opencv_contrib/issues/245/comments","statuses_url":"https://api.github.com/repos/Itseez/opencv_contrib/statuses/df9adff57719fcb30aba123f370da83f993991cc","head":{"label":"kurnianggoro:KCF","ref":"KCF","sha":"df9adff57719fcb30aba123f370da83f993991cc","user":{"login":"kurnianggoro","id":4920587,"avatar_url":"https://avatars.githubusercontent.com/u/4920587?v=3","gravatar_id":"","url":"https://api.github.com/users/kurnianggoro","html_url":"https://github.com/kurnianggoro","followers_url":"https://api.github.com/users/kurnianggoro/followers","following_url":"https://api.github.com/users/kurnianggoro/following{/other_user}","gists_url":"https://api.github.com/users/kurnianggoro/gists{/gist_id}","starred_url":"https://api.github.com/users/kurnianggoro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurnianggoro/subscriptions","organizations_url":"https://api.github.com/users/kurnianggoro/orgs","repos_url":"https://api.github.com/users/kurnianggoro/repos","events_url":"https://api.github.com/users/kurnianggoro/events{/privacy}","received_events_url":"https://api.github.com/users/kurnianggoro/received_events","type":"User","site_admin":false},"repo":{"id":32844299,"name":"opencv_contrib","full_name":"kurnianggoro/opencv_contrib","owner":{"login":"kurnianggoro","id":4920587,"avatar_url":"https://avatars.githubusercontent.com/u/4920587?v=3","gravatar_id":"","url":"https://api.github.com/users/kurnianggoro","html_url":"https://github.com/kurnianggoro","followers_url":"https://api.github.com/users/kurnianggoro/followers","following_url":"https://api.github.com/users/kurnianggoro/following{/other_user}","gists_url":"https://api.github.com/users/kurnianggoro/gists{/gist_id}","starred_url":"https://api.github.com/users/kurnianggoro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kurnianggoro/subscriptions","organizations_url":"https://api.github.com/users/kurnianggoro/orgs","repos_url":"https://api.github.com/users/kurnianggoro/repos","events_url":"https://api.github.com/users/kurnianggoro/events{/privacy}","received_events_url":"https://api.github.com/users/kurnianggoro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kurnianggoro/opencv_contrib","description":"Repository for OpenCV's extra modules","fork":true,"url":"https://api.github.com/repos/kurnianggoro/opencv_contrib","forks_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/forks","keys_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/teams","hooks_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/hooks","issue_events_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/issues/events{/number}","events_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/events","assignees_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/assignees{/user}","branches_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/branches{/branch}","tags_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/tags","blobs_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/languages","stargazers_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/stargazers","contributors_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/contributors","subscribers_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/subscribers","subscription_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/subscription","commits_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/contents/{+path}","compare_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/merges","archive_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/downloads","issues_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/issues{/number}","pulls_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/labels{/name}","releases_url":"https://api.github.com/repos/kurnianggoro/opencv_contrib/releases{/id}","created_at":"2015-03-25T05:24:20Z","updated_at":"2015-03-25T05:24:23Z","pushed_at":"2015-06-03T07:59:56Z","git_url":"git://github.com/kurnianggoro/opencv_contrib.git","ssh_url":"git@github.com:kurnianggoro/opencv_contrib.git","clone_url":"https://github.com/kurnianggoro/opencv_contrib.git","svn_url":"https://github.com/kurnianggoro/opencv_contrib","homepage":null,"size":77175,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"KCF"}},"base":{"label":"Itseez:master","ref":"master","sha":"d4f651ea255bd95d36bfa3d3c36f3e30aac1e56a","user":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"repo":{"id":12756992,"name":"opencv_contrib","full_name":"Itseez/opencv_contrib","owner":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Itseez/opencv_contrib","description":"Repository for OpenCV's extra modules","fork":false,"url":"https://api.github.com/repos/Itseez/opencv_contrib","forks_url":"https://api.github.com/repos/Itseez/opencv_contrib/forks","keys_url":"https://api.github.com/repos/Itseez/opencv_contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Itseez/opencv_contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Itseez/opencv_contrib/teams","hooks_url":"https://api.github.com/repos/Itseez/opencv_contrib/hooks","issue_events_url":"https://api.github.com/repos/Itseez/opencv_contrib/issues/events{/number}","events_url":"https://api.github.com/repos/Itseez/opencv_contrib/events","assignees_url":"https://api.github.com/repos/Itseez/opencv_contrib/assignees{/user}","branches_url":"https://api.github.com/repos/Itseez/opencv_contrib/branches{/branch}","tags_url":"https://api.github.com/repos/Itseez/opencv_contrib/tags","blobs_url":"https://api.github.com/repos/Itseez/opencv_contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Itseez/opencv_contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Itseez/opencv_contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/Itseez/opencv_contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Itseez/opencv_contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/Itseez/opencv_contrib/languages","stargazers_url":"https://api.github.com/repos/Itseez/opencv_contrib/stargazers","contributors_url":"https://api.github.com/repos/Itseez/opencv_contrib/contributors","subscribers_url":"https://api.github.com/repos/Itseez/opencv_contrib/subscribers","subscription_url":"https://api.github.com/repos/Itseez/opencv_contrib/subscription","commits_url":"https://api.github.com/repos/Itseez/opencv_contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/Itseez/opencv_contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/Itseez/opencv_contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/Itseez/opencv_contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/Itseez/opencv_contrib/contents/{+path}","compare_url":"https://api.github.com/repos/Itseez/opencv_contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Itseez/opencv_contrib/merges","archive_url":"https://api.github.com/repos/Itseez/opencv_contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Itseez/opencv_contrib/downloads","issues_url":"https://api.github.com/repos/Itseez/opencv_contrib/issues{/number}","pulls_url":"https://api.github.com/repos/Itseez/opencv_contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/Itseez/opencv_contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/Itseez/opencv_contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Itseez/opencv_contrib/labels{/name}","releases_url":"https://api.github.com/repos/Itseez/opencv_contrib/releases{/id}","created_at":"2013-09-11T13:28:04Z","updated_at":"2015-06-06T12:46:10Z","pushed_at":"2015-06-05T21:12:48Z","git_url":"git://github.com/Itseez/opencv_contrib.git","ssh_url":"git@github.com:Itseez/opencv_contrib.git","clone_url":"https://github.com/Itseez/opencv_contrib.git","svn_url":"https://github.com/Itseez/opencv_contrib","homepage":null,"size":103035,"stargazers_count":240,"watchers_count":240,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":385,"mirror_url":null,"open_issues_count":53,"forks":385,"open_issues":53,"watchers":240,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245"},"html":{"href":"https://github.com/Itseez/opencv_contrib/pull/245"},"issue":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/issues/245"},"comments":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/issues/245/comments"},"review_comments":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245/comments"},"review_comment":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/pulls/245/commits"},"statuses":{"href":"https://api.github.com/repos/Itseez/opencv_contrib/statuses/df9adff57719fcb30aba123f370da83f993991cc"}}}}