python --- 截图工具 bettercam

获取截图数据
im = camera.get_latest_frame()
im 数据格式是{X, Y, [B, G, R, alpha]},所以需要去掉 alpha
print(f'{im.shape}') if im.shape[2] == 4: # If the image has an alpha channel, remove it im = im[:, :, :3, ]
由于im是BGR格式,如果使用plt显示保存图片,需要先转换为plt支持的RGB格式
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) plt.imsave('C:/Users/Administrator/Desktop/2.png', im) # plt.imshow(im) // 需要 im 是 RGB格式 # plt.show() # 显示图像窗口

浙公网安备 33010602011771号