Python:查找特定对角线中的像素

2024-06-02 08:01:09 发布

您现在位置:Python中文网/ 问答频道 /正文

实际上,我在我的所有图片中检索到黑色像素的坐标,如下所示:

frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
xcoords, ycoords = np.where((frame[:, :, 0:3] == [0, 0, 0]).all(2))

但是我想在我的图片的某个特定区域中检索所有黑色像素。但这个区域是这样的:

https://i.stack.imgur.com/YOZZP.png

你能帮我吗


Tags: 区域imgnp图片像素wherearraycv2