车牌识别(附源代码)
1.车牌抓拍与识别系统 C# 源代码

using System.Text;using System.Drawing.Design;using mon;using ponentModel.Design.Serialization;/* 视频监控*/public class Spjk{// 打开摄像头public DXButton UINavigatorButtonButton7{get{// 选择摄像头if ((this.mUINavigatorButtonButton7 == null)){this.mUINavigatorButtonButton7 = new DXButton(this);#region Search Criteriathis.mUINavigatorButtonButton7.SearchProperties[] = "dataNavigatorSampleButton[10]";this.mUINavigatorButtonButton7.SearchProperties[DXTestControl.PropertyNames.ClassName] = "NavigatorButton";this.mUINavigatorButtonButton7.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUINavigatorButtonButton7;}}// 摄像头设置完毕public DXButton UINavigatorButtonButton8{get{if ((this.mUINavigatorButtonButton8 == null)){this.mUINavigatorButtonButton8 = new DXButton(this);#region Search Criteriathis.mUINavigatorButtonButton8.SearchProperties[] = "dataNavigatorSampleButton[11]";//消息发送this.mUINavigatorButtonButton8.SearchProperties[DXTestControl.PropertyNames.ClassName] = "NavigatorButton";this.mUINavigatorButtonButton8.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUINavigatorButtonButton8;}}// 设置端口public DXButton UINavigatorButtonButton9{get{// 图片抓拍if ((this.mUINavigatorButtonButton9 == null)){this.mUINavigatorButtonButton9 = new DXButton(this);#region Search Criteriathis.mUINavigatorButtonButton9.SearchProperties[] = "dataNavigatorSampleButton[2]";//图片截取this.mUINavigatorButtonButton9.SearchProperties[DXTestControl.PropertyNames.ClassName] = "NavigatorButton";this.mUINavigatorButtonButton9.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUINavigatorButtonButton9;}}// 图片保存public DXButton UINavigatorButtonButton10{get{if ((this.mUINavigatorButtonButton10 == null)){this.mUINavigatorButtonButton10 = new DXButton(this);#region Search Criteriathis.mUINavigatorButtonButton10.SearchProperties[] = "dataNavigatorSampleButton[1]";this.mUINavigatorButtonButton10.SearchProperties[DXTestControl.PropertyNames.ClassName] = "NavigatorButton";this.mUINavigatorButtonButton10.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUINavigatorButtonButton10;}}// 图片剪切public DXButton UINavigatorButtonButton11{get{if ((this.mUINavigatorButtonButton11 == null)){this.mUINavigatorButtonButton11 = new DXButton(this);//逻辑读取#region Search Criteriathis.mUINavigatorButtonButton11.SearchProperties[] = "dataNavigatorSampleButton[0]";//设置this.mUINavigatorButtonButton11.SearchProperties[DXTestControl.PropertyNames.ClassName] = "NavigatorButton";this.mUINavigatorButtonButton11.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUINavigatorButtonButton11;}}// 图片优化#endregion#region Fieldsprivate DXButton mUINavigatorButtonButton;private DXButton mUINavigatorButtonButton1;private DXButton mUINavigatorButtonButton2;private DXButton mUINavigatorButtonButton3;private DXButton mUINavigatorButtonButton4;private DXButton mUINavigatorButtonButton5;private DXButton mUINavigatorButtonButton6;private DXButton mUINavigatorButtonButton7;private DXButton mUINavigatorButtonButton8;private DXButton mUINavigatorButtonButton9;private DXButton mUINavigatorButtonButton10;private DXButton mUINavigatorButtonButton11;#endregion}//图片格式选择[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIModuleListBoxCustom : DXTestControl{public UIModuleListBoxCustom(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "ModuleListBox";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "ModuleListBox";this.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}#region Properties//服务端跟踪信息public UIXtraTabControl1TabList43 UIXtraTabControl1TabList{get{if ((this.mUIXtraTabControl1TabList == null)){this.mUIXtraTabControl1TabList = new UIXtraTabControl1TabList43(this); //全局可写属性}return this.mUIXtraTabControl1TabList;}}public UIXtraTabControl2TabList UIXtraTabControl2TabList{get{//文本信息if ((this.mUIXtraTabControl2TabList == null)){this.mUIXtraTabControl2TabList = new UIXtraTabControl2TabList(this);}return this.mUIXtraTabControl2TabList;}}#endregion#region Fieldsprivate UIXtraTabControl1TabList43 mUIXtraTabControl1TabList;private UIXtraTabControl2TabList mUIXtraTabControl2TabList;#endregion}//图像修改[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIXtraTabControl1TabList43 : DXTestControl{public UIXtraTabControl1TabList43(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteria//查找this.SearchProperties[] = "xtraTabControl1";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "XtraTabControl";this.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}#region Propertiespublic UIXtraTabPage1Client42 UIXtraTabPage1Client{get{//图标设置if ((this.mUIXtraTabPage1Client == null)){this.mUIXtraTabPage1Client = new UIXtraTabPage1Client42(this);}return this.mUIXtraTabPage1Client;}}public DXTestControl UIXtraTabControlHeaderTabPage{get{//控件选择if ((this.mUIXtraTabControlHeaderTabPage == null)){this.mUIXtraTabControlHeaderTabPage = new DXTestControl(this);#region Search Criteriathis.mUIXtraTabControlHeaderTabPage.SearchProperties[] = "xtraTabControl1PageHeader1";this.mUIXtraTabControlHeaderTabPage.SearchProperties[DXTestControl.PropertyNames.ClassName] = "XtraTabControlHeader";this.mUIXtraTabControlHeaderTabPage.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUIXtraTabControlHeaderTabPage;}}public UIXtraTabPage2Client6 UIXtraTabPage2Client{get{if ((this.mUIXtraTabPage2Client == null)){this.mUIXtraTabPage2Client = new UIXtraTabPage2Client6(this);}return this.mUIXtraTabPage2Client;}}#endregion#region Fieldsprivate UIXtraTabPage1Client42 mUIXtraTabPage1Client;private DXTestControl mUIXtraTabControlHeaderTabPage;private UIXtraTabPage2Client6 mUIXtraTabPage2Client;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIXtraTabPage1Client42 : DXTestControl{public UIXtraTabPage1Client42(UITestControl searchLimitContainer) :base(searchLimitContainer)//服务端日志读取{#region Search Criteriathis.SearchProperties[] = "xtraTabPage1";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "XtraTabPage";this.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}#region Propertiespublic UIListBoxControlSampleList UIListBoxControlSampleList{get{if ((this.mUIListBoxControlSampleList == null)){this.mUIListBoxControlSampleList = new UIListBoxControlSampleList(this);}return this.mUIListBoxControlSampleList;}}#endregion#region Fieldsprivate UIListBoxControlSampleList mUIListBoxControlSampleList;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIListBoxControlSampleList : DXListBox{public UIListBoxControlSampleList(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "listBoxControlSample";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "ListBoxControl";this.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}#region Propertiespublic DXListBoxItem UIAngolaListItem//选定响应{get{if ((this.mUIAngolaListItem == null)){this.mUIAngolaListItem = new DXListBoxItem(this);#region Search Criteriathis.mUIAngolaListItem.SearchProperties[] = "listBoxControlSampleItem[5]";//算法设置this.mUIAngolaListItem.SearchProperties[DXTestControl.PropertyNames.ClassName] = "ListBoxControlItem";this.mUIAngolaListItem.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUIAngolaListItem;}}public DXListBoxItem UIUnitedStatesimageusListItem{get{if ((this.mUIUnitedStatesimageusListItem == null)){this.mUIUnitedStatesimageusListItem = new DXListBoxItem(this);#region Search Criteriathis.mUIUnitedStatesimageusListItem.SearchProperties[] = "listBoxControlSampleItem[0]";this.mUIUnitedStatesimageusListItem.SearchProperties[DXTestControl.PropertyNames.ClassName] = "ListBoxControlItem";this.mUIUnitedStatesimageusListItem.WindowTitles.Add("The XtraEditors Suite Demo (C# code)");#endregion}return this.mUIUnitedStatesimageusListItem;}}}//~~~~~~~/* 监控设置*/using mon;using System.Runtime.Remoting.Messaging;using System.Runtime.Remoting.MetadataServices;using System.Security.Cryptography.X509Certificates;using System.Data.Odbc;public class Jksz{public DXButton UISimpleButton2Button{get{if ((this.mUISimpleButton2Button == null))//矢量控制{this.mUISimpleButton2Button = new DXButton(this);#region Search Criteriathis.mUISimpleButton2Button.SearchProperties[] = "simpleButton2";this.mUISimpleButton2Button.SearchProperties[DXTestControl.PropertyNames.ClassName] = "SimpleButton";this.mUISimpleButton2Button.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUISimpleButton2Button;}}#endregion#region Fieldsprivate DXButton mUISimpleButton1Button;private DXButton mUISimpleButton2Button;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIRibbonControl1Ribbon5 : DXRibbon{public UIRibbonControl1Ribbon5(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "ribbonControl1";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "RibbonControl";this.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}#region Properties// 车主信息查看public DXRibbonPage UIRibbonPage1RibbonPage{get{if ((this.mUIRibbonPage1RibbonPage == null)){this.mUIRibbonPage1RibbonPage = new DXRibbonPage(this);#region Search Criteriathis.mUIRibbonPage1RibbonPage.SearchProperties[] = "RibbonPage1";this.mUIRibbonPage1RibbonPage.SearchProperties[DXTestControl.PropertyNames.ClassName] = "RibbonPage";this.mUIRibbonPage1RibbonPage.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUIRibbonPage1RibbonPage;}}//服务端信息日志public DXRibbonPage UIRibbonPage0RibbonPage{get{if ((this.mUIRibbonPage0RibbonPage == null)){this.mUIRibbonPage0RibbonPage = new DXRibbonPage(this);#region Search Criteriathis.mUIRibbonPage0RibbonPage.SearchProperties[] = "RibbonPage0";this.mUIRibbonPage0RibbonPage.SearchProperties[DXTestControl.PropertyNames.ClassName] = "RibbonPage";this.mUIRibbonPage0RibbonPage.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUIRibbonPage0RibbonPage;}}// 选择筛选时间#endregion#region Fieldsprivate DXRibbonPage mUIRibbonPage1RibbonPage;private DXRibbonPage mUIRibbonPage0RibbonPage;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]// 违章记录查看public class UICustomHeaderButtonsCustom : DXTestControl{public UICustomHeaderButtonsCustom(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "CustomHeaderButtons";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "CustomHeaderButtons";this.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}#region Propertiespublic UILayoutControl1Custom7 UILayoutControl1Custom{get//关联管理{if ((this.mUILayoutControl1Custom == null)){this.mUILayoutControl1Custom = new UILayoutControl1Custom7(this);}return this.mUILayoutControl1Custom;}//安全设定}#endregion#region Fieldsprivate UILayoutControl1Custom7 mUILayoutControl1Custom;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UILayoutControl1Custom7 : DXTestControl{public UILayoutControl1Custom7(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "layoutControl1";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "LayoutControl";this.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}#region Propertiespublic UIActionDockPanelCustom UIActionDockPanelCustom{get{if ((this.mUIActionDockPanelCustom == null)){this.mUIActionDockPanelCustom = new UIActionDockPanelCustom(this);}return this.mUIActionDockPanelCustom;}}public DXRadioGroup UIRgTemplatesButtonRadioGroup{get{if ((this.mUIRgTemplatesButtonRadioGroup == null)){this.mUIRgTemplatesButtonRadioGroup = new DXRadioGroup(this);#region Search Criteria//捕获异常this.mUIRgTemplatesButtonRadioGroup.SearchProperties[] = "rgTemplatesButton";this.mUIRgTemplatesButtonRadioGroup.SearchProperties[DXTestControl.PropertyNames.ClassName] = "RadioGroup";this.mUIRgTemplatesButtonRadioGroup.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUIRgTemplatesButtonRadioGroup;}}#endregion#region Fieldsprivate UIActionDockPanelCustom mUIActionDockPanelCustom;private DXRadioGroup mUIRgTemplatesButtonRadioGroup;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIActionDockPanelCustom : DXTestControl{public UIActionDockPanelCustom(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "actionDockPanel";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "ActionDockPanel";this.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}#region Propertiespublic UIDockPanel1Client UIDockPanel1Client{get{if ((this.mUIDockPanel1Client == null)){this.mUIDockPanel1Client = new UIDockPanel1Client(this);}return this.mUIDockPanel1Client;}}#endregion#region Fieldsprivate UIDockPanel1Client mUIDockPanel1Client;#endregion}[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]public class UIDockPanel1Client : DXTestControl{//客户端局部变量public UIDockPanel1Client(UITestControl searchLimitContainer) :base(searchLimitContainer){#region Search Criteriathis.SearchProperties[] = "dockPanel1";this.SearchProperties[DXTestControl.PropertyNames.ClassName] = "DockPanel";this.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}#region Propertiespublic DXButton UICustomHeaderButtonButton{get{if ((this.mUICustomHeaderButtonButton == null)){this.mUICustomHeaderButtonButton = new DXButton(this);#region Search Criteriathis.mUICustomHeaderButtonButton.SearchProperties[] = "CustomHeaderButton";this.mUICustomHeaderButtonButton.SearchProperties[DXTestControl.PropertyNames.ClassName] = "DockPanelButton";this.mUICustomHeaderButtonButton.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUICustomHeaderButtonButton;}}public UIDockPanel2_ContainerCustom UIDockPanel2_ContainerCustom{get{if ((this.mUIDockPanel2_ContainerCustom == null)){this.mUIDockPanel2_ContainerCustom = new UIDockPanel2_ContainerCustom(this);}return this.mUIDockPanel2_ContainerCustom;}}public DXButton UIPushbuttonButton{//延时控制get{if ((this.mUIPushbuttonButton == null)){this.mUIPushbuttonButton = new DXButton(this);#region Search Criteriathis.mUIPushbuttonButton.SearchProperties[] = "Push button"; //管理方式this.mUIPushbuttonButton.SearchProperties[DXTestControl.PropertyNames.ClassName] = "DockPanelButton";this.mUIPushbuttonButton.WindowTitles.Add("Application UI Layout ControlsDemo (C# code)");#endregion}return this.mUIPushbuttonButton;}}public DXButton UICheckButtonButton{get{if ((this.mUICheckButtonButton == null)){this.mUICheckButtonButton = new DXButton(this);#region Search Criteriathis.mUICheckButtonButton.SearchProperties[] = "Check Button";this.mUICheckButtonButton.SearchProperties[DXTestControl.PropertyNames.ClassName] = "DockPanelButton";this.mUICheckButtonButton.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUICheckButtonButton;}}public DXButton UIImageButton{get{if ((this.mUIImageButton == null)){this.mUIImageButton = new DXButton(this);#region Search Criteriathis.mUIImageButton.SearchProperties[] = "Image";this.mUIImageButton.SearchProperties[DXTestControl.PropertyNames.ClassName] = "DockPanelButton";this.mUIImageButton.WindowTitles.Add("Application UI Layout Controls Demo (C# code)");#endregion}return this.mUIImageButton;}//客户端清空Cookie}}///* 监控选项*/using System.Runtime.InteropServices;using System.Data.SqlTypes;using System.Data.OracleClient;public class Jkxx{private void buttonX4_Click(object sender, EventArgs e){switch (comboBoxEx2.SelectedIndex){case 0:if (dateTimeInput3.Text == "" && dateTimeInput4.Text == ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='是'"; Supplier_Load sl = new Supplier_Load (sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text != "" && dateTimeInput4.Text == ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='是' AND Input_Date >='" + dateTimeInput3.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text != "" && dateTimeInput4.Text != ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='是' AND Input_Date >='" + dateTimeInput3.Value + "' AND Input_Date <='" + dateTimeInput4.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text == "" && dateTimeInput4.Text != ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='是' AND Input_Date <='" + dateTimeInput4.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}//数据库访问break;case 1:if (dateTimeInput3.Text == "" && dateTimeInput4.Text == ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='否'"; Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text != "" && dateTimeInput4.Text == ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='否' AND Input_Date >='" + dateTimeInput3.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text != "" && dateTimeInput4.Text != ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='否' AND Input_Date >='" + dateTimeInput3.Value + "' AND Input_Date <='" + dateTimeInput4.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}if (dateTimeInput3.Text == "" && dateTimeInput4.Text != ""){string sql = "SELECT * FROM [ZCERP].[dbo].[ZH_PAY_SUPPLIER] WHERE OD_PAY_ALL_M ='否' AND Input_Date <='" + dateTimeInput4.Value + "'";Supplier_Load sl = new Supplier_Load(sql);sl.StartPosition = FormStartPosition.CenterScreen;sl.ShowDialog();return;}break;}}//++++++/* 查看视频*///数据设置using System.Runtime.Remoting.Metadata.W3cXsd2001;using System.Web.UI.WebControls;public class Cksp{public virtual DragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams DragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams{get//客户端选定{if((this.mDragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams == null)){this.mDragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams = new DragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams();}returnthis.mDragPropertyGridRowFromCustomizationFormWithInsertAfterDragActionParams;}}public virtual CheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedValues CheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedValues {get{if((this.mCheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedValues == null)){this.mCheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedVal ues = new CheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedValues();}returnthis.mCheckDraggingPropertyGridRowFromCustomizationFormWithInsertAfterDragActionExpectedValues;}}public virtual DragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams DragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams {get{if((this.mDragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams == null)){this.mDragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionPara ms = new DragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams();}returnthis.mDragPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams;}}public virtual CheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionExpect edValues CheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionExpect edValues{get{if((this.mCheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActio nExpectedValues == null)){this.mCheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragA ctionExpectedValues = new CheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionExpect edValues();}//删除序列returnthis.mCheckDraggingPropertyGridRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionExpectedValues;}}public virtual DragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams DragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams{get{if((this.mDragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams == null)) {this.mDragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams = new DragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams();}returnthis.mDragPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionParams;}}public virtual CheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionExpectedValu es CheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionExpectedValu es{get{if((this.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionExpec tedValues == null)){this.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionEx pectedValues = new CheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionExpectedValu es();}returnthis.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormWithMoveChildDragActionExpecte dValues;}}public virtualDragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams DragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams {get{if((this.mDragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragAction Params == null)){this.mDragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragAc tionParams = new DragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionParams( );}returnthis.mDragPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActionP arams;}}public virtual CheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActi onExpectedValues CheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActi onExpectedValues{//删除信息项get{if((this.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChild DragActionExpectedValues == null)){this.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveC hildDragActionExpectedValues = new CheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDragActi onExpectedValues();}returnthis.mCheckDraggingPropertyGridCategoryRowsFromCustomizationFormToCollapsedRowWithMoveChildDr agActionExpectedValues;//登录信息}。
车牌识别系统源代码

num=0;
for j=1:b
if goal(i,j)==1
num=num+1;
end
end
if num<(b*0.1)
line_down=i;
break;
end
x(k)=uint8(x(k));
if x(k)>0 %当所选区域不为空时进行输出
11=11+1;% 用来记录输出的字符数
s(11)=char(x(k));
end
temp(32,32)=0;
imshow(temp);
end
now=now+2;
goalboundary=boundary;
s=min(goalboundary,[],1);
e=max(goalboundary,[],1);
goal=imcrop(Image,[s(2) s(1) e(2)- s(2) e(1)-s(1)]);
end
text(boundray(1,2)-35,boundray(1,1)+13,metric_string,'Color','g','FontSize',14,'FontWeight','bold');%显示匹配度字串
B6=imerode(B5,se);
[B,L]=bwboundaries(B6,4);%对边界图进行小区域联通,是车牌区域连通为一个方块
imshow(label2rgb(L,@jet,[.5 .5 .5]))%对连通区域进行标记
hold on
for k=1:length(B)
实验报告用MATLAB实现车牌识别系统

图像处理大作业实验报告--用MATLAB实现车牌识别系统作者东南大学电子系李浩翔06006435指导老师张雄实验日期2010-1-10索引:实验目的实验原理实验步骤1.预处理2.边缘识别3.小区块联通4.车牌区域的识别并截取5.字符截取6.字符识别实验思路分析本程序的局限性附录附录1 程序源代码1.主程序2.子函数(code)附录2 测试图像处理过程汇总1.测试图像12.测试图像2附录3 参考文献及参考程序实验目的(返回索引)使用MATLAB对包含车牌的图片进行处理,利用算法识别出车牌所在的区域,并辨认其数字及字母,最后在屏幕上输出所识别出的车牌号。
实验原理(返回索引)1.将拍摄下的彩色图像转换为灰度图,之后用中值滤波对灰度图像进行预处理,从而减少干扰信息。
2.使用sobel算子识别出图像的边缘,并转化为二值化图像。
并对二值化之后的图像进行卷积,加强边缘的轮廓。
3.用膨胀-再腐蚀的方法分别作用于图像的横轴与纵轴,将小块的联通区域连接起来,使车牌的形状更加清晰,为下一步的识别做好准备。
4.利用车牌长宽比的特性对各个联通区域进行判断,识别出车牌所在区域,并截取。
5.对截取出的车牌区域进行进一步的处理,分割出各个字符。
6.对分割出的字符进行特征判断,从而识别出具体的车牌号。
实验步骤(返回索引)1.预处理(返回索引)A. 将拍摄下的彩色图像转换为灰度图,便于进行接下来的算法处理。
图1 拍摄下的图片B.对灰度图进行中值滤波,减少干扰点对二值化运算结果的影响。
图3 进行中值滤波后的灰度图C.将中值滤波后的灰度图用设定门限灰度的方法(取门限值为0.2)转化为二值化图像,在后继的车牌区域截取运算中作为源图像使用。
图4 使用设定灰度门限的方法获得的二值化图像2.边缘识别(返回索引)A.利用sobel算子识别出图3中的边缘区域,并将其转换为二值化图像。
在转换后的二值化图像中,边缘区域被作为白点标出,而非边缘区域被黑色区域覆盖。
中国车牌号的识别大全(完整版)

中国车牌号的识别大全(包括军车和政府高官用车)北京市(京)京A、京C、京E、京F、北京市(城区),京G 北京市(远郊区), 京B 出租车,京O警察天津市(津)津A、津B、津C、天津市 ,津E 出租车上海市(沪)沪A、沪B、沪D 上海市区,沪C 远郊区重庆市(渝)渝A 重庆市区(江南),渝B 重庆市区(江北),渝C 永川区,渝F 万州区,渝G 涪陵区,渝H 黔江区河北省(冀)冀A 石家庄,冀B 唐山,冀C 秦皇岛,冀D 邯郸,冀E邢台,冀F 保定,冀G 张家口,冀H 承德,冀J 沧州,冀R 廊坊,冀T 衡水河南省(豫)豫A 郑州,豫B 开封,豫C 洛阳,豫D 平顶山,豫E 安阳,豫F 鹤壁,豫G 新乡,豫H 焦作,豫J 濮阳,豫K 许昌,豫L 漯河,豫M 三门峡,豫N 商丘,豫P 周口,豫Q 驻马店,豫R 南阳,豫S 信阳,豫U 济源云南省(云)云A 昆明,云B 东川,云C 昭通,云D 曲靖, 云E 楚雄彝族,云F 玉溪,云G 红河哈尼族,云H 文山壮族苗,云J 思茅,云L 大理白族,云K 西双版纳,云M 保山,云N 德宏傣族,云P 丽江,云Q 怒江傈族,云R 迪庆藏族,云S 临沧辽宁省(辽)辽A 沈阳,辽B 大连,辽C 鞍山,辽D 抚顺,辽E 本溪,辽F 丹东,辽G 锦州,辽H 营口,辽J 阜新,辽K 辽阳,辽L 盘锦,辽M 铁岭,辽N 朝阳,辽P 葫芦岛,辽V 省直机关黑龙江省(黑)黑A 哈尔滨 ,黑B 齐齐哈尔,黑C 牡丹江,黑D 佳木斯,黑E 大庆,黑F 伊春,黑G 鸡西,黑H 鹤岗,黑J 双鸭山,黑K 七台河,黑L 松花江行署,黑M 绥化,黑N 黑河,黑P 大兴安岭湖南省(湘)湘A 长沙,湘B 株洲,湘C 湘潭,湘D 衡阳,湘E 邵阳,湘F 岳阳,湘G 大庸,湘H 益阳,湘J 常德,湘K 娄底,湘L 郴州,湘M 零陵,湘N怀化,湘P 湘西州安徽省(皖)皖A 合肥,皖B 芜湖,皖C 蚌埠,皖D 淮南,皖E 马鞍山,皖F 淮北,皖G 铜陵,皖H 安庆,皖J 黄山,皖K 阜阳,皖L 宿州,皖M 滁州,皖N 六安,皖P 宣城,皖Q 巢湖,皖R 池州山东省(鲁)鲁A 济南,鲁B 青岛,鲁C 淄博,鲁D 枣庄,鲁E 东营,鲁F 烟台,鲁G 潍坊,鲁H 济宁,鲁J 泰安,鲁K 威海,鲁L 日照,鲁M 莱芜,鲁N 德州,鲁P 聊城,鲁Q 临沂,鲁R 菏泽,鲁U 青岛开发区新疆维吾尔(新)新A 乌鲁木齐,新B 昌吉回族,新C 石河子,新D 奎屯,新E 博尔塔拉,新F 伊犁哈萨,新G 塔城,新H 阿勒泰,新J 克拉玛依,新K 吐鲁番, 新L 哈密,新M 巴音郭,新N 阿克苏,新P 克孜勒苏柯,新Q 喀什,新R 和田江苏省(苏)苏A 南京,苏B 无锡,苏C 徐州,苏D 常州,苏E 苏州,苏F 南通,苏G 连云港,苏H 淮阴,苏J 盐城,苏K 扬州,苏L 镇江,苏M 泰州,苏N 宿迁浙江省(浙)浙A 杭州,浙B 宁波,浙C 温州,浙D 绍兴,浙E 湖州,浙F 嘉兴,浙G 金华,浙H 衢州,浙J 台州,浙K 丽水,浙L 舟山江西省(赣)赣A 南昌,赣B 赣州,赣C 宜春,赣D 吉安,赣E 上饶,赣F 抚州,赣G 九江,赣H 景德镇,赣J 萍乡,赣K 新余,赣L 鹰潭湖北省(鄂)鄂A 武汉,鄂B 黄石,鄂C 十堰,鄂D 沙市,鄂E 宜昌,鄂F 襄樊,鄂G 鄂州,鄂H 荆门,鄂J 黄岗,鄂K 孝感,鄂L 咸宁,鄂M 荆州,鄂N 郧阳,鄂P 宜昌,鄂Q 鄂西州 广西壮族(桂)桂A 南宁,桂B 柳州,桂C 桂林,桂D 梧州,桂E 北海,桂F 南宁,桂G 柳州,桂H 桂林,桂J 贺州(属梧州),桂K 玉林,桂M 河池,桂L 百色,桂N 钦州,桂P 防城甘肃省(甘)甘A 兰州,甘B 嘉峪关,甘C 金昌,甘D 白银,甘E 天水,甘F 酒泉,甘G 张掖,甘H 武威,甘J 定西,甘K 陇南,甘L 平凉,甘M 庆阳 ,甘N 临夏回族,甘P 甘南藏族山西省(晋)晋A 太原,晋B 大同,晋C 阳泉,晋D 长治,晋E 晋城,晋F 朔州,晋H 忻州,晋J 吕梁,晋K 晋中,晋L 临汾,晋M 运城内蒙古(蒙)蒙A 呼和浩特,蒙B 包头,蒙C 乌海,蒙D 赤峰,蒙E呼伦贝尔盟,蒙F 兴安盟,蒙G 锡林郭勒盟,蒙H 乌兰察布盟,蒙J 伊克昭盟,蒙K 巴彦淖尔盟,蒙L 阿拉善盟陕西省(陕)陕A 西安,陕B 铜川,陕C 宝鸡,陕D 威阳,陕E 渭南,陕F 汉中,陕G 安康,陕H 商洛,陕J 延安,陕K 榆林,陕U 省直机关吉林省(吉)吉A 长春,吉B 吉林,吉C 四平,吉D 辽源,吉E 通化,吉F 白山,吉G 白城,吉H 延边朝鲜族福建省(闽)闽A 福州,闽B 莆田,闽C 泉州,闽D 厦门,闽E 漳州,闽F 龙岩,闽G 三明,闽H 南平,闽J 宁德,闽K 省直机关贵州省(贵)贵A 贵阳,贵B 六盘水,贵C 遵义,贵D 铜仁,贵E 黔西南州,贵F 毕节,贵G 安顺,贵H 黔东南州,贵J 黔南州 广东省(粤)粤A 广州,粤B 深圳,粤C 珠海,粤D 汕头,粤E 佛山,粤F 韶关,粤G 湛江,粤H 肇庆,粤J 江门,粤K 茂名,粤L 惠州,粤M 梅州,粤N 汕尾,粤P 河源,粤Q 阳江,粤R 清远,粤S 东莞,粤T 中山,粤U 潮州,粤V 揭阳,粤W 云浮,粤X 顺德,粤Y 南海,粤Z港澳进入内地车辆 青海省(青)青A 西宁,青B 海东,青C 海北,青D 黄南,青E 海南州,青F 果洛州,青G 玉树州,青H 海西州,西藏(藏)藏A 拉萨,藏B 昌都,藏C 山南,藏D 日喀则,藏E 那曲,藏F 阿里,藏G 林芝四川省(川)川A 成都,川B 绵阳,川C 自贡,川D 攀枝花,川E 泸州,川F 德阳,川H 广元,川J 遂宁,川K 内江,川L 乐山,川Q 宜宾,川R 南充,川S 达县,川T 雅安,川U 阿坝藏族,川V 甘孜藏族,川W 凉山彝族,川Z 眉山。
基于 OpenCV 和 Python 车牌识别系统的设计与实现代码大全

题目基于OpenCV和Python车牌识别系统的设计与实现1.1 题目的主要研究内容(1)工作的主要描述利用python中自带的opencv库中的模式识别算法制作一个简易的模式识别系统,使用自己搜集到的数据集对模型进行训练,最终完成特征提取、分类等工作,并且在最后的推理过程中,实现了车牌识别的工作。
(2)系统流程图1.2 题目研究的工作基础或实验条件项目的编程环境为python,编译器使用pycharm2021.3 x64,设计一个车牌识别系统,有GUI界面。
选择一张有车牌的图片后,完成车牌定位、倾斜校正、字符分割,最后通过k-NN 算法对车牌的字母和数字进行识别,将识别结果在GUI界面中显示出来1.3 数据集描述车牌定位就是在图片中识别出哪个位置有车牌,是字符分割和字母数字识别的前提,是车牌识别系统的关键和难点。
:例如,训练数据的目录结构树如下所示:1.4 特征提取过程描述1.对原始图像进行高斯模糊,减少噪点。
2.提取图像边缘。
首先将彩色图像转为灰度图gray,利用大核对灰度图进行开操作得到图像open,相当于对灰度图进行涂抹操作,将灰度图gray和开操作后的图像open按1:-1的比例融合得到图像add,以上操作可以将大面积灰度值相似的地方置黑,可以减少车灯、背景、地面、挡风玻璃等细节。
接着使用canny 算法对融合图像add提取边缘,得到图像canny。
3.使用横向长条作为核对边缘图像进行一次闭操作,得到图像close,相当于对边缘横向涂抹,因为一般视角车牌是宽大于高的矩形。
再对图像close进行一次开操作,得到图像open2,消除较细的线条和不大的竖向线条,从而将车牌位置的连通区域独立出来。
4.查找连通区域,通过最小外接矩形的宽高比2~5.5筛选合适的连通区域。
5.将最小外接矩形图像旋转矫正,上下左右向外扩展一点范围,避免连通区域没能覆盖车牌造成影响。
6.将连通区域原图转为HSV图像,确定图像的主要颜色,若不为蓝、黄、绿,则排除。
车牌识别代码

车牌识别代码[fn,pn,fi]=uigetfile;%读入文件I=imread([pn fn]);figure,imshow(I);%显示原始图像title;Im1=rgb2gray(I);figure(2),subplot(1,2,1),imshow(Im1);title('灰度图');tic %计时开始[height,width]=size(Im1);%预处理I_edge=zeros(height,width);% 创建height*width的矩阵for i=1:width-1 % 对每一列开始遍历I_edge(:,i)=abs(I(:,i+1)-I(:,i));% 每列的值赋为原图像中左右两列相减的绝对值(即梯度) end% 归一化处理(0~255)I_edge=(255/(max(max(I_edge))-min(min(I_edge))))*(I_edge-min(min(I_edge)));figureimshow(I_edge);title('归一化处理')[I_edge,y1]=select(I_edge,height,width); %%%%%%调用select函数figureimshow(I_edge);title('选择')BW2 = I_edge;%%%%%%%%%%%%%%%%%一些形态学处理SE=strel('rectangle',[10,10]);IM2=imerode(BW2,SE);%腐蚀figureimshow(IM2);title('腐蚀');IM2=bwareaopen(IM2,20);%开运算,消除细小物体figureimshow(IM2);title('开运算');IM3=imdilate(IM2,SE);%膨胀figureimshow(IM2);title('膨胀'); %%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%投影以粗略估计车牌位置p_h=projection(double(IM3),'h'); %调用projection函数if(p_h(1)>0)p_h=[0,p_h];endp_v=projection(double(IM3),'v'); %调用projection函数if(p_v(1)>0)p_v=[0,p_v];end%%%%%%p_h=double((p_h>5));p_h=find(((p_h(1:end-1)-p_h(2:end))~=0));len_h=length(p_h)/2;%%%%%p_v=double((p_v>5));p_v=find(((p_v(1:end-1)-p_v(2:end))~=0));len_v=length(p_v)/2;%%%%%%%%%%%%%%%%%%%%%%%%%%%%粗略计算车牌候选区k=1;for i=1:len_hfor j=1:len_vs=IM3(p_h(2*i-1):p_h(2*i),p_v(2*j-1):p_v(2*j));if(mean(mean(s))>0.1)p{k}=[p_h(2*i-1),p_h(2*i)+1,p_v(2*j-1),p_v(2*j)+1];k=k+1;endendendk=k-1;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%进一步缩小车牌候选区for i=1:kedge_IM3=double(edge(double(IM3(p{i}(1):p{i}(2),p{i}(3):p{i}(4))),'canny'));[x,y]=find(edge_IM3==1);p{i}=[p{i}(1)+min(x),p{i}(2)-(p{i}(2)-p{i}(1)+1-max(x)),...p{i}(3)+min(y),p{i}(4)-(p{i}(4)-p{i}(3)+1-max(y))];p_center{i}=[fix((p{i}(1)+p{i}(2))/2),fix((p{i}(3)+p{i}(4))/2)];p_ratio(i)=(p{i}(4)-p{i}(3))/(p{i}(2)-p{i}(1));end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%对上面参数和变量的说明:p为一胞元,用于存放每个图像块的左上和右下两个点的坐标;%存放格式为:p{k}=[x1,x2,y1,y2];x1,x2分别为行坐标,y1,y2为列坐标%p_center为一胞元,用于存放每个图像块的中心坐标,p_center{k}=[x,y];x,y分别为行,列坐标%p_ratio为一矩阵,用来存放图像块的长宽比例%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%合并临近区域%%%%%%%%如果有多个区域则执行合并if k>1n=0;ncount=zeros(1,k);for i=1:k-1%%%需要调整if条件中的比例%%%需要调整%检查是否满足合并条件if(abs(p{i}(1)+p{i}(2)-p{i+1}(1)-p{i+1}(2))<=height/30&&abs(p{i+1}(3)-p{i}(4))<=width/15) p{i+1}(1)=min(p{i}(1),p{i+1}(1));p{i+1}(2)=max(p{i}(2),p{i+1}(2));p{i+1}(3)=min(p{i}(3),p{i+1}(3));p{i+1}(4)=max(p{i}(4),p{i+1}(4)); %向后合并n=n+1;ncount(n)=i+1;endend%如果有合并,求出合并后最终区域if(n>0)d_ncount=ncount(2:n+1)-ncount(1:n);%避免重复记录临近的多个区域。
基于Python实现的车牌识别项目

基于Python实现的车牌识别项⽬车牌识别在⾼速公路中有着⼴泛的应⽤,⽐如我们常见的电⼦收费(ETC)系统和交通违章车辆的检测,除此之外像⼩区或地下车库门禁也会⽤到,基本上凡是需要对车辆进⾏⾝份检测的地⽅都会⽤到。
简介车牌识别系统(Vehicle License Plate Recognition)是计算机视频图像识别技术在车辆牌照识别中的⼀种应⽤,通常⼀个车牌识别系统主要包括以下这四个部分:车辆图像获取车牌定位车牌字符分割车牌字符识别我们再来看⼀下百科中对车牌识别技术的描述:车牌识别技术要求能够将运动中的汽车牌照从复杂背景中提取并识别出来,通过车牌提取、图像预处理、特征提取、车牌字符识别等技术,识别车辆牌号、颜⾊等信息,⽬前最新的技术⽔平为字母和数字的识别率可达到 99.7%,汉字的识别率可达到99%。
实现⽅式我们这⾥不做太复杂的车辆动态识别,只演⽰从图像中识别车牌信息,车牌识别功能的实现⽅式⼤致分为两种,⼀种是⾃⼰编写代码实现,另⼀种是借助第三⽅ API 接⼝实现。
⾃⼰实现如果我们想要通过 Python ⾃⼰⼿动编码实现车牌识别功能,可以借助⼀些 Python 库,⽐如:OpenCV、TensorFlow 等,这种⽅式因为每⼀个功能点都需要我们⾃⼰编码实现,所有会相对复杂⼀些,另⼀⽅⾯如果我们想要保证识别的准确性,可能需要做⼤量的实验,也就是说会花费更多的时间。
第三⽅接⼝现在已经有⼀些第三⽅平台实现好了车牌识别的功能,并且他们对外提供了 API 接⼝,我们只需要调⽤他们提供的接⼝即可,这种⽅式实现就相对简单了⼀些,并且通常接⼝提供⽅对外提供的接⼝功能的准确性也是基本可以保证的,原因很简单,如果接⼝功能太差的话,⼀是⾃⼰打脸,还有就是基本不会有什么⼈使⽤,也就失去了接⼝对外提供的价值了,另外第三⽅接⼝可能会收取⼀定费⽤,因此,如果现实中我们具体实现的话要综合考虑。
具体实现SDK 安装百度云 SDK 对多种语⾔提供了⽀持,⽐如:Python、Java、C++、IOS、Android 等,这⾥我们安装 Python 版的 SDK,安装很简单,使⽤pip install baidu-aip命令即可。
车牌识别代码OpenCV

车牌识别代码OpenCV#include<opencv2\opencv.hpp>#include<iostream> using namespace cv; using namespace std; int areas;//该函数⽤来验证是否是我们想要的区域,车牌定位原理其实就是在图⽚上寻找矩形,我们可以⽤长宽⽐例以及⾯积来验证是否是我们想要的矩形,宽⾼⽐为520/110=4.7272 (车牌的长除以宽),区域⾯积最⼩为15个像素,最⼤为125个像素bool VerifySize(RotatedRect candidate) { float error = 0.4; //40%的误差范围float aspect = 4.7272;//宽⾼⽐例int min = 25 * aspect * 25; //最⼩像素为15int max = 125 * aspect * 125;//最⼤像素为125float 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;elsereturn true; } int main(int argc, char** argv) {Mat src;src = imread("D:\\Car1.jpg");//读取含车牌的图⽚if (!src.data) {cout << "Could not open Car.jph.." << endl;return -1;}Mat img_gray;cvtColor(src, img_gray, CV_BGR2GRAY);//灰度转换Mat img_blur;blur(img_gray, img_blur, Size(5, 5));//⽤来降噪Mat img_sobel;Sobel(img_gray, img_sobel, CV_8U, 1, 0, 3);//Sobel滤波,对x进⾏求导,就是强调y⽅向,对y进⾏求导,就是强调x⽅向,在此我们对x求导,查找图⽚中的竖直边Mat img_threshold;threshold(img_sobel, img_threshold, 0, 255, THRESH_BINARY | THRESH_OTSU);Mat element = getStructuringElement(MORPH_RECT, Size(21, 5));//这个Size很重要!!不同的图⽚适应不同的Size,待会在下⾯放图,⼤家就知道区别了morphologyEx(img_threshold, img_threshold,MORPH_CLOSE,element);//闭操作,就是先膨胀后腐蚀,⽬的就是将图⽚联通起来,取决于element的Size。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
车牌识别电子1301 洪江 13一、目的与要求车牌定位系统的目的在于正确获取整个图像中车牌的区域,并识别出车牌号。
通过设计实现车牌识别系统,能够提高学生分析问题和解决问题的能力,还能培养一定的科研能力二、设计原理:牌照自动识别是一项利用车辆的动态视频或静态图像进行牌照、牌照颜色自动识别的模式识别技术。
其硬件基础一般包括触发设备、摄像设备、照明设备、图像采集设备、识别车牌的处理机等,其软件核心包括车牌定位算法、车牌字符分割算法和光学字符识别算法等。
某些牌照识别系统还具有通过视频图像判断车辆驶入视野的功能称之为视频车辆检测。
一个完整的牌照识别系统应包括车辆检测、图像采集、牌照识别等几部分。
当车辆检测部分检测到车辆到达时触发图像采集单元,采集当前的视频图像。
牌照识别单元对图像进行处理,定位出牌照位置,再将牌照中的字符分割出来进行识别,然后组成牌照输出。
三、详细设计步骤:为了进行牌照识别,需要以下几个基本的步骤:a.牌照定位,定位图片中的牌照位置;b.牌照字符分割,把牌照中的字符分割出来;c.牌照字符识别,把分割好的字符进行识别,最终组成牌照。
牌照识别过程中,牌照颜色的识别依据算法不同,可能在上述不同步骤实现,通常与牌照识别互相配合、互相验证。
(1)牌照定位:自然环境下,汽车图像背景复杂、光照不均匀,如何在自然背景中准确地确定牌照区域是整个识别过程的关键。
首先对采集到的视频图像进行大围相关搜索,找到符合汽车牌照特征的若干区域作为候选区,然后对这些侯选区域做进一步分析、评判,最后选定一个最佳的区域作为牌照区域,并将其从图象中分割出来。
(2)牌照字符分割 :完成牌照区域的定位后,再将牌照区域分割成单个字符,然后进行识别。
字符分割一般采用垂直投影法。
由于字符在垂直方向上的投影必然在字符间或字符的间隙处取得局部最小值的附近,并且这个位置应满足牌照的字符书写格式、字符、尺寸限制和一些其他条件。
利用垂直投影法对复杂环境下的汽车图像中的字符分割有较好的效果。
(3)牌照字符识别 :字符识别方法目前主要有基于模板匹配算法和基于人工神经网络算法。
基于模板匹配算法首先将分割后的字符二值化,并将其尺寸大小缩放为字符数据库中模板的大小,然后与所有的模板进行匹配,最后选最佳匹配作为结果。
基于人工神经元网络的算法有两种:一种是先对待识别字符进行特征提取,然后用所获得特征来训练神经网络分配器;另一种方法是直接把待处理图像输入网络,由网络自动实现特征提取直至识别出结果。
实际应用中,牌照识别系统的识别率与牌照质量和拍摄质量密切相关。
牌照质量会受到各种因素的影响,如生锈、污损、油漆剥落、字体褪色、牌照被遮挡、牌照倾斜、高亮反光、多牌照、假牌照等等;实际拍摄过程也会受到环境亮度、拍摄亮度、车辆速度等等因素的影响。
这些影响因素不同程度上降低了牌照识别的识别率,也正是牌照识别系统的困难和挑战所在。
为了提高识别率,除了不断的完善识别算法,还应该想办法克服各种光照条件,使采集到的图像最利于识别。
四、各个功能模块的主要实现程序1.载入车牌图像:I=imread('car1.jpg');figure(1),imshow(I);title('original image');%将车牌的原图显示出来,结果如下:2.将彩图转换为灰度图并绘制直方图:I1=rgb2gray(I);%将彩图转换为灰度图figure(2),subplot(1,2,1),imshow(I1);title('gray image');figure(2),subplot(1,2,2),imhist(I1);title('灰度图直方图');%绘制灰度图的直方图结果如下所示:3. 用roberts算子进行边缘检测:I2=edge(I1,'roberts',0.18,'both');%选择阈值0.18,用roberts算子进行边缘检测figure(3),imshow(I2);title('roberts operator edge detection image');结果如下:4.图像实施腐蚀操作:se=[1;1;1];I3=imerode(I2,se);%对图像实施腐蚀操作,即膨胀的反操作figure(4),imshow(I3);title('corrosion image');5.平滑图像se=strel('rectangle',[25,25]);%构造结构元素以正方形构造一个seI4=imclose(I3,se);figure(5),imshow(I4);title('smothing image');结果如下所示:6. 删除二值图像的小对象I5=bwareaopen(I4,2000);%去除聚团灰度值小于2000的部分figure(6),imshow(I5);title('remove the small objects'); %用imshow函数显示滤波后图像结果如下所示:7.车牌定位[y,x,z]=size(I5);%返回I5各维的尺寸,存储在x,y,z中myI=double(I5);%将I5转换成双精度tic %tic表示计时的开始,toc表示计时的结束Blue_y=zeros(y,1);%产生一个y*1的零阵for i=1:yfor j=1:xif(myI(i,j,1)==1)Blue_y(i,1)= Blue_y(i,1)+1;%蓝色像素点统计 endendend[temp MaxY]=max(Blue_y);%Y方向车牌区域确定PY1=MaxY;while ((Blue_y(PY1,1)>=5)&&(PY1>1))PY1=PY1-1;endPY2=MaxY;while ((Blue_y(PY2,1)>=5)&&(PY2<y))PY2=PY2+1;endIY=I(PY1:PY2,:,:);Blue_x=zeros(1,x);%进一步确定x方向的车牌区域for j=1:xfor i=PY1:PY2if(myI(i,j,1)==1)Blue_x(1,j)= Blue_x(1,j)+1;endendendPX1=1;while ((Blue_x(1,PX1)<3)&&(PX1<x))PX1=PX1+1;endPX2=x;while ((Blue_x(1,PX2)<3)&&(PX2>PX1))PX2=PX2-1;endPX1=PX1-1;%对车牌区域的校正PX2=PX2+1;dw=I(PY1:PY2-8,PX1:PX2,:);t=toc;figure(7),subplot(1,2,1),imshow(IY),title('Line direction areas'); figure(7),subplot(1,2,2),imshow(dw),title('positioning color images');8.字符分割与识别对分割出的彩色车牌图像进行灰度转换、二值化、均值滤波、腐蚀膨胀以及字符分割以从车牌图像中分离出组成车牌的单个字符图像,对分割出来的字符进行预处理(二值化、归一化),然后分析提取,对分割出的字符图像进行识别给出文本形式的车牌。
代码如下:imwrite(dw,'dw.jpg');%将彩色车牌写入dw文件中a=imread('dw.jpg');%读取车牌文件中的数据b=rgb2gray(a);%将车牌图像转换为灰度图imwrite(b,'gray licence plate.jpg');%将灰度图像写入文件中figure(8);subplot(3,2,1),imshow(b),title('车牌灰度图像')g_max=double(max(max(b)));g_min=double(min(min(b)));T=round(g_max-(g_max-g_min)/3); % T 为二值化的阈值[m,n]=size(b);d=(double(b)>=T); % d:二值图像imwrite(d,'binary licence plate.jpg');subplot(3,2,2),imshow(d),title('before filtering binary licence plate')h=fspecial('average',3);d=im2bw(round(filter2(h,d)));%使用指定的滤波器h对h进行d即均值滤波imwrite(d,'after average licence plate.jpg');subplot(3,2,3),imshow(d),title('after average licence plate')se=eye(2); % eye(n) returns the n-by-n identity matrix 单位矩阵[m,n]=size(d);%返回矩阵b的尺寸信息,并存储在m,n中if bwarea(d)/m/n>=0.365 %计算二值图像中对象的总面积与整个面积的比是否大于0.365 d=imerode(d,se);%如果大于0.365则图像进行腐蚀elseif bwarea(d)/m/n<=0.235 %计算二值图像中对象的总面积与整个面积的比是否小于0.235d=imdilate(d,se);%如果小于则实现膨胀操作endimwrite(d,'expansion or corrosion the licence plate.jpg');subplot(3,2,4),imshow(d),title('expansion or corrosion the licence plate');运行结果如下所示:9.字符分割在汽车牌照自动识别过程中,字符分割有承前启后的作用。
它在前期牌照定位的基础上进行字符的分割,然后再利用分割的结果进行字符识别。
字符识别的算法很多,因为车牌字符间间隔较大,不会出现字符粘连情况,所以此处采用的方法为寻找连续有文字的块,若长度大于某阈值,则认为该块有两个字符组成,需要分割。
一般分割出来的字符要进行进一步的处理,以满足下一步字符识别的需要。
但是对于车牌的识别,并不需要太多的处理就已经可以达到正确识别的目的。