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
e4c8510e
Commit
e4c8510e
authored
Mar 21, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
text: apply CV_OVERRIDE/CV_FINAL
parent
56835214
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
51 deletions
+51
-51
ocr.hpp
modules/text/include/opencv2/text/ocr.hpp
+8
-8
textDetector.hpp
modules/text/include/opencv2/text/textDetector.hpp
+1
-1
erfilter.cpp
modules/text/src/erfilter.cpp
+19
-19
ocr_beamsearch_decoder.cpp
modules/text/src/ocr_beamsearch_decoder.cpp
+7
-7
ocr_hmm_decoder.cpp
modules/text/src/ocr_hmm_decoder.cpp
+7
-7
ocr_holistic.cpp
modules/text/src/ocr_holistic.cpp
+3
-3
ocr_tesseract.cpp
modules/text/src/ocr_tesseract.cpp
+5
-5
text_detectorCNN.cpp
modules/text/src/text_detectorCNN.cpp
+1
-1
No files found.
modules/text/include/opencv2/text/ocr.hpp
View file @
e4c8510e
...
...
@@ -134,11 +134,11 @@ public:
*/
virtual
void
run
(
Mat
&
image
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
virtual
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
// aliases for scripting
CV_WRAP
String
run
(
InputArray
image
,
int
min_confidence
,
int
component_level
=
0
);
...
...
@@ -240,7 +240,7 @@ public:
*/
virtual
void
run
(
Mat
&
image
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
/** @brief Recognize text using HMM.
...
...
@@ -267,7 +267,7 @@ public:
*/
virtual
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
// aliases for scripting
CV_WRAP
String
run
(
InputArray
image
,
int
min_confidence
,
int
component_level
=
0
);
...
...
@@ -453,11 +453,11 @@ public:
*/
virtual
void
run
(
Mat
&
image
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
virtual
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
);
int
component_level
=
0
)
CV_OVERRIDE
;
// aliases for scripting
CV_WRAP
String
run
(
InputArray
image
,
int
min_confidence
,
int
component_level
=
0
);
...
...
@@ -555,7 +555,7 @@ public:
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
OCR_LEVEL_WORD
)
=
0
;
int
component_level
=
OCR_LEVEL_WORD
)
CV_OVERRIDE
=
0
;
/** @brief Recognize text using a segmentation based word-spotting/classifier cnn.
...
...
@@ -586,7 +586,7 @@ public:
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
OCR_LEVEL_WORD
)
=
0
;
int
component_level
=
OCR_LEVEL_WORD
)
CV_OVERRIDE
=
0
;
/** @brief Creates an instance of the OCRHolisticWordRecognizer class.
*/
...
...
modules/text/include/opencv2/text/textDetector.hpp
View file @
e4c8510e
...
...
@@ -48,7 +48,7 @@ public:
@param Bbox a vector of Rect that will store the detected word bounding box
@param confidence a vector of float that will be updated with the confidence the classifier has for the selected bounding box
*/
CV_WRAP
virtual
void
detect
(
InputArray
inputImage
,
CV_OUT
std
::
vector
<
Rect
>&
Bbox
,
CV_OUT
std
::
vector
<
float
>&
confidence
)
=
0
;
CV_WRAP
virtual
void
detect
(
InputArray
inputImage
,
CV_OUT
std
::
vector
<
Rect
>&
Bbox
,
CV_OUT
std
::
vector
<
float
>&
confidence
)
CV_OVERRIDE
=
0
;
/** @brief Creates an instance of the TextDetectorCNN class using the provided parameters.
...
...
modules/text/src/erfilter.cpp
View file @
e4c8510e
...
...
@@ -114,7 +114,7 @@ public:
//Constructor
ERFilterNM
();
//Destructor
~
ERFilterNM
()
{}
~
ERFilterNM
()
CV_OVERRIDE
{}
float
minProbability
;
bool
nonMaxSuppression
;
...
...
@@ -122,7 +122,7 @@ public:
// the key method. Takes image on input, vector of ERStat is output for the first stage,
// input/output - for the second one.
void
run
(
InputArray
image
,
vector
<
ERStat
>&
regions
);
void
run
(
InputArray
image
,
vector
<
ERStat
>&
regions
)
CV_OVERRIDE
;
protected
:
int
thresholdDelta
;
...
...
@@ -138,14 +138,14 @@ protected:
public
:
// set/get methods to set the algorithm properties,
void
setCallback
(
const
Ptr
<
ERFilter
::
Callback
>&
cb
);
void
setThresholdDelta
(
int
thresholdDelta
);
void
setMinArea
(
float
minArea
);
void
setMaxArea
(
float
maxArea
);
void
setMinProbability
(
float
minProbability
);
void
setMinProbabilityDiff
(
float
minProbabilityDiff
);
void
setNonMaxSuppression
(
bool
nonMaxSuppression
);
int
getNumRejected
();
void
setCallback
(
const
Ptr
<
ERFilter
::
Callback
>&
cb
)
CV_OVERRIDE
;
void
setThresholdDelta
(
int
thresholdDelta
)
CV_OVERRIDE
;
void
setMinArea
(
float
minArea
)
CV_OVERRIDE
;
void
setMaxArea
(
float
maxArea
)
CV_OVERRIDE
;
void
setMinProbability
(
float
minProbability
)
CV_OVERRIDE
;
void
setMinProbabilityDiff
(
float
minProbabilityDiff
)
CV_OVERRIDE
;
void
setNonMaxSuppression
(
bool
nonMaxSuppression
)
CV_OVERRIDE
;
int
getNumRejected
()
CV_OVERRIDE
;
private
:
// pointer to the input/output regions vector
...
...
@@ -171,32 +171,32 @@ private:
// default 1st stage classifier
class
CV_EXPORTS
ERClassifierNM1
:
public
ERFilter
::
Callback
class
CV_EXPORTS
ERClassifierNM1
CV_FINAL
:
public
ERFilter
::
Callback
{
public
:
//Constructor
ERClassifierNM1
(
const
string
&
filename
);
// Destructor
~
ERClassifierNM1
()
{}
~
ERClassifierNM1
()
CV_OVERRIDE
{}
// The classifier must return probability measure for the region.
double
eval
(
const
ERStat
&
stat
);
double
eval
(
const
ERStat
&
stat
)
CV_OVERRIDE
;
private
:
Ptr
<
Boost
>
boost
;
};
// default 2nd stage classifier
class
CV_EXPORTS
ERClassifierNM2
:
public
ERFilter
::
Callback
class
CV_EXPORTS
ERClassifierNM2
CV_FINAL
:
public
ERFilter
::
Callback
{
public
:
//constructor
ERClassifierNM2
(
const
string
&
filename
);
// Destructor
~
ERClassifierNM2
()
{}
~
ERClassifierNM2
()
CV_OVERRIDE
{}
// The classifier must return probability measure for the region.
double
eval
(
const
ERStat
&
stat
);
double
eval
(
const
ERStat
&
stat
)
CV_OVERRIDE
;
private
:
Ptr
<
Boost
>
boost
;
...
...
@@ -1178,16 +1178,16 @@ Ptr<ERFilter::Callback> loadClassifierNM2(const String& filename)
}
// dummy classifier
class
ERDummyClassifier
:
public
ERFilter
::
Callback
class
ERDummyClassifier
CV_FINAL
:
public
ERFilter
::
Callback
{
public
:
//Constructor
ERDummyClassifier
()
{}
// Destructor
~
ERDummyClassifier
()
{}
~
ERDummyClassifier
()
CV_OVERRIDE
{}
// The classifier must return probability measure for the region.
double
eval
(
const
ERStat
&
s
)
{
if
(
s
.
area
==
0
)
return
(
double
)
0.0
;
return
(
double
)
1.0
;}
double
eval
(
const
ERStat
&
s
)
CV_OVERRIDE
{
if
(
s
.
area
==
0
)
return
(
double
)
0.0
;
return
(
double
)
1.0
;}
};
/* Create a dummy classifier that accepts all regions */
...
...
modules/text/src/ocr_beamsearch_decoder.cpp
View file @
e4c8510e
...
...
@@ -155,7 +155,7 @@ bool beam_sort_function ( beamSearch_node a, beamSearch_node b )
}
class
OCRBeamSearchDecoderImpl
:
public
OCRBeamSearchDecoder
class
OCRBeamSearchDecoderImpl
CV_FINAL
:
public
OCRBeamSearchDecoder
{
public
:
//Default constructor
...
...
@@ -186,7 +186,7 @@ public:
}
}
~
OCRBeamSearchDecoderImpl
()
~
OCRBeamSearchDecoderImpl
()
CV_OVERRIDE
{
}
...
...
@@ -196,7 +196,7 @@ public:
vector
<
Rect
>*
component_rects
,
vector
<
string
>*
component_texts
,
vector
<
float
>*
component_confidences
,
int
component_level
)
int
component_level
)
CV_OVERRIDE
{
CV_Assert
(
mask
.
type
()
==
CV_8UC1
);
//nothing to do with a mask here
...
...
@@ -209,7 +209,7 @@ public:
vector
<
Rect
>*
component_rects
,
vector
<
string
>*
component_texts
,
vector
<
float
>*
component_confidences
,
int
component_level
)
int
component_level
)
CV_OVERRIDE
{
CV_Assert
(
(
src
.
type
()
==
CV_8UC1
)
||
(
src
.
type
()
==
CV_8UC3
)
);
...
...
@@ -519,15 +519,15 @@ Ptr<OCRBeamSearchDecoder> OCRBeamSearchDecoder::create(const String& _filename,
return
makePtr
<
OCRBeamSearchDecoderImpl
>
(
loadOCRBeamSearchClassifierCNN
(
_filename
),
_vocabulary
,
transition_p
,
emission_p
,
(
decoder_mode
)
_mode
,
_beam_size
);
}
class
OCRBeamSearchClassifierCNN
:
public
OCRBeamSearchDecoder
::
ClassifierCallback
class
OCRBeamSearchClassifierCNN
CV_FINAL
:
public
OCRBeamSearchDecoder
::
ClassifierCallback
{
public
:
//constructor
OCRBeamSearchClassifierCNN
(
const
std
::
string
&
filename
);
// Destructor
~
OCRBeamSearchClassifierCNN
()
{}
~
OCRBeamSearchClassifierCNN
()
CV_OVERRIDE
{}
void
eval
(
InputArray
src
,
vector
<
vector
<
double
>
>&
recognition_probabilities
,
vector
<
int
>&
oversegmentation
);
void
eval
(
InputArray
src
,
vector
<
vector
<
double
>
>&
recognition_probabilities
,
vector
<
int
>&
oversegmentation
)
CV_OVERRIDE
;
int
getWindowSize
()
{
return
window_size
;}
int
getStepSize
()
{
return
step_size
;}
...
...
modules/text/src/ocr_hmm_decoder.cpp
View file @
e4c8510e
...
...
@@ -158,7 +158,7 @@ public:
mode
=
_mode
;
}
~
OCRHMMDecoderImpl
()
~
OCRHMMDecoderImpl
()
CV_OVERRIDE
{
}
...
...
@@ -167,7 +167,7 @@ public:
vector
<
Rect
>*
component_rects
,
vector
<
string
>*
component_texts
,
vector
<
float
>*
component_confidences
,
int
component_level
)
int
component_level
)
CV_OVERRIDE
{
CV_Assert
(
(
image
.
type
()
==
CV_8UC1
)
||
(
image
.
type
()
==
CV_8UC3
)
);
...
...
@@ -413,7 +413,7 @@ public:
vector
<
Rect
>*
component_rects
,
vector
<
string
>*
component_texts
,
vector
<
float
>*
component_confidences
,
int
component_level
)
int
component_level
)
CV_OVERRIDE
{
CV_Assert
(
(
image
.
type
()
==
CV_8UC1
)
||
(
image
.
type
()
==
CV_8UC3
)
);
...
...
@@ -694,15 +694,15 @@ Ptr<OCRHMMDecoder> OCRHMMDecoder::create( const String& _filename,
return
makePtr
<
OCRHMMDecoderImpl
>
(
loadOCRHMMClassifier
(
_filename
,
_classifier
),
_vocabulary
,
transition_p
,
emission_p
,
(
decoder_mode
)
_mode
);
}
class
OCRHMMClassifierKNN
:
public
OCRHMMDecoder
::
ClassifierCallback
class
OCRHMMClassifierKNN
CV_FINAL
:
public
OCRHMMDecoder
::
ClassifierCallback
{
public
:
//constructor
OCRHMMClassifierKNN
(
const
std
::
string
&
filename
);
// Destructor
~
OCRHMMClassifierKNN
()
{}
~
OCRHMMClassifierKNN
()
CV_OVERRIDE
{}
void
eval
(
InputArray
mask
,
vector
<
int
>&
out_class
,
vector
<
double
>&
out_confidence
);
void
eval
(
InputArray
mask
,
vector
<
int
>&
out_class
,
vector
<
double
>&
out_confidence
)
CV_OVERRIDE
;
private
:
Ptr
<
KNearest
>
knn
;
};
...
...
@@ -956,7 +956,7 @@ public:
// Destructor
~
OCRHMMClassifierCNN
()
{}
void
eval
(
InputArray
image
,
vector
<
int
>&
out_class
,
vector
<
double
>&
out_confidence
);
void
eval
(
InputArray
image
,
vector
<
int
>&
out_class
,
vector
<
double
>&
out_confidence
)
CV_OVERRIDE
;
protected
:
void
normalizeAndZCA
(
Mat
&
patches
);
...
...
modules/text/src/ocr_holistic.cpp
View file @
e4c8510e
...
...
@@ -13,7 +13,7 @@ using namespace std;
namespace
cv
{
namespace
text
{
class
OCRHolisticWordRecognizerImpl
:
public
OCRHolisticWordRecognizer
class
OCRHolisticWordRecognizerImpl
CV_FINAL
:
public
OCRHolisticWordRecognizer
{
private
:
dnn
::
Net
net
;
...
...
@@ -34,7 +34,7 @@ public:
CV_Assert
(
getClassCount
()
==
words
.
size
());
}
void
run
(
Mat
&
image
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
void
run
(
Mat
&
image
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
CV_OVERRIDE
{
CV_Assert
(
component_level
==
OCR_LEVEL_WORD
);
//Componnents not applicable for word spotting
double
confidence
;
...
...
@@ -53,7 +53,7 @@ public:
}
}
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
std
::
vector
<
std
::
string
>*
component_texts
=
NULL
,
std
::
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
CV_OVERRIDE
{
//Mask is ignored because the CNN operates on a full image
CV_Assert
(
mask
.
cols
==
image
.
cols
&&
mask
.
rows
==
image
.
rows
);
...
...
modules/text/src/ocr_tesseract.cpp
View file @
e4c8510e
...
...
@@ -127,7 +127,7 @@ CV_WRAP String OCRTesseract::run(InputArray image, InputArray mask, int min_conf
}
class
OCRTesseractImpl
:
public
OCRTesseract
class
OCRTesseractImpl
CV_FINAL
:
public
OCRTesseract
{
private
:
#ifdef HAVE_TESSERACT
...
...
@@ -172,7 +172,7 @@ public:
#endif
}
~
OCRTesseractImpl
()
~
OCRTesseractImpl
()
CV_OVERRIDE
{
#ifdef HAVE_TESSERACT
tess
.
End
();
...
...
@@ -181,7 +181,7 @@ public:
void
run
(
Mat
&
image
,
string
&
output
,
vector
<
Rect
>*
component_rects
=
NULL
,
vector
<
string
>*
component_texts
=
NULL
,
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
int
component_level
=
0
)
CV_OVERRIDE
{
CV_Assert
(
(
image
.
type
()
==
CV_8UC1
)
||
(
image
.
type
()
==
CV_8UC3
)
);
...
...
@@ -249,7 +249,7 @@ public:
void
run
(
Mat
&
image
,
Mat
&
mask
,
string
&
output
,
vector
<
Rect
>*
component_rects
=
NULL
,
vector
<
string
>*
component_texts
=
NULL
,
vector
<
float
>*
component_confidences
=
NULL
,
int
component_level
=
0
)
int
component_level
=
0
)
CV_OVERRIDE
{
CV_Assert
(
mask
.
type
()
==
CV_8UC1
);
CV_Assert
(
(
image
.
type
()
==
CV_8UC1
)
||
(
image
.
type
()
==
CV_8UC3
)
);
...
...
@@ -257,7 +257,7 @@ public:
run
(
mask
,
output
,
component_rects
,
component_texts
,
component_confidences
,
component_level
);
}
void
setWhiteList
(
const
String
&
char_whitelist
)
void
setWhiteList
(
const
String
&
char_whitelist
)
CV_OVERRIDE
{
#ifdef HAVE_TESSERACT
tess
.
SetVariable
(
"tessedit_char_whitelist"
,
char_whitelist
.
c_str
());
...
...
modules/text/src/text_detectorCNN.cpp
View file @
e4c8510e
...
...
@@ -60,7 +60,7 @@ public:
inputChannelCount_
=
3
;
}
void
detect
(
InputArray
inputImage_
,
std
::
vector
<
Rect
>&
Bbox
,
std
::
vector
<
float
>&
confidence
)
void
detect
(
InputArray
inputImage_
,
std
::
vector
<
Rect
>&
Bbox
,
std
::
vector
<
float
>&
confidence
)
CV_OVERRIDE
{
CV_Assert
(
inputImage_
.
channels
()
==
inputChannelCount_
);
Mat
inputImage
=
inputImage_
.
getMat
();
...
...
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