资源简介
视频测速
车辆测速
目标跟踪
参考参考
。。。。。。。。。。。。。。。。。。。。
代码片段和文件信息
#include
#include
#include “stdafx.h“
#include “cv.h“
#include “highgui.h“
#define max_corners 50 //限定最大能找到的角点数
#define unsigned char uchar
//-----------保存被跟踪的角点头指针 结构
typedef struct Point
{
int i;
CvPoint P_corner;
struct Point *next;
}
Point;
//-------------------------------------------------
//----------------被跟踪的角点链表结构
typedef struct List
{
int number; //被跟踪的链表计数
Point *p;
List *next;
}
List;
//-------------------------------------------------
void re_find_corners(intintIplImage*CvPoint2D32f*int*);
void draw_corners(IplImage *CvPoint2D32f *int );
void DeCorner(CvPoint2D32f *intCvPoint2D32f *intCvPoint2D32f *int*);
int corners_matching(IplImage *CvPoint2D32f * IplImage *CvPoint2D32f * );
float cornersDistance(CvPoint2D32f *CvPoint2D32f *);
List * insertCornerList(List* List * Point *);
Point * insertCell(Point * Point * CvPoint2D32f * );
List * freeList(List *CvPoint2D32f (*r_corner_4)[max_corners]int );
void draw_corners(IplImage * CvPoint2D32f (*corners)[max_corners]int );
int square(int );
IplImage *m_pPreImage = NULL;
IplImage *m_pGrayImage = NULL;
IplImage *m_pSmoothImage = NULL;
IplImage *pPrev = NULL;
IplImage *pCurr = NULL;
IplImage *pDest = NULL;
IplImage *pMask = NULL;
IplImage *pMaskDest = NULL;
IplImage *dst = NULL;
IplImage *cornerImage1 = NULL;
IplImage *cornerImage2 = NULL;
IplImage *ImageShow1 = NULL; //存储显示带角点的图
IplImage *ImageShow2 = NULL; // 检测出来的超速车辆在此图上标出
IplImage *grayImage= NULL; //原始图像转变的灰度图像
IplImage *cornersImage1 = NULL; //临时图像
IplImage *cornersImage2 = NULL; //临时图像
List *L_head = NULL; //头文件指针
List *S_head = NULL; //中间指针
int qualityLevel=0; //最小质量因子
int minDistance=60; //角点的最小距离。这里使用 Euclidean 距离
int cornerCount_3=max_corners;
CvScalar color = CV_RGB(25500); //所绘制角点的颜色(红色
CvPoint2D32f corners_1L_1[max_corners]; //检测存储没帧中角点的点数组
int cornerCount_1L_1=max_corners; //count1L_1对应的角点数目
CvPoint2D32f corners_1L_2[max_corners]; //检测存储没帧中角点的点数组
int cornerCount_1L_2=max_corners; //count1L_2对应的角点数目
CvPoint2D32f corners_2L_1[max_corners]; //存储角点对比后的角点
int cornerCount_2L_1=0;
CvPoint2D32f corners_2L_2[max_corners]; //存储角点对比后的角点
int cornerCount_2L_2=0;
CvPoint2D32f corners_4[2][max_corners]; //匹配成功后的数组
int cornerCount_4 =0;
int length = 0;//测速两点之间的长度
int ra=3; //圆半径
int th=2; //圆线厚度
int main(int argc char* argv[])
{
int m_i=0; //
int m_j=1; //图像奇偶帧角点检测
CvSize imgSize;
CvCapture *m_pCapture = NULL;
IplConvKernel* element;
CvSeq* contour = 0;
CvMemStorage* storage = cvCreateMemStorage(0);
CvRect r;
// IplConvKernel* element;
cvNamedWindow( “VideoDisplay1“ 1 );
cvNamedWindow( “VideoDisplay2“ 1 );
cvNamedWindow( “VideoDisplay3“ 1 );
cvNamedWindow( “VideoDisplay4“ 1 );
cvNamedWindow(“HarrisShow“1
- 上一篇:基于单片机的水位控制系统
- 下一篇:基于mfcvc++6.0的图书馆管理系统
评论
共有 条评论