commit
7f99931019
@ -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,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
|
||||
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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…
Reference in new issue