资源简介

基于opencv实现的车牌号做字符识别

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 
#include 
#include “lib/normal.h“
#include “lib/cutchar.h“
#include “lib/match.h“

#define DEBUG

#ifdef DEBUG
#define DE(format ...) printf(format ## __VA_ARGS__)
#else
#define DE(format ...) while(0)
#endif

int main(int argc char** argv){
Mat img img_2 img_3 img_4 img_5 img_w;
IplImage pI_1;
IplImage pI_2;
int width reWidth=30 wWidth=120 pic_width;
int height reHeight=100 wHeight = 60;
char str[2];
char pic_name[6];

int i = 0 j = 0 k;
int threshold = 0 pic_ArrNumber tmp;
int vArr[reHeight];
int **pic_Arr;
CvScalar s1;
float percentage = 0.0;
int proSum;

if(argc < 2){
DE(“Please input argv[1]\n“);
return -1;
}
img = cv::imread(argv[1]);

namedWindow(str);
imshow(str img);

width = img.rows;
height = img.cols;

pic_gray(img img_2);
threshold = histogram_Calculate(img_2 5);
DE(“threshold:%d\n“threshold);

pic_Thresholding(img_2 threshold);

    detectionchange(img_2 img_3 7);

carCard_Resize(img_3 img_4 reWidth reHeight);
pic_Thresholding(img_4 60);
pI_1 = img_4;

verProjection_calculate(img_4 vArr reHeight);
pic_Arr = verProjection_cut(vArr reHeight &pic_ArrNumber);

for(i=0; i< pic_ArrNumber; i++){
// printf(“pic_ArrNumber:%d: %d %d\n“ pic_ArrNumber pic_Arr[i][0] pic_Arr[i][1]);
pic_width = pic_Arr[i][1] - pic_Arr[i][0];
if(pic_width < 3){
continue;
}

img_5 = cv::Mat(reWidth pic_Arr[i][1] - pic_Arr[i][0] + 1 CV_8UC1 1);
pI_2 = img_5;
for(j=0; j for(k=pic_Arr[i][0]; k<=pic_Arr[i][1]; k++){
s1 = cvGet2D(&pI_1 j k);
cvSet2D(&pI_2 j k-pic_Arr[i][0] s1);
}
}
percentage = pixelPercentage(img_5);
if(percentage < 0.1){
continue;
}
if(pic_width < 6){
if(percentage > 0.6){
printf(“1“);
}
sprintf(str “%d“ i+3);
namedWindow(str);
imshow(str img_5);
continue;
}
carCard_Resize(img_5 img_w wWidth wHeight);
pic_Thresholding(img_w 50);

proSum = getPro(img_w);
// proSum = match_ok(img_w);
match_result(proSum);
sprintf(str “%d“ i+3);
namedWindow(str);
imshow(str img_w);
}
printf(“\n“);

waitKey(0);
return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     12288  2015-02-13 13:11  字符识别\2_cDistinguish\.main.cpp.swp

     文件      11118  2015-02-13 10:48  字符识别\2_cDistinguish\1.txt

     文件      15096  2015-02-12 11:03  字符识别\2_cDistinguish\cutchar.o

     文件      97265  2015-02-13 13:10  字符识别\2_cDistinguish\disting

    ..A..H.     12288  2015-02-13 09:14  字符识别\2_cDistinguish\lib\.match.h.swp

     文件       2708  2015-02-12 08:55  字符识别\2_cDistinguish\lib\cutchar.cpp

     文件        731  2015-02-12 08:55  字符识别\2_cDistinguish\lib\cutchar.h

     文件       7106  2015-02-13 10:59  字符识别\2_cDistinguish\lib\match.cpp

     文件        533  2015-02-13 09:14  字符识别\2_cDistinguish\lib\match.h

     文件       6190  2015-02-12 08:55  字符识别\2_cDistinguish\lib\normal.cpp

     文件       1156  2015-02-12 08:55  字符识别\2_cDistinguish\lib\normal.h

     文件       4001  2015-02-12 10:57  字符识别\2_cDistinguish\lib\xihua_2.cpp

     文件        153  2015-02-12 10:31  字符识别\2_cDistinguish\lib\xihua_2.h

     文件       2265  2015-02-13 13:11  字符识别\2_cDistinguish\main.cpp

     文件      18392  2015-02-13 13:10  字符识别\2_cDistinguish\main.o

     文件        435  2015-02-13 09:11  字符识别\2_cDistinguish\Makefile

     文件      35616  2015-02-13 13:10  字符识别\2_cDistinguish\match.o

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\0.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\1.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\2.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\3.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\4.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\5.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\6.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\7.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\8.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\9.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\A.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\B.bmp

     文件       8278  2015-02-13 09:19  字符识别\2_cDistinguish\match_pic\C.bmp

............此处省略347个文件信息

评论

共有 条评论