First iteration of fake dataset generation

This commit is contained in:
2024-03-22 11:20:07 +01:00
parent 9f34973132
commit 674025fa62
2 changed files with 20 additions and 93 deletions

View File

@@ -1,13 +1,24 @@
from PIL import Image
import numpy
import numpy as np
from matplotlib import pyplot as plt
import sys
sys.path.insert(0, '../../algorithms/distance/')
from rmsdiff import rmsdiff
IMAGE_SIZE = 64
MODE = 'L'
IImage = Image.new(MODE, (IMAGE_SIZE, IMAGE_SIZE))
I = IImage.load()
for y in range(IMAGE_SIZE):
for x in range(IMAGE_SIZE):
I[y, x] = numpy.random.normal(loc = 0, scale = 1, size = 1)
def randomImage(scale):
# Is `np.clip` necessary?
return np.round(np.random.normal(loc = 0, scale = scale, size = (IMAGE_SIZE, IMAGE_SIZE)))
I.show()
prnu = randomImage(scale = 1)
plt.imshow(prnu)
plt.show()
images = [randomImage(scale = 10) + prnu for _ in range(10)]
for image in images:
print(rmsdiff(image, prnu))
print(rmsdiff(contextAdaptiveInterpolator(image), prnu))