我需要比较两个二进制图像。我目前只计算图像上黑色像素的数量,如果它接近模板值或略高于模板值,则表示它们相似。否则,它们就不一样了
这是我在图像上找到黑色像素数的代码
#Get all non-black pixels
count = cv2.countNonZero(thresh_temp)
# get pixel count of image
height, width= thresh_temp.shape
cntPixels = height*width
# compute all black pixels
cntBlack = cntPixels - count
print('This is only black pixels',cntBlack)
目前没有回答
相关问题 更多 >
编程相关推荐