Skip to content
Snippets Groups Projects

Resize objects polygons according to original image size

Merged Yoann Schneider requested to merge fix-polygons-scale into main

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

Checking pipeline status.

Approval is optional
Ready to merge by members who can write to the target branch.

Merge details

  • 1 commit and 1 merge commit will be added to main (squashes 17 commits).
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading