我有一张从中选择感兴趣区域的照片。现在我要检查黑白和BGR中像素的颜色值是否相似。如果相似,则返回值应为true。如何在python中用opencv实现呢?
def test(file, y1, y2, x1, x2):
img = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
white = (255, 255)
print(img.shape)
roi = img[y1:y2, x1:x2]
print(np.all(video_place is white))
cv2.imshow('image', roi)
cv2.waitKey()
cv2.destroyAllWindows
MfG Felix