Skip to content

Commit 9aa1562

Browse files
Text recognition crnn (#176)
* rcnn only for EN * review 1 * add readme.md * rename file * review 2 * review 3 * option v * review 4
1 parent 0d61961 commit 9aa1562

File tree

4 files changed

+4440
-2
lines changed

4 files changed

+4440
-2
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.24)
2+
set(project_name "opencv_zoo_text_recognition_crnn")
3+
4+
PROJECT (${project_name})
5+
6+
set(OPENCV_VERSION "4.7.0")
7+
set(OPENCV_INSTALLATION_PATH "" CACHE PATH "Where to look for OpenCV installation")
8+
find_package(OpenCV ${OPENCV_VERSION} REQUIRED HINTS ${OPENCV_INSTALLATION_PATH})
9+
# Find OpenCV, you may need to set OpenCV_DIR variable
10+
# to the absolute path to the directory containing OpenCVConfig.cmake file
11+
# via the command line or GUI
12+
13+
file(GLOB SourceFile
14+
"demo.cpp")
15+
# If the package has been found, several variables will
16+
# be set, you can find the full list with descriptions
17+
# in the OpenCVConfig.cmake file.
18+
# Print some message showing some of them
19+
message(STATUS "OpenCV library status:")
20+
message(STATUS " config: ${OpenCV_DIR}")
21+
message(STATUS " version: ${OpenCV_VERSION}")
22+
message(STATUS " libraries: ${OpenCV_LIBS}")
23+
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
24+
25+
# Declare the executable target built from your sources
26+
add_executable(${project_name} ${SourceFile})
27+
28+
# Link your application with OpenCV libraries
29+
target_link_libraries(${project_name} PRIVATE ${OpenCV_LIBS})

models/text_recognition_crnn/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Note:
3636
- Try `text_recognition_CRNN_CH_2021sep.onnx` with `charset_94_CH.txt`
3737
- Try `text_recognition_CRNN_CN_2021sep.onnx` with `charset_3944_CN.txt`.
3838

39+
### Python
40+
3941
Run the demo detecting English:
4042

4143
```shell
@@ -52,13 +54,38 @@ Run the demo detecting Chinese:
5254

5355
```shell
5456
# detect on camera input
55-
python demo.py --model text_recognition_CRNN_CN_2021nov.onnx --charset charset_3944_CN.txt
57+
python demo.py --model text_recognition_CRNN_CN_2021nov.onnx
5658
# detect on an image
57-
python demo.py --input /path/to/image --model text_recognition_CRNN_CN_2021nov.onnx --charset charset_3944_CN.txt
59+
python demo.py --input /path/to/image --model text_recognition_CRNN_CN_2021nov.onnx
5860

5961
# get help regarding various parameters
6062
python demo.py --help
6163
```
64+
### C++
65+
66+
Install latest OpenCV and CMake >= 3.24.0 to get started with:
67+
68+
```shell
69+
# detect on camera input
70+
./build/opencv_zoo_text_recognition_crnn
71+
# detect on an image
72+
./build/opencv_zoo_text_recognition_crnn --input /path/to/image -v
73+
74+
# get help regarding various parameters
75+
./build/opencv_zoo_text_recognition_crnn --help
76+
```
77+
78+
Run the demo detecting Chinese:
79+
80+
```shell
81+
# detect on camera input
82+
./build/opencv_zoo_text_recognition_crnn --model=text_recognition_CRNN_CN_2021nov.onnx --charset=charset_3944_CN.txt
83+
# detect on an image
84+
./build/opencv_zoo_text_recognition_crnn --input=/path/to/image --model=text_recognition_CRNN_CN_2021nov.onnx --charset=charset_3944_CN.txt
85+
86+
# get help regarding various parameters
87+
./build/opencv_zoo_text_recognition_crnn --help
88+
6289

6390
### Examples
6491

0 commit comments

Comments
 (0)