Make Gaussian noise in getPrnuShownAsSuch only on text

This commit is contained in:
2024-03-29 13:22:36 +01:00
parent ec7c5c6688
commit 81852d5dc6
2 changed files with 10 additions and 6 deletions

View File

@@ -31,4 +31,11 @@ def getPrnuShownAsSuch(size, gaussianNoise = 0):
# Center vertically, especially in the case `HEIGHT` > `WIDTH`.
draw.text((0, HEIGHT // 2 - fontSize // 2), TEXT, 255, font = font)
imageNpArray = np.array(imagePil)
return imageNpArray + randomGaussianImage(gaussianNoise, size[::-1])
gaussianNoiseNpArray = randomGaussianImage(gaussianNoise, size[::-1])
#prnuShownAsSuch = imageNpArray + gaussianNoiseNpArray
prnuShownAsSuch = imageNpArray
for y in range(HEIGHT):
for x in range(WIDTH):
if prnuShownAsSuch[y, x] != 0:
prnuShownAsSuch[y, x] += gaussianNoiseNpArray[y, x]
return prnuShownAsSuch