master
Paul597 3 months ago
parent 3fd2b82a79
commit 5937b75e13

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

@ -109,6 +109,7 @@ def fun_test(x,cls,corners):
# print(corners)
error = 0
error_y = 0
error_x = 0
model = cls()
f = model.f
H = model.H - 9
@ -116,12 +117,15 @@ def fun_test(x,cls,corners):
seta = math.atan(1 / math.sqrt(pow(math.tan(x[1]), 2) + 1 / pow(math.tan(x[0]), 2)))
column = 0
k = 0
k1 = 0
for index, value in enumerate(corners):
if index % 11 == 10:
column += 1
index += 1
k += 1
k1 = 0
continue
k1 += 1
Xw, Yw = calc_way.calc_distance(value[0], value[1], x[0], x[1])
Xw1, Yw1 = calc_way.calc_distance(corners[index+1][0], corners[index+1][1], x[0], x[1])
print(f"{index}个点")
@ -130,11 +134,13 @@ def fun_test(x,cls,corners):
d2 = math.sqrt((Xw1 - Xw) ** 2 + (Yw1 - Yw) ** 2)
print(f"两点距离为:{d2:.2f}")
error = error + abs(d2 - 60)
d_y = abs(570-60*k-50+Yw)
d_y = abs(570-60*k-77+Yw)
error_y = error_y + d_y
d_x = abs(488 + 760-60*k-Xw )
error_x = error_x + d_x
print(f"平均误差为:{error/80:.2f}")
print(f"errpr_y:{error/80:.2f}")
return error/80 + error_y/80
return error/80 + error_y/80 + error_x/80
def get_result_test(cls,corners):
params = cls,corners
@ -185,7 +191,7 @@ def undistort_image(image_path, camera_matrix, dist_coeffs):
# result = get_result_test(model.Model,find_corners("corrected.jpg",11,8))
# print(result)
# find_corners("corrected.jpg",11,8)
# x_zeros,y_zeros = calc_way.calc_zeros_yto0(-200)
# x_zeros,y_zeros = calc_way.calc_zeros_yto0(-90)
# print(x_zeros,y_zeros)
# # 读取图像
# img = cv2.imread("corrected.jpg")

@ -39,8 +39,8 @@ class Model:
# 外参
# self.alpha = 8.749e-01
# self.beta = 7.664e-01
self.alpha = 9.478e-01
self.beta = 8.111e-01
self.alpha = 9.951e-01
self.beta = 7.263e-01
# 位置修正
self.y = -50
self.x = 22

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

After

Width:  |  Height:  |  Size: 303 KiB

Loading…
Cancel
Save