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
57648c2c
Commit
57648c2c
authored
Dec 02, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #876 from alalek:fix_contrib_872
parents
bd619c55
31d11378
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
detect_er_chars.py
modules/text/samples/detect_er_chars.py
+5
-6
textdetection.cpp
modules/text/samples/textdetection.cpp
+2
-3
textdetection.py
modules/text/samples/textdetection.py
+4
-6
erfilter.cpp
modules/text/src/erfilter.cpp
+0
-0
No files found.
modules/text/samples/detect_er_chars.py
View file @
57648c2c
...
...
@@ -5,7 +5,6 @@ import os
import
cv2
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
print
(
'
\n
detect_er_chars.py'
)
print
(
' A simple demo script using the Extremal Region Filter algorithm described in:'
)
...
...
@@ -32,8 +31,8 @@ regions = cv2.text.detectRegions(gray,er1,er2)
#Visualization
rects
=
[
cv2
.
boundingRect
(
p
.
reshape
(
-
1
,
1
,
2
))
for
p
in
regions
]
for
rect
in
rects
:
cv2
.
rectangle
(
img
,
rect
[
0
:
2
],
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
0
,
0
,
255
),
2
)
img
=
img
[:,:,::
-
1
]
#flip the colors dimension from BGR to RGB
plt
.
imshow
(
img
)
plt
.
xticks
([]),
plt
.
yticks
([])
# to hide tick values on X and Y axis
plt
.
show
(
)
cv2
.
rectangle
(
img
,
rect
[
0
:
2
],
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
0
,
0
,
0
),
2
)
for
rect
in
rects
:
cv2
.
rectangle
(
img
,
rect
[
0
:
2
],
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
255
,
255
,
255
),
1
)
cv2
.
imshow
(
"Text detection result"
,
img
)
cv2
.
waitKey
(
0
)
modules/text/samples/textdetection.cpp
View file @
57648c2c
...
...
@@ -32,7 +32,6 @@ 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
...
...
@@ -70,8 +69,8 @@ int main(int argc, const char * argv[])
imshow
(
"grouping"
,
src
);
cout
<<
"Done!"
<<
endl
<<
endl
;
cout
<<
"Press 'e' to show the extracted Extremal Regions, any other key to exit."
<<
endl
<<
endl
;
if
(
waitKey
(
-
1
)
==
101
)
cout
<<
"Press '
spac
e' to show the extracted Extremal Regions, any other key to exit."
<<
endl
<<
endl
;
if
((
waitKey
()
&
0xff
)
==
' '
)
er_show
(
channels
,
regions
);
// memory clean-up
...
...
modules/text/samples/textdetection.py
View file @
57648c2c
...
...
@@ -5,7 +5,6 @@ import os
import
cv2
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
print
(
'
\n
textdetection.py'
)
print
(
' A demo script of the Extremal Region Filter algorithm described in:'
)
...
...
@@ -50,11 +49,10 @@ for channel in channels:
#Visualization
for
r
in
range
(
0
,
np
.
shape
(
rects
)[
0
]):
rect
=
rects
[
r
]
cv2
.
rectangle
(
vis
,
(
rect
[
0
],
rect
[
1
]),
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
0
,
255
,
255
),
2
)
cv2
.
rectangle
(
vis
,
(
rect
[
0
],
rect
[
1
]),
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
0
,
0
,
0
),
2
)
cv2
.
rectangle
(
vis
,
(
rect
[
0
],
rect
[
1
]),
(
rect
[
0
]
+
rect
[
2
],
rect
[
1
]
+
rect
[
3
]),
(
255
,
255
,
255
),
1
)
#Visualization
vis
=
vis
[:,:,::
-
1
]
#flip the colors dimension from BGR to RGB
plt
.
imshow
(
vis
)
plt
.
xticks
([]),
plt
.
yticks
([])
# to hide tick values on X and Y axis
plt
.
show
()
cv2
.
imshow
(
"Text detection result"
,
vis
)
cv2
.
waitKey
(
0
)
modules/text/src/erfilter.cpp
View file @
57648c2c
This diff is collapsed.
Click to expand it.
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