所以我正在尝试编译以下代码,但它显示了cv2.findContours上的错误.虽然,我使用的是Python 2.7版本.任何原因导致错误:解压缩python 2.7的值太多了?
import cv2
import numpy as np
import time
#Open Camera object
cap = cv2.VideoCapture(0)
#Decrease frame size
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1000)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 600)
def nothing(x):
pass
# Function to find angle between two vectors
def Angle(v1,v2):
dot = np.dot(v1,v2)
x_modulus = np.sqrt((v1*v1).sum())
y_modulus = np.sqrt((v2*v2).sum())
cos_angle = dot / x_modulus / y_modulus
angle = np.degrees(np.arccos(cos_angle))
return angle
# Function to find distance between two points in a list of lists
def FindDistance(A,B):
return np.sqrt(np.power((A[0][0]-B[0][0]),2) + np.power((A[0][1]-B[0][1]),2))
# Creating a …Run Code Online (Sandbox Code Playgroud)