# 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.cppv1.6alpha
commit
7c3439db97
@ -1,217 +1,11 @@
|
|||||||
|
.idea/
|
||||||
#ignore thumbnails created by windows
|
_build/
|
||||||
Thumbs.db
|
resources/image/tmp/
|
||||||
#Ignore files build by Visual Studio
|
|
||||||
*.obj
|
|
||||||
*.exe
|
|
||||||
*.pdb
|
|
||||||
*.user
|
|
||||||
*.aps
|
|
||||||
*.pch
|
|
||||||
*.vspscc
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*.ncb
|
|
||||||
*.suo
|
*.suo
|
||||||
*.tlb
|
*.sdf
|
||||||
*.tlh
|
*.opensdf
|
||||||
*.bak
|
*.exe
|
||||||
*.cache
|
|
||||||
*.ilk
|
|
||||||
*.log
|
|
||||||
[Bb]in
|
|
||||||
[Dd]ebug*/
|
|
||||||
*.lib
|
*.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
|
*.pdb
|
||||||
*.pgc
|
*.ilk
|
||||||
*.pgd
|
demo
|
||||||
*.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/
|
|
@ -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>
|
|
@ -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
|
#ifndef EASYPR_EASYPR_H
|
||||||
#define EASYPR_EASYPR_H
|
#define EASYPR_EASYPR_H
|
||||||
|
|
||||||
#include "easypr/plate_recognize.h"
|
#include "easypr/core/plate_recognize.h"
|
||||||
#include "easypr/svm_train.h"
|
#include "easypr/train/svm_train.h"
|
||||||
|
#include "easypr/train/ann_train.h"
|
||||||
#include "easypr/preprocess/mc_data.h"
|
#include "easypr/preprocess/mc_data.h"
|
||||||
#include "easypr/preprocess/gdts.h"
|
#include "easypr/preprocess/gdts.h"
|
||||||
#include "easypr/preprocess/deface.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/api.hpp"
|
||||||
|
|
||||||
#endif //EASYPR_EASYPR_H
|
#endif //EASYPR_EASYPR_H
|
||||||
|
@ -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,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
|
@ -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…
Reference in new issue