Merge branch 'micooz-master'

v1.6alpha
liuruoze 9 years ago
commit 7f99931019

209
.gitignore vendored

@ -1,10 +1,22 @@
.idea/
_build/
resources/image/tmp/
*.suo
*.sdf
*.opensdf
*.exe
*.lib
*.pdb
*.ilk
demo
tmp
experi
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
@ -12,206 +24,15 @@ Thumbs.db
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
# Build results
experiment/
experi/
bak/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
*.orig
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# idea IDE
.idea/
# XCode IDE
EasyPR.xcodeproj/
# Debug tmp files
tmp/
# native_test files
native_test/
[Tt]est[Rr]esult*

@ -14,8 +14,10 @@ else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} doesnt support C++11. Please upgrade or use a different C++ compiler.")
endif()
# opencv package required
find_package(OpenCV REQUIRED)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/opencv3")
# opencv3 package required
find_package(OpenCV 3.0.0 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# easypr library
include_directories(include)
@ -32,6 +34,7 @@ set(SOURCE_FILES
src/core/plate_recognize.cpp
src/train/ann_train.cpp
src/train/svm_train.cpp
src/train/train.cpp
src/preprocess/deface.cpp
src/preprocess/gdts.cpp
src/preprocess/mc_data.cpp
@ -41,6 +44,8 @@ set(SOURCE_FILES
add_library(easypr STATIC ${SOURCE_FILES})
# test cases
add_executable(easypr_test test/main.cpp)
add_executable(demo test/main.cpp)
target_link_libraries(easypr_test ${OpenCV_LIBS} easypr)
# link
target_link_libraries(demo ${OpenCV_LIBS} easypr ${OpenCV_LIBS})
set_target_properties(demo PROPERTIES RUNTIME_OUTPUT_DIRECTORY ../)

@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EasyPR", "EasyPR.vcxproj", "{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "vcprojs\demo.vcxproj", "{FADCD7E1-8071-4F1C-8071-C469569C3B56}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{9955D685-A3FF-42E4-AF4B-4F6CE7A4B7F2}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeasypr", "vcprojs\libeasypr.vcxproj", "{2791E339-04FB-44EF-9F92-C90131FE7772}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,14 +13,14 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}.Debug|Win32.ActiveCfg = Debug|Win32
{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}.Debug|Win32.Build.0 = Debug|Win32
{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}.Release|Win32.ActiveCfg = Release|Win32
{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}.Release|Win32.Build.0 = Release|Win32
{9955D685-A3FF-42E4-AF4B-4F6CE7A4B7F2}.Debug|Win32.ActiveCfg = Debug|Win32
{9955D685-A3FF-42E4-AF4B-4F6CE7A4B7F2}.Debug|Win32.Build.0 = Debug|Win32
{9955D685-A3FF-42E4-AF4B-4F6CE7A4B7F2}.Release|Win32.ActiveCfg = Release|Win32
{9955D685-A3FF-42E4-AF4B-4F6CE7A4B7F2}.Release|Win32.Build.0 = Release|Win32
{FADCD7E1-8071-4F1C-8071-C469569C3B56}.Debug|Win32.ActiveCfg = Debug|Win32
{FADCD7E1-8071-4F1C-8071-C469569C3B56}.Debug|Win32.Build.0 = Debug|Win32
{FADCD7E1-8071-4F1C-8071-C469569C3B56}.Release|Win32.ActiveCfg = Release|Win32
{FADCD7E1-8071-4F1C-8071-C469569C3B56}.Release|Win32.Build.0 = Release|Win32
{2791E339-04FB-44EF-9F92-C90131FE7772}.Debug|Win32.ActiveCfg = Debug|Win32
{2791E339-04FB-44EF-9F92-C90131FE7772}.Debug|Win32.Build.0 = Debug|Win32
{2791E339-04FB-44EF-9F92-C90131FE7772}.Release|Win32.ActiveCfg = Release|Win32
{2791E339-04FB-44EF-9F92-C90131FE7772}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{62ADD040-59C5-4D8E-A065-8C5D0CD777BE}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EasyPR</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<SourcePath>$(SourcePath)</SourcePath>
<TargetName>libeasypr</TargetName>
<OutDir>$(SolutionDir)\bin\debug\</OutDir>
<IntDir>$(Configuration)\EasyPR\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>libeasypr</TargetName>
<OutDir>$(SolutionDir)\bin\release\</OutDir>
<IntDir>$(Configuration)\EasyPR\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(ProjectDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opencv_calib3d2411d.lib;opencv_contrib2411d.lib;opencv_core2411d.lib;opencv_features2d2411d.lib;opencv_flann2411d.lib;opencv_gpu2411d.lib;opencv_highgui2411d.lib;opencv_imgproc2411d.lib;opencv_legacy2411d.lib;opencv_ml2411d.lib;opencv_nonfree2411d.lib;opencv_objdetect2411d.lib;opencv_ocl2411d.lib;opencv_photo2411d.lib;opencv_stitching2411d.lib;opencv_superres2411d.lib;opencv_ts2411d.lib;opencv_video2411d.lib;opencv_videostab2411d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Micooz\Documents\opencv\build\x86\vc12\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opencv_calib3d248d.lib;opencv_contrib248d.lib;opencv_core248d.lib;opencv_features2d248d.lib;opencv_calib3d2411.lib;opencv_contrib2411.lib;opencv_core2411.lib;opencv_features2d2411.lib;opencv_flann2411.lib;opencv_gpu2411.lib;opencv_highgui2411.lib;opencv_imgproc2411.lib;opencv_legacy2411.lib;opencv_ml2411.lib;opencv_nonfree2411.lib;opencv_objdetect2411.lib;opencv_ocl2411.lib;opencv_photo2411.lib;opencv_stitching2411.lib;opencv_superres2411.lib;opencv_ts2411.lib;opencv_video2411.lib;opencv_videostab2411.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Users\Micooz\Documents\opencv\build\x86\vc12\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\easypr.h" />
<ClInclude Include="include\easypr\api.hpp" />
<ClInclude Include="include\easypr\chars_identify.h" />
<ClInclude Include="include\easypr\chars_recognise.h" />
<ClInclude Include="include\easypr\chars_segment.h" />
<ClInclude Include="include\easypr\core_func.h" />
<ClInclude Include="include\easypr\feature.h" />
<ClInclude Include="include\easypr\plate.h" />
<ClInclude Include="include\easypr\plate_detect.h" />
<ClInclude Include="include\easypr\plate_judge.h" />
<ClInclude Include="include\easypr\plate_locate.h" />
<ClInclude Include="include\easypr\plate_recognize.h" />
<ClInclude Include="include\easypr\preprocess\deface.h" />
<ClInclude Include="include\easypr\preprocess\gdts.h" />
<ClInclude Include="include\easypr\preprocess\mc_data.h" />
<ClInclude Include="include\easypr\program_options.h" />
<ClInclude Include="include\easypr\svm_train.h" />
<ClInclude Include="include\easypr\util.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\core\chars_identify.cpp" />
<ClCompile Include="src\core\chars_recognise.cpp" />
<ClCompile Include="src\core\chars_segment.cpp" />
<ClCompile Include="src\core\core_func.cpp" />
<ClCompile Include="src\core\feature.cpp" />
<ClCompile Include="src\core\plate.cpp" />
<ClCompile Include="src\core\plate_detect.cpp" />
<ClCompile Include="src\core\plate_judge.cpp" />
<ClCompile Include="src\core\plate_locate.cpp" />
<ClCompile Include="src\core\plate_recognize.cpp" />
<ClCompile Include="src\preprocess\deface.cpp" />
<ClCompile Include="src\preprocess\gdts.cpp" />
<ClCompile Include="src\preprocess\mc_data.cpp" />
<ClCompile Include="src\train\ann_train.cpp" />
<ClCompile Include="src\train\svm_train.cpp" />
<ClCompile Include="src\util\program_options.cpp" />
<ClCompile Include="src\util\util.cpp" />
</ItemGroup>
<ItemGroup>
<Xml Include="resources\model\ann.xml" />
<Xml Include="resources\model\svm.xml" />
</ItemGroup>
<ItemGroup>
<Text Include="resources\image\GDSL.txt" />
<Text Include="resources\image\使用说明.txt" />
<Text Include="关于版权.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -1,157 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="头文件\easypr">
<UniqueIdentifier>{9bb276ae-c7dc-4518-9674-bad84e57b9ac}</UniqueIdentifier>
</Filter>
<Filter Include="头文件\easypr\preprocess">
<UniqueIdentifier>{6d263c48-a60a-4d68-8c2d-be376356168a}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\core">
<UniqueIdentifier>{bab97015-644d-43a0-a50a-a10567a88dbe}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\preprocess">
<UniqueIdentifier>{9a417cf1-7356-4acc-8b03-2b23009aa1ff}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\train">
<UniqueIdentifier>{46477ca6-b57a-48af-b8a7-49b05c42319f}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\util">
<UniqueIdentifier>{53a5d227-5ea7-45e4-9533-ed69bff250fb}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\easypr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="include\easypr\api.hpp">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\chars_identify.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\chars_recognise.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\chars_segment.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\core_func.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\feature.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\plate.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\plate_detect.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\plate_judge.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\plate_locate.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\plate_recognize.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\program_options.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\svm_train.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\util.h">
<Filter>头文件\easypr</Filter>
</ClInclude>
<ClInclude Include="include\easypr\preprocess\deface.h">
<Filter>头文件\easypr\preprocess</Filter>
</ClInclude>
<ClInclude Include="include\easypr\preprocess\gdts.h">
<Filter>头文件\easypr\preprocess</Filter>
</ClInclude>
<ClInclude Include="include\easypr\preprocess\mc_data.h">
<Filter>头文件\easypr\preprocess</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\core\chars_identify.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\chars_recognise.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\chars_segment.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\core_func.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\train\ann_train.cpp">
<Filter>源文件\train</Filter>
</ClCompile>
<ClCompile Include="src\train\svm_train.cpp">
<Filter>源文件\train</Filter>
</ClCompile>
<ClCompile Include="src\util\util.cpp">
<Filter>源文件\util</Filter>
</ClCompile>
<ClCompile Include="src\util\program_options.cpp">
<Filter>源文件\util</Filter>
</ClCompile>
<ClCompile Include="src\core\feature.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\plate.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\plate_detect.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\plate_judge.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\plate_locate.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\core\plate_recognize.cpp">
<Filter>源文件\core</Filter>
</ClCompile>
<ClCompile Include="src\preprocess\deface.cpp">
<Filter>源文件\preprocess</Filter>
</ClCompile>
<ClCompile Include="src\preprocess\gdts.cpp">
<Filter>源文件\preprocess</Filter>
</ClCompile>
<ClCompile Include="src\preprocess\mc_data.cpp">
<Filter>源文件\preprocess</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="resources\model\ann.xml">
<Filter>资源文件</Filter>
</Xml>
<Xml Include="resources\model\svm.xml">
<Filter>资源文件</Filter>
</Xml>
</ItemGroup>
<ItemGroup>
<Text Include="关于版权.txt" />
<Text Include="resources\image\使用说明.txt" />
<Text Include="resources\image\GDSL.txt" />
</ItemGroup>
</Project>

@ -10,23 +10,19 @@ EasyPR是一个中文的开源车牌识别系统其目标是成为一个简
### 更新
本次更新是1.3 正式版,主要改进在于几个方面:
本次更新是1.3-opencv3.0版,主要改进在于几个方面:
1.相对原先的1.2版本,在完整识别率上有所提升:
1.支持opencv3.0注意这与2.x不兼容要想支持的话请下载上一个版本。
![效果比较](resources/doc/res/13ver.jpg)
2.ANN训练开放。
2.增加了30张左右的新图片目前的测试图片数达到了204张。
3.对“字符分割”类的代码做了改善。
3.代码优化。
在1.4版本中计划做以下几点改善:
1.开放ANN训练功能。
2.新的评价框架,更加合理的评估数据。
1.新的评价框架,更加合理的评估数据。
3.新的车牌定位算法。
2.新的车牌定位算法。
### 跨平台
@ -42,7 +38,7 @@ EasyPR是一个中文的开源车牌识别系统其目标是成为一个简
### 兼容性
EasyPR是基于opencv2.4.8版本开发的2.4.8以上的版本应该可以兼容,以前的版本可能会存在不兼容的现象。opencv3.0的版本还没有经过测试。
当前EasyPR是基于opencv3.0版本开发的3.0及以上的版本应该可以兼容,以前的版本可能会存在不兼容的现象。
### 例子
@ -129,100 +125,151 @@ EasyPR的所有源代码可在Github上的[项目主页](https://github.com/liur
如果你熟悉git版本控制工具可以使用下面的命令来从Github里克隆代码
```
$ git clone https://github.com/liuruoze/EasyPR
```
$ git clone https://github.com/liuruoze/EasyPR
EasyPR支持当前主流的操作系统通常不需要对源代码进行更改就可以编译运行尽管如此不同平台上IDE的配置也是有很大差异的下面主要说明WindowsLinux以及Mac OS下的编译方法。
**Note**: 无论在哪个平台使用EasyPR都要安装对应平台版本的[opencv](http://opencv.org/),建议使用正式稳定版本。
windows平台下的opencv的配置可以参考这份[博客](http://my.phirobot.com/blog/2014-02-opencv_configuration_in_vs.html)。
**Note**: 无论在哪个平台使用EasyPR首先都要安装对应平台版本的[opencv](http://opencv.org/),建议使用正式稳定版本。
#### Windows
Windows下的配置建议使用最新的Visual Studio 2013版本。
Windows下的配置建议使用最新的**Visual Studio 2013**版本。目前opencv3.0已经不支持vs2010vs2012对C++ 11支持的不足会存在编译问题。
目前2010与2012下会存在编译问题这是由于老版本对C++ 11特性支持的不足导致的
在之前版本的使用和交流过程中我们发现很多同学对Visual Studio开发环境不甚了解甚至没有做过C++项目对EasyPR环境的配置存在很大的障碍。为此在新版本中我们特意准备了傻瓜式自动配置脚本来方便大家使用EasyPR
* 打开项目目录下的解决方案文件`EasyPR.sln`。
**方法一(推荐)**
1. 首先你需要安装最新版本的[Python](https://www.python.org/downloads/)。将Python的安装目录默认安装在C:\Python34添加到系统环境变量PATH中。
2. 双击 `configure.py` 运行脚本,根据提示填写相关信息。
3. 打开解决方案文件 `EasyPR.sln`,直接编译运行即可。
**方法二**
* 打开解决方案文件 `EasyPR.sln`
**Note**: 该解决方案会加载两个项目,一个是`EasyPR`用于编译src/下的源文件生成静态库`libeasypr.lib`;另一个是`Demo`用来编译test/下的main.cpp并链接libeasypr.lib生成可执行程序。
* 配置OpenCV库
* 配置OpenCV
OpenCV for Windows通常会将使用VS编译好二进制文件放到`opencv\build\`目录下。
EasyPR两个项目的Debug和Release模式都会引用opencv.props属性表用属性表管理器打开修改用户宏里面的`OpenCV`项使之指向你的OpenCV的build目录。
解决方案自动加载的两个项目配置不符合你的环境,请依次手动配置:
**demo**
**Note**: 如果你使用的opencv版本不是`2.4.11`,请修改属性表下的`链接器`-`输入`-`附加依赖项`调整为对应版本的lib。
| 配置项 | 值
|-------------|-----------
| `C/C++`-`附加包含目录` | **[opencv3的include目录]**;$(SolutionDir)include
| `链接器`-`附加库目录` | **[opencv3的lib目录]**
| `链接器`-`输入`-`附加依赖项` | **opencv_world300d.lib**;%(AdditionalDependencies)
*Note*Debug版本为**opencv_world300d.lib**Release版本为**opencv_world300.lib**
**libeasypr**
| 配置项 | 值
|-------------|-----------
| `C/C++`-`附加包含目录` | **[opencv3的include目录]**;$(SolutionDir)include
**Note**: 如果你要使用X64的opencv库或者其他版本的VS请修改`链接器`-`常规`-`附加库目录`,调整为对应的版本。
* 生成解决方案
默认情况下,生成出现的`libeasypr.lib`和`easypr_test.exe`会放在`bin\debug(release)`下。
默认情况下,生成的 `demo.exe` 会放在项目根目录下。
**Note**: 直接双击运行程序会出现找不到opencv动态库的情况这个时候有两个办法
* 在`opencv3\build\x86(x64)\vc(..)\bin`下找到缺失的dll放到执行目录下。
* 将上述bin目录添加到系统环境变量**PATH**中,然后重新运行程序。
**Note**: 直接双击运行程序会出现找不到opencv动态库的情况这个时候只需要在`opencv\build\x86(x64)\vc(..)\bin`下找到缺失的dll放到执行目录即可。
**参考**windows平台下的opencv的手动配置可以参考这份[博客](http://my.phirobot.com/blog/2014-02-opencv_configuration_in_vs.html)
#### Linux & Mac OS
EasyPR使用CMake在Linux及Mac OS下进行构建确保系统安装了最新版本的[CMake](http://cmake.org),然后在任意目录(将存放编译所需的Makefile)执行:
EasyPR使用CMake在Linux及Mac OS下进行构建确保系统安装了最新版本的[CMake](http://cmake.org)
```
$ cmake path/to/EasyPR
```
为了避免系统中安装的老版本opencv对编译的影响需要在 `CMakeLists.txt` 中修改:
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/local/opt/opencv3")
路径指向opencv3的安装目录该目录下应该有OpenCV的CMake配置文件。
完成后在同一目录下执行编译命令:
项目提供了一键编译shell在项目根目录下执行
```
$ make
$ ./build
```
CMake将首先把EasyPR/src下的源文件编译打包为静态库`libeasypr.a`,然后编译`test/main.cpp`,链接静态库生成可执行程序`easypr_test`
即可
-----
**Note**: *你可以直接利用EasyPR/include和这个静态库来调用EasyPR提供的函数接口编写自己的程序。*
**Note**: *你可以直接利用 EasyPR/include 和编译生成的静态库来调用EasyPR提供的函数接口编写自己的程序。*
运行Demo
```
$ ./easypr_test // 进入菜单交互界面
$ ./easypr_test ? // 查看CLI帮助
$ ./demo // 进入菜单交互界面
$ ./demo ? // 查看CLI帮助
```
### 命令行示例
可以向`easypr_test[.exe]`传递命令行参数来完成你想要的工作目前Demo支持四个子命令其他功能如字符识别将逐步加入。对于每个子命令的帮助信息可以传入`-h`参数来获取。
可以向 `demo[.exe]` 传递命令行参数来完成你想要的工作目前Demo支持5个子命令。对于每个子命令的帮助信息可以传入 `-h` 参数来获取。
**车牌识别**
```
# 利用提供的SVM和ANN模型来识别一张图片里面的所有车牌
$ ./easypr_test recognize -p resources/image/plate_recognize.jpg --svm resources/model/svm.xml --ann resources/model/ann.xml
# 或者更简单一些(注意模型路径)
$ ./easypr_test recognize -p resources/image/plate_recognize.jpg
```
# 利用提供的SVM和ANN模型来识别一张图片里面的所有车牌
$ ./demo recognize -p resources/image/plate_recognize.jpg --svm resources/model/svm.xml --ann resources/model/ann.xml
# 或者更简单一些(注意模型路径)
$ ./demo recognize -p resources/image/plate_recognize.jpg
**SVM训练**
```
# 首先生成训练用图片
$ ./easypr_test svm --create --in raw/ --out learn/
# 接下来给训练用图片打标签自动把“是”车牌的图块放到has/“不是”车牌的图块放到no/里注意这里要使用svm.xml的原因是为了简化你的分类工作量你也可以手动对图块分类
$ ./easypr_test svm --tag --source=learn/ --has=has/ --no=no/ --svm=resources/model/svm.xml
# 接下来就是训练过程了,--divide意味着训练程序会对两个目录下的图块进行划分默认是70%的训练数据30%的测试数据,分别放在
# has/train(70%), has/test;
# no/train(70%), no/test
# Note: 目前你需要自己建立子目录
$ ./easypr_test svm --train --has-plate=has/ --no-plate=no/ --divide --svm=save/to/svm.xml
```
新版本的EasyPR大大简化了SVM训练
# 首先准备好车牌图片集合plates/
# 是车牌的放在plates/has/
# 不是车牌的放在plates/no/
# 车牌可从项目resources/train/svm.7z中解压得到。
$ ./demo svm --plates=path/to/your/plates --svm=save/to/svm.xml
# 该命令将70%的车牌作为训练数据另外30%的车牌作为测试数据,
# 这个只可在 include/easypr/config.h 修改。
# 将训练好的模型存放在 save/to/svm.xml。
假设你在easypr的主目录下面新建了一个tmp文件夹并且把svm.7z解压得到的svm文件夹移动到tmp文件夹下面
则可以执行 $ demo svm --plates=tmp/svm --svm=tmp/svm.xml生成得到的tmp文件夹下面的svm.xml就是训练好的模型
替换resources/model/svm.xml就可以达到替换新模型的目的替换前请先备份原始模型。
**ANN训练**
先准备好字符图片集合可从项目resources/train/ann.7z中解压得到。
每类字符都存放在以其名称命名的子文件夹中,命名规则请参考 `include/easypr/config.h`
一切准备就绪后,运行下面这条命令即可:
$ ./demo ann --chars=path/to/chars --ann=save/to/ann.xml
假设你在easypr的主目录下面新建了一个tmp文件夹并且把ann.7z解压得到的ann文件夹移动到tmp文件夹下面
则可以执行 $ demo ann --chars=tmp/ann --ann=tmp/ann.xml生成得到的tmp文件夹下面的svm.xml就是训练好的模型
替换resources/model/ann.xml就可以达到替换新模型的目的替换前请先备份原始模型。
### 获取帮助
详细的开发与教程请见[介绍与开发教程](http://www.cnblogs.com/subconscious/p/3979988.html)。
如果你在使用过程中遇到任何问题,请在[这里](https://github.com/liuruoze/EasyPR/issues)告诉我们。
EasyPR讨论QQ群号是366392603加前请注明EasyPR学习讨论。
### Contributors
* liuruoze1.0-1.2版作者1.3版整合工作
@ -243,6 +290,4 @@ $ ./easypr_test svm --train --has-plate=has/ --no-plate=no/ --divide --svm=save/
taotao1233邱锦山唐大侠jsxyhelu如果有一天(zhoushiwei),学习奋斗,袁承志,
圣城小石匠goldriverMicooz梦里时光Rain Wang任薛纪ahccom星夜落尘海豚嘎嘎(车主之家)
刘超Free&&Easy, 以及所有对EasyPR贡献数据的热心同学。
圣城小石匠goldriverMicooz梦里时光Rain Wang任薛纪ahccom星夜落尘海豚嘎嘎(车主之家)刘超以及所有对EasyPR贡献数据的热心同学。

@ -1281,3 +1281,31 @@
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.550505个, 完全匹配数:144张, 完全匹配率:72.7273%
总时间:195秒, 平均执行时间:0.955882秒
2015-12-03 19:52:21
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.681592个, 完全匹配数:141张, 完全匹配率:70.1493%
总时间:171秒, 平均执行时间:0.838235秒
2015-12-03 19:53:11
总图片数:21张, 未识出图片:7张, 定位率:66.6667%
平均字符差距:2.35714个, 完全匹配数:4张, 完全匹配率:28.5714%
总时间:4秒, 平均执行时间:0.190476秒
2015-12-03 20:11:38
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.681592个, 完全匹配数:141张, 完全匹配率:70.1493%
总时间:155秒, 平均执行时间:0.759804秒
2015-12-03 20:35:20
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.641791个, 完全匹配数:144张, 完全匹配率:71.6418%
总时间:161秒, 平均执行时间:0.789216秒
2015-12-30 07:58:57
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.681592个, 完全匹配数:141张, 完全匹配率:70.1493%
总时间:174秒, 平均执行时间:0.852941秒
2015-12-30 08:07:06
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.641791个, 完全匹配数:144张, 完全匹配率:71.6418%
总时间:179秒, 平均执行时间:0.877451秒
2015-12-30 08:13:36
总图片数:204张, 未识出图片:3张, 定位率:98.5294%
平均字符差距:0.696517个, 完全匹配数:144张, 完全匹配率:71.6418%
总时间:179秒, 平均执行时间:0.877451秒

@ -0,0 +1,11 @@
#!/usr/bin/env bash
BUILD_PATH="_build/"
if [ ! -e $BUILD_PATH ]; then
mkdir $BUILD_PATH
fi
cd _build/
cmake ../
make -j 4

@ -0,0 +1,164 @@
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# EasyPR auto configure script
# --------------------------------------------------------------------
#
# This script configures OpenCV3.0 for Visual Studio
# on Windows.
#
# You are required to have Python3.* installed, and python.exe must
# be added to your PATH (C:\Python34 for example).
#
# You can use it by executing:
#
# C:\> cd path\to\EasyPR
# C:\> python configure.py
#
# Note: compatible with python3, haven't been tested on python2.
#
# --------------------------------------------------------------------
import os
import re
kProjectDir = "vcprojs"
kProjects = ["libeasypr.vcxproj", "demo.vcxproj"]
kProjectTemplates = ["libeasypr.vcxproj.template", "demo.vcxproj.template"]
kOpenCVConfig = "OpenCVConfig-version.cmake"
kConfig = {
"build": "",
"include": "",
"library": "",
"link": ["opencv_world300"],
"bit": "",
"vs": ""
}
kPatterns = {
"include": "(<AdditionalIncludeDirectories>)(.*?)(</AdditionalIncludeDirectories>)",
"library": "(<AdditionalLibraryDirectories>)(.*?)(</AdditionalLibraryDirectories>)",
"link": "(<AdditionalDependencies>)(.*?)(</AdditionalDependencies>)"
}
kReplacements = {
"include": r"\1%s;\2\3",
"library": r'\1%s\3',
"link": r'\1%s;\2\3'
}
def configure():
for i in range(2):
print(">> creating %s" % kProjects[i])
tpath = os.path.join(kProjectDir, kProjectTemplates[i])
fp = open(tpath, encoding="utf-8")
try:
# read from disk
original = fp.read()
nstring = ""
if 0 == i:
nstring = configure_libeasypr(original)
elif 1 == i:
nstring = configure_demo(original)
# write to disk
wpath = os.path.join(kProjectDir, kProjects[i])
writer = open(wpath, mode="wb")
try:
writer.write(nstring.encode())
finally:
writer.close()
finally:
fp.close()
print(">> all done! Open EasyPR.sln and have fun!")
def configure_libeasypr(buffer):
# additional include dir
pattern = re.compile(kPatterns["include"])
return pattern.sub(kReplacements["include"] %
(kConfig["include"][:2] + re.escape(kConfig["include"][2:])),
buffer)
def configure_demo(buffer):
# additional include dir
pattern = re.compile(kPatterns["include"])
nstring = pattern.sub(kReplacements["include"] %
(kConfig["include"][:2] + re.escape(kConfig["include"][2:])),
buffer)
# additional library dir
pattern = re.compile(kPatterns["library"])
nstring = pattern.sub(kReplacements["library"] %
(kConfig["library"][:2] + re.escape(kConfig["library"][2:])),
nstring)
# additional dependencies
#lib_string = ""
#for lib in kConfig["link"]:
# lib_string += (lib + "d.lib")
#pattern = re.compile(kPatterns["link"])
#return pattern.sub(kReplacements["link"] % lib_string, nstring)
return nstring
def check_opencv_version():
file = os.path.join(kConfig["build"], kOpenCVConfig)
print(">> Checking ", file)
fp = open(file)
major_version = 0
try:
fline = fp.readline()
match = re.search(r"OpenCV_VERSION (\d)\.(\d)\.(\d{,2})", fline)
if match is not None:
major_version = match.group(1)
finally:
fp.close()
return major_version
def cli():
while True:
root_ = input(r"Where is your opencv root path? (e.g, C:\path\to\opencv3): ")
if os.path.exists(root_):
kConfig["build"] = os.path.join(root_, "build")
kConfig["include"] = os.path.join(kConfig["build"], "include")
break
else:
print("Invalid path")
if check_opencv_version() != "3":
print("requires opencv 3")
exit()
while True:
xbit = input("Which library version you want to use? (x86 for 32bit, x64 for 64bit): ")
if xbit == "x86" or xbit == "x64":
kConfig["bit"] = xbit
break
else:
print("Please type x86 or x64")
while True:
vc = input("Which Visual Studio you are using? (vs2012 or vs2013): ")
if vc == "vs2012":
kConfig["vs"] = "vc11"
break
elif vc == "vs2013":
kConfig["vs"] = "vc12"
break
else:
print("Please type vs2012 or vs2013")
kConfig["library"] = os.path.normpath("%s/%s/%s/lib/" % (kConfig["build"], kConfig["bit"], kConfig["vs"]))
if __name__ == "__main__":
cli()
configure()

@ -1,12 +1,15 @@
#ifndef EASYPR_EASYPR_H
#define EASYPR_EASYPR_H
#include "easypr/plate_recognize.h"
#include "easypr/svm_train.h"
#include "easypr/core/plate_recognize.h"
#include "easypr/train/svm_train.h"
#include "easypr/train/ann_train.h"
#include "easypr/preprocess/mc_data.h"
#include "easypr/preprocess/gdts.h"
#include "easypr/preprocess/deface.h"
#include "easypr/util.h"
#include "easypr/util/util.h"
#include "easypr/util/program_options.h"
#include "easypr/api.hpp"
#include "easypr/config.h"
#endif //EASYPR_EASYPR_H

@ -12,16 +12,13 @@ namespace easypr {
namespace api {
static bool plate_judge(const char* image,const char *model) {
static bool plate_judge(const char* image, const char* model) {
cv::Mat src = cv::imread(image);
assert(!src.empty());
CPlateJudge judger;
judger.LoadModel(model);
int result;
judger.plateJudge(src, result);
PlateJudge::instance()->plateJudge(src, result);
return result == 1;
}
@ -49,8 +46,6 @@ static std::vector<std::string> plate_recognize(const char* image,
assert(!img.empty());
CPlateRecognize pr;
pr.LoadSVM(model_svm);
pr.LoadANN(model_ann);
pr.setLifemode(life_mode);
pr.setDebug(false);
@ -67,10 +62,7 @@ static Color get_plate_color(const char* image) {
return getPlateType(img, true);
}
}
}
#endif //EASYPR_API_HPP
#endif // EASYPR_API_HPP

@ -1,63 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// Name: chars_identify Header
// Version: 1.0
// Date: 2014-09-25
// Author: liuruoze
// Copyright: liuruoze
// Reference: Mastering OpenCV with Practical Computer Vision Projects
// Reference: CSDN Bloger taotao1233
// Desciption:
// Defines CCharsIdentify
//////////////////////////////////////////////////////////////////////////
#ifndef __CHARS_IDENTIFY_H__
#define __CHARS_IDENTIFY_H__
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CCharsIdentify {
public:
CCharsIdentify();
//! 字符分割
string charsIdentify(Mat, bool, bool);
string charsIdentify(Mat input);
//! 字符分类
int classify(Mat, bool, bool);
int classify(Mat f);
//! 装载ANN模型
void LoadModel();
//! 装载ANN模型
void LoadModel(string s);
//! 设置与读取模型路径
inline void setModelPath(string path) { m_path = path; }
inline string getModelPath() const { return m_path; }
private:
//使用的ANN模型
CvANN_MLP ann;
//! 模型存储路径
string m_path;
//! 特征尺寸
int m_predictSize;
//! 省份对应map
std::map<string, string> m_map;
};
} /* \namespace easypr */
#endif /* endif __CHARS_IDENTIFY_H__ */

@ -0,0 +1,69 @@
#ifndef EASYPR_CONFIG_H_
#define EASYPR_CONFIG_H_
namespace easypr {
static const char* kDefaultSvmPath = "resources/model/svm.xml";
static const char* kDefaultAnnPath = "resources/model/ann.xml";
typedef enum {
kForward = 1, // correspond to "has plate"
kInverse = 0 // correspond to "no plate"
} SvmLabel;
static const float kSvmPercentage = 0.7f;
static const int kPredictSize = 10;
static const int kNeurons = 40;
static const char *kChars[] = {
"0", "1", "2",
"3", "4", "5",
"6", "7", "8",
"9",
/* 10 */
"A", "B", "C",
"D", "E", "F",
"G", "H", /* {"I", "I"} */
"J", "K", "L",
"M", "N", /* {"O", "O"} */
"P", "Q", "R",
"S", "T", "U",
"V", "W", "X",
"Y", "Z",
/* 24 */
"zh_cuan" , "zh_e" , "zh_gan" ,
"zh_gan1" , "zh_gui" , "zh_gui1" ,
"zh_hei" , "zh_hu" , "zh_ji" ,
"zh_jin" , "zh_jing" , "zh_jl" ,
"zh_liao" , "zh_lu" , "zh_meng" ,
"zh_min" , "zh_ning" , "zh_qing" ,
"zh_qiong", "zh_shan" , "zh_su" ,
"zh_sx" , "zh_wan" , "zh_xiang",
"zh_xin" , "zh_yu" , "zh_yu1" ,
"zh_yue" , "zh_yun" , "zh_zang" ,
"zh_zhe"
/* 31 */
};
static const std::map<const char*, const char*> kCharsMap = {
{"zh_cuan" , ""}, {"zh_e" , ""}, {"zh_gan" , ""},
{"zh_gan1" , ""}, {"zh_gui" , ""}, {"zh_gui1" , ""},
{"zh_hei" , ""}, {"zh_hu" , ""}, {"zh_ji" , ""},
{"zh_jin" , ""}, {"zh_jing" , ""}, {"zh_jl" , ""},
{"zh_liao" , ""}, {"zh_lu" , ""}, {"zh_meng" , ""},
{"zh_min" , ""}, {"zh_ning" , ""}, {"zh_qing" , ""},
{"zh_qiong", ""}, {"zh_shan" , ""}, {"zh_su" , ""},
{"zh_sx" , ""}, {"zh_wan" , ""}, {"zh_xiang", ""},
{"zh_xin" , ""}, {"zh_yu" , ""}, {"zh_yu1" , ""},
{"zh_yue" , ""}, {"zh_yun" , ""}, {"zh_zang" , ""},
{"zh_zhe" , ""}
/* 31 */
};
static const int kCharsTotalNumber = 65;
static bool kDebug = false;
}
#endif // EASYPR_CONFIG_H_

@ -0,0 +1,22 @@
#ifndef EASYPR_CORE_CHARSIDENTIFY_H_
#define EASYPR_CORE_CHARSIDENTIFY_H_
#include <opencv2/opencv.hpp>
namespace easypr {
class CharsIdentify {
public:
static CharsIdentify* instance();
std::pair<std::string, std::string> identify(cv::Mat input);
private:
CharsIdentify();
static CharsIdentify* instance_;
cv::Ptr<cv::ml::ANN_MLP> ann_;
};
}
#endif // EASYPR_CORE_CHARSIDENTIFY_H_

@ -9,15 +9,12 @@
// Desciption:
// Defines CCharsRecognise
//////////////////////////////////////////////////////////////////////////
#ifndef __CHARS_RECOGNISE_H__
#define __CHARS_RECOGNISE_H__
#ifndef EASYPR_CORE_CHARSRECOGNISE_H_
#define EASYPR_CORE_CHARSRECOGNISE_H_
#include "easypr/chars_segment.h"
#include "easypr/chars_identify.h"
#include "easypr/core/chars_segment.h"
#include "easypr/core/chars_identify.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CCharsRecognise {
@ -26,23 +23,11 @@ class CCharsRecognise {
~CCharsRecognise();
//! 字符分割与识别
int charsRecognise(Mat, String&, int index = 0);
string charsRecognise(Mat plate);
//! 装载ANN模型
void LoadANN(string s);
//! 是否开启调试模式
inline void setCRDebug(int param) { m_charsSegment->setDebug(param); }
//! 获取调试模式状态
inline int getCRDebug() { return m_charsSegment->getDebug(); }
std::string charsRecognise(cv::Mat plate);
//! 获得车牌颜色
inline string getPlateColor(Mat input) const {
string color = "未知";
inline std::string getPlateColor(cv::Mat input) const {
std::string color = "δ֪";
Color result = getPlateType(input, true);
if (BLUE == result) color = "蓝牌";
if (YELLOW == result) color = "黄牌";
@ -72,11 +57,8 @@ class CCharsRecognise {
private:
//!字符分割
CCharsSegment* m_charsSegment;
//! 字符识别
CCharsIdentify* m_charsIdentify;
};
} /* \namespace easypr */
#endif /* endif __CHARS_RECOGNISE_H__ */
#endif // EASYPR_CORE_CHARSRECOGNISE_H_

@ -9,10 +9,10 @@
// Desciption:
// Defines CCharsSegment
//////////////////////////////////////////////////////////////////////////
#ifndef __CHARS_SEGMENT_H__
#define __CHARS_SEGMENT_H__
#ifndef EASYPR_CORE_CHARSSEGMENT_H_
#define EASYPR_CORE_CHARSSEGMENT_H_
#include "core_func.h"
#include "easypr/core/core_func.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
@ -24,7 +24,7 @@ class CCharsSegment {
CCharsSegment();
//! 字符分割
int charsSegment(Mat, vector<Mat>&, int index = 0);
int charsSegment(Mat input, std::vector<Mat>& resultVec);
//! 字符尺寸验证
bool verifyCharSizes(Mat r);
@ -36,16 +36,16 @@ class CCharsSegment {
Rect GetChineseRect(const Rect rectSpe);
//! 找出指示城市的字符的Rect例如苏A7003X就是A的位置
int GetSpecificRect(const vector<Rect>& vecRect);
int GetSpecificRect(const std::vector<Rect>& vecRect);
//! 这个函数做两个事情
// 1.把特殊字符Rect左边的全部Rect去掉后面再重建中文字符的位置。
// 2.从特殊字符Rect开始依次选择6个Rect多余的舍去。
int RebuildRect(const vector<Rect>& vecRect, vector<Rect>& outRect,
int RebuildRect(const std::vector<Rect>& vecRect, std::vector<Rect>& outRect,
int specIndex);
//! 将Rect按位置从左到右进行排序
int SortRect(const vector<Rect>& vecRect, vector<Rect>& out);
int SortRect(const std::vector<Rect>& vecRect, std::vector<Rect>& out);
//! 设置变量
inline void setLiuDingSize(int param) { m_LiuDingSize = param; }
@ -93,4 +93,4 @@ class CCharsSegment {
} /* \namespace easypr */
#endif /* endif __CHARS_SEGMENT_H__ */
#endif // EASYPR_CORE_CHARSSEGMENT_H_

@ -1,56 +1,55 @@
#ifndef __CORE_FUNC_H__
#define __CORE_FUNC_H__
#include <opencv2/opencv.hpp>
using namespace cv;
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
enum Color { BLUE, YELLOW, WHITE, UNKNOWN };
enum LocateType { SOBEL, COLOR, OTHER };
//! 根据一幅图像与颜色模板获取对应的二值图
//! 输入RGB图像, 颜色模板(蓝色、黄色)
//! 输出灰度图只有0和255两个值255代表匹配0代表不匹配
Mat colorMatch(const Mat& src, Mat& match, const Color r,
const bool adaptive_minsv);
//! 判断一个车牌的颜色
//! 输入车牌mat与颜色模板
//! 返回true或fasle
bool plateColorJudge(const Mat& src, const Color r, const bool adaptive_minsv,
float& percent);
bool bFindLeftRightBound(Mat& bound_threshold, int& posLeft, int& posRight);
bool bFindLeftRightBound1(Mat& bound_threshold, int& posLeft, int& posRight);
bool bFindLeftRightBound2(Mat& bound_threshold, int& posLeft, int& posRight);
//去除车牌上方的钮钉
//计算每行元素的阶跃数如果小于X认为是柳丁将此行全部填0涂黑
// X的推荐值为可根据实际调整
bool clearLiuDing(Mat& img);
void clearLiuDingOnly(Mat& img);
void clearLiuDing(Mat mask, int& top, int& bottom);
//! 获得车牌颜色
Color getPlateType(const Mat& src, const bool adaptive_minsv);
//! 直方图均衡
Mat histeq(Mat in);
Mat features(Mat in, int sizeData);
Rect GetCenterRect(Mat& in);
Mat CutTheRect(Mat& in, Rect& rect);
int ThresholdOtsu(Mat mat);
//! 获取垂直和水平方向直方图
Mat ProjectedHistogram(Mat img, int t);
} /*! \namespace easypr*/
#endif
/* endif __CORE_FUNC_H__ */
#ifndef EASYPR_CORE_COREFUNC_H_
#define EASYPR_CORE_COREFUNC_H_
#include <opencv2/opencv.hpp>
using namespace cv;
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
enum Color { BLUE, YELLOW, WHITE, UNKNOWN };
enum LocateType { SOBEL, COLOR, OTHER };
//! 根据一幅图像与颜色模板获取对应的二值图
//! 输入RGB图像, 颜色模板(蓝色、黄色)
//! 输出灰度图只有0和255两个值255代表匹配0代表不匹配
Mat colorMatch(const Mat& src, Mat& match, const Color r,
const bool adaptive_minsv);
//! 判断一个车牌的颜色
//! 输入车牌mat与颜色模板
//! 返回true或fasle
bool plateColorJudge(const Mat& src, const Color r, const bool adaptive_minsv,
float& percent);
bool bFindLeftRightBound(Mat& bound_threshold, int& posLeft, int& posRight);
bool bFindLeftRightBound1(Mat& bound_threshold, int& posLeft, int& posRight);
bool bFindLeftRightBound2(Mat& bound_threshold, int& posLeft, int& posRight);
//去除车牌上方的钮钉
//计算每行元素的阶跃数如果小于X认为是柳丁将此行全部填0涂黑
// X的推荐值为可根据实际调整
bool clearLiuDing(Mat& img);
void clearLiuDingOnly(Mat& img);
void clearLiuDing(Mat mask, int& top, int& bottom);
//! 获得车牌颜色
Color getPlateType(const Mat& src, const bool adaptive_minsv);
//! 直方图均衡
Mat histeq(Mat in);
Mat features(Mat in, int sizeData);
Rect GetCenterRect(Mat& in);
Mat CutTheRect(Mat& in, Rect& rect);
int ThresholdOtsu(Mat mat);
//! 获取垂直和水平方向直方图
Mat ProjectedHistogram(Mat img, int t);
} /*! \namespace easypr*/
#endif // EASYPR_CORE_COREFUNC_H_

@ -0,0 +1,30 @@
#ifndef EASYPR_CORE_FEATURE_H_
#define EASYPR_CORE_FEATURE_H_
#include <opencv2/opencv.hpp>
namespace easypr {
//! 获得车牌的特征数
cv::Mat getTheFeatures(cv::Mat in);
//! EasyPR的getFeatures回调函数
//! 用于从车牌的image生成svm的训练特征features
typedef void (*svmCallback)(const cv::Mat& image, cv::Mat& features);
//! EasyPR的getFeatures回调函数
//! 本函数是获取垂直和水平的直方图图值
void getHistogramFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取SIFT特征子
void getSIFTFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取HOG特征子
void getHOGFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取HSV空间量化的直方图特征子
void getHSVHistFeatures(const cv::Mat& image, cv::Mat& features);
} /*! \namespace easypr*/
#endif // EASYPR_CORE_FEATURE_H_

@ -1,56 +1,56 @@
//////////////////////////////////////////////////////////////////////////
// Name: plate Header
// Version: 1.0
// Date: 2015-03-12
// Author: liuruoze
// Copyright: liuruoze
// Desciption:
// An abstract class for car plate.
//////////////////////////////////////////////////////////////////////////
#ifndef __PLATE_H__
#define __PLATE_H__
#include "core_func.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CPlate {
public:
bool bColored;
//! 构造函数
CPlate();
//! 设置与读取变量
inline void setPlateMat(Mat param) { m_plateMat = param; }
inline Mat getPlateMat() const { return m_plateMat; }
inline void setPlatePos(RotatedRect param) { m_platePos = param; }
inline RotatedRect getPlatePos() const { return m_platePos; }
inline void setPlateStr(String param) { m_plateStr = param; }
inline String getPlateStr() const { return m_plateStr; }
inline void setPlateLocateType(LocateType param) { m_locateType = param; }
inline LocateType getPlateLocateType() const { return m_locateType; }
private:
//! 车牌的图块
Mat m_plateMat;
//! 车牌在原图的位置
RotatedRect m_platePos;
//! 车牌字符串
String m_plateStr;
//! 车牌定位的方法
LocateType m_locateType;
};
} /*! \namespace easypr*/
#endif /* endif __PLATE_H__ */
//////////////////////////////////////////////////////////////////////////
// Name: plate Header
// Version: 1.0
// Date: 2015-03-12
// Author: liuruoze
// Copyright: liuruoze
// Desciption:
// An abstract class for car plate.
//////////////////////////////////////////////////////////////////////////
#ifndef EASYPR_CORE_PLATE_H_
#define EASYPR_CORE_PLATE_H_
#include "core_func.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CPlate {
public:
bool bColored;
//! 构造函数
CPlate();
//! 设置与读取变量
inline void setPlateMat(Mat param) { m_plateMat = param; }
inline Mat getPlateMat() const { return m_plateMat; }
inline void setPlatePos(RotatedRect param) { m_platePos = param; }
inline RotatedRect getPlatePos() const { return m_platePos; }
inline void setPlateStr(String param) { m_plateStr = param; }
inline String getPlateStr() const { return m_plateStr; }
inline void setPlateLocateType(LocateType param) { m_locateType = param; }
inline LocateType getPlateLocateType() const { return m_locateType; }
private:
//! 车牌的图块
Mat m_plateMat;
//! 车牌在原图的位置
RotatedRect m_platePos;
//! 车牌字符串
String m_plateStr;
//! 车牌定位的方法
LocateType m_locateType;
};
} /*! \namespace easypr*/
#endif // EASYPR_CORE_PLATE_H_

@ -10,11 +10,11 @@
// Desciption:
// Defines CPlateDetect
//////////////////////////////////////////////////////////////////////////
#ifndef __PLATE_DETECT_H__
#define __PLATE_DETECT_H__
#ifndef EASYPR_CORE_PLATEDETECT_H_
#define EASYPR_CORE_PLATEDETECT_H_
#include "easypr/plate_locate.h"
#include "easypr/plate_judge.h"
#include "easypr/core/plate_locate.h"
#include "easypr/core/plate_judge.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
@ -28,14 +28,14 @@ class CPlateDetect {
~CPlateDetect();
//! 深度车牌检测使用颜色与二次Sobel法综合
int plateDetect(Mat src, vector<CPlate>& resultVec,
int plateDetect(Mat src, std::vector<CPlate>& resultVec,
bool showDetectArea = true, int index = 0);
//! 展示中间的结果
int showResult(const Mat& result);
//! 装载SVM模型
void LoadSVM(string s);
void LoadSVM(std::string s);
//! 生活模式与工业模式切换
inline void setPDLifemode(bool param) { m_plateLocate->setLifemode(param); }
@ -95,11 +95,8 @@ class CPlateDetect {
//! 车牌定位
CPlateLocate* m_plateLocate;
//! ³µÅÆÅжÏ
CPlateJudge* m_plateJudge;
};
} /*! \namespace easypr*/
#endif /* endif __PLATE_DETECT_H__ */
#endif // EASYPR_CORE_PLATEDETECT_H_

@ -0,0 +1,32 @@
#ifndef EASYPR_CORE_PLATEJUDGE_H_
#define EASYPR_CORE_PLATEJUDGE_H_
#include "easypr/core/plate.h"
#include "easypr/core/feature.h"
#include "easypr/core/core_func.h"
namespace easypr {
class PlateJudge {
public:
static PlateJudge* instance();
//! 对多幅车牌进行SVM判断
int plateJudge(const std::vector<CPlate>&, std::vector<CPlate>&);
//! 车牌判断
int plateJudge(const std::vector<Mat>&, std::vector<Mat>&);
//! 车牌判断(一副图像)
int plateJudge(const Mat& inMat, int& result);
private:
PlateJudge();
static PlateJudge* instance_;
cv::Ptr<ml::SVM> svm_;
};
}
#endif // EASYPR_CORE_PLATEJUDGE_H_

@ -11,11 +11,11 @@
// Desciption:
// Defines CPlateLocate
//////////////////////////////////////////////////////////////////////////
#ifndef __PLATE_LOCATE_H__
#define __PLATE_LOCATE_H__
#ifndef EASYPR_CORE_PLATELOCATE_H_
#define EASYPR_CORE_PLATELOCATE_H_
#include "easypr/plate.h"
#include "easypr/core_func.h"
#include "easypr/core/plate.h"
#include "easypr/core/core_func.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
@ -28,18 +28,18 @@ class CPlateLocate {
//! Sobel第一次搜索
//! 不限制大小和形状获取的BoundRect进入下一步
int sobelFrtSearch(const Mat& src, vector<Rect_<float>>& outRects);
int sobelFrtSearch(const Mat& src, std::vector<Rect_<float>>& outRects);
//! Sobel第二次搜索
//! 对大小和形状做限制,生成参考坐标
int sobelSecSearch(Mat& bound, Point2f refpoint,
vector<RotatedRect>& outRects);
std::vector<RotatedRect>& outRects);
int sobelSecSearchPart(Mat& bound, Point2f refpoint,
vector<RotatedRect>& outRects);
std::vector<RotatedRect>& outRects);
//! 抗扭斜处理
int deskew(const Mat& src, const Mat& src_b, vector<RotatedRect>& inRects,
vector<CPlate>& outPlates);
int deskew(const Mat& src, const Mat& src_b,
std::vector<RotatedRect>& inRects, std::vector<CPlate>& outPlates);
//! 是否偏斜
//! 输入二值化图像,输出判断结果
@ -61,15 +61,15 @@ class CPlateLocate {
void affine(const Mat& in, Mat& out, const double slope);
//! 颜色定位法
int plateColorLocate(Mat src, vector<CPlate>& candPlates, int index = 0);
int plateColorLocate(Mat src, std::vector<CPlate>& candPlates, int index = 0);
//! Sobel定位法
int plateSobelLocate(Mat src, vector<CPlate>& candPlates, int index = 0);
int plateSobelLocate(Mat src, std::vector<CPlate>& candPlates, int index = 0);
int sobelOperT(const Mat& in, Mat& out, int blurSize, int morphW, int morphH);
//! Color搜索
int colorSearch(const Mat& src, const Color r, Mat& out,
vector<RotatedRect>& outRects, int index = 0);
std::vector<RotatedRect>& outRects, int index = 0);
//! 未使用函数与代码
//! 开始------------
@ -77,7 +77,7 @@ class CPlateLocate {
//! 未使用函数与代码
//! 车牌定位
int plateLocate(Mat, vector<Mat>&, int = 0);
int plateLocate(Mat, std::vector<Mat>&, int = 0);
//! 车牌的尺寸验证
bool verifySizes(RotatedRect mr);
@ -127,7 +127,7 @@ class CPlateLocate {
static const int TYPE = CV_8UC3;
//! verifySize所用常量
static const int DEFAULT_VERIFY_MIN = 1; // 3
static const int DEFAULT_VERIFY_MIN = 1; // 3
static const int DEFAULT_VERIFY_MAX = 24; // 20
//! 角度判断所用常量
@ -159,4 +159,4 @@ class CPlateLocate {
} /*! \namespace easypr*/
#endif /* endif __PLATE_LOCATE_H__ */
#endif // EASYPR_CORE_PLATELOCATE_H_

@ -9,11 +9,11 @@
// Desciption:
// Defines CPlateRecognize
//////////////////////////////////////////////////////////////////////////
#ifndef __PLATE_RECOGNIZE_H__
#define __PLATE_RECOGNIZE_H__
#ifndef EASYPR_CORE_PLATERECOGNIZE_H_
#define EASYPR_CORE_PLATERECOGNIZE_H_
#include "easypr/plate_detect.h"
#include "easypr/chars_recognise.h"
#include "easypr/core/plate_detect.h"
#include "easypr/core/chars_recognise.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
@ -25,18 +25,15 @@ class CPlateRecognize : public CPlateDetect, public CCharsRecognise {
CPlateRecognize();
//! 车牌检测与字符识别
int plateRecognize(cv::Mat src, std::vector<std::string>& licenseVec, int index = 0);
int plateRecognize(Mat src, std::vector<std::string> &licenseVec);
//! 生活模式与工业模式切换
inline void setLifemode(bool param) { CPlateDetect::setPDLifemode(param); }
//! 是否开启调试模式
inline void setDebug(bool param) {
CPlateDetect::setPDDebug(param);
CCharsRecognise::setCRDebug(param);
}
inline void setDebug(bool param) { CPlateDetect::setPDDebug(param); }
};
} /* \namespace easypr */
#endif /* endif __PLATE_RECOGNITION_H__ */
#endif // EASYPR_CORE_PLATERECOGNIZE_H_

@ -1,35 +0,0 @@
#ifndef __FEATURE_H__
#define __FEATURE_H__
#include <opencv2/opencv.hpp>
namespace easypr {
//! 获得车牌的特征数
cv::Mat getTheFeatures(cv::Mat in);
//! EasyPR的getFeatures回调函数
//! 用于从车牌的image生成svm的训练特征features
typedef void(*svmCallback)(const cv::Mat& image, cv::Mat& features);
//! EasyPR的getFeatures回调函数
//! 本函数是生成直方图均衡特征的回调函数
void getHisteqFeatures(const cv::Mat& image, cv::Mat& features);
//! EasyPR的getFeatures回调函数
//! 本函数是获取垂直和水平的直方图图值
void getHistogramFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取SIFT特征子
void getSIFTFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取HOG特征子
void getHOGFeatures(const cv::Mat& image, cv::Mat& features);
//! 本函数是获取HSV空间量化的直方图特征子
void getHSVHistFeatures(const cv::Mat& image, cv::Mat& features);
} /*! \namespace easypr*/
#endif
/* endif __FEATURE_H__ */

@ -1,65 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// Name: plate_judge Header
// Version: 1.1
// Date: 2014-09-28
// MDate: 2015-01-28
// Author: liuruoze
// Copyright: liuruoze
// Reference: Mastering OpenCV with Practical Computer Vision Projects
// Reference: CSDN Bloger taotao1233
// Desciption:
// Defines CPlateLocate
//////////////////////////////////////////////////////////////////////////
#ifndef __PLATE_JUDGE_H__
#define __PLATE_JUDGE_H__
#include "easypr/plate.h"
#include "easypr/feature.h"
#include "easypr/core_func.h"
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
class CPlateJudge {
public:
CPlateJudge();
//! 对多幅车牌进行SVM判断
int plateJudge(const vector<CPlate>&, vector<CPlate>&);
//! 车牌判断
int plateJudge(const vector<Mat>&, vector<Mat>&);
//! 车牌判断(一副图像)
int plateJudge(const Mat& inMat, int& result);
//! 直方图均衡
Mat histeq(Mat);
//! 装载SVM模型
void LoadModel();
//! 装载SVM模型
void LoadModel(string s);
//! 设置与读取模型路径
inline void setModelPath(string path) { m_path = path; }
inline string getModelPath() const { return m_path; }
private:
//! 使用的SVM模型
CvSVM svm;
//! EasyPR的getFeatures回调函数
//! 用于从车牌的image生成svm的训练特征features
svmCallback m_getFeatures;
//! 模型存储路径
string m_path;
};
} /*! \namespace easypr*/
#endif /* endif __PLATE_JUDGE_H__ */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save