generated from dopt-python/py311
change formatting
This commit is contained in:
parent
aea65430e0
commit
c169d6d1cf
@ -123,15 +123,20 @@ def measure_length(
|
|||||||
|
|
||||||
offset = 20
|
offset = 20
|
||||||
|
|
||||||
dst = np.array([
|
dst = np.array(
|
||||||
|
[
|
||||||
[offset, offset],
|
[offset, offset],
|
||||||
[max_width - 1 + offset, offset],
|
[max_width - 1 + offset, offset],
|
||||||
[max_width - 1 + offset, max_height - 1 + offset],
|
[max_width - 1 + offset, max_height - 1 + offset],
|
||||||
[offset, max_height - 1 + offset]
|
[offset, max_height - 1 + offset],
|
||||||
], dtype="float32")
|
],
|
||||||
|
dtype="float32",
|
||||||
|
)
|
||||||
|
|
||||||
M = cv2.getPerspectiveTransform(box, dst)
|
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)
|
gray_warped = cv2.cvtColor(warped, cv2.COLOR_BGR2GRAY)
|
||||||
_, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY)
|
_, binary_warped = cv2.threshold(gray_warped, 80, 255, cv2.THRESH_BINARY)
|
||||||
@ -141,7 +146,9 @@ def measure_length(
|
|||||||
[
|
[
|
||||||
f"{dimB:.3f}".replace(".", ","),
|
f"{dimB:.3f}".replace(".", ","),
|
||||||
f"{dimA:.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(
|
||||||
|
".", ","
|
||||||
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user