mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 12:48:28 +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]
|
||||
right_clusters = [c for c in clusters if c.label in exclude_labels]
|
||||
# Create a deep copy of the original image for both sides
|
||||
left_image = copy.deepcopy(page.image)
|
||||
right_image = copy.deepcopy(page.image)
|
||||
left_image = page.image.copy()
|
||||
right_image = page.image.copy()
|
||||
|
||||
# Draw clusters on both images
|
||||
draw_clusters(left_image, left_clusters, scale_x, scale_y)
|
||||
|
||||
@@ -90,7 +90,7 @@ class PagePreprocessingModel(BasePageModel):
|
||||
|
||||
# DEBUG code:
|
||||
def draw_text_boxes(image, cells, show: bool = False):
|
||||
draw = ImageDraw.Draw(image)
|
||||
draw = ImageDraw.Draw(image.copy())
|
||||
for c in cells:
|
||||
x0, y0, x1, y1 = (
|
||||
c.to_bounding_box().l,
|
||||
|
||||
Reference in New Issue
Block a user