Open Craftint opened 3 years ago
The width and height of the resulting image is 70x70 pixels.
The datamatrix itself is 10x10 cells.
The border around the encoded datamatrix is 10 pixels, so 20 in total. That leaves us with 50 pixels, 5 pixels per cell.
If you want to somehow modify this you can cut off the border and resize as needed.
from PIL import Image
import numpy as np
import cv2
img = Image.frombytes('RGB', (encoded_data.width, encoded_data.height), encoded_data.pixels)
img_cv2 = np.array(img)
resized = cv2.resize(img_cv2 , (14,14), interpolation = cv2.INTER_CUBIC)
resized = cv2.resize(img_cv2 , (14,14), interpolation = cv2.INTER_CUBIC)
Result:
Returns
While I have set it to be 10x10.