Skip to content

Commit

Permalink
fix: get bounds for blocks instead of pages (#2705)
Browse files Browse the repository at this point in the history
* fix: use `page.bounding_box` when feature is page

Closes #2702

* fix: outline blocks instead of pages

Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
  • Loading branch information
busunkim96 and leahecole committed Jan 10, 2020
1 parent 488d076 commit a8d3a1b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions vision/cloud-client/document_text/doctext.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,14 @@ def get_document_bounds(image_file, feature):
if (feature == FeatureType.BLOCK):
bounds.append(block.bounding_box)

if (feature == FeatureType.PAGE):
bounds.append(block.bounding_box)

# The list `bounds` contains the coordinates of the bounding boxes.
# [END vision_document_text_tutorial_detect_bounds]
return bounds


def render_doc_text(filein, fileout):
image = Image.open(filein)
bounds = get_document_bounds(filein, FeatureType.PAGE)
bounds = get_document_bounds(filein, FeatureType.BLOCK)
draw_boxes(image, bounds, 'blue')
bounds = get_document_bounds(filein, FeatureType.PARA)
draw_boxes(image, bounds, 'red')
Expand Down

0 comments on commit a8d3a1b

Please sign in to comment.