当前位置: 首页>>代码示例>>Python>>正文


Python QR.decode方法代码示例

本文整理汇总了Python中qrtools.QR.decode方法的典型用法代码示例。如果您正苦于以下问题:Python QR.decode方法的具体用法?Python QR.decode怎么用?Python QR.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qrtools.QR的用法示例。


在下文中一共展示了QR.decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scanadd

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def scanadd(name):

    myCode = QR(filename=name)
    if myCode.decode():
        if myCode.data_type == "text":
            print "worked"
            retval=""
            add = False
            start = True
            for x in myCode.data:
                if x in "13" and start:
                    add = True
                    start = False
                    retval+=x
                elif add and x in "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ":
                    retval+=x
                else:
                    add=False
            print "raw",myCode.data
            return retval
            #aystit(retval, amt)
        else:
            print "That isn't text you tricky trickster"
    else:
        print "I can't decode that.  Sorry."
开发者ID:8bitninja3000,项目名称:btcatm,代码行数:27,代码来源:bitcoinc2.py

示例2: decodeFile

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
 def decodeFile(self, fn=None):
     if not fn:
         fn = unicode(QtGui.QFileDialog.getOpenFileName(
             self, 
             u'Open QRCode',
             filter=u'Images (*.png *.jpg);; All Files (*.*)'
             )
         )
     if os.path.isfile(fn):
         qr = QR(filename=fn)
         if qr.decode():
             self.showInfo(qr)
         else:
             QtGui.QMessageBox.information(
                 self,
                 u'Decode File',
                 u'No QRCode could be found in file: <b>%s</b>.' % fn
             )
     else:
         QtGui.QMessageBox.information(
             self,
             u"Decode from file",
             u"The file <b>%s</b> doesn't exist." %
             os.path.abspath(fn),
             QtGui.QMessageBox.Ok
         )
开发者ID:prashantyahide,项目名称:qtqr,代码行数:28,代码来源:qtqr.py

示例3: decode_image

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def decode_image(filename="default.png"):
    """default.png is a sample image. for more qr code images, see http://qrcode.kaywa.com/"""
    my_code = QR(filename=os.path.dirname(os.path.abspath(__file__)) + "/" + filename)
    if my_code.decode():
        print my_code.data
        return my_code.data
    else:
        return None
开发者ID:kai33,项目名称:NaviCane,代码行数:10,代码来源:qrcode_reader.py

示例4: decodeKey

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def decodeKey(file):
	decCode = QR(filename=file)
	if decCode.decode():
		key = decCode.data
		int_key = []
		for b in key.split('/'):
			int_key.append(int(b))
		return int_key 
开发者ID:rolandshoemaker,项目名称:aesQR,代码行数:10,代码来源:aesQR.py

示例5: decodeQRCode

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def decodeQRCode(fileName, path=""):
    """expects fileName is .jpg"""
    myCode = QR(filename = path + fileName)
    if myCode.decode():
        print "decoderen qr gelukt"
        return myCode.data
    else:
        print "decoderen qr gefaald"
        return False
开发者ID:nielsdb,项目名称:zeppelin,代码行数:11,代码来源:camera.py

示例6: decodeAES

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def decodeAES(key, file):
	if isinstance(key, str):
		int_key = hexToKey(key)
	elif isinstance(key, list):
		int_key = key[:]
	AESqr = QR(filename=file)
	if AESqr.decode():
		plaintext = dAES.decrypt(AESqr.data, int_key)
	return plaintext
开发者ID:rolandshoemaker,项目名称:aesQR,代码行数:11,代码来源:aesQR.py

示例7: get_qr_code

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def get_qr_code(image_filename):
    """ Return True if the given image is a front page (based on a QR code)
    or false otherwise. The QR code must contain FRONT_PAGE_CODE to indicate
    that the page is a front page. """
    scanner = QR(filename=image_filename)
    if scanner.decode():
        data = scanner.data
        return data
    else:
        return None
开发者ID:ottobonn,项目名称:exam-normalizer,代码行数:12,代码来源:normalize.py

示例8: qrimg

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def qrimg(lines,filename):
    lines = unicode(lines, "utf-8")
    img=Image.new("RGBA", (380,380),(255,255,255))
    draw = ImageDraw.Draw(img)
    y_text =8 
    for line in lines.splitlines():
        width, height = font.getsize(line)
        draw.text((10,y_text),line,(0,0,0), font=font)
        y_text +=height
        draw = ImageDraw.Draw(img)
    #img = img.resize((380,420))
    img.save(filename)
    thedata = QR(filename=filename)
    if thedata.decode():
        return thedata.data
    else:
        return "Error: " + filename + " "
开发者ID:cyberhack255,项目名称:ctf-solutions,代码行数:19,代码来源:solveqrgrams.py

示例9: decodeFile

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
 def decodeFile(self, fn=None):
     if not fn:
         fn = unicode(
             QtGui.QFileDialog.getOpenFileName(
                 self, self.trUtf8("Open QRCode"), filter=self.trUtf8("Images (*.png *.jpg);; All Files (*.*)")
             )
         )
     if os.path.isfile(fn):
         qr = QR(filename=fn)
         if qr.decode():
             self.showInfo(qr)
         else:
             QtGui.QMessageBox.information(
                 self,
                 self.trUtf8("Decode File"),
                 unicode(self.trUtf8("No QRCode could be found in file: <b>%s</b>.")) % fn,
             )
