图片处理
import cv2 #============================= #截取图像某一部分ROI(region of interest) mini=cv2.imread('C:/Users/59925/Desktop/pytest/pics/minions-s.jpg') print(mini.shape) cut_mini=mini[0:150,0:150] cv2.imshow('img',cut_mini) #============================ #颜色通道提取 b,g,r=cv2.split(mini) cv2.imshow('b',b) print(b.shape) recover_mini=cv2.merge((b,g,r)) cv2.imshow('recover_mini',recover_mini) print(recover_mini.shape) #只保留一个通道b,其他通道(r,g)设为0 mini[:,:,0]=0 mini[:,:,2]=0 cv2.imshow('b',mini)
标签:mini,截取,imshow,cv2,opencv,shape,print,recover,图片 From: https://www.cnblogs.com/tanyuanqing/p/17478044.html