python 曲线拟合,曲线拟合交点
目录
效果图:
源代码:
效果图:
源代码:
import json
import os
import shutil
import cv2
import numpy as np
from numpy.polynomial.polynomial import Polynomial
def calculate_distance(x1, y1, x2, y2):
return np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
def get_new_group(group_0_x, group_0_y, group_1_x,group_1_y):
# 计算四种组合的距离
dist_head_head = calculate_distance(group_0_x[0], group_0_y[0], group_1_x[0], group_1_y[0]) # 头点和头点
dist_head_tail = calculate_distance(group_0_x[0], grou