乘简 发表于 2018-8-4 14:35:08

车牌识别(八)模板比较

本帖最后由 乘简 于 2018-8-4 14:37 编辑

就是把缩放后的图片,与事先准备好的模板进行比较,找到最优解,再输入车牌。

我这里用了与原作者不同的方法,原方法简单字符与复杂字比只会白点越少
而我所采用的就是在比较的时候,如果两点都为白色,则为黑色
如果两点不相同,则为白色,这样只有最相似的字白点才会最少
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long       DWORD;
typedef int               BOOL;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef float               FLOAT;
typedef unsigned char       byte;

#define max(a,b)            (((a) > (b)) ? (a) : (b))
#define min(a,b)            (((a) < (b)) ? (a) : (b))

//车牌点阵字体,16*32字体,逐行式,两字节占一行
byte const FONT[]={
{0x07,0xE0,0x1F,0xF8,0x3F,0xFC,0x7C,0x3E,0x78,0x1E,0xF0,0x0F,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xF0,0x0F,0x78,0x1E,0x7C,0x3E,0x3F,0xFC,0x1F,0xF8,0x07,0xE0},/*"0.BMP",0*/

{0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00},/*"1.BMP",0*/

{0x07,0xE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,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xFF,0xFC,0xFF,0xFC,
0xFF,0xFC,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00},/*"F.BMP",0*/

{0x07,0xE0,0x1F,0xF8,0x3F,0xFC,0x7C,0x3E,0x78,0x1E,0xF0,0x0F,0xE0,0x07,0xE0,0x07,
0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0xFF,
0xE0,0xFF,0xE0,0xFF,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xF0,0x0F,0x78,0x0E,0x7C,0x3E,0x3F,0xFC,0x1F,0xF8,0x07,0xE0},/*"G.BMP",0*/

{0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,
0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07,0xE0,0x07},/*"H.BMP",0*/

{0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,
0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,0x00,0x07,
0x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x07,0xE0,0x07,0xE0,0x07,0xE0,0x0E,0x70,0x0E,0x70,0x0E,0x70,0x1C,0x38,
0x1C,0x38,0x3C,0x38,0x38,0x1C,0x38,0x1C,0x70,0x1E,0x70,0x0E,0xF0,0x0F,0xE0,0x07},/*"X.BMP",0*/

{0xE0,0x07,0xE0,0x0F,0xF0,0x0E,0x70,0x0E,0x70,0x1C,0x78,0x1C,0x38,0x3C,0x38,0x38,
0x3C,0x38,0x1C,0x70,0x1E,0x70,0x1E,0x70,0x0E,0xE0,0x0F,0xE0,0x0F,0xE0,0x07,0xC0,
0x07,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80},/*"Y.BMP",0*/

{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0x00,0x0E,0x00,0x1E,0x00,0x1C,0x00,0x3C,
0x00,0x38,0x00,0x78,0x00,0x70,0x00,0x70,0x00,0xE0,0x00,0xE0,0x01,0xE0,0x01,0xC0,
0x03,0xC0,0x03,0x80,0x07,0x80,0x07,0x00,0x0F,0x00,0x0E,0x00,0x1E,0x00,0x1C,0x00,
0x3C,0x00,0x38,0x00,0x78,0x00,0x70,0x00,0xF0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},/*"Z.BMP",0*/

{0x00,0xC0,0x00,0xC0,0x60,0xC0,0x61,0x80,0x37,0xFE,0x34,0x02,0x14,0x62,0x15,0x6A,
0x05,0x4A,0x05,0xD2,0x44,0x52,0xC4,0x42,0x65,0xFA,0x75,0xFA,0x24,0xD2,0x04,0xD2,
0x05,0xDA,0x05,0x5A,0x27,0x4A,0x34,0x62,0x24,0x06,0x24,0x62,0x20,0x60,0x2F,0xFF,
0x6F,0xFF,0x60,0x60,0x40,0xF0,0x40,0x90,0x41,0x98,0xC3,0x0E,0xDE,0x07,0x0C,0x03},/*"澳.BMP",0*/

{0x04,0x60,0x04,0x60,0x04,0x60,0xFF,0xFF,0xFF,0xFF,0x04,0x64,0x04,0x66,0x00,0x12,
0x40,0x14,0x5F,0xFF,0x5F,0xFF,0x50,0x10,0x50,0x10,0x77,0xD0,0x77,0xD2,0x74,0x92,
0x14,0x92,0x14,0x92,0x17,0xD2,0xF7,0xDE,0xF4,0x5C,0x54,0x4C,0x57,0xCC,0x57,0xCC,
0x54,0x8C,0x54,0x8C,0xD4,0x9D,0x97,0xDD,0xB7,0xF7,0xB0,0x77,0x20,0x63,0x20,0x43},/*"藏.BMP",0*/

{0x00,0x03,0x38,0x03,0x38,0x03,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,
0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,0x38,0xC3,
0x38,0xC3,0x38,0xC3,0x38,0xC3,0x30,0xC3,0x30,0xC3,0x30,0xC3,0x30,0xC3,0x70,0xC3,
0x70,0xC3,0x70,0xC3,0x60,0xC3,0xE0,0xC3,0xE0,0xC3,0xE0,0xC3,0xC0,0x03,0xC0,0x03},/*"川.BMP",0*/

{0xF7,0x80,0xF7,0xBF,0xF7,0xBF,0xD4,0xA3,0xD4,0xA2,0xD4,0xA2,0xF7,0xA2,0xF7,0xA2,
0xF7,0xA6,0x00,0x26,0x00,0x24,0xFF,0xAC,0xFF,0xB8,0x00,0x3C,0x00,0x26,0x00,0x22,
0xFF,0xE2,0xFF,0xE3,0x30,0x23,0x30,0x21,0x30,0x21,0x3F,0xA1,0x3F,0xA1,0x3F,0x21,
0x01,0x3F,0x01,0x2F,0x01,0x26,0x01,0x24,0x03,0x20,0x0F,0x20,0x0F,0x20,0x06,0x20},/*"鄂.BMP",0*/

{0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0xFF,0xFF,0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xF8,0x1F,0xF8,0x18,0x18,0x18,0x18,0x18,0x18},/*"甘.BMP",0*/

{0x30,0x20,0x30,0x60,0x18,0x7E,0xFE,0x7E,0xFE,0xC4,0x4C,0xE4,0x4D,0xAC,0x6C,0x38,
0x28,0x18,0xFE,0x7F,0xFF,0xE7,0x01,0x81,0x00,0x7E,0xFC,0x7E,0xFC,0x10,0xC4,0x10,
0xC5,0xFF,0xFD,0xFF,0xC4,0x00,0xC4,0xFE,0xFC,0xFE,0xFC,0x82,0x10,0x82,0x10,0x92,
0xFE,0x92,0xFE,0xB2,0xFE,0x30,0x10,0x6C,0x10,0xEE,0x13,0xC7,0x11,0x83,0x11,0x00},/*"赣.BMP",0*/

{0x01,0x18,0x41,0x18,0x61,0x18,0x61,0x18,0x31,0x18,0x27,0xFE,0x07,0xFE,0x01,0x18,
0x01,0x18,0x01,0x18,0x81,0x18,0xC1,0x18,0xEF,0xFF,0x6F,0xFF,0x21,0x18,0x01,0x08,
0x03,0x08,0x02,0x0C,0x07,0xFE,0x0F,0xFE,0x2F,0xFB,0x3B,0x0B,0x2B,0x08,0x23,0x08,
0x63,0xF8,0x63,0xF8,0x43,0x00,0x43,0x00,0x43,0x06,0xC3,0x06,0xC3,0xFE,0x81,0xFC},/*"港.BMP",0*/

{0x01,0x80,0x01,0x80,0x01,0x80,0x3F,0xFC,0x3F,0xFC,0x21,0x84,0x21,0x84,0x21,0x84,
0x3F,0xFC,0x3F,0xFC,0x01,0x80,0x01,0x80,0x01,0x80,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x30,0x0C,0x30,0x0C,0x31,0x8C,0x31,0x8C,0x31,0x0C,
0x31,0x0C,0x33,0x40,0x03,0x70,0x06,0x78,0x0E,0x1C,0x3C,0x0E,0xF8,0x06,0x70,0x02},/*"贵.BMP",0*/

{0x00,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x11,0xFE,0x11,0xFE,
0xFC,0x20,0xFC,0x20,0x30,0x20,0x30,0x20,0x30,0x20,0x33,0xFF,0x33,0xFF,0x3C,0x00,
0x7C,0x20,0x7C,0x20,0x56,0x20,0x54,0x20,0xD1,0xFE,0xD1,0xFE,0x90,0x20,0x90,0x20,
0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x17,0xFF,0x17,0xFF,0x10,0x00,0x10,0x00},/*"桂.BMP",0*/

{0x7F,0xFE,0x7F,0xFE,0x61,0x86,0x61,0x86,0x69,0x96,0x6D,0xB6,0x6D,0xB6,0x6D,0xB6,
0x65,0xA6,0x61,0xA6,0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,0x01,0x80,0x01,0x80,0x01,0x80,
0x7F,0xFE,0x7F,0xFE,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x40,0x02,0x64,0x46,0x46,0x66,0x46,0x66,0xC6,0x63,0xC6,0x23,0xC6,0x02},/*"黑.BMP",0*/

{0x00,0x60,0x60,0x60,0x60,0x20,0x30,0x30,0x38,0x30,0x10,0x20,0x01,0xFF,0x01,0xFF,
0x01,0x03,0x81,0x03,0xC1,0x03,0xE1,0x03,0x71,0x03,0x31,0x03,0x21,0x03,0x01,0x03,
0x01,0xFF,0x01,0xFF,0x11,0x03,0x19,0x00,0x19,0x00,0x13,0x00,0x33,0x00,0x33,0x00,
0x23,0x00,0x22,0x00,0x62,0x00,0x66,0x00,0x46,0x00,0xC4,0x00,0x4C,0x00,0x0C,0x00},/*"沪.BMP",0*/

{0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0xFF,0xFF,0xFF,0xFF,
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x30,0x0C,0x30,0x0C,
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x30,0x0C},/*"吉.BMP",0*/

{0x02,0x40,0x02,0x4C,0xFE,0x7E,0xFE,0x70,0x02,0x40,0x06,0x43,0xFE,0x7F,0xF2,0x7E,
0x82,0x00,0x3F,0xFC,0x3F,0xFC,0x21,0x84,0x21,0x84,0x3F,0xFC,0x3F,0xFC,0x21,0x84,
0x3F,0xFC,0x3F,0xFC,0x04,0x20,0x04,0x20,0x3F,0xFC,0x3F,0xFC,0x04,0x20,0x04,0x20,
0xFF,0xFF,0xFF,0xFF,0x04,0x20,0x06,0x30,0x1C,0x3C,0x38,0x1E,0x70,0x06,0x40,0x02},/*"冀.BMP",0*/

{0x00,0x60,0x00,0x60,0x00,0x60,0x60,0x60,0x67,0xFE,0x37,0xFE,0x30,0x66,0x10,0x66,
0x00,0x66,0x0F,0xFF,0x0F,0xFF,0xC0,0x66,0xE0,0x66,0x60,0x66,0x20,0x66,0x27,0xFE,
0x07,0xFE,0x00,0x60,0x00,0x60,0x30,0x60,0x37,0xFE,0x27,0xFE,0x20,0x60,0x60,0x60,
0x60,0x60,0x4F,0xFF,0x4F,0xFF,0xC0,0x60,0xC0,0x60,0xC0,0x60,0x00,0x60,0x00,0x60},/*"津.BMP",0*/

{0x7F,0xFE,0x7F,0xFE,0x7F,0xFE,0x06,0x40,0x06,0x48,0x36,0x4C,0x36,0x4C,0x16,0x48,
0x16,0x58,0x1E,0x58,0x16,0x50,0x06,0x50,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x1F,0xF8,0x10,0x08,0x10,0x08,0x10,0x08,0x1F,0xF8,
0x1F,0xF8,0x1F,0xF8,0x10,0x08,0x10,0x08,0x10,0x08,0x1F,0xF8,0x1F,0xF8,0x10,0x08},/*"晋.BMP",0*/

{0x03,0x00,0x03,0x00,0x01,0x80,0x01,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,
0x10,0x08,0x1F,0xF8,0x1F,0xF8,0x1F,0xF8,0x00,0x80,0x08,0x90,0x08,0x90,0x18,0xB8,
0x18,0x98,0x30,0x8C,0x30,0x8E,0x60,0x86,0xE1,0x86,0x41,0x82,0x47,0x80,0x03,0x00},/*"京.BMP",0*/

{0x12,0x10,0x12,0x30,0xFF,0xA0,0xFF,0xBF,0x12,0x7F,0x32,0x44,0x3F,0xE4,0x7F,0xA4,
0x60,0xA4,0xC0,0x9C,0xFC,0x9C,0xC5,0x98,0x47,0x9F,0x7D,0x77,0x7F,0x63,0x01,0xC0,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x1F,0xF8,0x1F,0xF8,0x00,0x00,0x00,0x00,0x1F,0xF8,
0x1F,0xF8,0x00,0x00,0x3F,0xFC,0x1F,0xFC,0x10,0x0C,0x10,0x0C,0x1F,0xFC,0x30,0x0C},/*"警.BMP",0*/

{0x60,0x00,0x63,0xFE,0x23,0xFE,0x33,0xFE,0x30,0x06,0x30,0x0C,0x20,0x1C,0x00,0x18,
0x00,0x30,0x00,0x30,0x00,0x30,0xF0,0x30,0xF0,0x30,0xF0,0x30,0x30,0x30,0x30,0x30,
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xE0,
0x30,0xE0,0x30,0xE0,0x30,0x00,0x78,0x00,0xCE,0x00,0xC7,0xFF,0xC3,0xFF,0x00,0xFF},/*"辽.BMP",0*/

{0x06,0x00,0x0F,0xF0,0x0F,0xF0,0x18,0x20,0x10,0x60,0x30,0x40,0x7F,0xFC,0xFF,0xFC,
0xF1,0x8C,0xB1,0x8C,0x3F,0xFC,0x3F,0xFC,0x31,0x8C,0x31,0x8C,0x3F,0xFC,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x30,0x0C,
0x30,0x0C,0x3F,0xFC,0x3F,0xFC,0x30,0x0C,0x30,0x0C,0x3F,0xFC,0x3F,0xFC,0x30,0x0C},/*"鲁.BMP",0*/

{0x0C,0x60,0x0C,0x60,0x0C,0x60,0xFF,0xFF,0xFF,0xFF,0x0C,0x60,0x0C,0x60,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0xC0,0x03,0xDF,0xFB,0xDF,0xFB,0x00,0x00,0x00,0x00,0x7F,0xFE,
0x7F,0xFE,0x41,0x82,0x07,0x00,0x0F,0x8C,0x3D,0x9C,0x73,0xF8,0x66,0xF0,0x0E,0xD0,
0x1C,0xD8,0x79,0xC8,0x73,0x4C,0x67,0x4E,0x0E,0x47,0x3C,0x43,0xF9,0xC2,0x61,0xC0},/*"蒙.BMP",0*/

{0x60,0x00,0x67,0xFF,0x67,0xFF,0x20,0x01,0x20,0x01,0x01,0x81,0xC1,0x81,0x81,0x81,
0x81,0x81,0x9F,0xF9,0x8F,0xF9,0x89,0x99,0x89,0x99,0x89,0x99,0x89,0x99,0x89,0x99,
0x8F,0xF9,0x8F,0xF9,0x89,0x81,0x89,0x91,0x99,0x91,0x81,0x99,0x81,0x99,0x83,0xF9,
0x9F,0xFD,0x9E,0x09,0x90,0x01,0x80,0x01,0x80,0x01,0x80,0x03,0x80,0x0F,0x00,0x06},/*"闽.BMP",0*/

{0x03,0x00,0x03,0x80,0x01,0x80,0x01,0x80,0x01,0x00,0xFF,0xFF,0xFF,0xFF,0xC0,0x03,
0xC0,0x03,0xC0,0x03,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,
0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x07,0x80,0x07,0x80,0x03,0x00},/*"宁.BMP",0*/

{0x01,0x80,0x01,0x80,0x01,0x80,0x7F,0xFE,0x7F,0xFE,0x01,0x80,0x01,0x80,0x3F,0xFC,
0x3F,0xFC,0x01,0x80,0x01,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x1F,0xFC,
0x1F,0xFC,0x1F,0xFC,0x10,0x0C,0x10,0x0C,0x1F,0xFC,0x1F,0xFC,0x1F,0xFC,0x10,0x0C,
0x10,0x0C,0x1F,0xFC,0x1F,0xFC,0x10,0x0C,0x10,0x0C,0x10,0x1C,0x10,0x1C,0x10,0x18},/*"青.BMP",0*/

{0x00,0x60,0x00,0x60,0x00,0x30,0x00,0x30,0xFC,0x30,0xFF,0xFF,0xFF,0xFF,0x20,0x00,
0x20,0x00,0x20,0x00,0x21,0xFE,0x21,0xFE,0x21,0x06,0xF9,0x06,0xF9,0x06,0x21,0x06,
0x21,0x06,0x21,0xFE,0x21,0xFE,0x20,0x30,0x20,0x30,0x24,0x30,0x3D,0x30,0x39,0x36,
0xF3,0x36,0xC3,0x32,0x82,0x33,0x06,0x33,0x06,0x31,0x04,0xE1,0x00,0x60,0x00,0x40},/*"琼.BMP",0*/

{0x00,0x20,0xF8,0x20,0xF8,0x20,0x98,0x20,0x9B,0xFE,0x9B,0xFE,0x90,0x20,0x90,0x20,
0xB1,0x20,0xB3,0x22,0xF3,0x26,0xA1,0x26,0xB1,0x24,0xB1,0xAC,0x99,0x24,0x98,0x20,
0x9F,0xFF,0x8F,0xFF,0x88,0x60,0x88,0x60,0x88,0x60,0xB8,0x60,0xB8,0x70,0xB0,0xF0,
0x80,0xD0,0x81,0x98,0x81,0x98,0x83,0x0C,0x87,0x0E,0x8E,0x07,0x9C,0x07,0x88,0x02},/*"陕.BMP",0*/

{0x0C,0x30,0x0C,0x30,0x08,0x30,0x08,0x30,0xFF,0xFF,0xFF,0xFF,0x08,0x30,0x08,0x30,
0x08,0x30,0x09,0x30,0x01,0x00,0x01,0x00,0x01,0x00,0x7F,0xF8,0x7F,0xF8,0x7F,0xF0,
0x03,0x10,0x03,0x10,0x13,0x14,0x32,0x16,0x32,0x16,0x22,0x12,0x66,0x13,0x66,0x13,
0xC4,0x10,0x4C,0x10,0x0C,0x10,0x18,0x10,0x18,0x30,0x30,0xF0,0x70,0x70,0x20,0x60},/*"苏.BMP",0*/

{0x02,0x00,0x03,0x00,0x07,0x00,0x06,0x00,0x06,0x10,0x0C,0x30,0x0C,0x38,0x18,0x18,
0x18,0x0C,0x30,0x0C,0x30,0x06,0x60,0xFE,0xFF,0xFF,0xFF,0xFB,0x78,0x03,0x00,0x01,
0x00,0x00,0x00,0x00,0x3F,0xFE,0x3F,0xFE,0x3F,0xFE,0x20,0x06,0x20,0x04,0x20,0x04,
0x20,0x04,0x20,0x04,0x20,0x04,0x20,0x04,0x3F,0xFC,0x3F,0xFC,0x3F,0xFE,0x20,0x06},/*"台.BMP",0*/

{0x20,0x60,0x30,0x20,0x20,0x20,0x20,0x40,0x23,0xFE,0xFB,0xFE,0xFA,0x02,0xFA,0x02,
0x8A,0x02,0x8A,0x02,0x88,0x00,0x89,0xFC,0x89,0xFC,0x88,0x00,0x88,0x00,0xF8,0x00,
0xFB,0xFF,0x8B,0xFF,0x8B,0xFF,0x88,0x90,0x88,0x90,0x88,0x90,0x88,0x90,0x88,0x90,
0xF8,0x90,0xF8,0x90,0x88,0x91,0x89,0x91,0x81,0x19,0x83,0x1F,0x87,0x1F,0x06,0x0E},/*"皖.BMP",0*/

{0x42,0x00,0x42,0x3F,0x62,0x3F,0x62,0x3F,0x22,0x23,0x22,0x23,0x02,0x23,0x02,0x23,
0x0F,0xA3,0x8F,0xA3,0x82,0x3F,0xC2,0x3F,0xE6,0x3F,0x66,0x23,0x26,0x23,0x07,0xA3,
0x07,0xA3,0x06,0xA3,0x4E,0xA3,0x6E,0xBF,0x6A,0x3F,0x4A,0x23,0x4A,0x23,0x5A,0x23,
0x5A,0x23,0x52,0x23,0x42,0x23,0xC2,0x3F,0xC2,0x3F,0xC2,0x3F,0xC2,0x23,0x82,0x23},/*"湘.BMP",0*/

{0x08,0x03,0x08,0x1F,0x08,0x3F,0xFF,0x30,0xFF,0x20,0xFF,0x20,0x00,0x20,0x22,0x20,
0x22,0x20,0x26,0x20,0x24,0x20,0x44,0x3F,0xFF,0xBF,0xFF,0xA6,0x08,0x26,0x08,0x26,
0x08,0x26,0x08,0x26,0xFF,0xA6,0xFF,0xA6,0x88,0xA6,0x08,0x66,0x2A,0x66,0x6A,0x66,
0x6B,0x66,0x4B,0x46,0xC9,0x46,0xC8,0x46,0x88,0xC6,0x38,0xC6,0x38,0xC6,0x18,0x86},/*"新.BMP",0*/

{0x01,0x0C,0x23,0x0C,0x73,0x08,0x31,0x98,0x39,0x98,0x11,0x10,0x10,0x10,0x00,0x30,
0xFF,0xFE,0xFF,0xFE,0xC0,0x02,0xC0,0x02,0xC0,0x02,0xC0,0x03,0x1F,0xF8,0x1F,0xF8,
0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0xC0,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0x00,0x80,
0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x80,0x07,0x80,0x07,0x80,0x03,0x00},/*"学.BMP",0*/

{0x00,0x40,0x40,0xE0,0x60,0xA0,0x30,0xB0,0x31,0xB0,0x11,0x18,0x11,0x18,0x03,0x0C,
0x03,0xF6,0x07,0xF7,0x8C,0x03,0xCC,0x00,0xF8,0x00,0x6F,0xC2,0x37,0xD2,0x04,0xD2,
0x04,0xD2,0x04,0xD2,0x07,0xD2,0x27,0xD2,0x34,0xD2,0x34,0xD2,0x24,0xD2,0x27,0xD2,
0x27,0xD2,0x64,0xD2,0x64,0xC2,0x44,0xC2,0x44,0xC2,0xC5,0xCE,0xC4,0xCE,0x44,0x8C},/*"渝.BMP",0*/

{0x00,0x40,0xFC,0xFC,0xFC,0xFC,0x0C,0x8C,0x0D,0x88,0x09,0x88,0x7B,0xFF,0x73,0xFF,
0x32,0x93,0x30,0x93,0x10,0x93,0x20,0xFF,0xFE,0xFF,0xFC,0x20,0x34,0x60,0x34,0x62,
0x34,0xE6,0x3D,0xB6,0x33,0x3C,0x31,0x7C,0x30,0x54,0x30,0xD4,0x31,0xB6,0x33,0x3A,
0x32,0x7A,0x30,0x5B,0x30,0xDB,0x31,0x99,0x37,0x11,0xF2,0x70,0x62,0x30,0x40,0x20},/*"豫.BMP",0*/

{0x02,0x00,0x06,0x00,0x7F,0xFC,0x7F,0xFC,0x60,0x0C,0x65,0x8C,0x65,0xAC,0x65,0xAC,
0x61,0x8C,0x67,0xEC,0x67,0xEC,0x63,0x8C,0x67,0xAC,0x65,0xAC,0x65,0xAC,0x61,0x8C,
0x60,0x0C,0x7F,0xFC,0x7F,0xFC,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x0C,0x00,
0x0C,0x00,0x1F,0xFC,0x1F,0xFC,0x00,0x1C,0x00,0x18,0x00,0x78,0x01,0xF0,0x01,0xC0},/*"粤.BMP",0*/

{0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x02,0x00,0x03,0x00,
0x03,0x00,0x02,0x00,0x06,0x00,0x06,0x00,0x04,0x20,0x0C,0x30,0x0C,0x30,0x08,0x18,
0x18,0x18,0x18,0x18,0x10,0x0C,0x30,0x1C,0x37,0xFC,0x3F,0xFE,0x3F,0x06,0x30,0x06},/*"云.BMP",0*/

{0x02,0x02,0x42,0x3F,0xE2,0x3F,0x62,0x30,0x32,0x20,0x32,0x20,0x02,0x20,0x0A,0x20,
0x0F,0xA0,0x0F,0xA0,0x82,0x3F,0xC2,0x3F,0xE2,0x26,0x72,0x26,0x22,0xA6,0x23,0xA6,
0x03,0xA6,0x0F,0x26,0x0E,0x26,0x0A,0x26,0x32,0x26,0x32,0x26,0x22,0x26,0x22,0x26,
0x62,0x66,0x62,0x66,0x62,0x66,0x42,0x46,0x42,0x46,0xCE,0xC6,0xC6,0xC6,0x40,0x06},/*"浙.BMP",0*/
};

