栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

opencv(cv2)处理图片时报错cv2.error: OpenCV(3.4.2) C:Miniconda3conda-bldopencv-suite

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

opencv(cv2)处理图片时报错cv2.error: OpenCV(3.4.2) C:Miniconda3conda-bldopencv-suite

参考:
https://stackoverflow.com/questions/7385465/resize-an-image-and-changing-its-depth
原因:
回答评论1
resize输入输出数值类型或插值类型缺失
because OpenCV resize is missing support for certain combinations of input and output depths (numeric types), and interpolation types
解决方案:
回答评论


转化类型
the image dtype was int64 (in Python). It worked as soon as I used uint8

我的情况是由于原本图片类型为int32 img.astype(‘uint8’)解决
 

img = cv2.imread("images/coffe.jpg")  # 读取图像
dst1 = cv2.resize(img, (500, 500))  # 按照宽500像素、高500像素的大小进行缩放
image=dst1.astype('uint8')
print(image,image.shape)

问题解决

 

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

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

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