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
9638b145
Commit
9638b145
authored
Jun 03, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1191 from abratchik:contrib.java.wrapper.fix.3.2
parents
63bb7c16
53da3059
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
7 deletions
+61
-7
CMakeLists.txt
modules/text/CMakeLists.txt
+1
-1
erfilter.hpp
modules/text/include/opencv2/text/erfilter.hpp
+20
-2
ocr.hpp
modules/text/include/opencv2/text/ocr.hpp
+26
-1
erfilter.cpp
modules/text/src/erfilter.cpp
+14
-3
No files found.
modules/text/CMakeLists.txt
View file @
9638b145
set
(
the_description
"Text Detection and Recognition"
)
ocv_define_module
(
text opencv_ml opencv_imgproc opencv_core opencv_features2d OPTIONAL opencv_highgui WRAP python
)
ocv_define_module
(
text opencv_ml opencv_imgproc opencv_core opencv_features2d OPTIONAL opencv_highgui WRAP python
java
)
if
(
NOT CMAKE_CROSSCOMPILING OR OPENCV_FIND_TESSERACT
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
...
...
modules/text/include/opencv2/text/erfilter.hpp
View file @
9638b145
...
...
@@ -193,10 +193,10 @@ public:
loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
@param thresholdDelta : Threshold step in subsequent thresholds when extracting the component tree
@param minArea : The minimum area (% of image size) allowed for retreived ER's
@param m
in
Area : The maximum area (% of image size) allowed for retreived ER's
@param m
ax
Area : The maximum area (% of image size) allowed for retreived ER's
@param minProbability : The minimum probability P(er|character) allowed for retreived ER's
@param nonMaxSuppression : Whenever non-maximum suppression is done over the branch probabilities
@param minProbability : The minimum probability difference between local maxima and local minima ERs
@param minProbability
Diff
: The minimum probability difference between local maxima and local minima ERs
The component tree of the image is extracted by a threshold increased step by step from 0 to 255,
incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of
...
...
@@ -227,6 +227,24 @@ features: hole area ratio, convex hull ratio, and number of outer inflexion poin
CV_EXPORTS_W
Ptr
<
ERFilter
>
createERFilterNM2
(
const
Ptr
<
ERFilter
::
Callback
>&
cb
,
float
minProbability
=
(
float
)
0.3
);
/** @brief Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm
from the provided path e.g. /path/to/cpp/trained_classifierNM1.xml
@overload
*/
CV_EXPORTS_W
Ptr
<
ERFilter
>
createERFilterNM1
(
const
String
&
filename
,
int
thresholdDelta
=
1
,
float
minArea
=
(
float
)
0.00025
,
float
maxArea
=
(
float
)
0.13
,
float
minProbability
=
(
float
)
0.4
,
bool
nonMaxSuppression
=
true
,
float
minProbabilityDiff
=
(
float
)
0.1
);
/** @brief Reads an Extremal Region Filter for the 2nd stage classifier of N&M algorithm
from the provided path e.g. /path/to/cpp/trained_classifierNM2.xml
@overload
*/
CV_EXPORTS_W
Ptr
<
ERFilter
>
createERFilterNM2
(
const
String
&
filename
,
float
minProbability
=
(
float
)
0.3
);
/** @brief Allow to implicitly load the default classifier when creating an ERFilter object.
...
...
modules/text/include/opencv2/text/ocr.hpp
View file @
9638b145
...
...
@@ -61,6 +61,31 @@ enum
OCR_LEVEL_TEXTLINE
};
//! Tesseract.PageSegMode Enumeration
enum
page_seg_mode
{
PSM_OSD_ONLY
,
PSM_AUTO_OSD
,
PSM_AUTO_ONLY
,
PSM_AUTO
,
PSM_SINGLE_COLUMN
,
PSM_SINGLE_BLOCK_VERT_TEXT
,
PSM_SINGLE_BLOCK
,
PSM_SINGLE_LINE
,
PSM_SINGLE_WORD
,
PSM_CIRCLE_WORD
,
PSM_SINGLE_CHAR
};
//! Tesseract.OcrEngineMode Enumeration
enum
ocr_engine_mode
{
OEM_TESSERACT_ONLY
,
OEM_CUBE_ONLY
,
OEM_TESSERACT_CUBE_COMBINED
,
OEM_DEFAULT
};
//base class BaseOCR declares a common API that would be used in a typical text recognition scenario
class
CV_EXPORTS_W
BaseOCR
{
...
...
@@ -136,7 +161,7 @@ public:
possible values.
*/
CV_WRAP
static
Ptr
<
OCRTesseract
>
create
(
const
char
*
datapath
=
NULL
,
const
char
*
language
=
NULL
,
const
char
*
char_whitelist
=
NULL
,
int
oem
=
3
,
int
psmode
=
3
);
const
char
*
char_whitelist
=
NULL
,
int
oem
=
OEM_DEFAULT
,
int
psmode
=
PSM_AUTO
);
};
...
...
modules/text/src/erfilter.cpp
View file @
9638b145
...
...
@@ -279,9 +279,9 @@ void ERFilterNM::er_tree_extract( InputArray image )
// the quads for euler number calculation
// quads[2][2] and quads[2][3] are never used.
// The four lowest bits in each quads[i][j] correspond to the 2x2 binary patterns
// Q_1, Q_2, Q_3 in the Neumann and Matas CVPR 2012 paper
// (see in page 4 at the end of first column).
// The four lowest bits in each quads[i][j] correspond to the 2x2 binary patterns
// Q_1, Q_2, Q_3 in the Neumann and Matas CVPR 2012 paper
// (see in page 4 at the end of first column).
// Q_1 and Q_2 have four patterns, while Q_3 has only two.
const
int
quads
[
3
][
4
]
=
{
...
...
@@ -1145,6 +1145,17 @@ Ptr<ERFilter> createERFilterNM2(const Ptr<ERFilter::Callback>& cb, float minProb
return
(
Ptr
<
ERFilter
>
)
filter
;
}
Ptr
<
ERFilter
>
createERFilterNM1
(
const
String
&
filename
,
int
_thresholdDelta
,
float
_minArea
,
float
_maxArea
,
float
_minProbability
,
bool
_nonMaxSuppression
,
float
_minProbabilityDiff
)
{
return
createERFilterNM1
(
loadClassifierNM1
(
filename
),
_thresholdDelta
,
_minArea
,
_maxArea
,
_minProbability
,
_nonMaxSuppression
,
_minProbabilityDiff
);
}
Ptr
<
ERFilter
>
createERFilterNM2
(
const
String
&
filename
,
float
_minProbability
)
{
return
createERFilterNM2
(
loadClassifierNM2
(
filename
),
_minProbability
);
}
/*!
Allow to implicitly load the default classifier when creating an ERFilter object.
The function takes as parameter the XML or YAML file with the classifier model
...
...
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