Skip to content

Commit a8d3a1b

Browse files
busunkim96leahecole
andcommitted
fix: get bounds for blocks instead of pages (#2705)
* fix: use `page.bounding_box` when feature is page Closes #2702 * fix: outline blocks instead of pages Co-authored-by: Leah E. Cole <[email protected]>
1 parent 488d076 commit a8d3a1b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

vision/cloud-client/document_text/doctext.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,14 @@ def get_document_bounds(image_file, feature):
8585
if (feature == FeatureType.BLOCK):
8686
bounds.append(block.bounding_box)
8787

88-
if (feature == FeatureType.PAGE):
89-
bounds.append(block.bounding_box)
90-
9188
# The list `bounds` contains the coordinates of the bounding boxes.
9289
# [END vision_document_text_tutorial_detect_bounds]
9390
return bounds
9491

9592

9693
def render_doc_text(filein, fileout):
9794
image = Image.open(filein)
98-
bounds = get_document_bounds(filein, FeatureType.PAGE)
95+
bounds = get_document_bounds(filein, FeatureType.BLOCK)
9996
draw_boxes(image, bounds, 'blue')
10097
bounds = get_document_bounds(filein, FeatureType.PARA)
10198
draw_boxes(image, bounds, 'red')

0 commit comments

Comments
 (0)