Вот мой код
Код: Выделить всё
def findHolds(img,detector = None):
img = cv2.GaussianBlur(img, (3, 5), 0)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
otsu, _ = cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
edges = cv2.Canny(img,otsu, otsu * 2, L2gradient = True)
contours, _ = cv2.findContours(edges,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
hulls = map(cv2.convexHull,contours)
mask = np.zeros(edges.shape,np.uint8)
cv2.drawContours(mask, list(hulls),-1, 255, -1)
if detector == None:
# Set up the detector with default parameters.
detector = buildDetector()
keypoints = detector.detect(mask)
return keypoints, hulls
Полная ошибка:
Код: Выделить всё
File "c:\Users\sylva\Documents\IUT\2A\SAE\escalade-en-ar-vr\NeuralClimb-master\Hold Detection\Example.py", line 13, in
holds, contours = hd.findHolds(img, detector)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sylva\Documents\IUT\2A\SAE\escalade-en-ar-vr\NeuralClimb-master\Hold Detection\holdDetector.py", line 96, in findHolds
keypoints = detector.detect(mask)
^^^^^^^^^^^^^^^^^^^^^
cv2.error: Unknown C++ exception from OpenCV code
detector.detect возвращает список координат в соответствии с параметрами детектора, которые вы определили ранее.>
Подробнее здесь: https://stackoverflow.com/questions/798 ... pencv-code