⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stdafx.h

📁 基于粒子滤波原理
💻 H
字号:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once


#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>




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


// plot points with + or x
#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))) 

//纹理定义
#define pi 3.14159


//float mask_x[9] = { -1, 0, 1, \
//					-1, 0, 1, \
//					-1, 0, 1};
//float mask_y[9] = { -1, -1, -1, \
//					0, 0, 0, \
//					1, 1, 1};


//给定位置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, CvMat* FuzhiMat, CvMat* FangxiangMat, \
				  CvMat* Model_WenLi, CvMat* WenLi, float exptect_dist, int steps, CvRandState rng);

//纹理统计
void wen_li_statistic(CvMat* FuzhiMat, CvMat* FangxiangMat, CvMat* WenLi);

//梯度计算
void grads_calculation(IplImage* pimage, CvMat* FuzhiMat, CvMat* FangxiangMat);
// TODO: reference additional headers your program requires here

⌨️ 快捷键说明

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