示例#1
0
    def get_imagedata( self, cellsize=5 ):
        """Write the matrix out to an PNG bytestream"""

        dmtx = DataMatrixRenderer( self.matrix )
        self.width = dmtx.width
        self.height = dmtx.height
        return dmtx.get_imagedata( cellsize )
示例#2
0
    def image_from_encoder(self):
        if self.matrix_size[0] != self.matrix_size[1]:
            ans = self.add_margins(np.mat(self.matrix), self.regions[1])
            ans = self.add_quiet_zone(ans)
            m = np.array(ans, dtype='u1')
            m[m==0] = 9
            m[m==1] = 0
            m[m==9] = 1
            im = Image.fromarray(m*255)
        else:
            r = DataMatrixRenderer(self.matrix, self.regions[0])
            im = r.get_pilimage(cellsize=1)

        return im
示例#3
0
 def save(self, filename, cellsize=5):
     """Write the matrix out to an image file"""
     dmtx = DataMatrixRenderer(self.matrix, self.regions)
     dmtx.write_file(cellsize, filename)
示例#4
0
 def get_ascii(self):
     """Return an ascii representation of the matrix"""
     dmtx = DataMatrixRenderer(self.matrix, self.regions)
     return dmtx.get_ascii()
示例#5
0
文件: __init__.py 项目: scsi110/mes-1
 def get_ascii(self):
     """Return an ascii representation of the matrix"""
     dmtx = DataMatrixRenderer(self.matrix)
     return dmtx.get_ascii()
示例#6
0
文件: __init__.py 项目: scsi110/mes-1
 def get_imagedata(self, cellsize=5):
     """Write the matrix out to an PNG bytestream"""
     dmtx = DataMatrixRenderer(self.matrix)
     self.width = dmtx.width
     self.height = dmtx.height
     return dmtx.get_imagedata(cellsize)
示例#7
0
文件: __init__.py 项目: scsi110/mes-1
 def save(self, filename, cellsize=5):
     """Write the matrix out to an image file"""
     dmtx = DataMatrixRenderer(self.matrix)
     dmtx.write_file(cellsize, filename)