Skip to content

Commit e8c6a09

Browse files
committed
new algo for plate detection
1 parent 25530b6 commit e8c6a09

File tree

501 files changed

+16892
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

501 files changed

+16892
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.dll filter=lfs diff=lfs merge=lfs -text
2+
build/Release/*.dll filter=lfs diff=lfs merge=lfs -text

.gitignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
build/*.vcxproj
2+
**/*.user
3+
**/*.pdb
4+
**/*.ilk
5+
**/*.exp
6+
**/cmake_install
7+
**/CMakeCache
8+
/build/CMakeFiles
9+
/build/LPReditor_ANPR_Lib.dir
10+
**/*.so
11+
**/*.sln
12+
**/*.filters
13+
#data/images/benchmarks-master/endtoend/plate_us/
14+
data/images/benchmarks-master/**/**/*.txt
15+
sample_cpp/build
16+
/python
17+
.git
18+
**/x64
19+
**/*.dir
20+
**/*.cmake
21+
**/.vs
22+
**/CMakeFiles
23+
sample_cpp/build
24+
#**/opencv*
25+
#**/cuda*
26+
#**/cudnn*
27+
#/build/**/opencv*.dll
28+
#**/onnxruntime.dll
29+
/build/Debug
30+
#/build/
31+
32+

