minor tweaks
This commit is contained in:
6
main.py
6
main.py
@@ -6,6 +6,7 @@ import cv2
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
WINSIZE = (500, 500)
|
||||||
WIN = "window"
|
WIN = "window"
|
||||||
SPACING = 50
|
SPACING = 50
|
||||||
GREEN = (0, 255, 0)
|
GREEN = (0, 255, 0)
|
||||||
@@ -153,12 +154,9 @@ def fit_to_line(line, *, canvas):
|
|||||||
|
|
||||||
loss = (
|
loss = (
|
||||||
0
|
0
|
||||||
#
|
|
||||||
+ point_to_point_error()
|
+ point_to_point_error()
|
||||||
+ point_to_line_error() * 2
|
+ point_to_line_error() * 2
|
||||||
+ line_to_line_error()
|
+ line_to_line_error()
|
||||||
#
|
|
||||||
# + spacing_error(fit)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
loss.backward()
|
loss.backward()
|
||||||
@@ -199,7 +197,7 @@ def main():
|
|||||||
line.append((x, y))
|
line.append((x, y))
|
||||||
optimization()
|
optimization()
|
||||||
|
|
||||||
canvas = np.zeros((500, 500, 3), dtype=np.uint8)
|
canvas = np.zeros((*WINSIZE, 3), dtype=np.uint8)
|
||||||
cv2.namedWindow(WIN)
|
cv2.namedWindow(WIN)
|
||||||
cv2.imshow(WIN, canvas)
|
cv2.imshow(WIN, canvas)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user