Skip to content

Commit a827a02

Browse files
committed
adding text extraction
1 parent 0192746 commit a827a02

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

examples/alchemy_vision_v1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
with open(join(dirname(__file__), '../resources/test.jpg'), 'rb') as image_file:
1717
print(json.dumps(alchemy_vision.get_image_keywords(image_file, knowledge_graph=True,
1818
force_show_all=True), indent=2))
19+
# Text recognition
20+
with open(join(dirname(__file__), '../resources/text.png'), 'rb') as image_file:
21+
print(json.dumps(alchemy_vision.get_image_scene_text(image_file), indent=2))
1922

2023
print(json.dumps(alchemy_vision.get_image_keywords(
2124
image_url='https://upload.wikimedia.org/wikipedia/commons/8/81/Morris-Chair-Ironwood.jpg'), indent=2))

resources/text.png

4.07 KB
Loading

watson_developer_cloud/alchemy_vision_v1.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def recognize_faces(self, image_file=None, image_url=None, knowledge_graph=False
3636
params = {'knowledgeGraph': knowledge_graph}
3737
return self._alchemy_image_request(method_name, image_file, image_url, params)
3838

39+
def get_image_scene_text(self, image_file=None, image_url=None):
40+
method_name = 'GetRankedImageSceneText'
41+
return self._alchemy_image_request(method_name, image_file, image_url)
42+
3943
def get_image_links(self, url=None, html=None):
4044
method_name = 'GetImage'
4145
return self._alchemy_html_request(method_name, url=url, html=html)

0 commit comments

Comments
 (0)