|
|
|
@ -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")
|
|
|
|
|