算法与计算机科学nayuki.io编辑精选
一步步生成二维码
Creating a QR Code step by step
2018 — 2024,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 Nayuki 的逐步教程,演示二维码从数据编码、纠错码计算、模块布局到掩码与格式信息的完整生成过程。页面把每一步的中间结果展开,适合想弄懂二维码内部原理的读者。
为什么经久不衰:它把二维码这个日常黑盒拆成可理解的每一步,既有严谨细节又直观,所以多年后仍值得反复阅读。
HN 评论精选
批评教程只讲步骤不讲原理,缺少对“为什么”的解释。
我很欣赏这些步骤,但它没有回答一个在我看来技术教程里经常被忽略的问题:“为什么?”。当然,我明白这里只是创建二维码的步骤,我也可以自己谷歌为什么二维码需要掩码图案,但这不是重点。好的材料应该解释为什么需要这么做,而不是只说应该这么做。哪怕一句话也够了。
asutekku查看英文原文
I appreciate the steps, but this fails to answer a question which, imho, is way too often omitted in tech tutorials, and that’s ”Why?”. Sure, I understand these are just the steps to create a QR code and I could just Google why the QR code needs a masking pattern, but that’s besides the point. A good material would explain why I need it, instead of just saying it should be done. Even one sentence would be sufficient.
分享照片级真实二维码的两步技术方案,并将项目以 Affero 许可证开源。
七年前我有个疯狂的想法,要做照片级真实的二维码。可惜后来被更高优先级的项目拉走了。当时大家一致建议我先别发布,以便靠它赚钱。直到今天,这两件事都没变。我不打算让它继续吃灰,决定以 Affero 许可证开源。制作照片级真实二维码需要两步。第一步是生成 93x93 的抖动单色图像,抖动计算要保留二维码必需的框架/定时位并生成 CRC。第二步是加入颜色信息,作为 186x186 的抖动层;调色板通过空间色彩量化(SCQ)创建,用 93x93 的二维码图像作为可用颜色范围的约束。SCQ 还能稳定用于动画的调色板(网站上没提供这个服务)。这些年网站容易发生数据腐化,我从备份中恢复了大部分缺失部分。大部分功能已恢复,我仍在忙更高优先级的项目。
pickledcods查看英文原文
Seven years ago I had the wildest ideas of creating photo realistic QR's. Sadly, I got pulled away to other projects with higher priority. The unanimous advice given to me at that time was to hold publishing so I could exploit it financially. Until today neither of both have changed. I'm not going to let it catch more dust and decided to open-source it under Affero license. Creating a photo realistic QR requires two steps. The first is to create a 93x93 dithered monochrome image. The dithering is calculated to preserve the mandatory QR framework/timing bits and generating the CRC. The second step is adding colour information as a 186x186 dithered layer. The colour palette is created using Spacial Colour Quantification which uses the 93x93 QR image as constraints on the available colour range. SCQ also stabilises palettes used for animations (a service not made available on the site). During the years the site has been prone to bitrot. I managed to recover most of the missing parts parts from backups. Most of the functionality has been restored and I'm still working with higher priority projects. [0] https://www.qrpicture.com [1] https://github.com/xyzzy/qrpicture
用纸质工具手工生成二维码的趣味实践,说明流程可完全脱离计算机。
隔离期间我设计了一套纯纸质、手工制作二维码的系统。一切都非常纸面化、官僚化,但也很好玩。有查字节的表格、计算 Reed-Solomon 的长表格,甚至还有用来比较不同掩码图案的透明纸片。我的目标是拍一个不用任何计算机、甚至不用计算器来生成二维码的视频。这是可行的,只是可能要花两个小时左右。
flixic查看英文原文
During quarantine I designed a paper-based system for making QR codes by hand. Everything is very papery and bureaucratic, but also fun. Tables to look up bytes, long forms for calculating Reed-Solomon, and even transparent sheets of paper for comparing different masking patterns. My goal is to film a video of generating a QR code without any computers or even calculators. It's possible, just might take two hours or so.
发现大写 URL 可让二维码更紧凑,并推荐 qart 等延伸阅读。
这太棒了。从中我了解到,把 URL 写成大写可以让二维码更紧凑!页面底部的链接也很值得读,尤其是 https://research.swtch.com/qart 。既然 iOS 和 Android 都在原生相机应用里直接支持二维码,我希望二维码能被更广泛地使用。
tln查看英文原文
This is fantastic. From this, I learned that making your URLs uppercase makes for a more compact code! The links at the bottom are great reads as well, especially: https://research.swtch.com/qart I hope that QR codes become more widely used, now that iOS and Android both include QR capabilities directly in the native camera apps.
历次讨论
同类还值得读
位运算技巧集
Bit Twiddling Hacks
斯坦福页面上的经典位运算技巧合集,收录了 popcount、前导/尾随零、位反转、交换、舍入等大量技巧,并附有解释和性能讨论。
算法与计算机科学上首页 8 次 · 2011–2024graphics.stanford.edu编辑精选如何不按平均评分排序
How Not To Sort By Average Rating
经典文章解释了为什么按平均评分排序不可靠:只有少量评价的条目(比如仅一条五星)会轻易排到最前,而评价数量的差异被忽略。
算法与计算机科学上首页 7 次 · 2009–2024evanmiller.org编辑精选数据结构可视化
Data Structure Visualizations
旧金山大学 David Galles 教授制作的数据结构与算法交互式可视化网站,涵盖 B 树、红黑树、排序、图算法等,可逐步操作观察其运行过程。
算法与计算机科学上首页 6 次 · 2011–2021cs.usfca.edu编辑精选1996 年以来的计算机科学最佳论文奖
Best Paper Awards in Computer Science since 1996
Jeff Huang 维护的一个汇总页面,收录了自 1996 年以来计算机科学各主要会议的“最佳论文奖”获奖名单,并按年份和会议整理,方便读者一站式浏览历届获奖论文。
算法与计算机科学上首页 6 次 · 2010–2018jeffhuang.com编辑精选算法(Jeff Erickson)
Algorithms, by Jeff Erickson
伊利诺伊大学 Jeff Erickson 教授的算法课教材,免费在线开放。
算法与计算机科学上首页 5 次 · 2018–2022jeffe.cs.illinois.edu编辑精选