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
bbca7b0c
Commit
bbca7b0c
authored
Jul 30, 2014
by
lluis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removes hardcoded filename for ERFilter used in feedback loop by adding a dummy classifier
parent
157e08f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
textdetection.cpp
modules/text/samples/textdetection.cpp
+1
-3
erfilter.cpp
modules/text/src/erfilter.cpp
+21
-1
No files found.
modules/text/samples/textdetection.cpp
View file @
bbca7b0c
...
...
@@ -32,6 +32,7 @@ int main(int argc, const char * argv[])
if
(
argc
<
2
)
show_help_and_exit
(
argv
[
0
]);
namedWindow
(
"grouping"
,
WINDOW_NORMAL
);
Mat
src
=
imread
(
argv
[
1
]);
// Extract channels to be processed individually
...
...
@@ -59,16 +60,13 @@ int main(int argc, const char * argv[])
// Detect character groups
cout
<<
"Grouping extracted ERs ... "
;
cout
<<
"image size "
<<
src
.
cols
<<
"x"
<<
src
.
rows
<<
endl
;
vector
<
vector
<
Vec2i
>
>
region_groups
;
vector
<
Rect
>
groups_boxes
;
erGrouping
(
src
,
channels
,
regions
,
region_groups
,
groups_boxes
,
ERGROUPING_ORIENTATION_HORIZ
);
//erGrouping(src, channels, regions, region_groups, groups_boxes, ERGROUPING_ORIENTATION_ANY, "./trained_classifier_erGrouping.xml", 0.5);
// draw groups
cout
<<
"image size "
<<
src
.
cols
<<
"x"
<<
src
.
rows
<<
endl
;
groups_draw
(
src
,
groups_boxes
);
cout
<<
"image size "
<<
src
.
cols
<<
"x"
<<
src
.
rows
<<
endl
;
imshow
(
"grouping"
,
src
);
cout
<<
"Done!"
<<
endl
<<
endl
;
...
...
modules/text/src/erfilter.cpp
View file @
bbca7b0c
...
...
@@ -1160,6 +1160,26 @@ Ptr<ERFilter::Callback> loadClassifierNM2(const string& filename)
return
makePtr
<
ERClassifierNM2
>
(
filename
);
}
// dummy classifier
class
ERDummyClassifier
:
public
ERFilter
::
Callback
{
public
:
//Constructor
ERDummyClassifier
()
{}
// Destructor
~
ERDummyClassifier
()
{}
// 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
;}
};
/* Create a dummy classifier that accepts all regions */
Ptr
<
ERFilter
::
Callback
>
loadDummyClassifier
();
Ptr
<
ERFilter
::
Callback
>
loadDummyClassifier
()
{
return
makePtr
<
ERDummyClassifier
>
();
}
/* ------------------------------------------------------------------------------------*/
/* -------------------------------- Compute Channels NM -------------------------------*/
...
...
@@ -3858,7 +3878,7 @@ void erGroupingNM(InputArray _img, InputArrayOfArrays _src, vector< vector<ERSta
{
//Feedback loop of detected lines to region extraction ... tries to recover missmatches in the region decomposition step by extracting regions in the neighbourhood of a valid sequence and checking if they are consistent with its line estimates
Ptr
<
ERFilter
>
er_filter
=
createERFilterNM1
(
load
ClassifierNM1
(
"trained_classifierNM1.xml"
),
1
,
0.005
f
,
0.3
f
,
0.
f
,
true
,
0.1
f
);
Ptr
<
ERFilter
>
er_filter
=
createERFilterNM1
(
load
DummyClassifier
(),
1
,
0.005
f
,
0.3
f
,
0.
f
,
false
);
for
(
int
i
=
0
;
i
<
(
int
)
valid_sequences
.
size
();
i
++
)
{
vector
<
Point
>
bbox_points
;
...
...
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