Add splitNxN
compatible with 1
and 4
This commit is contained in:
parent
60eceb575e
commit
4bf9ef8206
@ -30,8 +30,9 @@ IMAGE_SIZE_SHAPE_4x4 = [size // 4 for size in IMAGE_SIZE_SHAPE]
|
||||
|
||||
np.random.seed(0)
|
||||
|
||||
splitNxN = 4
|
||||
#prnuNpArray = 255 * randomGaussianImage(scale = PRNU_FACTOR, size = IMAGE_SIZE_SHAPE)
|
||||
prnuPil = Image.open('prnu_4x4_noise.png').convert('F')
|
||||
prnuPil = Image.open(f'prnu_{"4x4_" if splitNxN == 4 else ""}noise.png').convert('F')
|
||||
prnuNpArray = np.array(prnuPil) * PRNU_FACTOR
|
||||
|
||||
def isIn256Range(x):
|
||||
@ -45,8 +46,8 @@ for imageName in os.listdir(datasetPath):
|
||||
imageWithoutPrnuPil = Image.open(imagePath).convert('F')
|
||||
imageWithoutPrnuNpArray = np.array(imageWithoutPrnuPil)
|
||||
|
||||
m = imageWithoutPrnuNpArray.shape[0] // 4
|
||||
n = imageWithoutPrnuNpArray.shape[1] // 4
|
||||
m = imageWithoutPrnuNpArray.shape[0] // splitNxN
|
||||
n = imageWithoutPrnuNpArray.shape[1] // splitNxN
|
||||
|
||||
imageWithoutPrnuNpArrayTiles = [imageWithoutPrnuNpArray[x : x + m, y : y + n] for x in range(0, imageWithoutPrnuNpArray.shape[0], m) for y in range(0, imageWithoutPrnuNpArray.shape[1], n)]
|
||||
for imageWithoutPrnuNpArrayTile in imageWithoutPrnuNpArrayTiles:
|
||||
|
Loading…
Reference in New Issue
Block a user