# -*- coding:utf-8 -*- # @Author len # @Create 2023/10/22 15:07 import cv2 # 读取二维码图像文件 image_path = 'data/red.jpg' image = cv2.imread(image_path) # 获取图像每个像素的颜色值 height, width, _ = image.shape for y in range(height): for x in range(width): # 获取像素的BGR颜色值 b, g, r = image[y, x] # 输出颜色值 print(f"Pixel at ({x}, {y}): R={r}, G={g}, B={b}")