更新最新直接用point_diff_main

This commit is contained in:
琉璃月光
2026-01-08 17:38:48 +08:00
parent ce061d7840
commit d5457e02ca

View File

@ -173,8 +173,8 @@ def visualize_result(image, keypoints, bbox, fixed_point, offset_info, save_path
# ====================== 主函数 ======================
def calculate_offset_from_image(image_path, visualize=False):
orig = cv2.imread(image_path)
def calculate_offset_from_image(orig, visualize=False):
if orig is None:
return {'success': False, 'message': f'Failed to load image: {image_path}'}
@ -213,7 +213,8 @@ def calculate_offset_from_image(image_path, visualize=False):
# ====================== 示例调用 ======================
if __name__ == "__main__":
image_path = "11.jpg"
result = calculate_offset_from_image(image_path, visualize=False)
orig = cv2.imread(image_path)
result = calculate_offset_from_image(orig, visualize=False)
if result['success']:
print(f"Center point: ({result['cx']:.1f}, {result['cy']:.1f})")
print(f"Offset: DeltaX={result['dx_mm']:+.2f} mm, DeltaY={result['dy_mm']:+.2f} mm")