资源简介
基于SVM与ANN的车牌识别,结合opencv库使用。

代码片段和文件信息
#include “DetectRegions.h“
void DetectRegions::setFilename(string s)
{
filename = s;
}
DetectRegions::DetectRegions()
{
showSteps = false;
saveRegions = false;
}
/*对检测到的区域做一些基本的验证,这些验证基于面积与宽高比。
车牌区域:有40%的误差范围内,其宽高比为520/110 = 4.727272 */
bool DetectRegions::verifySizes (RotatedRect candidate)
{
float error = 0.4;
//Spain car plate size: 52*11 aspect 47272
const float aspect = 4.7272;
//Set a min and max area All other patches are discared
int min = 15 * aspect * 15;
int max = 125 *aspect * 125;
//Get only patches that match to a respect ratio.
float rmin = aspect - aspect * error;
float rmax = aspect + aspect* error;
int area =candidate.size.height * candidate.size.width;
float r = (float) candidate.size.width / (float) candidate.size.height;
if(r < 1)
r = 1/r;
if ((area < min || area > max) || (r < rmin || r > rmax))
return false;
else
return true;
}
Mat DetectRegions::histeq(Mat in) //直方图均衡
{
Mat out (in.size() in.type());
if (in.channels() == 3)
{
Mat hsv;
vector < Mat > HsvSplit;
cvtColor(in hsv CV_BGR2HSV);
split(hsvHsvSplit);//通道分离
equalizeHist(HsvSplit[2] HsvSplit[2]);
merge(HsvSplit hsv);
cvtColor(hsv out CV_HSV2BGR);
}
else if(in.channels() == 1)
equalizeHist(in out);
return out;
}
vector DetectRegions::segment(Mat input)
{
vector output;
Mat img_gray;
cvtColor(input img_gray CV_BGR2GRAY);
blur(img_gray img_gray Size(55));
Mat img_sobel;
Sobel(img_gray img_sobel CV_8U 1 0 3 1 0 BORDER_DEFAULT);
if(showSteps)
imshow(“Sobel“img_sobel);
Mat img_threshold;
threshold(img_sobel img_threshold 0 255 CV_THRESH_OTSU + CV_THRESH_BINARY);
if(showSteps)
imshow(“Thershold“img_threshold);
Mat element = getStructuringElement(MORPH_RECT Size(173));
morphologyEx(img_thresholdimg_threshold CV_MOP_CLOSE element);
if(showSteps)
imshow(“Close“ img_threshold);
vector < vector < Point> > contours;
findContours(img_threshold contours CV_RETR_EXTERNAL CV_CHAIN_APPROX_NONE);
vector < vector < Point > > :: iterator itc = contours.begin();
vector < RotatedRect > rects;
while (itc != contours.end())
{
RotatedRect mr = minAreaRect(Mat (*itc));
if( !verifySizes(mr))
itc = contours.erase(itc);
else
{
++itc;
rects.push_back(mr);
}
}
Mat result;
input.copyTo(result);
drawContours(result contours -1 Scalar(255 0 0) 1);
//For better rect cropping for each posible box
//Make floodfill algorithm because the plate has white background
//And then we can retrieve more clearly the contour box
for (int i = 0; i < rects.size(); i++)
{
circle( result rects[i].center 3 Scalar(0 255 0) -1);
float minSize = (rects[i].size.width < rects[i].size.height)? rects[i].size.width : rects[i].size.height;
minSize = minSize - minSize * 0.5;
//initialize rand and get 5 points around center for flo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301056 2015-04-30 09:30 testnouse\Debug\testnouse.exe
文件 2961740 2015-04-30 09:30 testnouse\Debug\testnouse.ilk
文件 3599360 2015-04-30 09:30 testnouse\Debug\testnouse.pdb
文件 196236 2014-06-02 08:20 testnouse\testnouse\2715DTZ.jpg
文件 2390 2015-04-30 09:30 testnouse\testnouse\Debug\cl.command.1.tlog
文件 90756 2015-04-30 09:30 testnouse\testnouse\Debug\CL.read.1.tlog
文件 3490 2015-04-30 09:30 testnouse\testnouse\Debug\CL.write.1.tlog
文件 1039376 2015-04-28 20:28 testnouse\testnouse\Debug\DetectRegions.obj
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
文件 2 2015-04-30 09:30 testnouse\testnouse\Debug\li
............此处省略32个文件信息
- 上一篇:SSD4全部答案Exercise+Quiz
- 下一篇:Eclipse使用详细教程
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- Halcon车牌识别
- 百度API车牌识别DEMO.rar
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- 易泊车牌识别停车计费系统介绍
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
评论
共有 条评论