Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OCR-Image-Desensitization
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
EvilCalf
OCR-Image-Desensitization
Commits
54671891
Commit
54671891
authored
Dec 09, 2019
by
EvilCalf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify some structure
parent
51783422
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
main.py
main.py
+5
-10
No files found.
main.py
View file @
54671891
...
@@ -9,14 +9,12 @@ import os
...
@@ -9,14 +9,12 @@ import os
import
pandas
as
pd
import
pandas
as
pd
tesseract_cmd
=
r
'.\tesseract-ocr\tesseract.exe'
tesseract_cmd
=
r
".\tesseract-ocr\tesseract.exe"
for
root
,
dirs
,
files
in
os
.
walk
(
"labimage/"
):
for
root
,
dirs
,
files
in
os
.
walk
(
"labimage/"
):
for
file
in
files
:
for
file
in
files
:
image
=
Image
.
open
(
root
+
"/"
+
file
)
image
=
Image
.
open
(
root
+
"/"
+
file
)
content
=
pytesseract
.
image_to_data
(
content
=
pytesseract
.
image_to_data
(
image
,
lang
=
"chi_sim43"
,
output_type
=
"dict"
)
image
,
lang
=
"chi_sim43"
,
output_type
=
"dict"
)
for
i
in
range
(
len
(
content
[
"text"
])):
for
i
in
range
(
len
(
content
[
"text"
])):
if
0
<
len
(
content
[
"text"
][
i
]):
if
0
<
len
(
content
[
"text"
][
i
]):
if
content
[
"text"
][
i
]
==
"姓名"
or
(
if
content
[
"text"
][
i
]
==
"姓名"
or
(
...
@@ -46,10 +44,7 @@ for root, dirs, files in os.walk("labimage/"):
...
@@ -46,10 +44,7 @@ for root, dirs, files in os.walk("labimage/"):
print
(
cnt
)
print
(
cnt
)
image
.
paste
((
0
,
0
,
0
),
(
x
-
10
,
y
-
10
,
x
+
w
+
400
,
y
+
h
+
30
))
image
.
paste
((
0
,
0
,
0
),
(
x
-
10
,
y
-
10
,
x
+
w
+
400
,
y
+
h
+
30
))
image
.
save
(
"./Output/"
+
file
)
image
.
save
(
"./Output/"
+
file
)
data
=
pd
.
DataFrame
({
'name'
:
[
cnt
],
'dir'
:
[
root
+
"/"
+
file
]})
data
=
pd
.
DataFrame
({
"name"
:
[
cnt
],
"dir"
:
[
root
+
"/"
+
file
]})
data
.
to_csv
(
"name2file.csv"
,
mode
=
'a'
,
header
=
False
)
data
.
to_csv
(
"name2file.csv"
,
mode
=
"a"
,
header
=
False
)
break
break
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