//文字表,共70个,数字英文占34个,编号0~33,汉字编号34~69
char *table[]={"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",\
               "A", "B", "C", "D", "E", "F", "G", "H", "J", "K",\
               "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V",\
               "W", "X", "Y", "Z","澳","藏","川","鄂","甘","赣",\
               "港","贵","桂","黑","沪","吉","冀","津","晋","京",\
               "警","辽","鲁","蒙","闽","宁","青","琼","陕","苏",\
               "台","皖","湘","新","学","渝","豫","粤","云","浙"};

//BMP图像结构
struct BMP_img
{
    //{BMP头
    BYTEbfType;//类型,判断是否为‘B’,‘M’
    DWORD size;//文件尺寸
    DWORD reser;//保留,为0
    DWORD header_length;//头部长度,也就是数据起始位置
    //}BMP头长度,14字节

    //{信息头40字节
    DWORD infoheader_length;//信息头长度,40
    DWORD width;//图像宽度
    DWORD height;//图像高度
    WORDbiplanes;//颜色平面数,为1
    WORDbmp_type;/* 8bit 24bit; */
    DWORD compres;//0表示不压缩
    DWORD datasize;//数据长度,size-54
    DWORD bixpm;//水平分辩率
    DWORD biypm;//垂直分辩率
    DWORD clrused;//为0所有颜色,其它的为索引数
    DWORD relclrused;//0表示都重要
    //}信息头结束

