I would like to extract prnu from the Vision dataset.
I am trying to do this by using part of your code in preprocess.py.
Below is my try:
img_path = "D01_I_flat_0001.jpg"
save_name = "prnu.jpg"
# open image with PIL
img = Image.open(img_path)
# centre crop and convert to tensor of dtype uint8
img = CenterCrop(config.centre_crop_size)(img)
img = ToTensor()(img) * 255
img = img.type(torch.uint8)
# save image
torch.save(img, save_name)
# save prnu_lp (with linear pattern)
prnu = extract_prnu_lp(np.array(img).transpose(1, 2, 0))
prnu = prnu.transpose(2, 0, 1)
prnu = torch.from_numpy(prnu)
torch.save(prnu, save_name.replace("rgb", "prnu_lp"))
But the output (prnu.jpg) is not readable as an image.
I need to extract prnu of the Vision dataset to feed my model.
Could you please help me how to apply prnu extractor code to the Vision dataset?