opencv-python的使用之dtype

版权声明:转发使用请写明文章来源 https://blog.csdn.net/weixin_33278772/article/details/85850168

如果直接使用np.float32格式的数据无法加载图片

必须使用np.unit8类型的数据。

# 数据的转换格式如下
import cv2
import numpy as np
# 使用img.dtype可以查看数据的类型
# 如np.unit8、np.float32
# 图片数据使用np.unit8的数据类型
# 转换
img = img.astype(np.unit8)

猜你喜欢

转载自blog.csdn.net/weixin_33278772/article/details/85850168