    //其它信息
    BYTE *image;//指向一块内存,保存BMP的内容
    DWORD lineBytes;//一行占多少字节
};

//从源BMP图中,剪切车牌所在区域的新结构
struct Bmp1{
    DWORD width;
    DWORD height;
    BYTE *image;
    int left;//保存车牌中7个字的左右列
    int right;
    int top;//保存车牌上下位置
    int bottom;
    int up;
    int down;
    byte strr;
    byte string;//反回已找到的车牌下标
    float ang;//倾斜角度
};

//蓝色车牌
struct HSV{
float H;//H值范围:190 ~ 245
float S;//S值范围: 0.35 ~ 1,我理解为黑白灰度
int V;//V值范围: 0.3 ~ 1
};

//读图片文件到内存中
int read_img(char const *fn, struct BMP_img *img)
{
    FILE *infile;
    if((infile=fopen(fn,"rb"))==NULL)return 0;

    fread(&img->bfType,2,1,infile);//BM
    if(!(img->bfType=='B' && img->bfType=='M'))return 0;
    fread(&img->size,sizeof(DWORD),1,infile);
    printf("\nBMP size             :%d",(int)img->size);
    fread(&img->reser,sizeof(DWORD),1,infile);
    printf("\n保留位:");
    fread(&img->header_length,sizeof(DWORD),1,infile);
    printf("\nheader length    :%d",(int)img->header_length);
    fread(&img->infoheader_length,sizeof(DWORD),1,infile);
    fread(&img->width, sizeof(DWORD), 1, infile);
    fread(&img->height, sizeof(DWORD), 1, infile);
    printf( "\nwidth   :%d\nheight:%d ", (int)img->width, (int)img->height);
    fread(&img->biplanes, sizeof(WORD), 1, infile);
    fread(&img->bmp_type, sizeof(WORD), 1, infile);
    printf("\nBMP Tpye             :%d ", img->bmp_type);
    fread(&img->compres, sizeof(DWORD), 1, infile);
    if(img->compres==0) {printf("\nbmp图片为非压缩!");}printf(" ");
    fread(&img->datasize, sizeof(DWORD), 1, infile);
    printf("\nBMP Data Size      :%d ",(int)img->datasize);
    fread(&img->bixpm, sizeof(DWORD), 1, infile);
    fread(&img->biypm, sizeof(DWORD), 1, infile);
    fread(&img->clrused, sizeof(DWORD), 1, infile);
    printf("\n实际使用颜色数=%d ",(int)img->clrused);printf(" ");
    fread(&img->relclrused, sizeof(DWORD), 1, infile);

    //计算一行需要多少字节,对齐到4字节
    img->lineBytes=(img->width*img->bmp_type+31)/32*4;//printf("\nLineBytes            :%l\n",img->lineBytes);
    if(img->bmp_type==24)//24位色
    {
      img->image=(unsigned char *)malloc(img->lineBytes*img->height);//分配一块内存,用于保存图像数据
      if(img->image==NULL) fprintf(stderr, "\n Allocation error for temp in read_bmp() \n");
      fseek(infile, img->header_length, SEEK_SET);//跳过头部,也就是跳到图像位置
      if(img->datasize==img->width*3)
            fread(img->image, sizeof(unsigned char), (img->lineBytes)*img->height, infile);//全部读到内存中
      else
      {
            for(int i=0;i<img->height;i++)
            {
                fread(&img->image, sizeof(unsigned char), img->lineBytes, infile);//全部读到内存中
            }
      }
    }
    fclose(infile);
    return 1;
}

