Skip to content

Resize objects polygons according to original image size

Closes #319 (closed)

Original bug can be reproduced using https://arkindex.teklia.com/element/e7e6c6b5-005f-4fb9-8e98-79a3655f80c0 and https://arkindex.teklia.com/model-version/734376a0-6a25-4886-aa03-e3cc9c3a961d. The bug didn't appear on the GIF because the GIF is generated in the right dimensions (another issue). To visualize the polygons on the image, I used the following snippet

Visualizer
import json
from pathlib import Path
from PIL import Image, ImageDraw
from itertools import chain

filepath = Path("out/e7e6c6b5-005f-4fb9-8e98-79a3655f80c0.json")
img_path = (Path("images") / f"{filepath.stem}.jpg")

data = json.loads(filepath.read_text())

img = Image.open(img_path)
drawing = ImageDraw.Draw(img)   
for obj in data["objects"]:
    drawing.polygon(list(chain.from_iterable(obj["polygon"])), width=5, outline ="red")

img.save(img_path.with_suffix(".draw.jpg"))
Edited by Yoann Schneider

Merge request reports

Loading