aihot  2017-04-27 23:51:15  OpenCV |   查看评论   
  
  •             //pow(-1.0, c)也就是-1的c次方,而c随机地取0或者1,也就是说weightTemp是随机的正或者负。  
  •             //随机测量矩阵中,矩阵元素有三种,sqrt(s)、-sqrt(s)和零。为正和为负的概率是相等的,  
  •             //这就是为什么是[2,4)均匀采样的原因,就是取0或者1概率一样。  
  •             //但是这里为什么是sqrt(s)分之一呢?还有什么时候是0呢?论文中是0的概率不是挺大的吗?  
  •             //没有0元素,哪来的稀疏表达和压缩呢?不懂,恳请指导!(当然稀疏表达的另一个好处  
  •             //就是只需保存非零元素。但这里和这个有关系吗?)  
  •             weightTemp = (float)pow(-1.0, cvFloor(rng.uniform(0.0, 2.0))) / sqrt(float(numRect));  
  •               
  •             //保存每一个特征模板对应的权重  
  •             featuresWeight[i].push_back(weightTemp);  
  •              
  •         }  
  •     }  
  • }  
  •   
  • //在上一帧跟踪的目标box的周围采集若干正样本和负样本,来初始化或者更新分类器的  
  • void CompressiveTracker::sampleRect(Mat& _image, Rect& _objectBox, float _rInner, float _rOuter, int _maxSampleNum, vector<Rect>& _sampleBox)  
  • /* Description: compute the coordinate of positive and negative sample image templates 
  •    Arguments: 
  •    -_image:        processing frame 
  •    -_objectBox:    recent object position  
  •    -_rInner:       inner sampling radius 
  •    -_rOuter:       Outer sampling radius 
  •    -_maxSampleNum: maximal number of sampled images 
  •    -_sampleBox:    Storing the rectangle coordinates of the sampled images. 
  • */  
  • {  
  •     int rowsz = _image.rows - _objectBox.height - 1;  
  •     int colsz = _image.cols - _objectBox.width - 1;  
  •     //我们是在上一帧跟踪的目标box的周围采集正样本和负样本的,而这个周围是通过以  
  •     //这个目标为中心的两个圆来表示,这两个圆的半径是_rInner和_rOuter。  
  •     //我们在离上一帧跟踪的目标box的小于_rInner距离的范围内采集正样本,  
  •     //在大于_rOuter距离的范围内采集负样本(论文中还有一个上界,但好像  
  •     //这里没有,其实好像也没什么必要噢)  
  •     float inradsq = _rInner*_rInner;  
  •     
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自压缩跟踪Compressive Tracking源码理解

    留言与评论(共有 0 条评论)
       
    验证码:
    [lianlun]1[/lianlun]