def __init__(self, text): """Set up the encoder with the input text. This will encode the text, and create a matrix with the resulting codewords""" enc = TextEncoder() codewords = enc.encode(text) self.width = 0 self.height = 0 matrix_size = enc.mtx_size self.matrix = [[None] * matrix_size for _ in range(0, matrix_size)] placer = DataMatrixPlacer() placer.place(codewords, self.matrix)
def __init__(self, text, sz=None): """Set up the encoder with the input text. This will encode the text, and create a matrix with the resulting codewords""" self.image = None enc = TextEncoder() self.codewords = enc.encode(text, sz=sz) self.width = 0 self.height = 0 self.matrix_size = enc.mtx_size self.regions = enc.regions self.matrix = [[None] * self.matrix_size[1] for _ in range(0, self.matrix_size[0])] placer = DataMatrixPlacer() placer.place(self.codewords, self.matrix)