作者:小郭学数据
源自:快学python
学习视频可参见python+opencv3.3视频教学 基础入门
今天写的是numpy在图像处理中的基本使用
1.获取图片高宽通道及图像反转
# 获取图片高宽通道及图像反转...image.shape[2] #通道数
print("width: %s, height: %s, channels: %s"%(width, height, channels))
#自己写的图像反转...i5处理器
调用opencv的API实现图像反转
#调用opencv的API实现图像反转
def inverse(image):
dst = cv.bitwise_not(image) # 按位取反...([400,400,3],np.uint8)
#将第二通道赋值为255,得到的图像为绿色
img2[:,:,1]=np.ones([400,400])*255
cv.imshow...("threechannels_image",img2)
构造的单通道和三通道图像如下:
?