## 数字图像基本处理
@Fu Xianjun. All Rights Reserved.
## 一、图像读取、显示、保存
## 1.图像读取
# 图像读取
import cv2
img=cv2.imread('dog.jpg')
## 2.图像显示
cv2.imshow('Dog',img)
cv2.waitKey()
cv2.destroyAllWindows()
##3.图像保存
cv2.imwrite('littledoge.jpg',img)
## 二、图像像素处理
使用random.randint 函数随机生成256*256的彩色图像
img = np.random.randint(0,256,size = [256,256,3],dtype = np.uint8)
cv2.imshow("demo",img)
cv2.waitKey()
cv2.destroyAllWindows()
For 循环进行像素访问与修改
img2=np.random.randint(0,256,size = [256,256,3],dtype = np.uint8)
for i in range(0,50):
for j in range(0,100);
for k in range(0,3):
img2[i,j,k]=255 #白色
cv2.imshow("before",imgrad)
cv2.imshow('after',img2)
cv2.waitKey()
cv2.dest