adjust inference

This commit is contained in:
Pete Matsyburka
2026-01-05 16:54:08 +02:00
parent f5cbcb3d24
commit c6819a19bd
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -122,7 +122,7 @@ module Templates
pad_w = (resolution - new_width) / 2
pad_h = (resolution - new_height) / 2
padded = image.embed(pad_w, pad_h, resolution, resolution, background: [0, 0, 0])
padded = image.embed(pad_w, pad_h, resolution, resolution, background: [255, 255, 255])
padded /= 255.0
@@ -245,6 +245,8 @@ module Templates
left, top, trim_width, trim_height = image.find_trim(threshold: 10, background: [255, 255, 255])
trim_width = [trim_width, image.width * 0.7].max
padded_left = [left - padding, 0].max
padded_top = [top - padding, 0].max
padded_right = [left + trim_width + padding, image.width].min