DSKCF使用图像的深度信息可以对目标的遮挡,尺度的变化和形变进行处理。
1.Fast depth segmentation
作者通过计算boundingbox区域的深度直方图,提取出峰值确定聚类的个数,然后进行kmean聚类,最后得到与front区域相同大小的mask(目标像素位置为1,其他为0)
this->m_histogram = DepthHistogram::createHistogram( 50, front_depth, mask );
//Find the peaks in the histogram
std::vector< int > peaks = this->m_histogram.getPeaks( 5, 0.02 );
//Group the points and label them
this->labelsResults = this->m_histogram.getLabels( peaks );
cv::Mat1i L=this->createLabelImageCC(front_depth,mask,this->labelsResults.centers,this->labelsResults.labels,this->labelsResults.labelsC);
//Find the nearest object and calculate its mean depth and standard deviation
int indexCenter=selectClosestObject( this->labelsResults.centers);
cv::Mat objectMask = createMask< uchar >( L, this->labelsResults.labelsC[indexCenter], false );
2.Detecting and handling scale changes
作者使用深度信息对目标的尺寸进行预测,首先通过当前帧预测目标的深度与上一帧的深度进行比较,得到尺度因子,也就是作者文中说的连续的尺度因子,然后根据这个尺度因子在定义好的尺度空间中查找最佳尺寸。可以通俗的认为物体越远尺寸越小,反之越大。
double sf = this->m_initialDepth / this->m_currentDepth;
this->m_scaleFactor = sf;
double scaleOffset = this->m_scaleFactor - this->m_scales[ this->m_i ];
size_t ind = 0;
std::vector< double > diffs(this->m_scales.begin(),this->m_scales.begin() + this->m_i);
for( size_t i = 0; i < diffs.size(); i++ )
{
diffs[ i ] = std::abs( diffs[ i ] - this->m_scaleFactor );
}
double a = *std::min_element( diffs.begin(), diffs.end() );
for( size_t i = 0; i < diffs.size(); i++ )
{
if( diffs[ i ] == a )
{
ind = i;
}
}
3.Detecting and handling occlusions
在进行detect系列操作后得到目标中心的位置,这时候的size还是没有更新的时候,仍使用的是前一帧的targetsize,通过这个区域进行depthsegment的更新,利用相应的深度信息判断是否遮挡。
bool OcclusionHandler::evaluateOcclusion( const DepthHistogram & histogram, const int objectBin, const double maxResponse,const double totalArea )
{
// ( f(z)_max < λ_r1 ) ∧ ( Φ( Ω_obj ) > λ_occ l)
std:: cout<<"evaluateOcclusion!"<<std::endl;
return ( ( maxResponse < this->m_lambdaR1 ) && ( this->phi( histogram, objectBin,totalArea ) > this->m_lambdaOcc ) );
}
bool OcclusionHandler::evaluateVisibility( const DepthHistogram & histogram, const int objectBin, const double maxResponse ) const
{
//( f(z)_n > λ_r2 ) ∧ ( Φ( Ω_Tbc ) < λ_occ )
std:: cout<<"evaluateVisibility!"<<std::endl;
return ( ( maxResponse > this->m_lambdaR2 ) && ( this->phi( histogram, objectBin ) < this->m_lambdaOcc ) );
}
今天有点累了就写到这了,假如有不对的地方请大家指教。