Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
0be529da
Commit
0be529da
authored
Aug 21, 2015
by
Lluis Gomez-Bigorda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds demo program of Scene Text Character Recognition using the CNN classifier.
parent
6e4d6bca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
character_recognition.cpp
modules/text/samples/character_recognition.cpp
+55
-0
scenetext_char01.jpg
modules/text/samples/scenetext_char01.jpg
+0
-0
scenetext_char02.jpg
modules/text/samples/scenetext_char02.jpg
+0
-0
scenetext_char03.jpg
modules/text/samples/scenetext_char03.jpg
+0
-0
No files found.
modules/text/samples/character_recognition.cpp
0 → 100644
View file @
0be529da
/*
* cropped_word_recognition.cpp
*
* A demo program of text recognition in a given cropped word.
* Shows the use of the OCRBeamSearchDecoder class API using the provided default classifier.
*
* Created on: Jul 9, 2015
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
*/
#include "opencv2/text.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
text
;
int
main
(
int
argc
,
char
*
argv
[])
{
cout
<<
endl
<<
argv
[
0
]
<<
endl
<<
endl
;
cout
<<
"A demo program of Scene Text Character Recognition: "
<<
endl
;
cout
<<
"Shows the use of the OCRBeamSearchDecoder::ClassifierCallback class using the Single Layer CNN character classifier described in:"
<<
endl
;
cout
<<
"Coates, Adam, et al.
\"
Text detection and character recognition in scene images with unsupervised feature learning.
\"
ICDAR 2011."
<<
endl
<<
endl
;
Mat
image
;
if
(
argc
>
1
)
image
=
imread
(
argv
[
1
]);
else
{
cout
<<
" Usage: "
<<
argv
[
0
]
<<
" <input_image>"
<<
endl
;
cout
<<
" the input image must contain a single character (e.g. scenetext_char01.jpg)."
<<
endl
<<
endl
;
return
(
0
);
}
string
vocabulary
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
// must have the same order as the clasifier output classes
Ptr
<
OCRHMMDecoder
::
ClassifierCallback
>
ocr
=
loadOCRHMMClassifierCNN
(
"OCRBeamSearch_CNN_model_data.xml.gz"
);
double
t_r
=
(
double
)
getTickCount
();
vector
<
int
>
out_classes
;
vector
<
double
>
out_confidences
;
ocr
->
eval
(
image
,
out_classes
,
out_confidences
);
cout
<<
"OCR output =
\"
"
<<
vocabulary
[
out_classes
[
0
]]
<<
"
\"
with confidence "
<<
out_confidences
[
0
]
<<
". Evaluated in "
<<
((
double
)
getTickCount
()
-
t_r
)
*
1000
/
getTickFrequency
()
<<
" ms."
<<
endl
<<
endl
;
return
0
;
}
modules/text/samples/scenetext_char01.jpg
0 → 100644
View file @
0be529da
538 Bytes
modules/text/samples/scenetext_char02.jpg
0 → 100644
View file @
0be529da
523 Bytes
modules/text/samples/scenetext_char03.jpg
0 → 100644
View file @
0be529da
541 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment