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
7c7ecd71
Commit
7c7ecd71
authored
Jul 07, 2016
by
Anguelos Nicolaou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing warnings
parent
551d1e68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
ocr_holistic.cpp
modules/text/src/ocr_holistic.cpp
+5
-4
No files found.
modules/text/src/ocr_holistic.cpp
View file @
7c7ecd71
...
@@ -60,9 +60,9 @@ protected:
...
@@ -60,9 +60,9 @@ protected:
void
classifyMiniBatch
(
std
::
vector
<
Mat
>
inputImageList
,
Mat
outputMat
){
void
classifyMiniBatch
(
std
::
vector
<
Mat
>
inputImageList
,
Mat
outputMat
){
//Classifies a list of images containing at most minibatchSz_ images
//Classifies a list of images containing at most minibatchSz_ images
CV_Assert
(
in
putImageList
.
size
(
)
<=
this
->
minibatchSz_
);
CV_Assert
(
in
t
(
inputImageList
.
size
()
)
<=
this
->
minibatchSz_
);
CV_Assert
(
outputMat
.
isContinuous
());
CV_Assert
(
outputMat
.
isContinuous
());
float
*
ouputPtr
=
(
float
*
)(
outputMat
.
data
);
#ifdef HAVE_CAFFE
net_
->
input_blobs
()[
0
]
->
Reshape
(
inputImageList
.
size
(),
1
,
this
->
inputGeometry_
.
height
,
this
->
inputGeometry_
.
width
);
net_
->
input_blobs
()[
0
]
->
Reshape
(
inputImageList
.
size
(),
1
,
this
->
inputGeometry_
.
height
,
this
->
inputGeometry_
.
width
);
net_
->
Reshape
();
net_
->
Reshape
();
float
*
inputBuffer
=
net_
->
input_blobs
()[
0
]
->
mutable_cpu_data
();
float
*
inputBuffer
=
net_
->
input_blobs
()[
0
]
->
mutable_cpu_data
();
...
@@ -78,6 +78,7 @@ protected:
...
@@ -78,6 +78,7 @@ protected:
const
float
*
outputNetData
=
net_
->
output_blobs
()[
0
]
->
cpu_data
();
const
float
*
outputNetData
=
net_
->
output_blobs
()[
0
]
->
cpu_data
();
float
*
outputMatData
=
(
float
*
)(
outputMat
.
data
);
float
*
outputMatData
=
(
float
*
)(
outputMat
.
data
);
memcpy
(
outputMatData
,
outputNetData
,
sizeof
(
float
)
*
this
->
outputSize_
*
inputImageList
.
size
());
memcpy
(
outputMatData
,
outputNetData
,
sizeof
(
float
)
*
this
->
outputSize_
*
inputImageList
.
size
());
#endif
}
}
#ifdef HAVE_CAFFE
#ifdef HAVE_CAFFE
...
@@ -129,7 +130,7 @@ public:
...
@@ -129,7 +130,7 @@ public:
inputImageList
.
getMatVector
(
allImageVector
);
inputImageList
.
getMatVector
(
allImageVector
);
classProbabilities
.
create
(
Size
(
this
->
outputSize_
,
allImageVector
.
size
()),
CV_32F
);
classProbabilities
.
create
(
Size
(
this
->
outputSize_
,
allImageVector
.
size
()),
CV_32F
);
Mat
outputMat
=
classProbabilities
.
getMat
();
Mat
outputMat
=
classProbabilities
.
getMat
();
for
(
int
imgNum
=
0
;
imgNum
<
allImageVector
.
size
(
);
imgNum
+=
this
->
minibatchSz_
){
for
(
int
imgNum
=
0
;
imgNum
<
int
(
allImageVector
.
size
()
);
imgNum
+=
this
->
minibatchSz_
){
int
rangeEnd
=
imgNum
+
std
::
min
<
int
>
(
allImageVector
.
size
()
-
imgNum
,
this
->
minibatchSz_
);
int
rangeEnd
=
imgNum
+
std
::
min
<
int
>
(
allImageVector
.
size
()
-
imgNum
,
this
->
minibatchSz_
);
std
::
vector
<
Mat
>::
const_iterator
from
=
allImageVector
.
begin
()
+
imgNum
;
std
::
vector
<
Mat
>::
const_iterator
from
=
allImageVector
.
begin
()
+
imgNum
;
std
::
vector
<
Mat
>::
const_iterator
to
=
allImageVector
.
begin
()
+
rangeEnd
;
std
::
vector
<
Mat
>::
const_iterator
to
=
allImageVector
.
begin
()
+
rangeEnd
;
...
@@ -208,7 +209,7 @@ public:
...
@@ -208,7 +209,7 @@ public:
while
(
std
::
getline
(
labelsFile
,
line
)){
while
(
std
::
getline
(
labelsFile
,
line
)){
labels_
.
push_back
(
std
::
string
(
line
));
labels_
.
push_back
(
std
::
string
(
line
));
}
}
CV_Assert
(
this
->
classifier_
->
getOutputSize
()
==
this
->
labels_
.
size
(
));
CV_Assert
(
this
->
classifier_
->
getOutputSize
()
==
int
(
this
->
labels_
.
size
()
));
}
}
void
recogniseImage
(
InputArray
inputImage
,
CV_OUT
String
&
transcription
,
CV_OUT
double
&
confidence
){
void
recogniseImage
(
InputArray
inputImage
,
CV_OUT
String
&
transcription
,
CV_OUT
double
&
confidence
){
...
...
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