mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 20:58:11 +00:00
fix: Ensure that the visualisations happen on copies of the page image
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
This commit is contained in:
@@ -122,8 +122,8 @@ class LayoutModel(BasePageModel):
|
|||||||
left_clusters = [c for c in clusters if c.label not in exclude_labels]
|
left_clusters = [c for c in clusters if c.label not in exclude_labels]
|
||||||
right_clusters = [c for c in clusters if c.label in exclude_labels]
|
right_clusters = [c for c in clusters if c.label in exclude_labels]
|
||||||
# Create a deep copy of the original image for both sides
|
# Create a deep copy of the original image for both sides
|
||||||
left_image = copy.deepcopy(page.image)
|
left_image = page.image.copy()
|
||||||
right_image = copy.deepcopy(page.image)
|
right_image = page.image.copy()
|
||||||
|
|
||||||
# Draw clusters on both images
|
# Draw clusters on both images
|
||||||
draw_clusters(left_image, left_clusters, scale_x, scale_y)
|
draw_clusters(left_image, left_clusters, scale_x, scale_y)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class PagePreprocessingModel(BasePageModel):
|
|||||||
|
|
||||||
# DEBUG code:
|
# DEBUG code:
|
||||||
def draw_text_boxes(image, cells, show: bool = False):
|
def draw_text_boxes(image, cells, show: bool = False):
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image.copy())
|
||||||
for c in cells:
|
for c in cells:
|
||||||
x0, y0, x1, y1 = (
|
x0, y0, x1, y1 = (
|
||||||
c.to_bounding_box().l,
|
c.to_bounding_box().l,
|
||||||
|
|||||||
Reference in New Issue
Block a user