Merge branch 'master-gbk'

# Conflicts:
#	include/easypr/chars_identify.h
#	include/easypr/core/chars_recognise.h
#	include/easypr/core/chars_segment.h
#	include/easypr/core/plate_recognize.h
#	include/easypr/plate_judge.h
#	src/core/chars_identify.cpp
#	src/core/chars_recognise.cpp
#	src/core/chars_segment.cpp
#	src/core/plate_judge.cpp
#	src/train/ann_train.cpp
#	src/util/program_options.cpp
#	test/accuracy.hpp
#	test/chars.hpp
#	test/main.cpp
v1.6alpha
Micooz 10 years ago
commit 7c3439db97

222
.gitignore vendored

@ -1,217 +1,11 @@
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
.idea/
_build/
resources/image/tmp/
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.sdf
*.opensdf
*.exe
*.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/
*.ilk
demo

@ -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)
@ -41,6 +43,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,23 @@ EasyPR是一个中文的开源车牌识别系统其目标是成为一个简
### 更新
本次更新是1.3 测试版,主要改进在于几个方面:
本次更新是1.3 正式版,主要改进在于几个方面:
1.增加了50张左右的新图片。见下图
1.相对原先的1.2版本,在完整识别率上有所提升
![新图片](resources/doc/res/new50.jpg)
![效果比较](resources/doc/res/13ver.jpg)
2.增加了extreme_test文件夹这里的图片以极端难处理情况为主。见下图
2.增加了30张左右的新图片目前的测试图片数达到了204张。
![extreme_test](resources/doc/res/extreme_test.jpg)
3.对“字符分割”类的代码做了改善。
3.重构了整体架构将EasyPR核心以静态库的方式编译分离出通用接口等等。此部分改善由Micooz贡献。见下图
在1.4版本中计划做以下几点改善
![架构重构](resources/doc/res/arch.jpg)
1.开放ANN训练功能。
4.代码优化,提高易懂与可读性
2.新的评价框架,更加合理的评估数据
下个版本会正式发布1.3 正式版
3.新的车牌定位算法
### 跨平台
@ -123,7 +123,11 @@ EasyPR的resources/image/general_test文件夹下的图片数据遵循[GDSL协
### 使用
EasyPR的所有源代码可在Github上的[项目主页](https://github.com/liuruoze/EasyPR)直接打包下载得到如果你熟悉git版本控制工具可以使用下面的命令来克隆代码
EasyPR的所有源代码可在Github上的[项目主页](https://github.com/liuruoze/EasyPR)直接打包下载得到。
由于Github在中国有时下载速度较慢可以使用oschina的镜像[地址](http://git.oschina.net/easypr/EasyPR)来下载。
如果你熟悉git版本控制工具可以使用下面的命令来从Github里克隆代码
```
$ git clone https://github.com/liuruoze/EasyPR
@ -133,9 +137,13 @@ EasyPR支持当前主流的操作系统通常不需要对源代码进行更
**Note**: 无论在哪个平台使用EasyPR都要安装对应平台版本的[opencv](http://opencv.org/),建议使用正式稳定版本。
windows平台下的opencv的配置可以参考这份[博客](http://my.phirobot.com/blog/2014-02-opencv_configuration_in_vs.html)。
#### Windows
Windows下的配置以Visual Studio 2013为例其他版本大同小异。
Windows下的配置建议使用最新的Visual Studio 2013版本。
目前2010与2012下会存在编译问题这是由于老版本对C++ 11特性支持的不足导致的。
* 打开项目目录下的解决方案文件`EasyPR.sln`。
@ -219,7 +227,7 @@ $ ./easypr_test svm --train --has-plate=has/ --no-plate=no/ --divide --svm=save/
* liuruoze1.0-1.2版作者1.3版整合工作
* 海豚嘎嘎1.3版算法贡献者,提升了车牌定位与字符识别的准确率
* 海豚嘎嘎(车主之家)1.3版算法贡献者,提升了车牌定位与字符识别的准确率
* Micooz1.3版架构改善与重构linux与mac的跨平台编译等
@ -235,4 +243,4 @@ $ ./easypr_test svm --train --has-plate=has/ --no-plate=no/ --divide --svm=save/
taotao1233邱锦山唐大侠jsxyhelu如果有一天(zhoushiwei),学习奋斗,袁承志,
圣城小石匠goldriverMicooz梦里时光Rain Wang任薛纪ahccom星夜落尘海豚嘎嘎
圣城小石匠goldriverMicooz梦里时光Rain Wang任薛纪ahccom星夜落尘海豚嘎嘎(车主之家)刘超以及所有对EasyPR贡献数据的热心同学。

@ -1113,3 +1113,79 @@
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:198秒, 平均执行时间:1.14451秒
2015-07-20 22:41:20
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:126秒, 平均执行时间:0.728324秒
2015-07-21 20:02:05
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:127秒, 平均执行时间:0.734104秒
2015-07-22 21:12:50
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:124秒, 平均执行时间:0.716763秒
2015-07-22 21:17:03
总图片数:173张, 未识出图片:6张, 定位率:96.5318%
平均字符差距:0.628743个, 完全匹配数:124张, 完全匹配率:74.2515%
总时间:102秒, 平均执行时间:0.589595秒
2015-07-22 21:20:02
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:125秒, 平均执行时间:0.722543秒
2015-07-22 21:27:11
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:129秒, 平均执行时间:0.745665秒
2015-07-22 21:32:24
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:126秒, 平均执行时间:0.728324秒
2015-07-22 21:35:43
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:126秒, 平均执行时间:0.728324秒
2015-07-29 07:50:04
总图片数:173张, 未识出图片:5张, 定位率:97.1098%
平均字符差距:0.458333个, 完全匹配数:130张, 完全匹配率:77.381%
总时间:123秒, 平均执行时间:0.710983秒
2015-07-29 08:04:44
总图片数:56张, 未识出图片:15张, 定位率:73.2143%
平均字符差距:1.92683个, 完全匹配数:16张, 完全匹配率:39.0244%
总时间:143秒, 平均执行时间:2.55357秒
2015-07-29 08:25:03
总图片数:56张, 未识出图片:15张, 定位率:73.2143%
平均字符差距:1.78049个, 完全匹配数:16张, 完全匹配率:39.0244%
总时间:119秒, 平均执行时间:2.125秒
2015-07-29 08:33:29
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.520202个, 完全匹配数:145张, 完全匹配率:73.2323%
总时间:184秒, 平均执行时间:0.901961秒
2015-07-29 08:44:36
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.520202个, 完全匹配数:145张, 完全匹配率:73.2323%
总时间:182秒, 平均执行时间:0.892157秒
2015-07-29 18:44:33
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.520202个, 完全匹配数:145张, 完全匹配率:73.2323%
总时间:174秒, 平均执行时间:0.852941秒
2015-07-29 18:51:04
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.535354个, 完全匹配数:146张, 完全匹配率:73.7374%
总时间:179秒, 平均执行时间:0.877451秒
2015-07-29 19:24:38
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.520202个, 完全匹配数:145张, 完全匹配率:73.2323%
总时间:159秒, 平均执行时间:0.779412秒
2015-07-29 19:32:48
总图片数:204张, 未识出图片:7张, 定位率:96.5686%
平均字符差距:0.664975个, 完全匹配数:141张, 完全匹配率:71.5736%
总时间:135秒, 平均执行时间:0.661765秒
2015-07-29 20:17:27
总图片数:204张, 未识出图片:6张, 定位率:97.0588%
平均字符差距:0.520202个, 完全匹配数:145张, 完全匹配率:73.2323%
总时间:176秒, 平均执行时间:0.862745秒
2015-08-05 14:09:17
总图片数:204张, 未识出图片:5张, 定位率:97.549%
平均字符差距:0.567839个, 完全匹配数:148张, 完全匹配率:74.3719%
总时间:230秒, 平均执行时间:1.12745秒

@ -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,162 @@
# -*- 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)
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,14 @@
#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"
#endif //EASYPR_EASYPR_H

@ -17,11 +17,8 @@ static bool plate_judge(const char* image,const char *model) {
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);

@ -0,0 +1,62 @@
#ifndef EASYPR_TRAIN_TRAIN_H_
#define EASYPR_TRAIN_TRAIN_H_
namespace easypr {
static const char* kDefaultSvmPath = "resources/model/svm.xml";
static const char* kDefaultAnnPath = "resources/model/ann.xml";
static const int kPredictSize = 10;
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 debug = false;
}
#endif // EASYPR_TRAIN_TRAIN_H_

@ -0,0 +1,24 @@
#ifndef __CHARS_IDENTIFY_H__
#define __CHARS_IDENTIFY_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_;
//使用的ANN模型
cv::Ptr<cv::ml::ANN_MLP> ann_;
};
}
#endif

@ -12,42 +12,29 @@
#ifndef __CHARS_RECOGNISE_H__
#define __CHARS_RECOGNISE_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 {
public:
CCharsRecognise();
//! 字符分割与识别
int charsRecognise(Mat, String&);
~CCharsRecognise();
string charsRecognise(Mat plate);
std::string charsRecognise(cv::Mat plate);
//! 装载ANN模型
void LoadANN(string s);
//! 是否开启调试模式
inline void setCRDebug(int param) { m_charsSegment->setDebug(param); }
//! 获取调试模式状态
inline int getCRDebug() { return m_charsSegment->getDebug(); }
//! 获得车牌颜色
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 = "黄牌";
if (BLUE == result) color = "蓝牌";
if (YELLOW == result) color = "黄牌";
return color;
}
//! 设置变量
//! 设置变量
inline void setLiuDingSize(int param) {
m_charsSegment->setLiuDingSize(param);
}
@ -68,11 +55,8 @@ class CCharsRecognise {
}
private:
//!字符分割
//!字符分割
CCharsSegment* m_charsSegment;
//! 字符识别
CCharsIdentify* m_charsIdentify;
};
} /* \namespace easypr */

@ -23,31 +23,31 @@ class CCharsSegment {
public:
CCharsSegment();
//! 字符分割
int charsSegment(Mat, vector<Mat>&);
//! 字符分割
int charsSegment(Mat, std::vector<Mat>&);
//! 字符尺寸验证
//! 字符尺寸验证
bool verifyCharSizes(Mat r);
//! 字符预处理
//! 字符预处理
Mat preprocessChar(Mat in);
//! 根据特殊车牌来构造猜测中文字符的位置和大小
//! 根据特殊车牌来构造猜测中文字符的位置和大小
Rect GetChineseRect(const Rect rectSpe);
//! 找出指示城市的字符的Rect例如苏A7003X就是A的位置
int GetSpecificRect(const vector<Rect>& vecRect);
//! 找出指示城市的字符的Rect例如苏A7003X就是A的位置
int GetSpecificRect(const std::vector<Rect>& vecRect);
//! 这个函数做两个事情
// 1.把特殊字符Rect左边的全部Rect去掉后面再重建中文字符的位置。
// 2.从特殊字符Rect开始依次选择6个Rect多余的舍去。
int RebuildRect(const vector<Rect>& vecRect, vector<Rect>& outRect,
//! 这个函数做两个事情
// 1.把特殊字符Rect左边的全部Rect去掉后面再重建中文字符的位置。
// 2.从特殊字符Rect开始依次选择6个Rect多余的舍去。
int RebuildRect(const std::vector<Rect>& vecRect, std::vector<Rect>& outRect,
int specIndex);
//! 将Rect按位置从左到右进行排序
int SortRect(const vector<Rect>& vecRect, vector<Rect>& out);
//! 将Rect按位置从左到右进行排序
int SortRect(const std::vector<Rect>& vecRect, std::vector<Rect>& out);
//! 设置变量
//! 设置变量
inline void setLiuDingSize(int param) { m_LiuDingSize = param; }
inline void setColorThreshold(int param) { m_ColorThreshold = param; }
@ -56,38 +56,38 @@ class CCharsSegment {
inline void setWhitePercent(float param) { m_WhitePercent = param; }
inline float getWhitePercent() const { return m_WhitePercent; }
//! 是否开启调试模式常量默认0代表关闭
//! 是否开启调试模式常量默认0代表关闭
static const int DEFAULT_DEBUG = 1;
//! preprocessChar所用常量
//! preprocessChar所用常量
static const int CHAR_SIZE = 20;
static const int HORIZONTAL = 1;
static const int VERTICAL = 0;
//! preprocessChar所用常量
//! preprocessChar所用常量
static const int DEFAULT_LIUDING_SIZE = 7;
static const int DEFAULT_MAT_WIDTH = 136;
static const int DEFAULT_COLORTHRESHOLD = 150;
//! 是否开启调试模式
//! 是否开启调试模式
inline void setDebug(int param) { m_debug = param; }
//! 获取调试模式状态
//! 获取调试模式状态
inline int getDebug() { return m_debug; }
private:
//!柳钉判断参数
//!柳钉判断参数
int m_LiuDingSize;
//!车牌大小参数
//!车牌大小参数
int m_theMatWidth;
//!车牌颜色判断参数
//!车牌颜色判断参数
int m_ColorThreshold;
float m_BluePercent;
float m_WhitePercent;
//! 是否开启调试模式0关闭非0开启
//! 是否开启调试模式0关闭非0开启
int m_debug;
};

@ -13,8 +13,8 @@
#ifndef __PLATE_DETECT_H__
#define __PLATE_DETECT_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
@ -25,15 +25,17 @@ class CPlateDetect {
public:
CPlateDetect();
~CPlateDetect();
//! 深度车牌检测使用颜色与二次Sobel法综合
int plateDetect(Mat src, vector<CPlate>& resultVec,
bool showDetectArea = true, int index = 0);
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); }
@ -93,9 +95,6 @@ class CPlateDetect {
//! 车牌定位
CPlateLocate* m_plateLocate;
//! ³µÅÆÅжÏ
CPlateJudge* m_plateJudge;
};
} /*! \namespace easypr*/

@ -0,0 +1,37 @@
#ifndef __PLATE_JUDGE_H__
#define __PLATE_JUDGE_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);
//! 直方图均衡
Mat histeq(Mat);
private:
PlateJudge();
static PlateJudge* instance_;
cv::Ptr<ml::SVM> svm_;
};
}
#endif

@ -14,8 +14,8 @@
#ifndef __PLATE_LOCATE_H__
#define __PLATE_LOCATE_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);

@ -12,8 +12,8 @@
#ifndef __PLATE_RECOGNIZE_H__
#define __PLATE_RECOGNIZE_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
@ -24,17 +24,15 @@ class CPlateRecognize : public CPlateDetect, public CCharsRecognise {
public:
CPlateRecognize();
//! 车牌检测与字符识别
int plateRecognize(cv::Mat src, std::vector<std::string>& licenseVec,
int index = 0);
//! 车牌检测与字符识别
int plateRecognize(cv::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);
}
};

@ -1,46 +0,0 @@
#ifndef EASYPR_SVM_TRAIN_H
#define EASYPR_SVM_TRAIN_H
#include <vector>
#include <opencv2/opencv.hpp>
namespace easypr {
class Svm {
public:
typedef enum {
kForward = 1, // correspond to "has plate"
kInverse = 0 // correspond to "no plate"
} Label;
Svm(const char* forward_data_folder, const char* inverse_data_folder);
void train(bool divide = true, float divide_percentage = 0.7,
bool train = true, const char* out_svm_folder = NULL);
private:
/*
* divide images into train part and test part by percentage
*/
void divide(const char* images_folder, float percentage = 0.7);
void get_train();
void get_test();
const char* forward_;
const char* inverse_;
// these two variables are used for cv::CvSVM::train_auto()
cv::Mat classes_;
cv::Mat trainingData_;
// these two variables are used for cv::CvSVM::predict()
std::vector<cv::Mat> test_imgaes_;
std::vector<Label> test_labels_;
};
}
#endif //EASYPR_SVM_TRAIN_H

@ -0,0 +1,26 @@
#ifndef EASYPR_TRAIN_ANNTRAIN_H_
#define EASYPR_TRAIN_ANNTRAIN_H_
#include <opencv2/opencv.hpp>
namespace easypr{
class AnnTrain{
public:
explicit AnnTrain(const char* chars_folder, const char* xml);
void train(const int & neurons = 40);
void test();
private:
cv::Ptr<cv::ml::TrainData> train_data();
cv::Ptr<cv::ml::ANN_MLP> ann_;
const char* ann_xml_;
const char* chars_folder_;
};
}
#endif // EASYPR_TRAIN_ANNTRAIN_H_

@ -0,0 +1,48 @@
#ifndef EASYPR_SVM_TRAIN_H
#define EASYPR_SVM_TRAIN_H
#include <vector>
#include <opencv2/opencv.hpp>
#include "easypr/config.h"
namespace easypr {
class SvmTrain {
public:
typedef enum {
kForward = 1, // correspond to "has plate"
kInverse = 0 // correspond to "no plate"
} Label;
SvmTrain(const char* forward_data_folder, const char* inverse_data_folder);
void train(bool divide = true, float divide_percentage = 0.7,
const char* out_svm_folder = kDefaultSvmPath);
void runTest(const char* svm_path = kDefaultSvmPath);
private:
/*
* divide images into train part and test part by percentage
*/
void divide(const char* images_folder, float percentage = 0.7);
void getTrain();
void getTest();
const char* forward_;
const char* inverse_;
// these two variables are used for cv::CvSVM::train_auto()
cv::Mat classes_;
cv::Ptr<cv::ml::TrainData> trainingData_;
// these two variables are used for cv::CvSVM::predict()
std::vector<cv::Mat> test_imgaes_;
std::vector<Label> test_labels_;
};
}
#endif //EASYPR_SVM_TRAIN_H

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

Loading…
Cancel
Save