change formatting

This commit is contained in:
Florian Förster 2026-01-06 08:06:28 +01:00
parent aea65430e0
commit c169d6d1cf

View File

@ -123,15 +123,20 @@ def measure_length(
offset = 20
dst = np.array([
[offset, offset],
[max_width - 1 + offset, offset],
[max_width - 1 + offset, max_height - 1 + offset],
[offset, max_height - 1 + offset]
], dtype="float32")
dst = np.array(
[
[offset, offset],
[max_width - 1 + offset, offset],
[max_width - 1 + offset, max_height - 1 + offset],
[offset, max_height - 1 + offset],
],
dtype="float32",
)
M = cv2.getPerspectiveTransform(box, dst)
warped = cv2.warpPerspective(orig, M, (max_width + 2 * offset, max_height + 2 * offset))
warped = cv2.warpPerspective(
orig, M, (max_width + 2 * offset, max_height + 2 * offset)
)
gray_warped = cv2.cvtColor(warped, cv2.COLOR_BGR2GRAY)
_, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY)
@ -141,7 +146,9 @@ def measure_length(
[
f"{dimB:.3f}".replace(".", ","),
f"{dimA:.3f}".replace(".", ","),
f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace(".", ","),
f"{pixel_count / pixels_per_metric_X / pixels_per_metric_Y:.1f}".replace(
".", ","
),
]
)