OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 3887|回复: 5

刚安装opencv后运行cv2.findContours函数时报错

[复制链接]
发表于 2019-1-19 17:53:26 | 显示全部楼层 |阅读模式
image, contours, hier = cv2.findContours(thresh, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)
有大佬知道这要怎么弄吗

回复

使用道具 举报

发表于 2019-1-23 20:41:39 | 显示全部楼层
首先看看你的图片,是否灰度化了?是否正确读到了?
回复 支持 反对

使用道具 举报

发表于 2019-2-5 21:53:07 | 显示全部楼层
图片数据类型好像需要变为无符号32位的,8位不够。
回复 支持 反对

使用道具 举报

发表于 2019-2-16 10:42:45 | 显示全部楼层
楼主的代码我咋有点看不懂...
回复 支持 反对

使用道具 举报

发表于 2019-2-21 09:54:49 | 显示全部楼层
使用的版本:opencv3.0.0
出现的前置条件:两张待对比的图片,
方法是:Core.absdiff(img1, img2, img);
错误信息: OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in cv::arithm_op, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\arithm.cpp, line 1987 Exception in thread "main" CvException [org.opencv.core.CvException
问题:两张图片长宽px一致的时候没有问题,但是长宽一旦有点差别就会出现该错误。是不是这个方法要求就是保存两张图片长宽一致?或者有其他更好的方法?

回复 支持 反对

使用道具 举报

发表于 2019-2-21 10:02:01 | 显示全部楼层
为啥我发不了帖子
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-3-29 13:54 , Processed in 0.008784 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表