欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

OpenCV學(xué)習(xí)——物體跟蹤的粒子濾波算法實(shí)現(xiàn)之位

系統(tǒng) 1772 0

/*
Computes the likelihood of there being a player at a given location in
an image

@param img image that has been converted to HSV colorspace using bgr2hsv()
@param r row location of center of window around which to compute likelihood
@param c col location of center of window around which to compute likelihood
@param w width of region over which to compute likelihood
@param h height of region over which to compute likelihood
@param ref_histo reference histogram for a player; must have been
normalized with normalize_histogram()

@return Returns the likelihood of there being a player at location
(\a r, \a c) in \a img
*/
float likelihood( IplImage* img, int r, int c,
int w, int h, histogram* ref_histo )
{
IplImage* tmp;
histogram* histo;
float d_sq;

/* extract region around (r,c) and compute and normalize its histogram */
cvSetImageROI( img, cvRect( c - w / 2, r - h / 2, w, h ) );
tmp = cvCreateImage( cvGetSize(img), IPL_DEPTH_32F, 3 );
cvCopy( img, tmp, NULL );
cvResetImageROI( img );
histo = calc_histogram( &tmp, 1 );
cvReleaseImage( &tmp );
normalize_histogram( histo );

/* compute likelihood as e^{\lambda D^2(h, h^*)} */
d_sq = histo_dist_sq( histo, ref_histo );
free( histo );
return exp( -LAMBDA * d_sq );
}

程序首先取出對(duì)相關(guān)粒子表示的區(qū)域,然后計(jì)算其直方圖,并且歸一化。將這個(gè)直方圖和原來(lái)用戶選定區(qū)域的直方圖傳入函數(shù)histo_dist_sq進(jìn)行比較,最后返回e^(-Lambda*d_sq)返回,成為這個(gè)粒子的權(quán)重。

函數(shù)histo_dist_sq的實(shí)現(xiàn)如下:

/*
Computes squared distance metric based on the Battacharyya similarity
coefficient between histograms.

@param h1 first histogram; should be normalized
@param h2 second histogram; should be normalized

@return Returns a squared distance based on the Battacharyya similarity
coefficient between \a h1 and \a h2
*/
float histo_dist_sq( histogram* h1, histogram* h2 )
{
float* hist1, * hist2;
float sum = 0;
int i, n;

n = h1->n;
hist1 = h1->histo;
hist2 = h2->histo;

/*
According the the Battacharyya similarity coefficient,

D = \sqrt{ 1 - \sum_1^n{ \sqrt{ h_1(i) * h_2(i) } } }
*/
for( i = 0; i < n; i++ )
sum += sqrt( hist1[i]*hist2[i] );
return 1.0 - sum;
}

采用統(tǒng)計(jì)學(xué)上的巴氏距離 Bhattacharyya distance,根據(jù)wiki的描述, Bhattacharyya distance 描述的是兩個(gè)離散概率分布的相似性,它通常在分類操作中被用來(lái)度量不同類型的可分離性,也就是說(shuō)這個(gè)距離算式就是評(píng)定相似度的。嚴(yán)格定義為:

For discrete probability distributions p and q over the same domain X, it is defined as:

where:

is the Bhattacharyya coefficient .

該程序中的算式和這個(gè)式子略有差別。

OpenCV學(xué)習(xí)——物體跟蹤的粒子濾波算法實(shí)現(xiàn)之位置可能性確定


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 国产成人免费 | 久久久久久中文字幕 | 日本无卡码免费一区二区三区 | 亚洲成人自拍偷拍 | 奇米影视四色7777 | 亚瑟天堂久久一区二区影院 | 四虎在线免费观看视频 | 国产免费一级淫片 | 久久88香港三级 | 79thz.com| 污视频在线观看网站 | 一级毛片大全 | 国产亚洲一区二区三区 | 国产在线观看www鲁啊鲁免费 | 色噜噜狠狠狠狠色综合久不 | 欧美日韩中字 | 国产香港一级毛片在线看 | 精品三级国产 | 人人看人人舔 | 一区二区免费 | 综合爱爱 | 毛片毛片毛片毛片毛片怎么 | 亚洲综合在线网 | 精品成人A片久久久久久船舶 | 精品视频在线免费看 | 亲爱的热爱的电视剧免费观看 | 天天做天天爱夜夜大爽完整 | 欧美综合久久 | 成人国产精品免费视频 | 欧美日韩中文国产一区发布 | 青娱乐在线视频盛宴 | 激情毛片| 午夜国产电影 | 99久久精品免费看国产免费 | 成人黄色在线观看视频 | 久久久久久91香蕉国产 | 白白操在线视频 | 日韩另类 | 97精品国产综合久久 | 亚洲精品乱码久久久久久按摩观 | 久操久热 |