//把二值图保存为24位黑白图
void WriteBmp1(char const *fn,byte *bmp,int width,int height)
{
    int w4;
    struct BMP_img img;
    //一行有多少个字节
    img.lineBytes=((width*3+3)>>2)<<2;//对齐到4字节边界
    w4=img.lineBytes*height;//图像尺寸
    img.bfType='B';img.bfType='M';
    img.size=w4+54;
    img.reser=0;
    img.header_length=54;
    img.infoheader_length=40;
    img.width=width;
    img.height=height;
    img.biplanes=1;
    img.bmp_type=24;
    img.compres=0;
    img.datasize=w4;
    img.bixpm=0;
    img.biypm=0;
    img.clrused=0;
    img.relclrused=0;
   
    FILE *infile;
    if((infile=fopen(fn,"wb"))==NULL)
    {
      return;
    }
    fwrite(&img.bfType,2,1,infile);//printf("\n打开的图为 %d",img->bfType);//B M
    fwrite(&img.size,sizeof(DWORD),1,infile);   //      printf("\nBMP size             :%l",img->size);
    fwrite(&img.reser,sizeof(DWORD),1,infile);//printf("\n保留位:");
    fwrite(&img.header_length,sizeof(DWORD),1,infile); //printf("\nheader length    :%l",img->header_length);
    fwrite(&img.infoheader_length,sizeof(DWORD),1,infile);
    fwrite(&img.width, sizeof(DWORD), 1, infile);
    fwrite(&img.height, sizeof(DWORD), 1, infile);   //printf( "\nwidth   :%l\nheight:%l ", img->width, img->height);
    fwrite(&img.biplanes, sizeof(WORD), 1, infile);
    fwrite(&img.bmp_type, sizeof(WORD), 1, infile);// printf("\nBMP Tpye             :%l ", img->bmp_type);
    fwrite(&img.compres, sizeof(DWORD), 1, infile);    //if(img->compres==0) {printf("\nbmp图片为非压缩!");}printf(" ");
    fwrite(&img.datasize, sizeof(DWORD), 1, infile);//printf("\nBMP Data Size      :%l ",img->datasize);
    fwrite(&img.bixpm, sizeof(DWORD), 1, infile);
    fwrite(&img.biypm, sizeof(DWORD), 1, infile);
    fwrite(&img.clrused, sizeof(DWORD), 1, infile);    //printf("\n实际使用颜色数=%d ",img->clrused);printf(" ");
    fwrite(&img.relclrused, sizeof(DWORD), 1, infile);
   
    byte *wbmp=(byte*)malloc(w4);//后面多加两个字节,用于4字节对齐
    for(int i=0,s,w;i<height;i++)
    {
      s=i*width;
      w=i*img.lineBytes;
      for(int j=0;j<width;j++)
      {
            if(bmp){
                wbmp=wbmp=wbmp=bmp;
            }
            else wbmp=wbmp=wbmp=0;               
      }
    }
    fwrite(wbmp,img.datasize,1,infile);
    free(wbmp);
    fclose(infile);
}