开发者ID:primetang,项目名称:qrtools,代码行数:19,代码来源:qtqr.py

示例10: btnTakePhotoClick

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
    def btnTakePhotoClick(self, event):
        qr = QR()
        i = 0
        while qr.data == "NULL":
        #while i == 0:
            _filename = '/home/pi/cpi/camera' + str(i) + '.jpg'
            camera = picamera.PiCamera()
            camera.resolution = (300, 300)
            camera.capture(_filename)
            print "gecaptured: " + _filename
            z = qr.decode(_filename)
            print z


            
            bm = wx.Image(_filename, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
            
            #bitmap = wx.Bitmap(QR_IMAGE_FILE)
            #bitmap = self.scale_bitmap(bitmap, 300, 300)    
            #control = wx.StaticBitmap(self, -1, bitmap)
            #control.SetPosition((10, 10))
		
            self.imgQROutgoing.SetBitmap(bm)
            self.textImageWhatToDo.Label="Message: " + qr.data
            #self.Refresh()
            self.Update()
            print "refreshed" 
            #im = Image.open('/home/pi/cpi/camera' + str(i) + '.jpg')
            #pho = ImageTk.PhotoImage(im)
            #label = Label(image = pho)
            #label.image = pho
            #label.pack()
            ##root.update()
            ###frame.update()
            #self.ph.image = pho
            
            
            print "bild camera" + str(i) + ".jpg angezeigt"
            time.sleep(1)
            camera.close()
                #qr.destroy()
            i = i + 1
            print "i ist jetzt: " + str(i)
            print "--------------------------------------"
开发者ID:frischesoftware,项目名称:CryptoPi,代码行数:46,代码来源:main.py

示例11: readqr

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def readqr(data):
        filename = "%s%s.bmp" %(imgpath,str(uuid.uuid4()))
        ##qr mappings
        cmap = {'0': (255,255,255),
                '1': (0,0,0)}

        ## clean up the data
	length = len(data.split("\n"))
        data = data.replace("\n","")

        ##build image
        rawdata = [cmap[letter] for letter in data]
        img = Image.new('RGB', (length, len(data)//length), "white")
        img.putdata(rawdata)
        img.save(filename, 'BMP')

        ##decode image
        myCode = QR(filename=filename)
        if myCode.decode():
                text=myCode.data
                return text.lower()
        else:
                return False
开发者ID:Shad0wSt3p,项目名称:CySCA2015,代码行数:25,代码来源:qrmine_solver.py

示例12: check_image_qr

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
    def check_image_qr(self, path):
        myCode = QR(filename=path)
        if myCode.decode():
            self.qr_link = myCode.data_to_string()
            self.copy_link.set_sensitive(True)
            alert = NotifyAlert(10)
            alert.props.title = _("Code found")
            alert.props.msg = _("Click on toolbar button for "
                "copy link to clipboard.")
            alert.connect("response", lambda x,
                y: self.activity.remove_alert(x))
            self.activity.add_alert(alert)
        else:
            self.qr_link = None
            self.copy_link.set_sensitive(False)
            alert = NotifyAlert(10)
            alert.props.title = _("Code not found")
            alert.props.msg = _("Try again, please focus the Qr "
                "Code in the camera.")
            alert.connect("response", lambda x,
                y: self.activity.remove_alert(x))
            self.activity.add_alert(alert)

        self.stop_play.set_sensitive(False)
开发者ID:i5o,项目名称:qr-reader,代码行数:26,代码来源:activity.py

示例13: QR

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
#!/usr/bin/env python
# encoding: utf-8

from qrtools import QR

if __name__ == '__main__':
    qr = QR(filename='./qr-fix.png')
    if qr.decode():
        print qr.data
开发者ID:marlboromoo,项目名称:il0veCTF,代码行数:11,代码来源:qr.py

示例14: qrdecode

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
def qrdecode(filename):
    qr = QR()
    qr.decode(filename)
    return qr.data
开发者ID:boothandrewd,项目名称:Commencement-Scanner,代码行数:6,代码来源:qr.py

示例15: int

# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import decode [as 别名]
    resolution_level = 9
    
    num_cases = int(sys.stdin.readline())
    
    for num_case in range(num_cases):
        text_squares = sys.stdin.readline().rstrip('\r\n').split()

        squares = [ parse_square(s) for s in text_squares ]

        s = squares[0]
        
        for i in range(1, len(squares)):            
            s = add_squares(s, squares[i])       
               
        qrname = u'case%d_sum.png' % (num_case + 1)
        create_png(qrname, s, resolution_level)
        
        myCode = QR(filename=qrname)
        if myCode.decode():
            #m = md5.new()
            #m.update(myCode.data_to_string())
            #print m.hexdigest()
            secret = myCode.data_to_string()
            # Strip non iso-8859-1 characters
            secret = secret.decode('utf-8')
            secret = secret.encode('iso-8859-1', 'ignore')
            print secret
            
            

开发者ID:spnow,项目名称:TuentiChallenge2013,代码行数:29,代码来源:11-the_escape_from_pixel_island.py


注:本文中的qrtools.QR.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。