91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

粒子濾波器+目標跟蹤的C實現,VS2013+opencv249+gsl1.8。包含gsl1.8工具,無需二外單獨下載

資源截圖

代碼片段和文件信息

/*
??Functions?for?the?observation?model?in?a?particle?filter?football?player
??tracker

??@author?Rob?Hess
??@version?1.0.0-20060306
*/

#include?“defs.h“
#include?“utils.h“
#include?“observation.h“


/*
??Converts?a?BGR?image?to?HSV?colorspace
??
??@param?bgr?image?to?be?converted
??
??@return?Returns?bgr?converted?to?a?3-channel?32-bit?HSV?image?with
????S?and?V?values?in?the?range?[01]?and?H?value?in?the?range?[0360]
*/
//將圖像轉換到HSV顏色空間
IplImage*?bgr2hsv(?IplImage*?bgr?)
{
??IplImage*?bgr32f?*?hsv;

??bgr32f?=?cvCreateImage(?cvGetSize(bgr)?IPL_DEPTH_32F?3?);
??hsv?=?cvCreateImage(?cvGetSize(bgr)?IPL_DEPTH_32F?3?);
??cvConvertScale(?bgr?bgr32f?1.0?/?255.0?0?);
??cvCvtColor(?bgr32f?hsv?CV_BGR2HSV?);
??cvReleaseImage(?&bgr32f?);
??return?hsv;
}


/*
??Calculates?the?histogram?bin?into?which?an?HSV?entry?falls
??
??@param?h?Hue
??@param?s?Saturation
??@param?v?Value
??
??@return?Returns?the?bin?index?corresponding?to?the?HSV?color?defined?by
????\a?h?\a?s?and?\a?v.
*/
int?histo_bin(?float?h?float?s?float?v?)
{
??int?hd?sd?vd;

??/*?if?S?or?V?is?less?than?its?threshold?return?a?“colorless“?bin?*/
??vd?=?MIN(?(int)(v?*?NV?/?V_MAX)?NV-1?);
??if(?s?????return?NH?*?NS?+?vd;
??
??/*?otherwise?determine?“colorful“?bin?*/
??hd?=?MIN(?(int)(h?*?NH?/?H_MAX)?NH-1?);
??sd?=?MIN(?(int)(s?*?NS?/?S_MAX)?NS-1?);
??return?sd?*?NH?+?hd;
}



/*
??Calculates?a?cumulative?histogram?as?defined?above?for?a?given?array
??of?images
??
??@param?img?an?array?of?images?over?which?to?compute?a?cumulative?histogram;
????each?must?have?been?converted?to?HSV?colorspace?using?bgr2hsv()
??@param?n?the?number?of?images?in?imgs
????
??@return?Returns?an?un-normalized?HSV?histogram?for?\a?imgs
*/

/*?對直方圖進行計算
*?顏色特征對圖像本身的尺寸、方向、視角的依賴性較小,從而具有較高的魯棒性
*?粒子與目標的直方圖月相似,就越可能是目標
*/
histogram*?calc_histogram(?IplImage**?imgs?int?n?)
{
??IplImage*?img;
??histogram*?histo;
??IplImage*?h?*?s?*?v;
??float*?hist;
??int?i?r?c?bin;

??histo?=?malloc(?sizeof(histogram)?);
??histo->n?=?NH*NS?+?NV;
??hist?=?histo->histo;
??memset(?hist?0?histo->n?*?sizeof(float)?);

??for(?i?=?0;?i?????{
??????/*?extract?individual?HSV?planes?from?image?*/
??????img?=?imgs[i];
??????h?=?cvCreateImage(?cvGetSize(img)?IPL_DEPTH_32F?1?);
??????s?=?cvCreateImage(?cvGetSize(img)?IPL_DEPTH_32F?1?);
??????v?=?cvCreateImage(?cvGetSize(img)?IPL_DEPTH_32F?1?);
??????cvCvtPixToPlane(?img?h?s?v?NULL?);
??????
??????/*?increment?appropriate?histogram?bin?for?each?pixel?*/
??//?計算直方圖
??????for(?r?=?0;?r?height;?r++?)
??for(?c?=?0;?c?width;?c++?)
??{
????bin?=?histo_bin(?/*pixval32f(?h?r?c?)*/((float*)(h->imageData?+?h->widthStep*r)?)[c]
?????((float*)(s->imageData?+?s->widthStep*r)?)[c]
?????((float*)(v->imageData?+?v->widthStep*r)?)[c]?);
????hist[bin]?+=?1;
??}
??????cvReleaseImage(?&h?);
??????cvReleaseImage(?&s?);
??????cvReleaseImage(?&v?);
????}
??return?histo;
}



/*
??Normalizes?a?histogram?so?all?bins?sum?to?1.0

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????6476814??2008-05-29?11:00??gsl-1.8.exe

-----------?---------??----------?-----??----

??????????????6476814????????????????????1


評論

共有 條評論