//水平投影,从中间往两边计算,从而去掉最上面与最下面的多余部分
void shuipingtouying(struct Bmp1 *img,byte *dst)//得到车牌的上下边缘
{
    byte temp;
    int i,j,m,n;
    int *p=(int*)malloc(img->height*sizeof(int));//申请以行为单位的整型内存数

    for(i=0;i<img->width;i++)//宽度循环
    {
      if((dst==255)||(dst==255))//如果第一行 或 第二行有白点
      for(j=0;j<img->height;j++)//消除此白点,直到碰到黑点退出
      {
            if(dst==255)
                dst=0;
            else break;
      }
    }
    for(i=0;i<img->width;i++)
    {
      //倒数1,2行中有白点,则消除,否则退出
      if((dst==255)||(dst==255))
            for(j=img->height-1;j>0;j--)
            {
                if(dst==255)
                  dst=0;
                else break;
            }
    }

    //记录每一行的白点数
    for(i=0;i<img->height;i++)
    {
      p=0;
      for(j=0;j<img->width;j++)
      {
            if(dst==255)
                p++;
      }
    }

    //找到白点数最多的行
    temp=0;
    for(i=0;i<img->height;i++)
    {
      if(p>temp)
      {
          temp=p;
      }
    }

    n=temp/5;//以20%做为阀值
    img->up=0;
    img->down=img->height;
    m=img->height/2;
    for(i=m-1;i>0;i--)//从中间往上下遍历,如果有一行的白点数小于20%,则做为起点与终点
    {
      if(p<n)
      {
            img->up=i+1;//只有第一次,才赋值
            break;
      }
    }
    for(i=m+1;i<img->height;i++)//从下面往中间遍历
    {
      if(p<n)
      {
            img->down=i-1;
            break;
      }
    }
    free(p);

    //删除起始行之前的白点
    for(i=0;i<img->up;i++)
    {
      for(j=0;j<img->width;j++)
      {
            dst=0;
      }
    }
   
    //删除结束行之后的白点
    for(i=img->down+1;i<img->height;i++)
    {
      for(j=0;j<img->width;j++)
      {
            dst=0;
      }
    }
}

