OpenCV中遍历多张图片并获取各像素点的值

import cv2
import os
import numpy as np

np.set_printoptions(threshold = np.nan)	#这里多加一行代码,防止控制台输出省略号

pic_path = "D:\\test\\"	#图片路径

for file in os.listdir(pic_path):
	file_name = pic_path + file
	img = cv2.imread(file_name)
	for x in range(img.shape[0]):
		for y in range(img.shape[1]):
			px = img[x, y]
			print(px)	#行列每个点的bgr值

你可能感兴趣的:(OpenCV-Python)