Traceback (most recent call last): File "E:\1作业与文件\智能建造\大作业\cg.py", line 67, in <module> ear = detect_eyes(gray, shape) File "E:\1作业与文件\智能建造\大作业\cg.py", line 35, in detect_eyes left_eye_hull = cv2.convexHull(left_eye) cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'convexHull' > Overload resolution failed: > - points is not a numpy array, neither a scalar > - Expected Ptr<cv::UMat> for argument 'points'
时间: 2024-04-06 07:35:08 浏览: 109
这个错误提示是在使用OpenCV库时出现的,可能是因为传入convexHull函数的参数不符合要求导致的。可以检查一下传入的left_eye参数是否是一个numpy数组。如果不是,可以尝试将其转换为numpy数组再传入函数。另外,还可以检查一下传入的参数类型是否正确,例如是否需要使用Ptr<cv::UMat>类型的参数。
相关问题
Traceback (most recent call last): File "E:\1作业与文件\智能建造\大作业\cg.py", line 69, in <module> frame, ear = detect_eyes(frame, gray, shape) File "E:\1作业与文件\智能建造\大作业\cg.py", line 24, in detect_eyes left_eye_hull = cv2.convexHull(left_eye) cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'convexHull' > Overload resolution failed: > - points is not a numpy array, neither a scalar > - Expected Ptr<cv::UMat> for argument 'points'
这是一个 OpenCV 的错误信息,提示在执行函数 cv2.convexHull() 时出现了错误。可能的原因是传递给该函数的参数类型不正确,参数应该是一个 NumPy 数组或者是一个标量。请检查代码中传递给该函数的参数是否正确,特别是参数的数据类型是否正确。另外,还需要检查是否正确导入了 OpenCV 库。
ft1.1: Traceback (most recent call last): File "D:\小米云盘\桌面\temp1\text.py", line 12, in test_function self.assertEqual(function(2, 0, 4), 7.0) AssertionError: 5.0 != 7.0 Traceback (most recent call last): File "D:\小米云盘\桌面\temp1\text.py", line 12, i
t seems like you have encountered an error while running a test function in a Python script. The error message suggests that an assertion has failed, meaning that the expected output of a function is not equal to the actual output. Specifically, the test function is expecting the result of a function call with arguments (2, 0, 4) to be 7.0, but the actual result is 5.0.
To fix this error, you will need to modify the function being tested to return the correct output. Without seeing the code for the function and the test function, it is difficult to provide more specific advice. However, some common reasons for assertion errors include incorrect logic in the function, incorrect input values, and incorrect expected output values in the test function.
阅读全文