'How to compare similiarity between digital image and the scan-printed digital image

I'm trying to authenticate a Copy Detection Pattern by measuring the similarity between the digital binary (template) CDP and the scanned-printed CDP. A Copy-Detection Pattern (CDP) is a maximum entropy image, that takes full advantage of the information loss principle every time the pattern is printed or scanned, some information is lost about the original digital image.

What I have done for now is:

1. Generate the digital template CDP using numpy-opencv

s = 100
P = 0.3
noise = np.random.choice([0, 255], size=(s,s), p=[P, 1-P])
noise = noise.astype(np.uint8)
cv2.imwrite("noise.png",noise)

This generated a 100 x 100 pixels image with 72 PPI when I inspect its properties.

2. Print the digital template CDP at 600 dpi

To achieve this, first, I edited the image using Photoshop to bump up the PPI to 600 while keeping the pixels' dimension to 100 x 100 then print with the dpi setting set to 600. I got an object-sized 1/6 x 1/6 inch on A4 paper.

3. Scan the printed digital template CDP using a scanner

I scanned the whole A4 paper with a 1200 dpi scanner, next by using Photoshop i crop the object of interest, and I get 200 x 200 px image of the scan-printed digital template CDP

4. Compare the similarity between two images using Hamming distance

scan_printed = cv2.resize(scan_printed,(100,100),interpolation_method) # resize from (200,200) to (100,100) so both images have the same size to be compare
score = hamming(img1,img2)

Is what I have done for now correct? If correct now how can I do it with a mobile phone instead scanner? How to properly resize the scanned printed digital template so I can compare it with the digital template?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source