//垂直投影法
void cuizhitouying(struct Bmp1 *img,byte *temp)
{
    DWORD i,j;
    int num,flag;

    int up;
    int down;
    int bd;//当前列白点数

    //计算1个字符的宽度,也就是1块车牌的宽度,把所有字挨紧,空白区域占30%左右
    //然后一块车牌有7个字,所以一个字的宽度大根是width*0.7/7
    num=flag=0;
    up=img->height;//最高一个白点
    down=0;//最低一个白点
    for(i=0;i<img->width;i++)//按宽遍历
    {
      bd=0;
      for(j=0;j<img->height;j++)//按高遍历,也就是1列1列的遍历
      {
            if(temp==255)//记录每列白点数
            {
                bd++;
                if(up>j)up=j;//最高白点
                if(down<j)down=j;//记住最后一个白点的位置
            }
      }

      if(bd)//当前列有白点
      {
            if(flag==0)//还没有记录起点
            {
                flag=1;
                img->left=i;//记录下起点
            }
      }
      else//当前列没白点
      {
            if(flag)//如果已记录了起点
            {
                if((down-up)+1>img->height/2)//找到正确的字符
                {
                  img->right=i-1;//记录结束区域
                  img->top=up;
                  img->bottom=down;
                  num++;//查找下一个字符
                }
                flag=0;//记录下一个记点
                up=img->height;
                down=0;
            }
      }
    }
    //如果最后一个没有结束
    if(flag){
      img->right=img->width-1;
      img->top=up;
      img->bottom=down;
      num++;
    }
      
    if(num<7)//位数不够
    {
      printf("car no min error\n");
    }
    else if(num>7)//如果找到多于7个字符,说明里面有一个“川”字
    {
      printf("car no error\n");
    }
}

