当前位置: 首页 > news >正文

五金加工厂怎么做网站上海百度推广官网

五金加工厂怎么做网站,上海百度推广官网,我要做网站推广,企业网站的用户需求前言 在 JavaWeb 开发中#xff0c;一般使用 Zxing 来生成和识别二维码#xff0c;但是#xff0c;Zxing 的识别有点差强人意#xff0c;不少相对模糊的二维码识别率很低。不过就最新版本的测试来说#xff0c;识别率有了现显著提高。 对比 在没接触 Python 之前#xff…前言 在 JavaWeb 开发中一般使用 Zxing 来生成和识别二维码但是Zxing 的识别有点差强人意不少相对模糊的二维码识别率很低。不过就最新版本的测试来说识别率有了现显著提高。 对比 在没接触 Python 之前曾使用 Zbar 的客户端进行识别测了大概几百张相对模糊的图片Zbar的识别速度要快很多识别率也比 Zxing 稍微准确那边一丢丢但是稍微模糊一点就无法识别。相比之下微信和支付宝的识别效果就逆天了。 代码案例 # -*- coding:utf-8 -*- import os import qrcode import time from PIL import Image from pyzbar import pyzbar# 升级 pip 并安装第三方库 pip install -U pip pip install Pillow pip install pyzbar pip install qrcodedef make_qr_code_easy(content, save_pathNone):Generate QR Code by default :param content: The content encoded in QR Codeparams :param save_path: The path where the generated QR Code image will be saved in. If the path is not given the image will be opened by default.img qrcode.make(datacontent) if save_path:img.save(save_path) else:img.show() def make_qr_code(content, save_pathNone):Generate QR Code by given params :param content: The content encoded in QR Code :param save_path: The path where the generated QR Code image will be saved in. If the path is not given the image will be opened by default.qr_code_maker qrcode.QRCode(version2, error_correctionqrcode.constants.ERROR_CORRECT_M, box_size8, border1, ) qr_code_maker.add_data(datacontent) qr_code_maker.make(fitTrue)img qr_code_maker.make_image(fill_colorblack, back_colorwhite) if save_path:img.save(save_path) else:img.show() def make_qr_code_with_icon(content, icon_path, save_pathNone):Generate QR Code with an icon in the center :param content: The content encoded in QR Code :param icon_path: The path of icon image :param save_path: The path where the generated QR Code image will be saved in. If the path is not given the image will be opened by default. :exception FileExistsError: If the given icon_path is not exist. This error will be raised. :return:if not os.path.exists(icon_path): raise FileExistsError(icon_path) # First, generate an usual QR Code image qr_code_maker qrcode.QRCode(version4, error_correctionqrcode.constants.ERROR_CORRECT_H, box_size8, border1, ) qr_code_maker.add_data(datacontent) qr_code_maker.make(fitTrue)qr_code_img qr_code_maker.make_image(fill_colorblack, back_colorwhite).convert(RGBA) # Second, load icon image and resize iticon_img Image.open(icon_path)code_width, code_height qr_code_img.sizeicon_img icon_img.resize((code_width // 4, code_height // 4), Image.ANTIALIAS) # Last, add the icon to original QR Codeqr_code_img.paste(icon_img, (code_width * 3 // 8, code_width * 3 // 8)) if save_path:qr_code_img.save(save_path) else:qr_code_img.show() def decode_qr_code(code_img_path):Decode the given QR Code image, and return the content:param code_img_path: The path of QR Code image.:exception FileExistsError: If the given code_img_path is not exist. This error will be raised. :return: The list of decoded objectsif not os.path.exists(code_img_path):raise FileExistsError(code_img_path) # Here, set only recognize QR Code and ignore other type of codereturn pyzbar.decode(Image.open(code_img_path), symbols[pyzbar.ZBarSymbol.QRCODE], scan_locationsTrue) if __name__ __main__: # # 简易版 # make_qr_code_easy(make_qr_code_easy, make_qr_code_easy.png) # results decode_qr_code(make_qr_code_easy.png) # if len(results): # print(results[0].data.decode(utf-8)) # else: # print(Can not recognize.) # # # 参数版 # make_qr_code(make_qr_code, make_qr_code.png) # results decode_qr_code(make_qr_code.png) # if len(results): # print(results[0].data.decode(utf-8)) # else: # print(Can not recognize.) # # 带中间 logo 的 # make_qr_code_with_icon(https://blog.52itstyle.vip, icon.jpg, make_qr_code_with_icon.png) # results decode_qr_code(make_qr_code_with_icon.png) # if len(results): # print(results[0].data.decode(utf-8)) # else: # print(Can not recognize.) # 识别答题卡二维码 16 识别失败 t1 time.time() count 0 for i in range(1, 33):results decode_qr_code(os.getcwd()\\img\\str(i).png) if len(results): print(results[0].data.decode(utf-8)) else: print(Can not recognize.) count 1 t2 time.time() print(识别失败数量: str(count)) print(测试时间: str(int(round(t2 * 1000))-int(round(t1 * 1000)))) 测试了32张精挑细选的模糊二维码 识别失败数量:1 测试时间:130 使用最新版的 Zxing 识别失败了三张。 源码 以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持脚本之家。
http://www.pierceye.com/news/219756/

相关文章:

  • 厚街做网站的公司wordpress出现百度抓取404页面
  • 四川南充网站建设西安网站建设推广优化
  • 做企业门户网站都连连电商网站开发公司
  • 微商城网站建设价位公司要想做个网站这么弄
  • wordpress文章所属栏目关键词排名优化易下拉教程
  • 网站主题咋做免费网页模板素材网站
  • 网站建设对旅游意义公众号运营策划
  • 成都专业网站制作关于论文网站开发参考文献
  • 免费做代理郑州seo招聘
  • 做网站系统更新后wordpress
  • 兰州网站建站2024免费网站推广
  • 深圳模板建站企业网站出现搜索
  • app开发网站模板该网站正在紧急升级维护中
  • 公众号编辑器365保定seo推广
  • 陕西整站关键词自然排名优化外贸获客渠道有哪些
  • 网站策划需要具备什么福州高端建站
  • 域名注册没有网站美食网页设计素材图片
  • wordpress网站在哪里修改密码ps做网站要求高吗
  • 企业网站带商城源码Audiology wordpress
  • 星月教你做网站东营城乡建设局官网
  • 镇江网站建设开发旺店通erp系统
  • 体育直播网站建设深圳制作小程序
  • 手机微信管理系统搜索引擎优化的流程是什么
  • 壁纸公司网站源码做网站价格表
  • 潜江网站设计商务科技网站建设
  • 合肥企业网站制作网站开发公司简介
  • 德州市建设小学网站文员工作内容
  • 网站域名买卖营销技巧第三季在线观看
  • 西宁市公司网站建设比较网站建设
  • 深圳网站设计公司建设部人才网站