![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
田遥远
这个作者很懒,什么都没留下…
展开
-
findContours,ValueError: too many values to unpack (expected 2)报错
源代码发生报错:contours, hierarchy = cv2.findContours(imgThreshold, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # FIND ALL CONTOURSValueError: too many values to unpack (expected 2)contours, hierarchy = cv2.findContours(imgThreshold, cv2.RETR_EXTERNAL, cv2.CHA原创 2020-08-10 09:24:37 · 374 阅读 · 0 评论 -
python保存图片到目录,如果不存在该目录,则创建该目录
import cv2import osimg = cv2.imread('img.jpg', 1) # 读取img图片dirs = 'result/10' # 想要保存的路径if not os.path.exists(dirs): # 如果不存在路径,则创建这个路径,关键函数就在这两行,其他可以改变 os.makedirs(dirs)path = dirs+'/'+'img.jpg' # 将文件路径与文件名进行结合,得到完整的文件路径以及名称cv2.imwrite(pa原创 2020-08-06 15:36:26 · 5181 阅读 · 0 评论