栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

太多值无法解压缩调用cv2.findContours

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

太多值无法解压缩调用cv2.findContours

看来您正在使用OpenCV 3.x版,同时编写用于2.x分支的代码。在这两个分支之间有一些API更改。由于您使用的是Python,因此您将获得方便的帮助-
确保与文档一起使用它。

OpenCV 2.x:

>>> import cv2>>> help(cv2.findContours)Help on built-in function findContours in module cv2:findContours(...)    findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy

OpenCV 3.x:

>>> import cv2>>> help(cv2.findContours)Help on built-in function findContours:findContours(...)    findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy

这意味着在脚本中,

findContours
使用OpenCV 3.x时正确的调用方式类似于

(_, cnts, _) = cv2.findContours(closed.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

更新(2018年12月)

在OpenCV
4.x中,

findContours
仅返回2个值。

>>> help(cv2.findContours)Help on built-in function findContours:findContours(...)    findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy    .   @brief Finds contours in a binary image.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/661280.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号