CMakeLists.txt

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
2+
cmake_minimum_required(VERSION 3.5.1)
3+
PROJECT(LPReditor_ANPR_Lib)
4+
5+
if(MSVC)
6+
add_compile_options("/bigobj")
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
8+
endif(MSVC)
9+
10+
set(CMAKE_CXX_STANDARD 17)
11+
#************************
12+
#OPENCV
13+
#************************
14+
if (MSVC)
15+
#if necessary change the path ../opencv-master/build/ to the path where you build opencv
16+
find_path(OPENCV4_ROOT OpenCV.sln ../opencv-master/build/)
17+
set(OpenCV_DIR OPENCV4_ROOT)
18+
if(NOT OpenCV_FOUND)
19+
find_path(OpenCV_DIR OpenCV.sln ../opencv-master/build/)
20+
endif(NOT OpenCV_FOUND)
21+
else (MSVC)
22+
endif (MSVC)
23+
#if necessary change the path ../opencv-master/build/ to the path where you build opencv
24+
FIND_PACKAGE( OpenCV REQUIRED PATHS "../opencv-master/build/")
25+
set(OpenCV_DIR ../opencv-master/build)
26+
message(STATUS "OpenCV library status:")
27+
message(STATUS " config: ${OpenCV_DIR}")
28+
message(STATUS " version: ${OpenCV_VERSION}")
29+
message(STATUS " libraries: ${OpenCV_LIBS}")
30+
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
31+
#************************
32+
#EXECUTABLE
33+
#************************
34+
find_path(LPReditor_ANPR_Lib_ROOT Open_LPReditor_Lib.cpp ../LPReditor_ANPR_Lib/ )
35+
find_path(LPReditor_ANPR_Lib_INC utils_anpr_detect.h ${LPReditor_ANPR_Lib_ROOT}/include/ )
36+
find_path(LPReditor_ANPR_Lib_SOURCE utils_anpr_detect.cpp ${LPReditor_ANPR_Lib_ROOT}/src/ )
37+
FILE(GLOB LPReditor_ANPR_LibSources ${LPReditor_ANPR_Lib_ROOT}/*.cpp ${LPReditor_ANPR_Lib_ROOT}/*.h ${LPReditor_ANPR_Lib_SOURCE}/*.cpp ${LPReditor_ANPR_Lib_INC}/*.h )
38+
# Create a target for the library
39+
ADD_LIBRARY( ${CMAKE_PROJECT_NAME} SHARED ${LPReditor_ANPR_LibSources} )
40+
#************************
41+
#INC DIRS
42+
#************************
43+
include_directories(${LPReditor_ANPR_Lib_INC})
44+
#************************
45+
#PREPROCESSOR
46+
#************************
47+
add_definitions(
48+
-DLPREDITOR_EXPORTS
49+
-DLPREDITOR_DEMO_NO_ARGS
50+
#-DLPR_EDITOR_USE_CUDA
51+
)
52+
53+
SET_TARGET_PROPERTIES (${CMAKE_PROJECT_NAME} PROPERTIES DEFINE_SYMBOL "COMPILING_DLL" )
54+
#************************
55+
#LINKING
56+
#************************
57+
if(MSVC)
58+
foreach(flag_var
59+
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
60+
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
61+
if(${flag_var} MATCHES "/MT")
62+
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
63+
endif(${flag_var} MATCHES "/MT")
64+
endforeach(flag_var)
65+
endif(MSVC)
66+
target_link_libraries(${CMAKE_PROJECT_NAME} ${OpenCV_LIBS})
67+
set(USE_GPU true CACHE BOOL "whether to use gpu")
68+
if(USE_GPU)
69+
add_definitions(-DLPR_EDITOR_USE_CUDA)
70+
endif(USE_GPU)
71+
#************************
72+
##onnxruntime
73+
#************************
74+
if (MSVC)
75+
if(USE_GPU)
76+
77+
#if necessary, in the lines below, change ../onnxruntime-win-gpu-x64-1.8.1/ to point to the actual path of the onnxruntime-win-gpu-x64-1.8.1 directory
78+
find_library(onnxruntime-win-gpu-x64_RELEASE
79+
NAMES onnxruntime
80+
PATHS
81+
../onnxruntime-win-gpu-x64-1.8.1/lib
82+
)
83+
SET(onnxruntime-win-gpu-x64_LIBRARY
84+
debug ${onnxruntime-win-gpu-x64_RELEASE}
85+
optimized ${onnxruntime-win-gpu-x64_RELEASE})
86+
find_path(onnxruntime-win-gpu-x64_LIB_PATH onnxruntime.lib ../onnxruntime-win-gpu-x64-1.8.1/lib)
87+
find_path(onnxruntime-win-gpu-x64_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-win-gpu-x64-1.8.1/include)
88+
MESSAGE( STATUS )
89+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
90+
MESSAGE( STATUS "onnxruntime-win-gpu-x64_LIBRARY =${onnxruntime-win-gpu-x64_LIBRARY}" )
91+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
92+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
93+
MESSAGE( STATUS "onnxruntime-win-gpu-x64_INCLUDE =${onnxruntime-win-gpu-x64_INCLUDE}" )
94+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
95+
MESSAGE( STATUS )
96+
include_directories(${onnxruntime-win-gpu-x64_INCLUDE})
97+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-win-gpu-x64_LIBRARY})
98+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-win-gpu-x64_LIB_PATH}/*.dll")
99+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-win-gpu-x64_LIB_PATH}/*.lib")
100+
else (USE_GPU)
101+
find_library(onnxruntime-win-x64_RELEASE
102+
NAMES onnxruntime
103+
PATHS
104+
../onnxruntime-win-x64-1.8.1/lib
105+
)
106+
SET(onnxruntime-win-x64_LIBRARY
107+
debug ${onnxruntime-win-x64_RELEASE}
108+
optimized ${onnxruntime-win-x64_RELEASE})
109+
find_path(onnxruntime-win-x64_LIB_PATH onnxruntime.lib ../onnxruntime-win-x64-1.8.1/lib)
110+
find_path(onnxruntime-win-x64_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-win-x64-1.8.1/include)
111+
MESSAGE( STATUS )
112+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
113+
MESSAGE( STATUS "onnxruntime-win-x64_INCLUDE =${onnxruntime-win-x64_INCLUDE}" )
114+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
115+
MESSAGE( STATUS )
116+
include_directories(${onnxruntime-win-x64_INCLUDE})
117+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-win-x64_LIBRARY})
118+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-win-x64_LIB_PATH}/*.dll")
119+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-win-x64_LIB_PATH}/*.lib")
120+
endif(USE_GPU)
121+
else (MSVC)
122+
123+
124+
if(USE_GPU)
125+
#if necessary, in the lines below, change ../onnxruntime-linux-x64-gpu-1.8.1/ to point to the actual path of the onnxruntime-linux-x64-gpu-1.8.1 directory
126+
find_library(onnxruntime-linux-x64-gpu_RELEASE
127+
NAMES libonnxruntime.so
128+
PATHS
129+
../onnxruntime-linux-x64-gpu-1.8.1/lib
130+
)
131+
SET(onnxruntime-linux-x64-gpu_LIBRARY
132+
debug ${onnxruntime-linux-x64-gpu_RELEASE}
133+
optimized ${onnxruntime-linux-x64-gpu_RELEASE})
134+
find_path(onnxruntime-linux-x64-gpu_LIB_PATH libonnxruntime.so ../onnxruntime-linux-x64-gpu-1.8.1/lib)
135+
find_path(onnxruntime-linux-x64-gpu_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-linux-x64-gpu-1.8.1/include)
136+
MESSAGE( STATUS )
137+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
138+
MESSAGE( STATUS "onnxruntime-linux-x64-gpu_LIBRARY =${onnxruntime-linux-x64-gpu_LIBRARY}" )
139+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
140+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
141+
MESSAGE( STATUS "onnxruntime-linux-x64-gpu_INCLUDE =${onnxruntime-linux-x64-gpu_INCLUDE}" )
142+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
143+
MESSAGE( STATUS )
144+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-linux-x64-gpu_LIB_PATH}/*.so")
145+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-linux-x64-gpu_LIB_PATH}/*.so")
146+
include_directories(${onnxruntime-linux-x64-gpu_INCLUDE})
147+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-linux-x64-gpu_LIBRARY})
148+
else (USE_GPU)
149+
find_library(onnxruntime-linux-x64_RELEASE
150+
NAMES libonnxruntime.so
151+
PATHS
152+
../onnxruntime-linux-x64-1.8.1/lib
153+
)
154+
SET(onnxruntime-linux-x64_LIBRARY
155+
debug ${onnxruntime-linux-x64_RELEASE}
156+
optimized ${onnxruntime-linux-x64_RELEASE})
157+
find_path(onnxruntime-linux-x64_LIB_PATH libonnxruntime.so ../onnxruntime-linux-x64-1.8.1/lib)
158+
find_path(onnxruntime-linux-x64_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-linux-x64-1.8.1/include)
159+
MESSAGE( STATUS )
160+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
161+
MESSAGE( STATUS "onnxruntime-linux-x64_LIBRARY =${onnxruntime-linux-x64_LIBRARY}" )
162+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
163+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
164+
MESSAGE( STATUS "onnxruntime-linux-x64_INCLUDE =${onnxruntime-linux-x64_INCLUDE}" )
165+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
166+
MESSAGE( STATUS )
167+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-linux-x64_LIB_PATH}/*.so")
168+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-linux-x64_LIB_PATH}/*.so")
169+
include_directories(${onnxruntime-linux-x64_INCLUDE})
170+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-linux-x64_LIBRARY})
171+
endif(USE_GPU)
172+
endif (MSVC)
173+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
174+
MESSAGE( STATUS "ONNXRUNTIME_DLLS =${ONNXRUNTIME_DLLS}" )
175+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
176+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
177+
MESSAGE( STATUS "ONNXRUNTIME_LIBS =${ONNXRUNTIME_LIBS}" )
178+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
179+
MESSAGE( STATUS )
180+
181+
#************************
182+
#CUSTOM POST BUILD COMMAND
183+
#************************
184+
if(MSVC)
185+
file(GLOB OPENCV_FOR_LPREDITOR_DLLS_DEBUG "${OpenCV_DIR}/bin/Debug/opencv_dnn*d.dll"
186+
#"${OpenCV_DIR}/bin/Debug/opencv_highgui*d.dll"
187+
#"${OpenCV_DIR}/bin/Debug/opencv_videoio*d.dll"
188+
"${OpenCV_DIR}/bin/Debug/opencv_imgcodecs*d.dll"
189+
"${OpenCV_DIR}/bin/Debug/opencv_imgproc*d.dll"
190+
"${OpenCV_DIR}/bin/Debug/opencv_core*d.dll"
191+
"${OpenCV_DIR}/bin/Debug/opencv_features2d*d.dll"
192+
"${OpenCV_DIR}/bin/Debug/opencv_flann*d.dll"
193+
)
194+
file(GLOB OPENCV_FOR_LPREDITOR_DLLS_RELEASE "${OpenCV_DIR}/bin/Release/opencv_dnn*.dll"
195+
#"${OpenCV_DIR}/bin/Release/opencv_highgui*.dll"
196+
#"${OpenCV_DIR}/bin/Release/opencv_videoio*.dll"
197+
"${OpenCV_DIR}/bin/Release/opencv_imgcodecs*.dll"
198+
"${OpenCV_DIR}/bin/Release/opencv_imgproc*.dll"
199+
"${OpenCV_DIR}/bin/Release/opencv_core*.dll"
200+
"${OpenCV_DIR}/bin/Release/opencv_features2d*.dll"
201+
"${OpenCV_DIR}/bin/Release/opencv_flann*.dll"
202+
)
203+
SET(OPENCV_FOR_LPREDITOR_DLLS debug ${OPENCV_FOR_LPREDITOR_DLLS_DEBUG} optimized ${OPENCV_FOR_LPREDITOR_DLLS_RELEASE})
204+
205+
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}
206+
POST_BUILD
207+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
208+
${ONNXRUNTIME_DLLS} ${ONNXRUNTIME_LIBS}
209+
${OPENCV_FOR_LPREDITOR_DLLS_RELEASE}
210+
${OPENCV_FOR_LPREDITOR_DLLS_DEBUG}
211+
$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
212+
else (MSVC)
213+
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}
214+
POST_BUILD
215+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
216+
${ONNXRUNTIME_DLLS} ${ONNXRUNTIME_LIBS}
217+
$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
218+
endif(MSVC)
219+

0 commit comments

Comments
 (0)