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
9195d2e6
Commit
9195d2e6
authored
Oct 11, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text: small adjustments in samples and image preprocessing
parent
fb0338fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
dictnet_demo.cpp
modules/text/samples/dictnet_demo.cpp
+0
-9
textbox_demo.cpp
modules/text/samples/textbox_demo.cpp
+2
-2
ocr_holistic.cpp
modules/text/src/ocr_holistic.cpp
+4
-0
text_detectorCNN.cpp
modules/text/src/text_detectorCNN.cpp
+5
-4
No files found.
modules/text/samples/dictnet_demo.cpp
View file @
9195d2e6
/*
* dictnet_demo.cpp
*
* Demonstrates simple use of the holistic word classifier in C++
*
* Created on: June 26, 2016
* Author: Anguelos Nicolaou <anguelos.nicolaou AT gmail.com>
*/
#include "opencv2/text.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
...
...
modules/text/samples/textbox_demo.cpp
View file @
9195d2e6
...
...
@@ -14,14 +14,14 @@ std::string getHelpStr(const std::string& progFname)
{
std
::
stringstream
out
;
out
<<
" Demo of text detection CNN for text detection."
<<
std
::
endl
<<
" M
ax Jaderberg et al.: Reading Text in the Wild with Convolutional Neural Networks, IJCV 2015"
<<
std
::
endl
<<
std
::
endl
<<
" M
inghui Liao, Baoguang Shi, Xiang Bai, Xinggang Wang, Wenyu Liu: TextBoxes: A Fast Text Detector with a Single Deep Neural Network, AAAI2017
\n\n
"
<<
" Usage: "
<<
progFname
<<
" <output_file> <input_image>"
<<
std
::
endl
<<
" Caffe Model files (textbox.prototxt, TextBoxes_icdar13.caffemodel)"
<<
std
::
endl
<<
" must be in the current directory. See the documentation of text::TextDetectorCNN class to get download links."
<<
std
::
endl
;
return
out
.
str
();
}
bool
fileExists
(
std
::
string
filename
)
bool
fileExists
(
const
std
::
string
&
filename
)
{
std
::
ifstream
f
(
filename
.
c_str
());
return
f
.
good
();
...
...
modules/text/src/ocr_holistic.cpp
View file @
9195d2e6
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "precomp.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core.hpp"
...
...
modules/text/src/text_detectorCNN.cpp
View file @
9195d2e6
...
...
@@ -5,12 +5,11 @@
#include "precomp.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core.hpp"
#include "opencv2/dnn.hpp"
#include <fstream>
#include <algorithm>
#include "opencv2/dnn.hpp"
using
namespace
cv
::
dnn
;
namespace
cv
...
...
@@ -75,20 +74,22 @@ public:
void
detect
(
InputArray
inputImage_
,
std
::
vector
<
Rect
>&
Bbox
,
std
::
vector
<
float
>&
confidence
)
{
CV_Assert
(
inputImage_
.
channels
()
==
inputChannelCount_
);
Mat
inputImage
=
inputImage_
.
getMat
().
clon
e
();
Size
inputSize
=
inputImage_
.
getMat
().
siz
e
();
Bbox
.
resize
(
0
);
confidence
.
resize
(
0
);
for
(
size_t
i
=
0
;
i
<
sizes_
.
size
();
i
++
)
{
Size
inputGeometry
=
sizes_
[
i
];
Mat
inputImage
=
inputImage_
.
getMat
().
clone
();
resize
(
inputImage
,
inputImage
,
inputGeometry
);
net_
.
setInput
(
blobFromImage
(
inputImage
,
1
,
inputGeometry
,
Scalar
(
123
,
117
,
104
)),
"data"
);
Mat
outputNet
=
net_
.
forward
();
int
nbrTextBoxes
=
outputNet
.
size
[
2
];
int
nCol
=
outputNet
.
size
[
3
];
int
outputChannelCount
=
outputNet
.
size
[
1
];
CV_Assert
(
outputChannelCount
==
1
);
getOutputs
((
float
*
)(
outputNet
.
data
),
nbrTextBoxes
,
nCol
,
Bbox
,
confidence
,
input
Image
.
size
()
);
getOutputs
((
float
*
)(
outputNet
.
data
),
nbrTextBoxes
,
nCol
,
Bbox
,
confidence
,
input
Size
);
}
}
};
...
...
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