Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2015104165
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김태희
2020-10-24 02:52:04 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
961c372bc863f5a94f589745857ef952eae8f9f0
961c372b
1 parent
d4b867c0
Add code for Text Detection
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
Prj/main.py
Prj/test01.jpg
Prj/main.py
0 → 100644
View file @
961c372
"""Detects text in the file."""
from
google.cloud
import
vision
import
io
import
os
os
.
environ
[
"GOOGLE_APPLICATION_CREDENTIALS"
]
=
"C:/Users/User/Downloads/SmokeDetection-ab1773dcbc6a.json"
client
=
vision
.
ImageAnnotatorClient
()
path
=
'D:/Curricular/5-2/CapstoneDesign2/git/Prj/test01.jpg'
with
io
.
open
(
path
,
'rb'
)
as
image_file
:
content
=
image_file
.
read
()
image
=
vision
.
Image
(
content
=
content
)
price_candidate
=
[]
card_number_candidate
=
[]
date_candidate
=
[]
response
=
client
.
text_detection
(
image
=
image
)
texts
=
response
.
text_annotations
print
(
'Texts:'
)
for
text
in
texts
:
content
=
text
.
description
content
=
content
.
replace
(
','
,
''
)
print
(
'
\n
"{}"'
.
format
(
content
))
if
response
.
error
.
message
:
raise
Exception
(
'{}
\n
For more info on error messages, check: '
'https://cloud.google.com/apis/design/errors'
.
format
(
response
.
error
.
message
))
Prj/test01.jpg
0 → 100644
View file @
961c372
114 KB
Please
register
or
login
to post a comment