(-215:断言失败)npoints> = 0&&函数"contourArea"中的(深度== CV_32F ||深度== CV_32S) [英] (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'contourArea'

查看:2070
本文介绍了(-215:断言失败)npoints> = 0&&函数"contourArea"中的(深度== CV_32F ||深度== CV_32S)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行创建图像的网站代码.

当我运行代码时,它给了我一个错误:

When I run the code it gives me an error:

cv2.error: OpenCV(4.1.0) 
/Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/shapedescr.cpp:274: 
error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) 
in function 'contourArea'

我不确定其背后的原因.

I am not sure about the reason behind it.

推荐答案

该仓库显然是为OpenCV 3.x编写的.但是,您正在OpenCV 4.1上运行.回购代码采用find_contour的轮廓的第二个返回值(find_contours(...)[1]).您应该将1更改为0.

The repo is clearly written for OpenCV 3.x. But, you are running on OpenCV 4.1. Repo code takes find_contour's second return value for contours( find_contours(...)[1] ). You should change 1 to 0.

这篇关于(-215:断言失败)npoints> = 0&&函数"contourArea"中的(深度== CV_32F ||深度== CV_32S)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