基于opencv2.0的车牌检测与字符分割的代码.doc

基于opencv2.0的车牌检测与字符分割的代码.doc

  1. 1、本文档共33页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于opencv2.0的车牌检测与字符分割的代码

/* 本程序主要实现的是车牌的定位与检测 主要是利用申继龙论文里面的方法 1、采集得到的图像 2、把RGB图像转换成HSI彩色图像 3、利用设定的H、S阈值得到二值图像 4、对二值图像水平投影获得候选区域 5、对候选区域的HSI图像边缘检测 */ #include stdafx.h #include opencv2/opencv.hpp #include opencv2/objdetect/objdetect.hpp #include opencv2/features2d/features2d.hpp #include opencv2/highgui/highgui.hpp #include opencv2/calib3d/calib3d.hpp #include opencv2/nonfree/nonfree.hpp #include opencv2/nonfree/features2d.hpp #include opencv2/imgproc/imgproc_c.h #include opencv2/legacy/legacy.hpp #include opencv2/legacy/compat.hpp #include iostream #include algorithm #include functional #include vector #include string #include stdlib.h #include stddef.h #include stdint.h #include math.h using namespace std; using namespace cv; #define pi 3IplImage* srcImage=NULL;//存储原图片 IplImage*srcImage1=NULL;//存储原始图片的副本 IplImage* HSI=NULL; static IplImage* grayImage=NULL;//存储原图片灰度图 static double posdouble=0.0; IplImage* channelOneImage=NULL; IplImage* channelTwoImage=NULL; IplImage* channelThreeImage=NULL; IplImage* plateImage=NULL;//存储车牌图像 IplImage* grayPlateImage=NULL;//存储车牌灰度图像 vectorIplImage*characterImageList;//存储7个车牌字符图像的容器 vectorintxList;//存储7个车牌字符的起始和结束位置 vectorvectorKeyPointkeyPointsList;//存储车牌字符特征点的集合 vectorMatdescriptorsMatList;//存储每一个车牌字符的特征点描述子矩阵 vectorvectorPoint contours;//用来存储经过闭开操作处理后的车牌轮廓 double GetH(int r,int g,int b) { double H=0;//H分量 double fenZi=1/2.0*((r-g)+(r-b)); double sq=pow(double(r-b),2)+(r-b)*(g-b); double fenMu=sqrt(sq); H=acos(fenZi/fenMu)*180/pi; if(bg) { H=360-H; } return H; } double GetS(int r,int g,int b) { double s=0;//S分量 int min=r; if(gr) { min=g; if(bg) { min=b; } } else { if(br) { min=b; } } s=1-3.0*min/((r+g+b)*1.0); return s; } double GetI(int r,int g,int b) { double i=0.0; i=1/3.0*(r+g+b); i=i/255.0; return i; } //通过公式来直接求H的值然后对H分量进行处理 void doHByMath(IplImage* eleImage) { int width=eleImage-width; int height=eleImage-height; for(int col=0;colheight;col++) { uchar* ptr=(uchar*)(eleImag

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档