1 分析原因
img, countours, hierarchy = cv2.findContours(edged_img.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
在cv2.findContour()里只返回两个值: contours, hierachy,而要的是contours。
修改如下:
countours, _ = cv2.findContours(edged_img.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
问题解决!!!
1 分析原因img, countours, hierarchy = cv2.findContours(edged_img.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)在cv2.findContour()里只返回两个值: contours, hierachy,而要的是contours。修改如下:countours, _ = cv2.findContours(edged_img.copy(), cv2.RETR_LIST, cv2.CHAIN
nts=
cv
2.find
Contour
s(edged.copy(),
cv
2.RETR_LIST,
cv
2.CHAIN_APPROX_SIMPLE)[1]
cnts=sorted(cnts,key=
cv
2.
contour
Area
,reverse=True)[:5]
问题原因:
该仓库显然是为
OpenCV
3.x编写的.但是,您正在
OpenCV
4.1上运行.回购代码采用find_
contour
的轮廓的第二个返回值(find_
contour
s(...)[1]).您应该将
cnts =
cv
2.find
Contour
s(edged_image.copy(),
cv
2.RETR_LIST,
cv
2.CHAIN_APPROX_SIMPLE)
cnts = cnts[0] if imutils.is_
cv
2() else cnts[1]
cnts = sorted(cnts, key=
cv
2.
contour
Area
, reverse=True)[:5]
OpenCV
(4.1.1) error: (-215:Assertion failed) n
points
>
error: (-215:Assertion failed) n
points
>= 0
&&
(
depth
==
CV
_
32F
||
depth
==
CV
_
32F
||
depth
==
CV
_
32S
【解决】error: (-215:Assertion failed) n
points
>= 0 && (
depth
==
CV
_
32F
||
depth
==
CV
_
32S
) in
function
‘
cv
::
contour
Area
’
In
OpenCV
3.4:
image,
contour
s, hierarchy=
cv
2.find
Contour
s(image,...
在做视觉里程计时,之间套用高博slam14讲的方法时
报错
:
OpenCV
Error: Assertion failed ((type ==
CV
_8U && dtype ==
CV
_
32S
) || dtype ==
CV
_
32F
) in batchDistance
原因:Since SIFT and SURF return a detectorType() of
CV
32F
(=...