【发布时间】:2021-08-22 03:38:53
【问题描述】:
我使用以下代码生成图像,然后添加白噪声以最终将形态学运算(打开)应用于最终图像。
**问题 ** - 当我添加带有 UINT8 噪声的 UINT8 图像时,为什么会得到不同的结果(Result-1)
img1 = np.zeros((300,600),np.uint8)
cv2.putText(img1, 'ABCD', org=(100,200), fontFace=cv2.FONT_ITALIC, fontScale=5, color=(255,255,255), thickness=25)
img2 = np.zeros((300,600))
cv2.putText(img2, 'ABCD', org=(100,200), fontFace=cv2.FONT_ITALIC, fontScale=5, color=(255,255,255), thickness=25)
noise1 = np.random.randint(low=0, high=2, size=(300,600), dtype=np.uint8)
noise2 = np.random.randint(low=0, high=2, size=(300,600))
noise1_img1 = img1+(noise1*255)
noise2_img2 = img2+(noise2*255)
noise1_img2 = img2+(noise1*255)
noise2_img1 = img1+(noise2*255)
结果:
【问题讨论】:
标签: python-3.x numpy image-processing computer-vision opencv-python