← 返回全部案例

CASE STUDY

2026.10.29–10.30 · 个人项目 · AI 协作

整理于约 5 分钟

二维码实验室:自己能解开,为什么别的扫描器读不出?

二维码实验室从一份已有 HTML 开始:输入内容,生成二维码,再演示纠错和污损。我提出把它接进 Lumi Lab,并保留结构解剖和图片下载。AI 编程工具负责改编与检查,原文件保留。

真正影响可信度的问题出在算法验证。一个实现能把自己生成的码解回来,仍然可能和其他扫描器不兼容。

第一次独立读取,掩模 4 暴露了问题

原编码器的掩模 4 有一处运算符优先级错误:需要对两项之和取模,代码却只对后一项取模。同一套实现里的解码逻辑无法提供足够独立的判断。

历史检查把黑白模块图加上静区,再交给 OpenCV 读取。首轮 32 组里,掩模 4 对应的四组没有读出,其他 28 组成功。这个分布让排查能够聚焦到掩模公式,修复也有了明确的回归目标。

第二个错误,要到较高版本才会出现

版本 7–10 需要额外的版本信息。原稿把相关区域放到了右下方,正确的两份区域应在右上与左下。小尺寸示例没有覆盖这里,同实现往返又可能共同接受错误布局。

后续检查增加了固定 BCH 位和独立参考矩阵。2026 年 10 月 30 日的记录中,336 组模块矩阵与 Project Nayuki 的参考实现一致。这个结果支持已覆盖输入的编码结构一致性,不能延伸成所有扫描环境兼容。

OpenCV 对其中部分图仍表现出分辨率差异,剩余两组由 jsQR 读取成功。我们保留这些差异,没有把某个扫描器一次没读出直接归咎于编码,也没有靠换扫描器隐去失败记录。

污损实验也要说清自己在测什么

页面直接翻转部分数据模块,避开功能图形,再尝试从矩阵恢复。它没有读取相机照片,也不能证明海报上的二维码能扫码。

DENSO WAVE 的说明将纠错比例定义为总码字的比例。因此,滑块上的污损面积不能直接与纠错等级的百分比比较。页面也去掉了未经核验的成功次数,以及“固定尺寸一定可扫”的说法。

我在这次协作中确定产品边界和需要什么证据,AI 修复代码并运行检查。输入为空或超容量时,还需要清除旧的可下载结果,避免读者下载到上一次内容。

本轮写作核对了实现、回归样例和历史验证记录,没有重新运行全部独立扫描。真实手机、印刷样张及 Safari、Firefox 扫码兼容仍未验收。打开二维码实验室时,生成、导出和实际扫码仍是需要分别检查的动作。

QR Studio: when the encoder and decoder agree on the same mistake

QR Studio began as an HTML page that generated codes and illustrated error correction. I asked to integrate it into Lumi Lab, retaining structural explanations and image exports. AI coding tools adapted and checked it; the original file stayed intact.

The main problem was validation: one implementation can decode its own output while disagreeing with independent scanners.

An independent decoder exposed mask 4

The mask-4 formula applied a modulo operation to the wrong part of a sum because of operator precedence. An internal round trip did not provide enough independent evidence.

Historical checks rendered the module grid with a quiet zone and used OpenCV. Of the first 32 cases, the four mask-4 cases failed while the other 28 decoded. That pattern narrowed the investigation to the formula and provided a regression target.

Higher versions revealed another layout error

Versions 7–10 require additional version information. The original placed it in a lower-right region rather than the two upper-right and lower-left regions. Small examples missed this, and a matching decoder could share the error.

The checks added fixed BCH bits and independent reference matrices. The October 30 record reports agreement with Project Nayuki across 336 matrices. This supports structural agreement for the covered inputs, without establishing compatibility in every scanning environment.

OpenCV still showed resolution-dependent behavior on some images. jsQR decoded the remaining two cases. The record retains those differences rather than treating one scanner’s result as the whole verdict.

Define the damage experiment

The page flips data modules while preserving function patterns and decodes the matrix. It does not scan photographs. DENSO WAVE defines correction percentages in terms of total codewords, so damaged area cannot be compared directly with that percentage.

We removed unsupported success counts and universal size claims. Empty or over-capacity input also clears the export state, preventing a download of the preceding code.

I set the product boundary and evidence requirements; AI fixed the implementation and ran checks. This article reviews the source, fixtures, and historical reports without rerunning the independent scans. Real phones, printed samples, Safari, and Firefox remain unverified. In QR Studio, generation, export, and real scanning still require separate checks.