-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Description
System information (version)
- OpenCV => 4.2
- Operating System / Platform => Windows 7 64 Bit
- Python 3.8.3
Detailed description
I'm trying to calculate the minEnclosingTriangle, but i'm getting error:
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\copy.cpp:254: error: (-215:Assertion failed) channels() == CV_MAT_CN(dtype) in function 'cv::Mat::copyTo'
here is my code:
import cv2 as cv
import numpy as np
arr = np.array([[0.0, 0.0],[0.0, 1.0],[1.0, 1.0]], dtype=np.float32)
print(arr)
c,r = cv.minEnclosingCircle(arr)
print(c,r)
t,t1 = cv.minEnclosingTriangle(arr)
print(t,t1)
and the output:
λ python triangle.py
[[0. 0.]
[0. 1.]
[1. 1.]]
(0.5, 0.5) 0.7072067856788635
Traceback (most recent call last):
File "triangle.py", line 8, in
t,t1 = cv.minEnclosingTriangle(arr)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\copy.cpp:254: error: (-215:Assertion failed) channels() == CV_MAT_CN(dtype) in function 'cv::Mat::copyTo'
The circle was calculated, so assume the InputArray points should be OK.
What I'm doing wrong?
Reactions are currently unavailable