Opencv 图像处理
cmd.exe 安装命令行 》pip install opencv-python 》pip install tensorflow 》pip install keras 必须安装tensorflow基础之上 板块一、 几何图形(cv2 图像处理) 图片导入; 图片长宽通道数学; 图片裁剪; 图片输出; 图片保存文件; tu = cv2.imread('image.jpg') (h,w,t)=tu.shape print(tu.shape) cX,cY = (w//2,h//2) print(cX) tl = tu[0:cY,0:cX] tr = tu[0:cY,cX:w] bl = tu[cY:h,0:cX] br = tu[cY:h,cX:w] def zzImage(zhou): plt.imshow(zhou) plt.axis('off') plt.show() zzImage(br) # 裁剪顺序 先y,再x cv2.imwrite('newImage.jpg',image) 封装常用函数 代码块(.py文件) 包含图片旋转代码 import cv2 import matplotlib.pyplot as plt import numpy as np # 读取图片 def imgRead(src): src = cv2.imread(src) return cv2