video_header.h

来自「基于粒子滤波原理」· C头文件 代码 · 共 45 行

H
45
字号


#include <iostream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

/* plot points */
#define draw_cross( center, color, d )                                 \
                cvLine( img, cvPoint( center.x - d, center.y - d ),                \
                             cvPoint( center.x + d, center.y + d ), color, 1, 0 ); \
                cvLine( img, cvPoint( center.x + d, center.y - d ),                \
                             cvPoint( center.x - d, center.y + d ), color, 1, 0 )
#define draw_plus( center, color, d )                                 \
                cvLine( img, cvPoint( center.x - d, center.y  ),                \
                             cvPoint( center.x + d, center.y  ), color, 1, 0 ); \
                cvLine( img, cvPoint( center.x , center.y - d ),                \
                             cvPoint( center.x , center.y + d ), color, 1, 0 )
#define calc_point(angle)                                      \
                cvPoint( cvRound(img->width/2 + img->width/3*cos(angle)),  \
                         cvRound(img->height/2 - img->width/3*sin(angle))) 


//给定位置point和大小area,在特定图像*pimage中画矩形
IplImage* rectangle_drawing(IplImage* pimage, CvPoint point, CvSize area);

//计算8位灰度图像的颜色直方图
CvHistogram* hist_calculation(IplImage* pimage, CvHistogram* hist, int histnum, float* histranges);

//画颜色直方图
IplImage* histogram_drawing(CvHistogram* hist, IplImage* histimage, int histnum);

//从灰度图像中得到目标小图像
IplImage* patchimage_getting(IplImage* pimage, IplImage* dstimage, CvPoint point, CvSize area);

//计算Bhattacharyya距离
float bhattacharyya(CvHistogram* hist1, CvHistogram* hist2, int histnum);

//权值计算,未进行归一化
void CondProbDens(CvConDensation* CD,  float* Measurement, float exptect_dist);
void ConDensWeightsCalculation(CvConDensation* CD, float bt, float exrtect_dist);

//粒子滤波主过程,输出估计结果
CvPoint PF_result(IplImage* pGrey, CvConDensation* CD, CvPoint state_prediction, CvHistogram* hist, CvSize area, int histnum, float* histranges, float exptect_dist, int steps, CvRandState rng);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?