//复制单个字符,存进数组中
void strBmp(struct Bmp1 *img,byte *temp)
{
    int i,j,k,n;
    //int w,h;
    for(i=0;i<7;i++)
    {
      n=0;
      for(j=img->top;j<=img->bottom;j++)//高度循环
      {
            for(k=img->left;k<=img->right;k++)//宽度循环
            {
                img->strr=temp;
            }
      }
      if(i==0)WriteBmp1("z1.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==1)WriteBmp1("z2.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==2)WriteBmp1("z3.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==3)WriteBmp1("z4.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==4)WriteBmp1("z5.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==5)WriteBmp1("z6.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
      if(i==6)WriteBmp1("z7.bmp",img->strr,img->right-img->left+1,img->bottom-img->top+1);
    }
}

//缩放到指定的宽度与高度
void changeGray(byte *srcBmp,byte *dstBmp,int width,int height,int nWidth,int nHeight)
{
    int i=0,j=0,i0,j0;
    float xx;float yy;
    xx=(float)nWidth/width;//宽度缩放比
    yy=(float)nHeight/height;

    memset(dstBmp,0x00,nHeight*nWidth*sizeof(byte));
    if(width<nWidth/2)//说明为1
    {
      for(i=0;i<nHeight;i++)
      {
            for(j=0;j<width;j++)
            {
                if(i<=height)
                {
                  dstBmp=srcBmp;
                }
                else{
                  dstBmp=srcBmp[(height-1)*width+j];
                }
            }
      }
    }
    else
    {
      for(i = 0; i <nHeight; i++)
      {
            for(j = 0; j <nWidth; j++)
            {
                //i0 = (int) ((float)i/yy+0.5);
                //j0 = (int) ((float)j/xx+0.5);
                i0 = (int) ((float)i/yy);
                j0 = (int) ((float)j/xx);
                if((j0>=0)&&(j0<width)&&(i0>=0)&&(i0<height))
                // {
                  dstBmp=srcBmp;
               //}
               //else
               //{
                //    dstBmp=255;
               //}
            }
      }
    }
}

void guiyi(struct Bmp1 *img)
{
    int xxx;
    int i;
    int yyy;

    byte *temp=(byte *)malloc(sizeof(byte)*512);
    for(i=0;i<7;i++)
    {
      xxx=img->right-img->left+1;
      yyy=img->bottom-img->top+1;

      changeGray(img->strr,temp,xxx,yyy,16,32);

      memcpy(img->strr,temp,sizeof(byte)*512);
      if(i==0)WriteBmp1("zz1.bmp",img->strr,16,32);
      if(i==1)WriteBmp1("zz2.bmp",img->strr,16,32);
      if(i==2)WriteBmp1("zz3.bmp",img->strr,16,32);
      if(i==3)WriteBmp1("zz4.bmp",img->strr,16,32);
      if(i==4)WriteBmp1("zz5.bmp",img->strr,16,32);
      if(i==5)WriteBmp1("zz6.bmp",img->strr,16,32);
      if(i==6)WriteBmp1("zz7.bmp",img->strr,16,32);
    }
}

//比较单个字符,我这里用了与原作者不同的方法,原方法简单字符复杂字比只会白点越少
//就是在比较的时候,如果两点都为白色,则为黑色
//如果两点不相同,则为白色,这样只有最相似的字白点才会最少
int cmpstr(byte *src,byte const *moban)
{
    int i,j;
    int k;
    int w=16,h=32;
   
    byte temp={0};
    memcpy(temp,src,512);
    byte temp1;
    for(i=0;i<h;i++)
    {
      for(j=0;j<w;j++)//0~16
      {
            k=1<<(7-(j%8));//j%8=0~7
            if((moban[(h-i-1)*2+j/8] & k) == k)
                temp1=255;
            else temp1=0;
      }
    }

    WriteBmp1("c1.bmp",temp,w,h);
    WriteBmp1("c2.bmp",temp1,w,h);
    for(i=0;i<h;i++)//模板尺寸为32*16
    {
      for(j=0;j<w;j++)
      {
            if(temp==255)//如果车牌与模板当前位置都为白色,则为0
            {
                if(temp1==255)temp=0;
                //k=1<<(7-(j%8));//当前要检查的是第几位
                //if((moban & k) == k)
                //    temp=0;
            }
            else if(temp1==255)temp=255;//如果原图为黑点,但模板有白点,则加上去
      }
    }
    WriteBmp1("c3.bmp",temp,w,h);
   
    //其实根本就不用删的,反正是遍历出最批配的字
    //delpoint(temp,h,w,4);//删除噪点,小于4点的删除掉
    //WriteBmp1("c4.bmp",temp,w,h);
   
    for(i=0;i<h;i++)//计算余下的白点数
    {
      for(j=0;j<w;j++)
      {
            if(temp==255)
            {
                k++;
            }
      }
    }
    return k;
}

//比较7个字符,得到最相似的那个
void strout(struct Bmp1 *img)
{
    int i,j,k=0,m=800,n=0;
    //int p={0};
    for(i=34;i<70;i++)//只扫描汉字
    {
      k=cmpstr(img->strr,FONT);//比较车牌的汉字与模板文件
      if(k==0)//如果完全批配,则返回ID号
      {
         n=i;
         break;
      }
      else//否则,找到噪点数最少的ID
      {
            if(k<m)
            {
                m=k;
                n=i;
            }
      }
    }
    img->string=n;//把找到的ID保存进string中

    //继续找后面的字符
    for(i=1;i<7;i++)
    {
      n=0;k=0;m=800;
      for(j=0;j<34;j++)//34个字符
      {
            k=cmpstr(img->strr,FONT);
            if(k==0)
            {
                n=j;
                break;
            }
            else
            {
                if(k<m)
                {
                  m=k;
                  n=j;
                }
            }
      }
      img->string=n;
    }
}

//输出车牌号
void outtext(struct Bmp1 img1)
{
    //10+26+31=67个车牌字符
    int i;

    printf("\n\n\n\n\n\n");
    printf("\n      The Car Id Is\n");
    printf("\n");
    for(i=0;i<7;i++)
    {
      printf("   ");
      printf("%s",table]);
    }
    printf("\n");
    printf("\n   This is designed by liujia\n");//刘佳就是原作者
    printf("\n\n\n\n\n\n\n\n");
}

int main(int argc, char **argv)
{
    struct BMP_img img;//定义结构
    struct Bmp1 img1;

    //把当前文件夹下的1.bmp文件内容,读到img结构中,并上下镜像
    if(read_img("1.bmp", &img)==0)
    {
      printf("error");
      return 0;
    }
   
    img1.width=img.width;
    img1.height=img.height;
    byte *temp=(byte*)malloc(img.width*img.height);
    //24位灰度图转单色灰度图
    for(int i=0;i<img.height;i++)
    {
      for(int j=0;j<img.width;j++)
      {
            temp=img.image;
      }
    }
   
    //水平投影,去掉上下非文字区域
    shuipingtouying(&img1,temp);
   
    //垂直投影,去掉车牌中的点,并计算7个字各在什么位置
    cuizhitouying(&img1,temp);//垂直投影,框住每一个字符
   
    //写入镜像后的数据到2.bmp中
    WriteBmp1("2.bmp",temp,img.width,img.height);
   
    //把每个文字切出来
    strBmp(&img1,temp);//把车牌字符放到数组里面

    //缩放每个文字,与模板大小相等
    guiyi(&img1);

    strout(&img1);//比较车牌与模板,得到最优解
    outtext(img1);//输出车牌,前面已经成功分解出车牌
   
    free(img.image);//释放动态分配的内存
    free(temp);
   
    printf("请打开2.bmp进行查看\n");
    system("pause");
    return 0;
}




举个例子:

可以看到,比较两个完全不同的字,结果中的白点,只会比原来的多,如果比较两个相似的图片,白点就少了,白点越少就是最优解

待比较的图片   模板图片      比较结果
页: [1]
查看完整版本: 车牌识别(八)模板比较