+
setSidebarOpen(value => !value)}>
+ {sidebarOpen ? '✕' : '☰'}
+ 目录
+
+
+ {sidebarOpen ? (
+
setSidebarOpen(false)} />
+ ) : null}
+
+
+
+
setSidebarCollapsed(value => !value)}
+ title={sidebarCollapsed ? '展开目录' : '折叠目录'}
+ aria-label={sidebarCollapsed ? '展开目录' : '折叠目录'}
+ aria-expanded={!sidebarCollapsed}
+ aria-controls="tutorial-navigation"
+ >
+ {sidebarCollapsed ? '☰' : '◀'}
+
+
+
+
+ {active === 0 ? (
+
goTo(1)} />
+ ) : currentChapter ? (
+
+
+ §{active}.
+ {currentChapter.title}
+
+ {currentChapter.badgeLabel}
+
+
+ {currentChapter.bridge}
+ {currentChapter.analogy ? : null}
+
+ {currentChapter.insight ? : null}
+ {currentChapter.equations?.length ? (
+
+ 原论文公式
+ {currentChapter.equations.map(id => (
+
+ ))}
+
+ ) : null}
+ {currentChapter.takeaways.length > 0 ? : null}
+ {currentChapter.transition ? (
+
+ ) : null}
+
+ ) : hasBili ? (
+
+ ) : null}
+
+
+
+
+ ← 上一页
+
+
+ {active + 1} / {lastSlide + 1}
+
+
+ {active === lastSlide - 1 && hasBili ? '延伸视频 →' : '下一页 →'}
+
+
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/AnalogyCard.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/AnalogyCard.tsx
new file mode 100644
index 00000000..160f1571
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/AnalogyCard.tsx
@@ -0,0 +1,32 @@
+import type { AnalogyCard as AnalogyCardDef } from '../types';
+import { widgetRegistry } from '../modules/registry';
+import { Figure } from './Figure';
+import '../styles/animation-intro.css';
+
+// Life-metaphor analogy card (560x140 canvas animation OR an optional paper figure).
+export function AnalogyCard({
+ analogy,
+ chapterId,
+}: {
+ analogy: AnalogyCardDef;
+ chapterId: string;
+}) {
+ const Widget = analogy.componentId ? widgetRegistry[analogy.componentId] : undefined;
+ return (
+
+
+ {analogy.title}
+
+
+
+ {Widget ? (
+
+ ) : analogy.figure ? (
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/BiliVideos.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/BiliVideos.tsx
new file mode 100644
index 00000000..dd0de185
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/BiliVideos.tsx
@@ -0,0 +1,75 @@
+import React, { useState, useCallback } from 'react';
+import type { BiliDef } from '../types';
+import { useBiliVideos, BiliCard } from '../lib/useBiliVideos';
+
+// Optional Bilibili recommendations. Renders whenever >=1 real BVID is passed.
+// Cards are ALWAYS shown from the static `it` data (title + optional baked-in cover),
+// so a failed runtime metadata fetch can never hide a video. The runtime fetch only
+// enriches with live views/duration and can supply a cover when none is baked in.
+// UI copy is Simplified Chinese.
+export function BiliVideos({ items }: { items: BiliDef[] }) {
+ const bvids = items.map((i) => i.bvid);
+ const [data, setData] = useState
>({});
+ // Track per-card cover load failures so we can fall back to the gradient
+ // placeholder instead of showing a broken-image icon.
+ const [imgError, setImgError] = useState>({});
+
+ const onLoad = useCallback((bvid: string, d: BiliCard | null) => {
+ setData((prev) => ({ ...prev, [bvid]: d }));
+ }, []);
+ useBiliVideos(bvids, onLoad);
+
+ const real = items.filter((i) => i.bvid && i.bvid.startsWith('BV'));
+
+ return (
+
+ 延伸学习 · B 站讲解视频
+ 推荐几个相关的视频讲解,帮助加深理解。
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterBridge.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterBridge.tsx
new file mode 100644
index 00000000..32ce6348
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterBridge.tsx
@@ -0,0 +1,13 @@
+// Chapter bridge ("本节作用") — the one-line role statement above each chapter body.
+// Content is generated by the skill (trusted), so inline HTML (e.g. ) is allowed.
+export function ChapterBridge({ text }: { text: string }) {
+ return (
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterModules.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterModules.tsx
new file mode 100644
index 00000000..62a91815
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/ChapterModules.tsx
@@ -0,0 +1,48 @@
+import { useState } from 'react';
+import type { ChapterDef } from '../types';
+import { Module } from './Module';
+
+export function ChapterModules({ chapter, paperSource }: { chapter: ChapterDef; paperSource?: string }) {
+ const first = chapter.modules[0]?.id;
+ const [selection, setSelection] = useState({ active: first, visited: new Set([first]) });
+ if (chapter.modules.length < 2) {
+ return first ? : null;
+ }
+
+ if (chapter.stackModules) {
+ return (
+
+ {chapter.modules.map(module => (
+
+ ))}
+
+ );
+ }
+
+ function show(id: string) {
+ setSelection(previous => ({ active: id, visited: new Set([...previous.visited, id]) }));
+ }
+
+ return (
+
+
+ {chapter.modules.map(module => (
+ show(module.id)}
+ >
+ {module.tabLabel ?? module.title}
+
+ ))}
+
+ {chapter.modules.filter(module => selection.visited.has(module.id)).map(module => (
+
+
+
+ ))}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Figure.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Figure.tsx
new file mode 100644
index 00000000..c057dbf5
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Figure.tsx
@@ -0,0 +1,24 @@
+// Optional paper-figure display. `src` is a path under /public (e.g. "./images/fig1.png")
+// or an absolute URL. Figures are OPTIONAL (per contract.md §7/figures): only render when
+// the generator supplies `src`. UI copy is Simplified Chinese where present.
+
+export function Figure({
+ src,
+ alt,
+ caption,
+ source,
+}: {
+ src?: string;
+ alt?: string;
+ caption?: string;
+ source?: string;
+}) {
+ if (!src) return null;
+ return (
+
+
+ {caption ? {caption} : null}
+ {source ? 在论文中查看 ↗ : null}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Formula.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Formula.tsx
new file mode 100644
index 00000000..201f35c7
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Formula.tsx
@@ -0,0 +1,44 @@
+import { useId, useState } from 'react';
+import type { FormulaDef } from '../types';
+
+export function Formula({ formula, paperSource }: { formula: FormulaDef; paperSource?: string }) {
+ const [active, setActive] = useState(0);
+ const explanationId = useId();
+ const titleId = useId();
+ const symbol = formula.symbols[active];
+ const equation = '' + formula.mathml + ' ';
+
+ return (
+
+
+ {formula.lead}
+
+ {symbol ? (
+
+
+ {formula.symbols.map(({ sym }, index) => (
+ setActive(index)}
+ >
+ {sym}
+
+ ))}
+
+
{symbol.desc}
+
+ ) : null}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Hero.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Hero.tsx
new file mode 100644
index 00000000..3f305a0c
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Hero.tsx
@@ -0,0 +1,64 @@
+import type { Meta, HeroConfig } from '../types';
+import { widgetRegistry } from '../modules/registry';
+import '../styles/animation-intro.css';
+
+// Hero (slide 0): paper metadata + old/new two-column contrast. Each side may
+// show a canvas widget (componentId) and/or a paper figure.
+export function Hero({
+ meta,
+ hero,
+ onStart,
+}: {
+ meta: Meta;
+ hero: HeroConfig;
+ onStart: () => void;
+}) {
+ const OldWidget = hero.oldMethod.componentId ? widgetRegistry[hero.oldMethod.componentId] : undefined;
+ const NewWidget = hero.newMethod.componentId ? widgetRegistry[hero.newMethod.componentId] : undefined;
+
+ return (
+
+
+
{meta.titleZh}
+
+ {meta.titleEn} · {meta.venue}
+
+
{meta.coreInsight}
+
+
开始教程
+ {meta.paperSource ?
论文原文 ↗ : null}
+
+
+ {(meta.keywords || []).map((k, i) => (
+
+ {k}
+
+ ))}
+
+
+
+
+
逐块独立编码
+
+
+ {OldWidget ?
: null}
+ {hero.oldMethod.figure ? (
+
+ ) : null}
+
+
+
+
联合稀疏编码
+
+
+ {NewWidget ?
: null}
+ {hero.newMethod.figure ? (
+
+ ) : null}
+
+
+
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/InsightBar.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/InsightBar.tsx
new file mode 100644
index 00000000..b73a90ef
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/InsightBar.tsx
@@ -0,0 +1,4 @@
+// Insight bar (💡). Rendered only when a chapter supplies `insight`.
+export function InsightBar({ text }: { text: string }) {
+ return
;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Module.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Module.tsx
new file mode 100644
index 00000000..f8e77b12
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Module.tsx
@@ -0,0 +1,36 @@
+import type { ModuleDef } from '../types';
+import { widgetRegistry } from '../modules/registry';
+import { Figure } from './Figure';
+
+const evidenceLabels = { demo: '教学演示', paper: '论文结果', extension: '教学扩展' };
+
+export function Module({ module, chapterId, paperSource }: { module: ModuleDef; chapterId: string; paperSource?: string }) {
+ const Widget = widgetRegistry[module.componentId];
+ const figure = module.figure;
+ const figureSource = paperSource && figure?.page ? paperSource + '#page=' + figure.page : paperSource;
+ return (
+
+
+ {module.id}
+
{module.title}
+ {module.evidence ? {evidenceLabels[module.evidence]} : null}
+
+
+
+ {Widget ? (
+
+ ) : (
+
+ 此互动模块暂时无法加载。
+
+ )}
+ {figure ? (
+
+ 查看论文原图
+
+
+ ) : null}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Takeaway.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Takeaway.tsx
new file mode 100644
index 00000000..8656e016
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/components/Takeaway.tsx
@@ -0,0 +1,20 @@
+import React from 'react';
+import type { Takeaway as TakeawayDef } from '../types';
+
+// Three-item chapter takeaway (🎯 🔧 ✨). Reused at the end of every chapter.
+export function Takeaway({ items }: { items: TakeawayDef[] }) {
+ return (
+
+ {items.map((it, i) => (
+
+ {i > 0 ? →
: null}
+
+
{it.icon}
+
{it.title}
+
{it.desc}
+
+
+ ))}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/paper-equations.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/paper-equations.ts
new file mode 100644
index 00000000..a54e1345
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/paper-equations.ts
@@ -0,0 +1,188 @@
+import type { FormulaDef, PaperEquationId } from '../types';
+
+const sub = (base: string, index: string) => `${base} ${index} `;
+const index = (name: string) => `${name} `;
+const yi = sub('𝐲', index('i'));
+const yj = sub('𝐲', index('j'));
+const yl = sub('𝐲', index('l'));
+const ai = sub('𝛂', index('i'));
+const aij = sub('𝛂', 'i j ');
+const Ai = sub('𝐀', index('i'));
+const Si = sub('S', index('i'));
+const ri = sub('𝐑', index('i'));
+const rj = sub('𝐑', index('j'));
+const one = sub('𝟏', index('m'));
+const D = '𝐃 ';
+const epsilon = sub('ε', index('i'));
+const pq = 'p , q ';
+
+const sum = (variable: string, end: string) =>
+ `∑ ${variable} = 1 ${end} `;
+const groupSum = `∑ j ∈ ${Si} `;
+const minimize = (variables: string) => `min ${variables} `;
+const normBase = (expr: string) => `∥ ${expr}∥ `;
+const norm = (expr: string, order: string) => `${normBase(expr)}${order} `;
+const squaredNorm = (expr: string) => `${normBase(expr)}2 2 `;
+const difference = (left: string, right: string) => `${left}− ${right}`;
+const kernel = (patch: string) => `${sub('K', index('h'))}( ${difference(yi, patch)}) `;
+const subjectTo = 's.t. ';
+const all = (variable: string) => `∀ ${variable} `;
+const rows = (lines: string[]) => '' + lines
+ .map(line => '' + line + ' ').join('') + ' ';
+
+export const paperEquations: Record = {
+ 1: {
+ label: '式(1)',
+ page: 2,
+ title: '非局部均值怎样借用相似块',
+ lead: '论文先用非局部均值解释图像自相似。两块越接近,候选像素在加权平均里通常越有分量。分母把所有权重归一化。',
+ mathml: `𝐱 [ i ] = ${sum('j', 'n')}
+ ${kernel(yj)} ${sum('l', 'n')}${kernel(yl)}
+ 𝐲 [ j ] `,
+ symbols: [
+ { sym: 'Kₕ', desc: '以 h 为带宽的高斯核。两块越相似,核权重通常越大。' },
+ { sym: '𝐲ᵢ、𝐲ⱼ', desc: '分别围绕第 i 个、第 j 个像素提取的观测图块。' },
+ { sym: '𝐱[i]、𝐲[j]', desc: '𝐱[i] 是目标像素的估计,𝐲[j] 是候选像素的观测值。' },
+ ],
+ },
+ 2: {
+ label: '式(2)',
+ page: 2,
+ title: '用固定字典估计一个图块',
+ lead: '在误差预算 ε 内选尽量稀疏的系数。演示取 p = 0,比较用了多少个原子。约束中的 α 沿用原文记号。',
+ mathml: `${minimize(`${ai}∈ ℝ k `)}
+ ${norm(ai, index('p'))}${subjectTo}${squaredNorm(difference(yi, D + '𝛂 '))}≤ ε `,
+ symbols: [
+ { sym: '𝐃', desc: '固定的字典,每列是一种可以用于组合的图块原子。' },
+ { sym: '𝛂ᵢ', desc: '第 i 个图块的 k 维编码,记录各字典原子的权重。' },
+ { sym: 'ε', desc: '观测与重建之间允许的平方误差上限。' },
+ ],
+ },
+ 3: {
+ label: '式(3)',
+ page: 2,
+ title: '从图像学习适合自己的字典',
+ lead: '在独立稀疏编码中,把每块的稀疏度相加,同时学习各块的系数和一套共同字典。',
+ mathml: rows([
+ `${minimize(`${D}∈ 𝒞 , 𝐀 `)}${sum('i', 'n')}${norm(ai, index('p'))}`,
+ `${subjectTo}${squaredNorm(difference(yi, D + ai))}≤ ε `,
+ ]),
+ symbols: [
+ { sym: '𝒞', desc: '列向量具有单位二范数的字典集合。' },
+ { sym: '𝐀', desc: '把独立编码的系数按列排在一起,每列对应一个图块。' },
+ { sym: 'p', desc: '决定稀疏度量。论文讨论 p = 0 与 p = 1。' },
+ ],
+ },
+ 4: {
+ label: '式(4)',
+ page: 3,
+ title: '独立编码时如何平均',
+ lead: '把每个恢复块放回原位置。在原文每个像素有 m 份估计的设定下,求和后除以 m。',
+ mathml: `𝐱 = 1 m ${sum('i', 'n')}${ri}${D}${ai}`,
+ symbols: [
+ { sym: '𝐑ᵢ', desc: '把第 i 个重建块放回整图的插入矩阵。' },
+ { sym: 'm', desc: '此处原文设定下,每个像素由 m 个重叠块估计。' },
+ ],
+ },
+ 5: {
+ label: '式(5)',
+ page: 3,
+ title: '用系数矩阵的行表达共享原子',
+ lead: '把一组相似块的系数排成矩阵。每列对应一个块,每行对应同一个原子,按行度量就能把原子选择联在一起。',
+ mathml: `${norm('𝐀 ', pq)}≜ ${sum('i', 'k')}
+ ${normBase('𝛂 i ')}q p `,
+ symbols: [
+ { sym: '𝛂ⁱ', desc: '系数矩阵的第 i 行,描述同一个原子在各图块中的系数。' },
+ { sym: 'p、q', desc: '原文讨论 (1, 2) 与 (0, ∞)。后者统计系数矩阵有多少行参与重建。' },
+ ],
+ },
+ 6: {
+ label: '式(6)',
+ page: 3,
+ title: '用块距离决定相似组',
+ lead: '比较整个图块的灰度结构。距离的平方不超过阈值 ξ,候选块就进入第 i 组。',
+ mathml: `${Si}≜ { j = 1 , … , n
+ ${subjectTo}${squaredNorm(difference(yi, yj))}≤ ξ } `,
+ symbols: [
+ { sym: 'Sᵢ', desc: '以图块 i 为参考得到的相似块索引集合。' },
+ { sym: 'ξ', desc: '入组的平方欧氏距离阈值。越严格的阈值会留下更少的候选块。' },
+ ],
+ },
+ 7: {
+ label: '式(7)',
+ page: 3,
+ title: '联合编码 · 固定字典,求一组图块的系数',
+ lead: '最小化符号下只有系数矩阵 Aᵢ,字典 D 已经给定。最终重建采用 ℓ₀,∞,即在整组的拟合误差不超过 εᵢ 时,尽量少启用原子行。',
+ mathml: rows([
+ `${minimize(Ai)}${norm(Ai, pq)}`,
+ `${subjectTo}${groupSum}${squaredNorm(difference(yj, D + aij))}≤ ${epsilon}`,
+ ]),
+ symbols: [
+ { sym: '𝐀ᵢ', desc: '第 i 个相似组的系数矩阵。每个列向量可以取不同数值。' },
+ { sym: '𝛂ᵢⱼ', desc: '在第 i 个相似组中,为第 j 个图块求出的系数。' },
+ { sym: 'εᵢ', desc: '整组的平方重建误差上限。' },
+ ],
+ },
+ 8: {
+ label: '式(8)',
+ page: 4,
+ title: '字典学习 · 用所有图块组一起更新字典',
+ lead: '最小化符号下同时有 D 和各组的 Aᵢ。论文用 ℓ₁,₂ 度量各组的稀疏性,并用组大小归一化各组的代价。所有组共同决定字典中的原子应该长什么样。',
+ mathml: rows([
+ `${minimize(`( ${Ai}) i = 1 n
+ , ${D}∈ 𝒞 `)}${sum('i', 'n')}
+ ${norm(Ai, pq)}| ${Si}| p `,
+ `s.t. ${all('i')}${groupSum}
+ ${squaredNorm(difference(yj, D + aij))}≤ ${epsilon}`,
+ ]),
+ symbols: [
+ { sym: '|Sᵢ|ᵖ', desc: '相似组的大小的 p 次幂,用来归一化该组在目标函数中的代价。' },
+ { sym: '𝐃 ∈ 𝒞', desc: '可学习的字典,其列向量具有单位二范数。' },
+ ],
+ },
+ 9: {
+ label: '式(9)',
+ page: 4,
+ title: '把相似组的恢复结果融合成整图',
+ lead: '有的像素收到更多估计。先累加所有还原块,再按每个像素真正收到的次数逐点归一化。',
+ mathml: rows([
+ `𝐱 = diag (
+ ${sum('i', 'n')}${groupSum}${rj}${one}) − 1 `,
+ `× ${sum('i', 'n')}${groupSum}${rj}${D}${aij}`,
+ ]),
+ symbols: [
+ { sym: '𝐑ⱼ𝟏ₘ', desc: '把块中的全一向量回填到整图,对覆盖到的每个像素计一次。' },
+ { sym: 'diag(…)⁻¹', desc: '用覆盖次数构成对角矩阵并取逆,实现每个像素各除以自己的次数。' },
+ { sym: '𝐑ⱼ𝐃𝛂ᵢⱼ', desc: '把第 i 组中第 j 块的恢复结果放回原图位置。' },
+ ],
+ },
+ 10: {
+ label: '式(10)',
+ page: 5,
+ title: '补色时只约束已经采样的位置',
+ lead: 'Bayer 掩码筛出实际测到的颜色。原文这一步要求候选重建在实测位置吻合,其余分量由字典和组稀疏约束共同估计。',
+ mathml: rows([
+ `${minimize(`${Ai}∈ ℝ k × | ${Si}| `)}
+ ${norm(Ai, '0 , ∞ ')}`,
+ `${subjectTo}${all('j')}${sub('M', index('j'))}(
+ ${difference(yj, sub('𝐃', '0 ') + aij)}) = 0 `,
+ ]),
+ symbols: [
+ { sym: 'Mⱼ', desc: '第 j 个图块的 Bayer 掩码,只保留实测颜色分量上的残差。' },
+ { sym: '𝐃₀', desc: '从自然彩色图像预学得到的初始字典。' },
+ { sym: '𝐀ᵢ', desc: '第 i 组的系数矩阵,用参与重建的行数衡量共享原子的多少。' },
+ ],
+ },
+ psnr: {
+ label: '§4.1 注 5',
+ page: 5,
+ title: '原文怎样把误差换算成 PSNR',
+ lead: '原文对 0–255 强度范围写出下面的指标。教学 RAW 演示用 0–1 归一化读数,峰值相应取 1。',
+ mathml: `PSNR = 10 log 10
+ ( 255 2 MSE ) `,
+ symbols: [
+ { sym: 'MSE', desc: '在同一评价区域内,把恢复结果与参考值之差平方后取平均。' },
+ { sym: '255', desc: '原文评估图像强度的最大值。结果以 dB 为单位,数值越高代表平方误差越小。' },
+ ],
+ },
+};
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/tutorial.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/tutorial.ts
new file mode 100644
index 00000000..868f2d9c
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/data/tutorial.ts
@@ -0,0 +1,462 @@
+import type { TutorialData } from '../types';
+
+export const tutorial: TutorialData = {
+ "meta": {
+ "titleEn": "Non-local Sparse Models for Image Restoration",
+ "titleZh": "非局部稀疏模型与 RAW 图像恢复",
+ "venue": "ICCV 2009",
+ "authors": "Julien Mairal、Francis Bach、Jean Ponce、Guillermo Sapiro、Andrew Zisserman",
+ "affiliation": "INRIA · ENS · University of Minnesota · University of Oxford",
+ "domain": "计算摄影与图像恢复",
+ "coreProblem": "从含噪的 Bayer 传感器读数中保留纹理,并恢复每个位置缺失的颜色。",
+ "coreInsight": "让相似图块共用一组字典原子,各自估计系数,再融合重叠位置的恢复结果。",
+ "paperSource": "https://www.di.ens.fr/~fbach/iccv09_mairal.pdf",
+ "keywords": [
+ "Bayer RAW",
+ "图块自相似",
+ "联合稀疏编码",
+ "去马赛克"
+ ]
+ },
+ "hero": {
+ "oldMethod": {
+ "desc": "看两块本应相似的瓷砖分别选印模。噪声会改变各块所选的纹样,修补后可能出现形状差异。",
+ "componentId": "paper-canvas"
+ },
+ "newMethod": {
+ "desc": "看同一种印模怎样保住两块砖的共有纹样。联合编码共享用于恢复的原子,每块仍可保留自己的纹样深浅。",
+ "componentId": "hero-joint"
+ }
+ },
+ "chapters": [
+ {
+ "kind": "chapter",
+ "id": "chap-1",
+ "route": "bayer-raw",
+ "title": "RAW 图像恢复要解决什么",
+ "badge": "inf",
+ "badgeLabel": "输入",
+ "bridge": "相机拍到的 Bayer RAW 有两道待解的问题。怎样从带噪读数中保住真实细纹,又怎样补出每个位置缺失的两种颜色分量?",
+ "modules": [
+ {
+ "kind": "module",
+ "id": "1.1",
+ "title": "平滑会留下多少纹理",
+ "tabLabel": "平滑与纹理",
+ "desc": "为什么平滑会抹掉细节? 在没有噪声时,砖纹本身就有明暗交界。局部平均用当前格和左右邻格的平均值替代当前读数。在平坦区域,平均能减弱随机起伏。一旦邻域跨过明暗交界,暗格会被拉亮,亮格会被压暗,原有的纹理边缘也会变钝。在图上怎么判断? 左边是含噪读数,右边是处理预览,虚线是加噪前的灰度。点击「应用局部平均」,先看宽条纹内部的波动,再看细条纹还能否分辨。",
+ "componentId": "raw-motivation",
+ "evidence": "demo"
+ },
+ {
+ "kind": "module",
+ "id": "1.2",
+ "title": "Bayer 只测一个颜色分量",
+ "tabLabel": "Bayer 采样",
+ "desc": "一个 Bayer 采样点测到了什么? 每个感光点前面只有红、绿、蓝中的一种滤色片。以演示的左上角为例,它只测到绿色,红色和蓝色都留待估计。如果绿色读数带噪,去噪 要把这一个已测值估得更准。去马赛克 再用周围的采样值估计缺失的红色和蓝色,从而得到完整 RGB。在图上怎么判断? 点击「下一步」,先看第一行的采样分布,再看整块。右侧的斜线表示缺测。4 × 4 的 16 个位置只提供 16 个读数,另外 32 个颜色分量需要补出。",
+ "componentId": "bayer-mask",
+ "evidence": "demo"
+ }
+ ],
+ "insight": "论文的实拍流程先在 Bayer RAW 上去噪,再去马赛克。",
+ "transition": "局部平均会跨过明暗边界。图像里还有哪些位置能为保留这段纹样提供线索?",
+ "takeaways": [
+ {
+ "icon": "🔍",
+ "title": "含噪观测",
+ "desc": "RAW 保留传感器读到的值,低光下仍可能有明显噪声。"
+ },
+ {
+ "icon": "🧩",
+ "title": "每点一色",
+ "desc": "二值掩码记录像素位置实际测到的颜色通道。"
+ },
+ {
+ "icon": "🧱",
+ "title": "纹理保留",
+ "desc": "局部平均能减弱噪声,也可能压弱细纹。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-2",
+ "route": "patch-matching",
+ "title": "为什么要找相似图块",
+ "badge": "inf",
+ "badgeLabel": "分组",
+ "bridge": "相邻像素可能分属不同纹样,局部平均会模糊它们的边界。同一纹样也会在较远的位置重复,把这些块放在一起,可以用多份观测来判断哪些结构值得保留。",
+ "analogy": {
+ "title": "用一块砖比对纹样",
+ "text": "参照砖滑向有相同纹样的一块。观察两块砖的图案怎样对齐,就能理解算法为什么在搜索窗口内按纹样找伙伴。",
+ "componentId": "tile-analogy"
+ },
+ "modules": [
+ {
+ "kind": "module",
+ "id": "2.1",
+ "title": "选出能入组的图像块",
+ "desc": "两块是否相似,要逐个比较对应位置的读数。点选近处横纹、中间弱纹和远处竖纹,查看平方距离条是否越过蓝色阈值线。位置最远的候选也可能最符合参照纹样。",
+ "componentId": "patch-match",
+ "evidence": "demo"
+ }
+ ],
+ "transition": "有了相似块,还要决定每块保留哪些结构。怎样用少量纹样重建一个带噪图块?",
+ "equations": [
+ 1,
+ 6
+ ],
+ "takeaways": [
+ {
+ "icon": "📐",
+ "title": "按块比对",
+ "desc": "计算对应像素的平方距离。"
+ },
+ {
+ "icon": "🔎",
+ "title": "阈值入组",
+ "desc": "窗口限制搜索范围,距离阈值决定是否入组。"
+ },
+ {
+ "icon": "🧱",
+ "title": "少匹配也可恢复",
+ "desc": "相似邻居不足时,单块仍可用稀疏表示重建。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-3",
+ "route": "sparse-coding",
+ "title": "怎样用少量原子重建图块",
+ "badge": "both",
+ "badgeLabel": "稀疏表示",
+ "bridge": "相似块提供了参照。要让它们一起恢复,先把单块写成几种基本纹样的叠加,并衡量这份重建与观测相差多少。",
+ "analogy": {
+ "title": "用模板补上刻纹",
+ "text": "看印模怎样把一种基本纹样补回瓷砖。印模对应字典原子,被印出的深浅对应这个原子在图块里的系数。",
+ "componentId": "tile-analogy"
+ },
+ "modules": [
+ {
+ "kind": "module",
+ "id": "3.1",
+ "componentId": "atom-coding",
+ "title": "两种纹样够用吗",
+ "desc": "原子选得太少,可能缺掉原有纹样。点选左侧的模板,观察重建块和含噪块的差异,再看平方残差。试着在本例的容差 0.05 内,用尽可能少的原子完成重建。",
+ "evidence": "demo"
+ }
+ ],
+ "insight": "约束内的稀疏解使用较少非零系数,残差容差可以随噪声水平设定。",
+ "transition": "每块都能单独选原子。遇到本应相似却各带噪声的一组块,让它们一起选会怎样?",
+ "equations": [
+ 2,
+ 3
+ ],
+ "takeaways": [
+ {
+ "icon": "◈",
+ "title": "原子",
+ "desc": "字典的每一列是一种可叠加的基本纹样。"
+ },
+ {
+ "icon": "⊕",
+ "title": "系数",
+ "desc": "系数控制一种纹样在图块里的强度和正负。"
+ },
+ {
+ "icon": "✓",
+ "title": "误差预算",
+ "desc": "先满足残差容差,再比较各方案用了多少原子。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-4",
+ "route": "joint-sparsity",
+ "title": "联合编码与字典学习",
+ "badge": "both",
+ "badgeLabel": "选原子与学原子",
+ "bridge": "上一节已经把相似图块分到同一组。接下来要做两件事。联合编码决定这组图块一起用哪些原子,再给每块估计各自的系数。字典学习则用当前图像的图块调整原子本身,让字典更容易表示这张图反复出现的结构。",
+ "analogy": {
+ "title": "同一枚印模可以印出不同深浅",
+ "text": "看同一枚印模怎样在两块砖上留下深浅不同的纹样。印模的形状对应原子,纹样的深浅对应各块的系数。联合编码让相似块一起挑印模,字典学习会调整印模的形状。",
+ "componentId": "tile-analogy"
+ },
+ "modules": [
+ {
+ "kind": "module",
+ "id": "4.1",
+ "componentId": "shared-coding",
+ "title": "固定字典后,相似块怎样共同选原子",
+ "tabLabel": "联合编码",
+ "desc": "两边都用同一套字典处理同样的三个含噪图块。 三块都有左亮右暗的纹样,各自混进了不同干扰。独立编码让每块根据自己的残差给原子打分。联合编码把三块对同一原子的分数相加,一起选得分最高的原子,再给每块估计各自的系数。分数越高,原子越能解释剩下还没重建的纹样。 点击「第 1 轮」,看两边框出了哪些原子行。每行是一个原子,每列是一个图块。彩条的长度表示系数大小,左右方向表示正负。干净块误差衡量还原程度,含噪块残差衡量对观测的拟合程度。",
+ "evidence": "demo"
+ },
+ {
+ "kind": "module",
+ "id": "4.2",
+ "title": "字典学习怎样改变原子本身",
+ "tabLabel": "字典学习",
+ "desc": "字典学习用当前图块调整原子的纹样。 离线原子上亮下暗,三个当前图块都偏向左亮右暗。点 LSC,观察原子怎样随图块更新。再点 LSSC,对照相似组在哪些步骤起作用。 演示按固定系数将三个图块加权,只更新一枚原子。论文用当前图像同时学习一套字典和各组的系数。",
+ "componentId": "dictionary-learn",
+ "evidence": "demo"
+ }
+ ],
+ "insight": "式(5)用系数矩阵的行表示共享原子。式(7)给定字典 D,求一组相似块的系数 Aᵢ。式(8)把 D 也纳入求解,让所有图块组共同适配一套字典。",
+ "transition": "联合编码给出了各块的重建。把它们拼回整图时,同一个像素收到几份不同估计,要怎样合并?",
+ "equations": [
+ 5,
+ 7,
+ 8
+ ],
+ "takeaways": [
+ {
+ "icon": "🔗",
+ "title": "联合编码选原子",
+ "desc": "相似块共用一组原子,每块为它们估计各自的系数。"
+ },
+ {
+ "icon": "◈",
+ "title": "字典学习调整原子",
+ "desc": "以离线字典为起点,用当前观测中的图块更新各原子的纹样。"
+ },
+ {
+ "icon": "🧱",
+ "title": "LSSC 的恢复顺序",
+ "desc": "用相似组适配字典,再固定学到的字典做联合编码,得到各块的恢复结果。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-5",
+ "route": "merge-patches",
+ "title": "怎样把图块拼回整图",
+ "badge": "inf",
+ "badgeLabel": "融合",
+ "bridge": "联合编码恢复的是图块,整图需要逐像素重建。把每块放回原位后,重叠处的同一像素会收到多份估计。",
+ "analogy": {
+ "title": "对齐几片补砖",
+ "text": "看两片补砖叠在一起时高亮的交叠区域。图块回填时,每一份覆盖该区域的估计都会参与计算。",
+ "componentId": "tile-analogy"
+ },
+ "modules": [
+ {
+ "kind": "module",
+ "id": "5.1",
+ "componentId": "overlap-merge",
+ "title": "一个像素收到几份估计",
+ "desc": "每个像素收到的估计份数由覆盖它的图块决定。拖动左侧定位框或点击方向键,比较只被一块覆盖的位置和重叠区。右侧把覆盖当前点的估计列出来,相加后除以实际份数。",
+ "evidence": "demo"
+ }
+ ],
+ "insight": "每个像素按自己收到的估计份数做平均。",
+ "transition": "回填可以融合已有估计。遇到 Bayer RAW 每个位置缺少的两个颜色分量,还需要怎样恢复?",
+ "equations": [
+ 4,
+ 9
+ ],
+ "takeaways": [
+ {
+ "icon": "◈",
+ "title": "原位回填",
+ "desc": "每块按自己的索引放回整图。"
+ },
+ {
+ "icon": "+",
+ "title": "计数累加",
+ "desc": "每覆盖一个已估计像素,就累加一次读数与计数。"
+ },
+ {
+ "icon": "✓",
+ "title": "逐点平均",
+ "desc": "除以覆盖次数,避免重叠多的区域因求和而变亮。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-6",
+ "route": "real-raw",
+ "title": "怎样从 Bayer RAW 得到全彩图",
+ "badge": "both",
+ "badgeLabel": "成像流程",
+ "bridge": "重叠图块可以合成整图,但 Bayer 马赛克每个位置仍只有一个实测颜色分量。论文的实拍流程先在马赛克上去噪,再保留已知分量作为补色约束。",
+ "analogy": {
+ "title": "揭开遮纸查看砖纹",
+ "text": "遮纸隔开已知纹样和待恢复的部分。看揭纸后露出的图案,它对应去马赛克时用来约束重建的已测颜色分量。",
+ "componentId": "tile-analogy"
+ },
+ "modules": [
+ {
+ "kind": "module",
+ "id": "6.1",
+ "title": "放大原论文的实拍效果",
+ "tabLabel": "实拍对照",
+ "desc": "同一场景经不同流程处理后,残噪、伪色和细节有何差别?切换夜景、郁金香或雕塑,在同一裁块比较两种结果。重点看夜景暗部、花瓣边缘和雕塑背景。这组图适合做视觉判断。",
+ "componentId": "real-effects",
+ "evidence": "paper"
+ },
+ {
+ "kind": "module",
+ "id": "6.2",
+ "title": "用掩码检验补色候选",
+ "tabLabel": "Bayer 补色",
+ "desc": "一份全彩图怎样通过 Bayer 观测的检验?点「下一步」比较两个补色候选,观察已测位置的红框和观测残差平方和。残差归零表示已测值吻合,缺失值仍由字典和相似块约束。论文图 3 给出了栅栏上的补色伪影对照。",
+ "componentId": "masked-rebuild",
+ "evidence": "demo",
+ "figure": {
+ "src": "./images/fig-3.png",
+ "alt": "栅栏裁块的两种去马赛克结果",
+ "caption": "论文图 3 · 左侧 LSC 结果在栅栏处出现黄蓝伪色,右侧为同一裁块的 LSSC 重建。",
+ "page": 6
+ }
+ },
+ {
+ "kind": "module",
+ "id": "6.3",
+ "title": "处理顺序从 RAW 到全彩",
+ "tabLabel": "处理流程",
+ "desc": "去噪和补色分别改变什么?点「下一步」查看含噪马赛克、同色去噪和简化插值补色。前两步每个位置都只有一个颜色分量,可以对照采样位 RMSE。最后一步才显示完整 RGB。",
+ "componentId": "raw-pipeline",
+ "evidence": "demo"
+ }
+ ],
+ "insight": "比较实拍结果时,留意噪声、伪色和纹理;这些局部图没有无噪声真值。",
+ "transition": "观察实拍细节可以发现差异。要检验算法的效果,论文分别在什么条件下做比较?",
+ "equations": [
+ 10
+ ],
+ "takeaways": [
+ {
+ "icon": "📷",
+ "title": "实拍输入",
+ "desc": "三张 RAW 来自同一台 Canon PowerShot G9,ISO 1600。"
+ },
+ {
+ "icon": "🎛",
+ "title": "先去噪再补色",
+ "desc": "去噪后再完成颜色估计与白平衡、色域转换等显影步骤。"
+ },
+ {
+ "icon": "🔎",
+ "title": "视觉比较",
+ "desc": "局部裁块展示可见残噪和伪色,定量结论需看对应协议。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-7",
+ "route": "experiments",
+ "title": "怎样判断去噪有没有效果",
+ "badge": "both",
+ "badgeLabel": "实验",
+ "bridge": "实拍裁块让我们看到了噪声和细节的变化。定量比较还需要对齐输入和评价条件,因此要分开看论文的合成去噪、Kodak 去马赛克和实拍 RAW 三组结果。",
+ "analogy": {
+ "title": "对齐修补区再验收",
+ "text": "看尺子依次对准两片砖的同一段接缝。图像实验也要对齐输入、评价区域和指标,才知道表中的数值能比较什么。",
+ "componentId": "tile-analogy"
+ },
+ "insight": "固定样本和原子支撑,才可以用误差变化检验拟合权重的影响。",
+ "modules": [
+ {
+ "kind": "module",
+ "id": "7.1",
+ "title": "按实验协议读 PSNR",
+ "tabLabel": "论文数据",
+ "desc": "比较前先确认两种方法做的是同一项任务。切换「合成去噪」,在相同的噪声强度下读平均 PSNR。切换「Kodak 去马赛克」,查看 24 张图像的重建结果。「实拍 RAW」对应论文的定性裁块对照。",
+ "componentId": "results-compare",
+ "evidence": "paper",
+ "figure": {
+ "src": "./images/fig-2.png",
+ "alt": "两组含噪输入与对应的局部恢复示例",
+ "caption": "论文图 2 · 左列为合成噪声输入,右列为作者方法恢复后的局部。",
+ "page": 6
+ }
+ },
+ {
+ "kind": "module",
+ "id": "7.2",
+ "title": "用模拟 RAW 检验等方差假设",
+ "tabLabel": "教学实验",
+ "desc": "真实 RAW 的噪声强度可能随亮度变化,按方差加权能否改善拟合?这个教学实验固定 Bayer 图块匹配和原子支撑。拖动光子数,再切换暗部或亮部,比较等权拟合与方差加权的 RMSE。表中同时列出含噪输入的误差作为基准。",
+ "componentId": "raw-test",
+ "evidence": "extension"
+ }
+ ],
+ "transition": "指标只回答实验条件下的问题。当纹样难匹配、噪声不均或算力有限时,应该怎样看待这套方法?",
+ "equations": [
+ "psnr"
+ ],
+ "takeaways": [
+ {
+ "icon": "📐",
+ "title": "同协议比较",
+ "desc": "表 2 评价去噪,表 3 评价去马赛克。"
+ },
+ {
+ "icon": "🌗",
+ "title": "检查暗部和亮部",
+ "desc": "模拟噪声方差随线性亮度改变,分区域可能得到不同结论。"
+ },
+ {
+ "icon": "🧪",
+ "title": "限定结论范围",
+ "desc": "教学实验回答的是权重在这组模拟条件下的影响。"
+ }
+ ]
+ },
+ {
+ "kind": "chapter",
+ "id": "chap-8",
+ "route": "critical-thinking",
+ "title": "批判性思考",
+ "badge": "both",
+ "badgeLabel": "评价",
+ "bridge": "先评估 LSSC 的实验依据、适用边界和计算代价,再想想它给我带来的三点启发,从组合技术的思路到今天的 RAW 恢复。",
+ "stackModules": true,
+ "modules": [
+ {
+ "kind": "module",
+ "id": "8.1",
+ "title": "什么时候值得用 LSSC",
+ "desc": "把前三个问题带进方法比较。先看原文在什么条件下得到结果,再看 BM3D、ELD 和后续 GroupSC 分别解决了什么问题。最后可以展开讨论题,设计验证方法。",
+ "componentId": "critical-review"
+ },
+ {
+ "kind": "module",
+ "id": "8.2",
+ "title": "对我的启发",
+ "desc": "这篇论文让我想到三个问题。两种方法怎样互补?今天拍 RAW 还需要补色吗?噪声模型简化之后,算法为什么还能起作用?",
+ "componentId": "critical-reflections"
+ }
+ ],
+ "takeaways": []
+ }
+ ],
+ "bilibili": [
+ {
+ "bvid": "BV1tE411A7RC",
+ "title": "稀疏表示",
+ "reason": "论文合作者 Guillermo Sapiro 的课程,第 4、5 集涉及字典学习与图像恢复。",
+ "cover": "https://i1.hdslb.com/bfs/archive/6a1ca47ddafe3369045c5613a14154cdf4181525.jpg",
+ "views": "2.2万播放"
+ },
+ {
+ "bvid": "BV19d4y1q7wz",
+ "title": "ISP 算法 · 图像去马赛克",
+ "reason": "用插值实例理解如何从 Bayer 采样补齐颜色。",
+ "cover": "https://i0.hdslb.com/bfs/archive/a1ba4f3f8e0dd98bf1d9b0d2423090aaf94c83a5.jpg",
+ "views": "7009播放"
+ },
+ {
+ "bvid": "BV1p34y197pE",
+ "title": "CFA 图像传感器的降噪",
+ "reason": "扩展材料,了解在马赛克上直接去噪的另一种方案。",
+ "cover": "https://i0.hdslb.com/bfs/archive/86250ed3efa7d832aea98556bea20ad38db4f119.jpg",
+ "views": "4638播放"
+ }
+ ]
+};
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/canvasKit.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/canvasKit.ts
new file mode 100644
index 00000000..605d893a
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/canvasKit.ts
@@ -0,0 +1,100 @@
+// Canvas drawing kit — paper-agnostic helpers. Ported from the legacy utils.js.
+// These are static; the generator does NOT edit this file. Paper-specific drawing
+// lives in components/modules under src/modules/*.
+
+export function lerp(a: number, b: number, t: number): number {
+ return a + (b - a) * t;
+}
+
+export function lerpColor(c1: string, c2: string, t: number): string {
+ const p = (h: string) => [
+ parseInt(h.slice(1, 3), 16),
+ parseInt(h.slice(3, 5), 16),
+ parseInt(h.slice(5, 7), 16),
+ ];
+ const [r1, g1, b1] = p(c1);
+ const [r2, g2, b2] = p(c2);
+ return `rgb(${Math.round(lerp(r1, r2, t))},${Math.round(lerp(g1, g2, t))},${Math.round(
+ lerp(b1, b2, t)
+ )})`;
+}
+
+export function clamp(v: number, min: number, max: number): number {
+ return Math.max(min, Math.min(max, v));
+}
+
+export function easeOutCubic(t: number): number {
+ return 1 - Math.pow(1 - t, 3);
+}
+
+export function easeInOutQuad(t: number): number {
+ return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
+}
+
+export function easeSpring(t: number): number {
+ return 1 - Math.cos(t * Math.PI * 0.5);
+}
+
+export function easeOutBounce(t: number): number {
+ const n1 = 7.5625;
+ const d1 = 2.75;
+ if (t < 1 / d1) return n1 * t * t;
+ if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
+ if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
+}
+
+export function dist(x1: number, y1: number, x2: number, y2: number): number {
+ const dx = x2 - x1;
+ const dy = y2 - y1;
+ return Math.sqrt(dx * dx + dy * dy);
+}
+
+export function map(
+ v: number,
+ inMin: number,
+ inMax: number,
+ outMin: number,
+ outMax: number
+): number {
+ return ((v - inMin) / (inMax - inMin)) * (outMax - outMin) + outMin;
+}
+
+/** Setup a canvas for HiDPI. Returns the 2D context scaled to CSS pixels. */
+export function setupCanvas(canvas: HTMLCanvasElement, w: number, h: number): CanvasRenderingContext2D {
+ const dpr = window.devicePixelRatio || 1;
+ canvas.width = w * dpr;
+ canvas.height = h * dpr;
+ canvas.style.width = w + 'px';
+ canvas.style.height = h + 'px';
+ const ctx = canvas.getContext('2d');
+ if (!ctx) throw new Error('2D context unavailable');
+ ctx.scale(dpr, dpr);
+ return ctx;
+}
+
+/**
+ * Pause rAF when the canvas scrolls off-screen. Returns a stop() to disconnect.
+ * `startFn` is called when it enters the viewport; `stopFn` when it leaves.
+ */
+export function observeCanvas(
+ canvas: HTMLCanvasElement,
+ startFn: () => void,
+ stopFn: () => void
+): () => void {
+ if (typeof IntersectionObserver === 'undefined') {
+ startFn();
+ return () => {};
+ }
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) startFn();
+ else stopFn();
+ });
+ },
+ { threshold: 0.05 }
+ );
+ observer.observe(canvas);
+ return () => observer.disconnect();
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/useBiliVideos.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/useBiliVideos.ts
new file mode 100644
index 00000000..c6f52db6
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/lib/useBiliVideos.ts
@@ -0,0 +1,101 @@
+import { useEffect } from 'react';
+
+// Bilibili metadata loader (optional). Fetches cover/title/
+// duration/views at runtime via JSONP. Degrades gracefully: empty bvid => hide card;
+// failed fetch => "视频暂不可用" fallback (never stuck on a loading state).
+// UI strings stay in Simplified Chinese (this is webpage output, not a skill doc).
+
+export interface BiliCard {
+ bvid: string;
+ title?: string;
+ cover?: string;
+ duration?: string;
+ views?: string;
+}
+
+function formatViews(n: number): string {
+ if (n >= 100000000) return (n / 100000000).toFixed(1) + '亿播放';
+ if (n >= 10000) return (n / 10000).toFixed(1) + '万播放';
+ return n + '播放';
+}
+
+function formatDuration(s: number): string {
+ const m = Math.floor(s / 60);
+ const sec = s % 60;
+ return m + ':' + (sec < 10 ? '0' : '') + sec;
+}
+
+let jsonpRequestSerial = 0;
+
+/**
+ * Fetch metadata for each bvid and call `onLoad(bvid, data)` per card.
+ * Best-effort: network/Api failures are swallowed and reported as null.
+ */
+export function useBiliVideos(
+ bvids: string[],
+ onLoad: (bvid: string, data: BiliCard | null) => void
+) {
+ const bvidKey = Array.from(
+ new Set(bvids.filter((bvid) => bvid && bvid.startsWith('BV')))
+ ).join('|');
+
+ useEffect(() => {
+ let cancelled = false;
+ const real = bvidKey ? bvidKey.split('|') : [];
+ if (real.length === 0) return;
+
+ const callbackHost = window as unknown as Record;
+ const pending: Array<{ callbackName: string; script: HTMLScriptElement }> = [];
+
+ real.forEach((bvid) => {
+ const callbackName = `__paper_skill_bili_${Date.now()}_${++jsonpRequestSerial}`;
+ const script = document.createElement('script');
+ const dispose = () => {
+ delete callbackHost[callbackName];
+ script.remove();
+ };
+
+ callbackHost[callbackName] = (res: any) => {
+ if (cancelled) return;
+ dispose();
+ if (!res || res.code !== 0 || !res.data) {
+ onLoad(bvid, null);
+ return;
+ }
+ const d = res.data;
+ onLoad(bvid, {
+ bvid,
+ title: d.title,
+ cover: d.pic ? d.pic.replace(/^http:/, 'https:') : undefined,
+ duration: d.duration ? formatDuration(d.duration) : undefined,
+ views: d.stat ? formatViews(d.stat.view) : undefined,
+ });
+ };
+ script.src =
+ 'https://api.bilibili.com/x/web-interface/view?bvid=' +
+ bvid +
+ '&jsonp=jsonp&callback=' +
+ callbackName;
+ script.onerror = () => {
+ if (cancelled) return;
+ dispose();
+ onLoad(bvid, null);
+ };
+ pending.push({ callbackName, script });
+ document.body.appendChild(script);
+ });
+
+ return () => {
+ cancelled = true;
+ pending.forEach(({ callbackName, script }) => {
+ // A fetched JSONP script may already be queued for execution. Keep a
+ // temporary no-op callback so late responses cannot raise ReferenceError.
+ callbackHost[callbackName] = () => undefined;
+ script.remove();
+ window.setTimeout(() => {
+ delete callbackHost[callbackName];
+ }, 60_000);
+ });
+ };
+ }, [bvidKey, onLoad]);
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/main.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/main.tsx
new file mode 100644
index 00000000..e9b5c47d
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/main.tsx
@@ -0,0 +1,12 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import App from './App';
+import './styles/tokens.css';
+import './styles/components.css';
+import './styles/paper.css';
+
+ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
+
+
+
+);
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/atom-coding.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/atom-coding.tsx
new file mode 100644
index 00000000..a68ea00b
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/atom-coding.tsx
@@ -0,0 +1,139 @@
+import { useState } from 'react';
+import { Stage, bench, colors, rounded } from './paper-canvas';
+
+export const patchAtoms = [
+ [0.5, 0.5, 0.5, 0.5],
+ [0.5, -0.5, 0.5, -0.5],
+ [0.5, 0.5, -0.5, -0.5],
+ [0.5, -0.5, -0.5, 0.5],
+];
+
+export function patchValues(coefficients: number[], atoms: number[][] = patchAtoms) {
+ return atoms[0].map((_, pixel) =>
+ atoms.reduce((total, atom, index) => total + atom[pixel] * coefficients[index], 0),
+ );
+}
+
+export function dotPatch(a: number[], b: number[]) {
+ return a.reduce((total, value, index) => total + value * b[index], 0);
+}
+
+export function squaredError(a: number[], b: number[]) {
+ return a.reduce((total, value, index) => total + (value - b[index]) ** 2, 0);
+}
+
+export function tileShade(value: number) {
+ const shade = Math.round(34 + Math.max(0, Math.min(1, value)) * 198);
+ return `rgb(${shade}, ${shade}, ${shade})`;
+}
+
+export function drawPatch(
+ ctx: CanvasRenderingContext2D, x: number, y: number, size: number,
+ values: number[], border = colors.light,
+) {
+ rounded(ctx, x, y, size, size, 7, colors.paper, border);
+ const inset = 4;
+ const cell = (size - 2 * inset) / 2;
+ values.forEach((value, index) => {
+ ctx.fillStyle = tileShade(value);
+ ctx.fillRect(x + inset + index % 2 * cell, y + inset + Math.floor(index / 2) * cell, cell, cell);
+ });
+}
+
+const templates = [
+ { name: '亮底', x: 36, y: 46 },
+ { name: '左右纹', x: 138, y: 46 },
+ { name: '上下纹', x: 36, y: 127 },
+ { name: '交错纹', x: 138, y: 127 },
+];
+const observed = patchValues([0.56, 0.28, -0.18, 0.04]);
+const tolerance = 0.05;
+
+export function AtomCoding() {
+ const [mask, setMask] = useState(0);
+ const selected = (index: number) => (mask & (1 << index)) !== 0;
+ const coefficients = patchAtoms.map((atom, index) => selected(index) ? dotPatch(observed, atom) : 0);
+ const reconstruction = patchValues(coefficients);
+ const residual = squaredError(observed, reconstruction);
+ const count = coefficients.filter(value => value !== 0).length;
+ const feasible = residual <= tolerance;
+ const minimal = feasible && count === 2;
+
+ function toggle(index: number) {
+ setMask(previous => previous ^ (1 << index));
+ }
+
+ function pick(x: number, y: number) {
+ const index = templates.findIndex(template =>
+ x >= template.x && x <= template.x + 84 && y >= template.y && y <= template.y + 68,
+ );
+ if (index >= 0) toggle(index);
+ }
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ bench(ctx, width, height);
+ rounded(ctx, 24, 32, 211, 171, 10, colors.paper, colors.light);
+ rounded(ctx, 485, 38, 126, 163, 9, '#fff', colors.line);
+ const reconstructionColor = count === 0 ? colors.blue
+ : !feasible ? colors.red : minimal ? colors.green : colors.orange;
+ templates.forEach(({ x, y }, index) => {
+ const active = selected(index);
+ rounded(ctx, x, y, 84, 68, 6, active ? '#e5ecf5' : colors.bg, active ? colors.blue : colors.line);
+ drawPatch(ctx, x + 17, y + 9, 50, patchAtoms[index].map(value => 0.5 + value * 0.72));
+ if (active) {
+ rounded(ctx, x + 66, y + 8, 10, 10, 4, colors.orange);
+ ctx.lineWidth = 2.5;
+ ctx.strokeStyle = colors.blue;
+ ctx.strokeRect(x + 3, y + 3, 78, 62);
+ }
+ });
+ drawPatch(ctx, 261, 71, 83, observed, colors.blue);
+ drawPatch(ctx, 373, 71, 83, reconstruction, reconstructionColor);
+ ctx.fillStyle = colors.ink;
+ ctx.textAlign = 'center';
+ ctx.font = '600 16px system-ui, sans-serif';
+ ctx.fillText('含噪块', 303, 57);
+ ctx.fillText('重建块', 414, 57);
+ ctx.strokeStyle = colors.line;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(543, 50);
+ ctx.lineTo(543, 191);
+ ctx.stroke();
+ coefficients.forEach((value, index) => {
+ const position = 65 + index * 36;
+ const extent = value * 93;
+ rounded(ctx, 494, position, 107, 10, 4, colors.bg);
+ if (selected(index)) {
+ rounded(ctx, Math.min(543, 543 + extent), position, Math.abs(extent), 10, 3, colors.blue);
+ ctx.fillStyle = colors.orange;
+ ctx.fillRect(541 + extent, position - 2, 4, 14);
+ }
+ });
+ }
+
+ const feedback = count === 0
+ ? '试着选一枚模板,观察重建与含噪块的差距。'
+ : !feasible
+ ? '平方残差仍高于容差。试试换一枚原子,或增加一枚。'
+ : minimal
+ ? '两枚原子已满足容差。这是此例中原子数最少的可行组合。'
+ : '误差已达标。试着去掉一枚原子,保留足够的拟合精度。';
+
+ return (
+ 0 && !feasible ? 'bad' : 'neutral'}>
+
+ {templates.map(({ name }, index) => (
+ toggle(index)}>{name}
+ ))}
+
+
+ 原子数 {count} / 4 平方残差 {residual.toFixed(3)} 容差 0.050
+
+ 系数:{coefficients.map((value, index) => `${templates[index].name} ${value.toFixed(2)}`).join(' ')}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/bayer-mask.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/bayer-mask.tsx
new file mode 100644
index 00000000..d07d6fc2
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/bayer-mask.tsx
@@ -0,0 +1,121 @@
+import { useState } from 'react';
+import { Stage, colors } from './paper-canvas';
+
+const channelNames = ['R', 'G', 'B'] as const;
+const channelColors = ['#b9574a', '#4c7954', '#4b73a0'] as const;
+const glaze = [
+ [142, 118, 86], [197, 156, 105], [184, 137, 78], [139, 118, 99],
+ [178, 153, 113], [214, 186, 130], [205, 162, 99], [158, 119, 93],
+ [88, 127, 126], [123, 161, 144], [142, 150, 103], [178, 146, 106],
+ [75, 107, 122], [104, 151, 154], [134, 159, 130], [134, 119, 79],
+] as const;
+const bayerPattern = [[1, 0], [2, 1]] as const;
+const activeRows = [0, 1, 4] as const;
+const feedback = [
+ '16 个位置展开成 48 个颜色分量。左边是模拟的完整彩色场景。',
+ '第一行按绿、红、绿、红采样。每个位置只保留一种颜色的读数。',
+ '整块共测得 16 个颜色值,48 个分量中还有 32 个需要估计。',
+];
+
+function fillFrame(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {
+ ctx.fillStyle = colors.light;
+ ctx.beginPath();
+ ctx.roundRect(x + 2, y + 3, width, height, 10);
+ ctx.fill();
+ ctx.fillStyle = colors.paper;
+ ctx.strokeStyle = colors.dark;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.roundRect(x, y, width, height, 10);
+ ctx.fill();
+ ctx.stroke();
+}
+
+function fillSample(
+ ctx: CanvasRenderingContext2D,
+ x: number,
+ y: number,
+ size: number,
+ channel: number,
+ value: number,
+) {
+ ctx.fillStyle = colors.paper;
+ ctx.fillRect(x, y, size, size);
+ ctx.globalAlpha = 0.2 + 0.8 * value / 255;
+ ctx.fillStyle = channelColors[channel];
+ ctx.fillRect(x, y, size, size);
+ ctx.globalAlpha = 1;
+}
+
+function drawMissing(ctx: CanvasRenderingContext2D, x: number, y: number, size: number) {
+ ctx.strokeStyle = colors.line;
+ ctx.strokeRect(x, y, size, size);
+ ctx.beginPath();
+ ctx.moveTo(x + 4, y + size - 4);
+ ctx.lineTo(x + size - 4, y + 4);
+ ctx.stroke();
+}
+
+export function BayerMask() {
+ const [step, setStep] = useState(0);
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ ctx.fillStyle = colors.bg;
+ ctx.fillRect(0, 0, width, height);
+ fillFrame(ctx, 49, 28, 170, 168);
+ fillFrame(ctx, 275, 28, 312, 168);
+ const shownRows = activeRows[step];
+
+ glaze.forEach((rgb, index) => {
+ const row = Math.floor(index / 4);
+ const column = index % 4;
+ const x = 55 + column * 40;
+ const y = 33 + row * 40;
+ const bayerChannel = bayerPattern[row % 2][column % 2];
+ if (row < shownRows) {
+ fillSample(ctx, x, y, 38, bayerChannel, rgb[bayerChannel]);
+ ctx.strokeStyle = colors.blue;
+ ctx.strokeRect(x, y, 38, 38);
+ } else {
+ ctx.fillStyle = 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ')';
+ ctx.fillRect(x, y, 38, 38);
+ }
+ });
+
+ channelNames.forEach((_, channel) => {
+ const panelX = 290 + channel * 96;
+ glaze.forEach((rgb, index) => {
+ const row = Math.floor(index / 4);
+ const column = index % 4;
+ const cellX = panelX + column * 22;
+ const cellY = 68 + row * 22;
+ const bayerChannel = bayerPattern[row % 2][column % 2];
+ if (channel === bayerChannel) {
+ if (row < shownRows) fillSample(ctx, cellX, cellY, 19, channel, rgb[channel]);
+ ctx.strokeStyle = colors.blue;
+ ctx.strokeRect(cellX, cellY, 19, 19);
+ } else {
+ drawMissing(ctx, cellX, cellY, 19);
+ }
+ });
+ });
+
+ ctx.textAlign = 'center';
+ ctx.fillStyle = colors.ink;
+ ctx.font = '600 15px system-ui, sans-serif';
+ ctx.fillText('教学彩砖', 134, 222);
+ ctx.fillText('R G B', 430, 54);
+ }
+
+ return (
+
+ setStep((previous) => Math.max(0, previous - 1))} disabled={step === 0}>
+ 上一步
+
+ {step + 1} / 3
+ setStep((previous) => Math.min(2, previous + 1))} disabled={step === 2}>
+ 下一步
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/critical-review.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/critical-review.tsx
new file mode 100644
index 00000000..67559a27
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/critical-review.tsx
@@ -0,0 +1,131 @@
+const original = 'https://www.di.ens.fr/~fbach/iccv09_mairal.pdf';
+const bm3d = 'https://webpages.tuni.fi/foi/GCF-BM3D/index.html';
+const groupSC = 'https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123670239.pdf';
+const extremeRaw = 'https://openaccess.thecvf.com/content_CVPR_2020/html/Wei_A_Physics-Based_Noise_Formation_Model_for_Extreme_Low-Light_Raw_CVPR_2020_paper.html';
+const rawChallenge = 'https://openaccess.thecvf.com/content/ICCV2025W/AIM/html/Li_AIM_2025_Challenge_on_Real-World_RAW_Image_Denoising_ICCVW_2025_paper.html';
+const adaBoost = 'https://www.sciencedirect.com/science/article/pii/S002200009791504X';
+const sonyPixelShift = 'https://support.d-imaging.sony.co.jp/app/imagingedge/en/instruction/1_2_about_psm.php';
+const nikonDemosaicing = 'https://www.nikon.com/company/technology/technology_fields/software_and_systems/image_processing_engine/';
+
+function Source({ href, children }: { href: string; children: string }) {
+ return {children} ↗ ;
+}
+
+export function CriticalReview() {
+ return (
+
+
+ LSSC 的优势和适用边界
+
+
+
重复纹理提供约束
+
共享字典原子让相似块保留共同纹样,各块仍可用不同系数。匹配、原子选择与融合都可检查。
+
强噪声可能干扰匹配,孤立结构也难找到可靠邻居。若不相似的块被分到一组,共享原子可能带来纹理误差。这是由模型机制作出的推断。
+
原文 §3.1–3.3
+
+
+
真实 RAW 的证据有限
+
原文在手动缩放通道后,用用户估计的全局 σ 近似噪声。真实传感器的噪声会随亮度、相机和拍摄条件变化。
+
三张实拍都来自 Canon PowerShot G9、ISO 1600。作者做的是定性比较,并指出第三张背景仍保留一部分噪声。
+
+ 原文 §4.3 和图 4
+ RAW 噪声模型
+
+
+
+
字典适配增加计算量
+
方法包含离线字典学习、图块匹配和逐图求解。原文在一张 256 × 256 的 peppers 合成噪声图上报告,SC 为 0.5 秒,LSC 为 85 秒,LSSC 为 220 秒。
+
这些时间来自原文的质量优先设置与 Intel Q9450 测试机,适合说明引入适配和联合编码的成本。
+
原文 §4.1
+
+
+
+
+
+ 和其他去噪方法比较
+
+
+ BM3D · 经典非局部基线
+ 两者都匹配相似图块。BM3D 用预设变换和协同滤波,省去逐图学习字典。LSSC 学习适合输入的字典,并让同组图块共享所用原子。
+ 原文表 2 在 12 张标准图、合成白高斯噪声 σ = 25 的条件下,LSSC 为 29.74 dB ,BM3D 为 29.72 dB 。优势随噪声档位而变。
+
+ BM3D 作者页
+ 原文表 2
+
+
+
+ ELD · 极低照度 RAW 去噪
+ Wei 等人用传感器和读出电子噪声模型合成训练数据,针对极低照度下的真实 RAW。LSSC 仍有显式先验和可检查的中间步骤。
+ 两类方法各有代价。LSSC 依赖可靠的块匹配及合理的噪声参数。物理噪声模型依赖传感器噪声特性的估计,训练结果也要用跨机型数据验证。
+ Wei 等,CVPR 2020
+
+
+
+
+
+ 从这篇论文出发的工作
+
+
+
直接延续 · GroupSC
+
Lecouat、Ponce 和 Mairal 保留非局部自相似与组稀疏,用连续的相似度权重构造可微的组收缩,并展开迭代进行端到端训练。
+
该论文表 3 在 BSD68 灰度图、合成噪声 σ = 25 下报告 LSSC 为 28.71 dB 、GroupSC 为 29.20 dB 。这组结果评价灰度合成去噪。
+
Lecouat 等,ECCV 2020 §3 与表 3
+
+
+
相关进展 · 跨机型 RAW 评估
+
AIM 2025 的真实 RAW 去噪挑战用多机型和多场景检验方法的泛化,给评估原文单一机型、单一 ISO 的个案提供了可借鉴的协议。
+
AIM 2025 挑战报告
+
+
+
+
+
+ 汇报讨论 · 怎样验证换相机后仍然有效?
+ 选取多个相机与 ISO 下的含噪 RAW 和低噪参考,固定输入归一化和后续显影。保留原版 LSSC,再分别更换噪声方差模型与匹配规则,每次改一个因素。
+ 同时记录 RAW 域 PSNR、平坦区残噪、纹理区域误差和每张处理时间。把易匹配和难匹配的样例分开看,才能判断改善来自噪声建模还是匹配。
+ 回看方差加权的教学对照 →
+
+
+ );
+}
+
+export function CriticalReflections() {
+ return (
+
+
+ 组合技术,先看各自能补上什么
+ 单独看一个含噪图块,稀疏编码可能选到恰好与这块噪声相似的原子。LSSC 先借助非局部匹配找到其他含有同类纹样的图块,再让这些块共同选原子、各自估计系数。相似图块提供多份结构证据,稀疏约束则限制需要多少种原子来解释这些观测。
+ 这让我想到人工智能导论里的 AdaBoost(自适应提升) 。它逐轮训练弱分类器,对本轮分错的样本提高相对权重,让下一轮更关注这些难例,最后由各轮分类器加权投票。AdaBoost 组合的是分类器的判断,LSSC 结合的是恢复同一幅图像的两种先验。
+ 两种方法给我的启发是,组合前先说明各部分能解决什么问题,再对照单独使用与组合使用的结果。论文里的 LSC 对图块独立编码,LSSC 在字典适配和重建时都利用相似组。比较两者的去噪效果和耗时,可以看出引入分组后整套方案的收益和成本。
+
+ LSSC 原文 §3
+ Freund 与 Schapire · AdaBoost
+
+
+
+
+ 像素位移已经能采更多颜色,为什么还需要去马赛克?
+ 采用 Bayer 彩色滤镜阵列的相机,在单次曝光中每个感光位置只记录 R、G、B 之一。比如绿色位置只测到绿色强度。要从这帧 RAW 输出全彩图,还需要估计该位置的红色和蓝色。
+ 像素位移用多次曝光增加实测信息。 相机在连拍之间微移传感器,同一景物位置就会先后落到不同颜色的滤镜下。在四帧整像素位移方案中,同一位置可以得到一份 R、两份 G 和一份 B 采样,合成时能利用这些 RGB 测量。它适合稳定机位下的静物,主体移动或光线变化可能造成合成伪影。
+ 目前主流彩色相机仍采用彩色滤镜阵列。从这样的单帧 RAW 生成全彩图,仍需去马赛克。2009 年论文讨论的两个问题因此仍有现实意义。已测颜色带噪声,另外两个颜色需要估计,今天的 RAW 恢复仍然要解决这两个问题。
+
+
+
+
+ 真实噪声偏离高斯白噪声,为什么 LSSC 还能有效?
+ 论文用全局 σ 决定拟合时允许多大的残差。 即使噪声偏离高斯,只要各处的噪声强度差异有限,全局 σ 仍能提供大致合理的误差尺度。
+ 如果相似块还能可靠分组,一条真实边缘就会在多块中为同一原子提供证据。各块的随机扰动通常缺少这种一致性,稀疏编码也限制了为零散扰动引入的原子数。最后融合重叠图块,还能减弱部分随机残差。
+ 原文的实拍流程也做了粗略适配。作者手动缩放 R、G、B 采样,使三通道的噪声看起来大致相当,然后用统一的 σ 在 Bayer 数据上去噪,再进行去马赛克。这个顺序减少了去马赛克先把噪声扩散到其他位置和通道的影响。实验只比较了三张实拍图的视觉效果,第三张背景仍有部分噪声。
+ 更贴近传感器的噪声模型有望进一步改善结果。用随亮度和通道变化的方差给残差加权,可以减少对高噪声观测的过度拟合,并帮助低噪声区域保留细纹理。强噪声会干扰匹配,重复出现的条纹也可能被当成纹理保留。论文把非均匀噪声建模列为后续工作,具体收益需要在真实 RAW 上做对照验证。
+
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/dictionary-learn.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/dictionary-learn.tsx
new file mode 100644
index 00000000..97c4f280
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/dictionary-learn.tsx
@@ -0,0 +1,103 @@
+import { useState } from 'react';
+import { drawPatch, patchAtoms } from './atom-coding';
+import { Stage, bench, colors, rounded } from './paper-canvas';
+
+const initialAtom = patchAtoms[2];
+const imagePatches = [
+ [.31, -.28, .35, -.33],
+ [.38, -.41, .36, -.35],
+ [.43, -.39, .40, -.43],
+];
+const coefficients = [.60, .75, .82];
+
+// With one unit-norm atom and fixed coefficients, the least-squares update
+// points in the direction of the coefficient-weighted sum of the patches.
+const weightedSum = initialAtom.map((_, pixel) =>
+ imagePatches.reduce((total, patch, index) => total + coefficients[index] * patch[pixel], 0),
+);
+const norm = Math.hypot(...weightedSum);
+const adaptedAtom = weightedSum.map(value => value / norm);
+
+const modes = [
+ { name: 'SC', adapts: false, psnr: 25.83, coding: '每块独立选原子。' },
+ { name: 'LSC', adapts: true, psnr: 26.18, coding: '每块仍独立选原子。' },
+ { name: 'LSSC', adapts: true, psnr: 26.57, coding: '相似块共同选原子,再各自估计系数。' },
+];
+
+function label(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, heading = false) {
+ ctx.font = heading ? '700 17px system-ui, sans-serif' : '500 14px system-ui, sans-serif';
+ ctx.fillStyle = heading ? colors.ink : colors.muted;
+ ctx.textAlign = 'center';
+ ctx.fillText(text, x, y);
+}
+
+export function DictionaryLearn() {
+ const [mode, setMode] = useState(0);
+ const active = modes[mode];
+ const displayedAtom = active.adapts ? adaptedAtom : initialAtom;
+ const orientation = active.adapts ? '左亮右暗' : '上亮下暗';
+ const update = active.adapts ? '用图块更新原子' : '沿用离线原子';
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ bench(ctx, width, height);
+ rounded(ctx, 22, 16, 164, 153, 9, colors.paper, colors.line);
+ rounded(ctx, 219, 16, 202, 153, 9, colors.paper, active.adapts ? colors.blue : colors.line);
+ rounded(ctx, 454, 16, 164, 153, 9, colors.paper, active.adapts ? colors.green : colors.line);
+
+ label(ctx, '离线原子', 104, 44, true);
+ drawPatch(ctx, 69, 55, 70, initialAtom.map(value => 0.5 + value * 0.8));
+ label(ctx, '上亮下暗', 104, 148);
+
+ label(ctx, '当前图像的图块', 320, 44, true);
+ imagePatches.forEach((patch, index) => {
+ const x = 240 + index * 55;
+ drawPatch(ctx, x, 65, 50, patch.map(value => 0.5 + value));
+ label(ctx, coefficients[index].toFixed(2), x + 25, 136);
+ });
+ label(ctx, '固定系数', 320, 155);
+
+ if (active.adapts) {
+ ctx.beginPath();
+ ctx.moveTo(425, 91);
+ ctx.lineTo(448, 91);
+ ctx.lineTo(441, 85);
+ ctx.moveTo(448, 91);
+ ctx.lineTo(441, 97);
+ ctx.strokeStyle = colors.blue;
+ ctx.lineWidth = 2;
+ ctx.stroke();
+ }
+
+ label(ctx, '用于编码的原子', 536, 44, true);
+ drawPatch(ctx, 501, 55, 70, displayedAtom.map(value => 0.5 + value * 0.8),
+ active.adapts ? colors.green : colors.light);
+ label(ctx, orientation, 536, 148);
+ }
+
+ return (
+
+
+
+ {modes.map((item, index) => (
+ setMode(index)}>
+ {item.name}
+
+ ))}
+
+
+
+ 论文表 2 · 12 张图的平均 PSNR(dB),高斯白噪声 σ = 50
+ {modes.map(item => {item.name} )}
+ {modes.map((item, index) => (
+
+ {item.psnr.toFixed(2)}
+
+ ))}
+
+
演示里的 LSC 和 LSSC 显示同一次原子更新。论文的 LSSC 在字典适配和最终编码时都利用了相似组。
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/exampleSlider.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/exampleSlider.tsx
new file mode 100644
index 00000000..b274bf7a
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/exampleSlider.tsx
@@ -0,0 +1,85 @@
+import React, { useEffect, useRef, useState } from 'react';
+import { setupCanvas, observeCanvas, clamp } from '../lib/canvasKit';
+import type { WidgetProps } from './registry';
+
+// EXAMPLE widget — copy this file as a template for paper-specific modules.
+// One slider drives a Canvas bar; feedback color follows the value (red/green per
+// contract.md §5). Each widget owns its own canvas + controls + feedback.
+
+const W = 1080;
+const H = 280;
+
+export const ExampleSlider: React.FC = ({ chapterId, moduleId }) => {
+ const canvasRef = useRef(null);
+ const stateRef = useRef({ value: 0.5 });
+ const rafRef = useRef(null);
+ const [value, setValue] = useState(0.5);
+ const [feedback, setFeedback] = useState({ text: '拖动滑块,观察数值如何改变画面。', cls: '' });
+
+ useEffect(() => {
+ const canvas = canvasRef.current;
+ if (!canvas) return;
+ let ctx: CanvasRenderingContext2D;
+ try {
+ ctx = setupCanvas(canvas, W, H);
+ } catch {
+ return;
+ }
+
+ const render = (s: { value: number }) => {
+ ctx.clearRect(0, 0, W, H);
+ const h = clamp(s.value, 0, 1) * (H - 40);
+ ctx.fillStyle = s.value > 0.7 ? '#228d5c' : s.value < 0.3 ? '#c43f52' : '#27446e';
+ ctx.fillRect(40, H - 20 - h, W - 80, h);
+ ctx.fillStyle = '#21324a';
+ ctx.font = '22px "Segoe UI", sans-serif';
+ ctx.fillText('value = ' + s.value.toFixed(2), 40, 32);
+ };
+
+ const tick = () => {
+ render(stateRef.current);
+ if (!canvas.classList.contains('is-ready')) canvas.classList.add('is-ready');
+ rafRef.current = requestAnimationFrame(tick);
+ };
+ const stop = () => {
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
+ rafRef.current = null;
+ };
+ const start = () => {
+ if (!rafRef.current) rafRef.current = requestAnimationFrame(tick);
+ };
+ const disconnect = observeCanvas(canvas, start, stop);
+ return () => {
+ stop();
+ disconnect();
+ };
+ }, []);
+
+ const onChange = (e: React.ChangeEvent) => {
+ const v = Number(e.target.value) / 100;
+ stateRef.current.value = v;
+ setValue(v);
+ setFeedback(
+ v > 0.7
+ ? { text: '数值较高,更接近目标状态。', cls: 'good' }
+ : v < 0.3
+ ? { text: '数值偏低,偏离了目标。', cls: 'bad' }
+ : { text: '处于中间区间,继续探索。', cls: '' }
+ );
+ };
+
+ return (
+
+
+
+
+ 参数 {value.toFixed(2)}
+
+
+
+
{feedback.text}
+
+ );
+};
+
+export default ExampleSlider;
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/hero-joint.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/hero-joint.tsx
new file mode 100644
index 00000000..75962c8a
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/hero-joint.tsx
@@ -0,0 +1,5 @@
+import { HeroComparison } from './paper-canvas';
+
+export function HeroJoint() {
+ return ;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/masked-rebuild.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/masked-rebuild.tsx
new file mode 100644
index 00000000..7a883e51
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/masked-rebuild.tsx
@@ -0,0 +1,99 @@
+import { useState } from 'react';
+import { Stage, colors } from './paper-canvas';
+
+type Rgb = [number, number, number];
+
+const tile: Rgb[] = [
+ [151, 181, 196], [163, 178, 182], [173, 168, 133], [181, 165, 119],
+ [147, 175, 190], [161, 170, 173], [177, 165, 125], [185, 161, 106],
+ [152, 170, 183], [169, 165, 149], [184, 160, 110], [160, 172, 165],
+ [160, 170, 161], [174, 163, 129], [144, 177, 181], [149, 179, 188],
+];
+const phases = ['Bayer 观测', '候选偏离观测', '符合观测的候选'];
+const channelLetters = ['R', 'G', 'B'];
+const edits = new Set([1, 6, 12]);
+
+function channelAt(index: number) {
+ const row = Math.floor(index / 4);
+ const col = index % 4;
+ return row % 2 === 0 ? (col % 2 === 0 ? 1 : 0) : (col % 2 === 0 ? 2 : 1);
+}
+
+function rgb(values: Rgb) {
+ return `rgb(${values.join(',')})`;
+}
+
+function text(ctx: CanvasRenderingContext2D, value: string, x: number, y: number, size = 14, color = colors.ink, weight = 500) {
+ ctx.fillStyle = color;
+ ctx.font = `${weight} ${size}px sans-serif`;
+ ctx.fillText(value, x, y);
+}
+
+export function MaskedRebuild() {
+ const [step, setStep] = useState(0);
+ const currentFeedback = [
+ '16 个分量来自传感器,另外 32 个分量等待估计。',
+ '三个已测分量偏离了观测,候选违反掩码约束。',
+ '全部已测值都吻合。待估值仍由字典和相似块约束。',
+ ][step];
+ const tone = step === 0 ? 'neutral' : step === 1 ? 'bad' : 'good';
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ ctx.fillStyle = colors.paper;
+ ctx.fillRect(0, 0, width, height);
+ text(ctx, 'Bayer 观测', 34, 33, 16, colors.ink, 700);
+ text(ctx, '重建候选', 235, 33, 16, colors.ink, 700);
+ const cell = 36;
+
+ tile.forEach((reference, index) => {
+ const col = index % 4;
+ const row = Math.floor(index / 4);
+ const c = channelAt(index);
+ const candidates: Rgb = [...reference];
+ const observed: Rgb = [225, 225, 225];
+ observed[c] = Math.max(95, reference[c] - 35);
+ observed[(c + 1) % 3] = Math.max(25, reference[c] - 105);
+ observed[(c + 2) % 3] = Math.max(25, reference[c] - 105);
+ if (step === 1 && edits.has(index)) candidates[c] += 18;
+
+ const fromX = 34 + col * cell;
+ const toX = 235 + col * cell;
+ const y = 50 + row * cell;
+
+ ctx.fillStyle = rgb(observed);
+ ctx.fillRect(fromX, y, cell - 2, cell - 2);
+ text(ctx, channelLetters[c], fromX + 12, y + 21, 13, '#ffffff', 700);
+
+ ctx.fillStyle = step ? rgb(candidates) : colors.bg;
+ ctx.fillRect(toX, y, cell - 2, cell - 2);
+ ctx.strokeStyle = colors.line;
+ ctx.lineWidth = 1;
+ ctx.strokeRect(toX, y, cell - 2, cell - 2);
+ if (!step) {
+ ctx.beginPath();
+ ctx.moveTo(toX + 7, y + cell - 8);
+ ctx.lineTo(toX + cell - 8, y + 7);
+ ctx.stroke();
+ } else if (step === 2 || edits.has(index)) {
+ ctx.strokeStyle = step === 2 ? colors.green : colors.red;
+ ctx.lineWidth = 2;
+ ctx.strokeRect(toX + 2, y + 2, cell - 6, cell - 6);
+ }
+ });
+
+ text(ctx, '已测分量 16 / 48', 424, 69, 17, colors.blue, 700);
+ text(ctx, '待估分量 32', 424, 103, 16, colors.muted);
+ text(ctx, '观测残差平方和', 424, 146, 15, colors.ink, 700);
+ const residual = step === 0 ? '尚无候选' : step === 1 ? String(edits.size * 18 ** 2) : '0';
+ const accent = step === 0 ? colors.muted : step === 1 ? colors.red : colors.green;
+ text(ctx, residual, 424, 183, step ? 27 : 15, accent, 700);
+ }
+
+ return (
+
+ setStep(step - 1)}>上一步
+ {step + 1} / 3 · {phases[step]}
+ setStep(step + 1)}>下一步
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/overlap-merge.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/overlap-merge.tsx
new file mode 100644
index 00000000..4a24d918
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/overlap-merge.tsx
@@ -0,0 +1,155 @@
+import { useRef, useState } from 'react';
+import type { KeyboardEvent } from 'react';
+import { Stage, bench, colors, rounded } from './paper-canvas';
+import { tileShade } from './atom-coding';
+
+type Cell = { x: number; y: number };
+const origin = { x: 36, y: 42 };
+const columns = 5;
+const rows = 4;
+const step = 40;
+const samples = [
+ { name: '甲', x: 0, y: 0, shift: 0.12 },
+ { name: '乙', x: 2, y: 0, shift: -0.10 },
+ { name: '丙', x: 0, y: 1, shift: 0.04 },
+ { name: '丁', x: 2, y: 1, shift: -0.02 },
+ { name: '戊', x: 0, y: 0, shift: -0.04 },
+];
+
+function estimates({ x, y }: Cell) {
+ const brightness = .18 + .10 * x + .06 * y + (x >= 3 ? .08 : 0);
+ return samples.map(sample =>
+ x >= sample.x && x < sample.x + 3 && y >= sample.y && y < sample.y + 3
+ ? brightness + sample.shift : null,
+ );
+}
+
+function aggregate(cell: Cell) {
+ const readings = estimates(cell);
+ const contributing = readings.filter((value): value is number => value !== null);
+ const sum = contributing.reduce((total, value) => total + value, 0);
+ return { readings, sum, count: contributing.length, average: sum / contributing.length };
+}
+
+const grid = Array.from({ length: rows }, (_, y) =>
+ Array.from({ length: columns }, (_, x) => aggregate({ x, y }).average),
+);
+
+const directions = [
+ { key: 'ArrowLeft', label: '左移一列', symbol: '←', x: -1, y: 0 },
+ { key: 'ArrowUp', label: '上一行', symbol: '↑', x: 0, y: -1 },
+ { key: 'ArrowDown', label: '下一行', symbol: '↓', x: 0, y: 1 },
+ { key: 'ArrowRight', label: '右移一列', symbol: '→', x: 1, y: 0 },
+];
+
+export function OverlapMerge() {
+ const [cell, setCell] = useState({ x: 2, y: 1 });
+ const draggingGrid = useRef(false);
+ const { readings, sum, count, average } = aggregate(cell);
+ const duplicate = readings[0] !== null && readings[4] !== null;
+
+ function drag(x: number, y: number) {
+ if (!draggingGrid.current) return;
+ const nextX = Math.max(0, Math.min(columns - 1, Math.floor((x - origin.x) / step)));
+ const nextY = Math.max(0, Math.min(rows - 1, Math.floor((y - origin.y) / step)));
+ setCell(previous => previous.x === nextX && previous.y === nextY ? previous : { x: nextX, y: nextY });
+ }
+
+ function beginDrag(x: number, y: number) {
+ draggingGrid.current = x >= origin.x && x < origin.x + columns * step
+ && y >= origin.y && y < origin.y + rows * step;
+ }
+
+ function canMove(x: number, y: number) {
+ return cell.x + x >= 0 && cell.x + x < columns && cell.y + y >= 0 && cell.y + y < rows;
+ }
+
+ function move(x: number, y: number) {
+ if (canMove(x, y)) setCell({ x: cell.x + x, y: cell.y + y });
+ }
+
+ function keyboard(event: KeyboardEvent) {
+ const direction = directions.find(option => option.key === event.key);
+ if (!direction) return;
+ event.preventDefault();
+ move(direction.x, direction.y);
+ }
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ bench(ctx, width, height);
+ rounded(ctx, 26, 16, 221, 194, 10, colors.paper, colors.light);
+ rounded(ctx, 300, 16, 308, 194, 10, colors.paper, colors.light);
+
+ ctx.fillStyle = colors.ink;
+ ctx.textAlign = 'left';
+ ctx.font = '600 16px system-ui, sans-serif';
+ ctx.fillText('回填位置', 38, 35);
+ ctx.fillText('像素估计', 318, 35);
+
+ grid.forEach((line, y) => line.forEach((value, x) => {
+ ctx.fillStyle = tileShade(value);
+ ctx.fillRect(origin.x + x * step + 1, origin.y + y * step + 1, step - 2, step - 2);
+ }));
+
+ samples.forEach((sample, index) => {
+ const extraInset = index === 4 ? 7 : 2;
+ const current = readings[index] !== null;
+ ctx.strokeStyle = current ? colors.blue : colors.light;
+ ctx.lineWidth = current ? 3 : 1;
+ ctx.setLineDash(index === 4 ? [6, 4] : []);
+ ctx.strokeRect(origin.x + sample.x * step + extraInset, origin.y + sample.y * step + extraInset,
+ 3 * step - 2 * extraInset, 3 * step - 2 * extraInset);
+ });
+ ctx.setLineDash([]);
+ const currentX = origin.x + cell.x * step;
+ const currentY = origin.y + cell.y * step;
+ ctx.lineWidth = 2;
+ ctx.strokeStyle = '#ffffff';
+ ctx.strokeRect(currentX + 3, currentY + 3, step - 6, step - 6);
+ ctx.strokeStyle = colors.orange;
+ ctx.lineWidth = 4;
+ ctx.strokeRect(currentX, currentY, step, step);
+
+ readings.forEach((value, index) => {
+ const y = 49 + index * 29;
+ rounded(ctx, 319, y, 121, 19, 4, value === null ? colors.bg : colors.light, colors.line);
+ if (value !== null) {
+ rounded(ctx, 319, y, value * 120, 19, 4, tileShade(value));
+ ctx.strokeStyle = colors.blue;
+ ctx.lineWidth = 2;
+ ctx.beginPath();
+ ctx.moveTo(447, y + 9.5);
+ ctx.lineTo(491, 117);
+ ctx.stroke();
+ }
+ });
+ rounded(ctx, 502, 80, 75, 75, 9, colors.paper, colors.green);
+ rounded(ctx, 508, 86, 63, 63, 4, tileShade(average));
+ }
+
+ const feedback = count === 1
+ ? '这里只由一块覆盖,结果直接取这份估计。'
+ : `这一格有 ${count} 份估计。相加后除以 ${count},得到 ${average.toFixed(2)}。`;
+
+ return (
+
+
+ {directions.map(({ key, label, symbol, x, y }) => (
+ move(x, y)}>{symbol}
+ ))}
+
+
+ 第 {cell.x + 1} 列,第 {cell.y + 1} 行 {count} 份估计
+
+ {readings.map((value, index) => value === null ? null : `${samples[index].name} ${value.toFixed(2)}`)
+ .filter(Boolean).join(' ')}
+
+ 平均:{sum.toFixed(2)} ÷ {count} = {average.toFixed(2)}
+ {duplicate && <> 甲和戊是同一位置在两个不同相似组中的估计,分别计入。>}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/paper-canvas.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/paper-canvas.tsx
new file mode 100644
index 00000000..fb50e585
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/paper-canvas.tsx
@@ -0,0 +1,243 @@
+import { useEffect, useRef } from 'react';
+import type { PointerEvent, ReactNode } from 'react';
+import { observeCanvas, setupCanvas } from '../lib/canvasKit';
+
+export const colors = {
+ bg: '#f5f8f0',
+ light: '#b8c9a7',
+ dark: '#76906a',
+ support: '#92400e',
+ blue: '#27446e',
+ green: '#228d5c',
+ red: '#c43f52',
+ orange: '#f07e47',
+ purple: '#7c3aed',
+ ink: '#21324a',
+ muted: '#68778f',
+ line: '#d7deea',
+ paper: '#fffcf2',
+};
+
+type Drawing = (ctx: CanvasRenderingContext2D, width: number, height: number) => void;
+type Hit = (x: number, y: number) => void;
+
+function prepare(canvas: HTMLCanvasElement, width: number, height: number) {
+ const context = setupCanvas(canvas, width, height);
+ canvas.style.width = '100%';
+ canvas.style.maxWidth = width + 'px';
+ canvas.style.height = 'auto';
+ canvas.style.marginInline = 'auto';
+ return context;
+}
+
+interface StageProps {
+ label: string;
+ draw: Drawing;
+ feedback: string;
+ tone?: 'good' | 'bad' | 'neutral';
+ children?: ReactNode;
+ width?: number;
+ height?: number;
+ onPick?: Hit;
+ onDrag?: Hit;
+}
+
+export function Stage({
+ label, draw, feedback, tone = 'neutral', children, width = 640, height = 240, onPick, onDrag,
+}: StageProps) {
+ const canvasRef = useRef(null);
+
+ useEffect(() => {
+ const canvas = canvasRef.current;
+ if (!canvas) return;
+ const context = prepare(canvas, width, height);
+ draw(context, width, height);
+ canvas.classList.add('is-ready');
+ }, [draw, width, height]);
+
+ function locate(event: PointerEvent, handler: Hit) {
+ const rect = event.currentTarget.getBoundingClientRect();
+ const x = (event.clientX - rect.left) * width / rect.width;
+ const y = (event.clientY - rect.top) * height / rect.height;
+ handler(Math.max(0, Math.min(width, x)), Math.max(0, Math.min(height, y)));
+ }
+
+ return (
+ <>
+ {
+ if (event.button !== 0) return;
+ if (onPick) locate(event, onPick);
+ if (onDrag) {
+ event.currentTarget.setPointerCapture(event.pointerId);
+ locate(event, onDrag);
+ }
+ }}
+ onPointerMove={event => {
+ if (onDrag && event.currentTarget.hasPointerCapture(event.pointerId)) locate(event, onDrag);
+ }}
+ />
+ {children && (
+ {
+ if (event.target instanceof HTMLInputElement || event.target instanceof HTMLSelectElement) {
+ if (event.key.startsWith('Arrow')) event.stopPropagation();
+ }
+ }}>
+ {children}
+
+ )}
+ {feedback}
+ >
+ );
+}
+
+export function rounded(
+ ctx: CanvasRenderingContext2D,
+ x: number,
+ y: number,
+ width: number,
+ height: number,
+ radius: number,
+ fill: string,
+ stroke?: string,
+) {
+ ctx.beginPath();
+ ctx.roundRect(x, y, width, height, radius);
+ ctx.fillStyle = fill;
+ ctx.fill();
+ if (stroke) {
+ ctx.strokeStyle = stroke;
+ ctx.lineWidth = 1.5;
+ ctx.stroke();
+ }
+}
+
+export function bench(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ rounded(ctx, 0, 0, width, height, 10, colors.bg);
+ ctx.fillStyle = colors.light;
+ ctx.fillRect(0, height - 26, width, 26);
+ ctx.fillStyle = colors.dark;
+ ctx.globalAlpha = .55;
+ ctx.fillRect(0, height - 26, width, 1);
+ ctx.globalAlpha = 1;
+}
+
+export function tile(
+ ctx: CanvasRenderingContext2D,
+ x: number,
+ y: number,
+ size: number,
+ motif: 'leaf' | 'cross' | 'diamond',
+ color: string,
+ opacity = 1,
+) {
+ rounded(ctx, x + 2, y + 5, size, size, 7, colors.dark);
+ rounded(ctx, x, y, size, size, 7, colors.paper, colors.light);
+ rounded(ctx, x + size * .09, y + size * .09, size * .82, size * .82, 4, colors.paper, colors.line);
+ ctx.save();
+ ctx.translate(x + size / 2, y + size / 2);
+ ctx.scale(size / 80, size / 80);
+ ctx.globalAlpha = opacity;
+ ctx.fillStyle = color;
+ ctx.strokeStyle = color;
+ ctx.lineWidth = 2;
+ if (motif === 'leaf') {
+ for (let i = 0; i < 4; i += 1) {
+ ctx.rotate(Math.PI / 2);
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.quadraticCurveTo(-19, -11, 0, -29);
+ ctx.quadraticCurveTo(19, -11, 0, 0);
+ ctx.fill();
+ }
+ } else if (motif === 'diamond') {
+ ctx.beginPath();
+ ctx.moveTo(0, -25);
+ ctx.lineTo(25, 0);
+ ctx.lineTo(0, 25);
+ ctx.lineTo(-25, 0);
+ ctx.closePath();
+ ctx.stroke();
+ ctx.rotate(Math.PI / 4);
+ ctx.strokeRect(-10, -10, 20, 20);
+ } else {
+ for (let i = 0; i < 4; i += 1) {
+ ctx.rotate(Math.PI / 2);
+ rounded(ctx, -4, -26, 8, 22, 4, color);
+ }
+ }
+ ctx.restore();
+}
+
+export function MovingCanvas({
+ label, draw, width = 560, height = 140,
+}: { label: string; draw: (ctx: CanvasRenderingContext2D, progress: number) => void; width?: number; height?: number }) {
+ const ref = useRef(null);
+
+ useEffect(() => {
+ const canvas = ref.current;
+ if (!canvas) return;
+ const context = prepare(canvas, width, height);
+ const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
+ let frame = 0;
+ let origin: number | undefined;
+ function render(progress: number) {
+ draw(context, progress);
+ canvas?.classList.add('is-ready');
+ }
+ function tick(time: number) {
+ origin ??= time;
+ const phase = ((time - origin) % 3400) / 3400;
+ const progress = (1 - Math.cos(phase * Math.PI * 2)) / 2;
+ render(progress);
+ frame = requestAnimationFrame(tick);
+ }
+ function stop() {
+ cancelAnimationFrame(frame);
+ frame = 0;
+ }
+ render(1);
+ if (reduce) return;
+ const disconnect = observeCanvas(canvas, () => {
+ if (!frame) frame = requestAnimationFrame(tick);
+ }, stop);
+ return () => {
+ disconnect();
+ stop();
+ };
+ }, [draw, width, height]);
+
+ return ;
+}
+
+export function HeroComparison({ shared }: { shared: boolean }) {
+ return (
+ {
+ bench(ctx, 420, 156);
+ rounded(ctx, 63, 115, 294, 20, 8, colors.support);
+ tile(ctx, 97, 40, 82, 'leaf', colors.blue, .62);
+ tile(ctx, 233, 40, 82, shared ? 'leaf' : 'cross', shared ? colors.green : colors.red, .3 + .5 * progress);
+ ctx.save();
+ ctx.translate(274, 50 + progress * 20);
+ rounded(ctx, -30, -7, 60, 14, 5, colors.support);
+ rounded(ctx, -9, -27, 18, 23, 6, colors.support);
+ rounded(ctx, -29, 1, 58, 7, 3, shared ? colors.green : colors.red);
+ ctx.restore();
+ }}
+ />
+ );
+}
+
+export function HeroOld() {
+ return ;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/patch-match.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/patch-match.tsx
new file mode 100644
index 00000000..59ce3c31
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/patch-match.tsx
@@ -0,0 +1,112 @@
+import { useState } from 'react';
+import { Stage, colors } from './paper-canvas';
+
+const reference = [0, 0, 4, 0, 0, 4, 0, 0, 4];
+const candidates = [
+ { label: '近处横纹', cells: [0, 0, 0, 0, 0, 0, 4, 4, 4], x: 175, description: '这块离得最近,条纹方向却不同。' },
+ { label: '中间弱纹', cells: [0, 0, 2, 0, 0, 2, 0, 0, 2], x: 326, description: '方向一致,亮度仍有差异。' },
+ { label: '远处竖纹', cells: [0, 1, 4, 0, 0, 4, 0, 0, 4], x: 479, description: '远处这块也在搜索窗里。' },
+];
+const threshold = 9;
+const candidateY = 43;
+const candidateSize = 78;
+const shades = ['#f1eee1', '#dce6d0', '#b8c9a7', '#95ad85', '#6a8962'];
+
+function drawPatch(
+ ctx: CanvasRenderingContext2D,
+ x: number,
+ y: number,
+ size: number,
+ cells: number[],
+ outline?: string,
+) {
+ ctx.fillStyle = colors.light;
+ ctx.beginPath();
+ ctx.roundRect(x + 1, y + 3, size, size, 7);
+ ctx.fill();
+ ctx.fillStyle = colors.paper;
+ ctx.beginPath();
+ ctx.roundRect(x, y, size, size, 7);
+ ctx.fill();
+ ctx.strokeStyle = outline ?? colors.dark;
+ ctx.lineWidth = outline ? 2.5 : 1;
+ ctx.stroke();
+ const cellSize = (size - 14) / 3;
+ cells.forEach((value, index) => {
+ const column = index % 3;
+ const row = Math.floor(index / 3);
+ ctx.fillStyle = shades[value];
+ ctx.fillRect(x + 7 + column * cellSize, y + 7 + row * cellSize, cellSize - 1, cellSize - 1);
+ });
+}
+
+export function PatchMatch() {
+ const [selection, setSelection] = useState(0);
+ const candidate = candidates[selection];
+ const distance = reference.reduce((total, value, index) => total + (value - candidate.cells[index]) ** 2, 0);
+ const withinThreshold = distance <= threshold;
+ const statusColor = withinThreshold ? colors.green : colors.red;
+ const feedback = candidate.description + '平方距离是 ' + distance
+ + (withinThreshold ? ',符合入组阈值 ' : ',高于入组阈值 ') + threshold + '。';
+
+ function pick(x: number, y: number) {
+ if (y < candidateY || y > candidateY + candidateSize) return;
+ const index = candidates.findIndex((item) => x >= item.x && x <= item.x + candidateSize);
+ if (index >= 0) setSelection(index);
+ }
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ ctx.fillStyle = colors.bg;
+ ctx.fillRect(0, 0, width, height);
+ ctx.strokeStyle = colors.dark;
+ ctx.lineWidth = 1;
+ ctx.setLineDash([5, 5]);
+ ctx.beginPath();
+ ctx.roundRect(154, 28, 446, 113, 12);
+ ctx.stroke();
+ ctx.setLineDash([]);
+
+ drawPatch(ctx, 32, 37, 94, reference, colors.blue);
+ candidates.forEach((item, index) => {
+ drawPatch(ctx, item.x, candidateY, candidateSize, item.cells, index === selection ? statusColor : undefined);
+ });
+
+ const x = 36;
+ const length = 568;
+ const current = x + distance / 64 * length;
+ const cutoff = x + threshold / 64 * length;
+ ctx.fillStyle = colors.light;
+ ctx.fillRect(x, 192, length, 9);
+ ctx.fillStyle = statusColor;
+ ctx.fillRect(x, 192, current - x, 9);
+ ctx.fillStyle = colors.blue;
+ ctx.fillRect(cutoff - 1, 184, 2, 24);
+ ctx.fillStyle = colors.orange;
+ ctx.beginPath();
+ ctx.arc(current, 196.5, 4.5, 0, Math.PI * 2);
+ ctx.fill();
+
+ ctx.fillStyle = colors.ink;
+ ctx.font = '600 14px system-ui, sans-serif';
+ ctx.textAlign = 'center';
+ ctx.fillText('参照砖', 79, 154);
+ ctx.textAlign = 'left';
+ ctx.fillText('平方距离', x, 182);
+ }
+
+ return (
+
+ {candidates.map((option, index) => (
+ setSelection(index)}
+ >
+ {option.label}
+
+ ))}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-motivation.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-motivation.tsx
new file mode 100644
index 00000000..c31258a5
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-motivation.tsx
@@ -0,0 +1,98 @@
+import { useState } from 'react';
+import { Stage, colors } from './paper-canvas';
+
+// Broad bands have flat interiors. The finer bands on the right emphasize texture loss.
+const clean = [54, 54, 54, 54, 210, 210, 210, 210, 54, 210, 54, 210];
+const noise = [14, -9, 10, -13, 12, -8, -11, 8, -10, 13, -7, 10];
+const noisy = clean.map((value, index) => value + noise[index]);
+const averaged = noisy.map((value, index) => (
+ (noisy[Math.max(0, index - 1)] + value + noisy[Math.min(noisy.length - 1, index + 1)]) / 3
+));
+const flatInteriors = [1, 2, 5, 6];
+
+function flatError(values: number[]) {
+ return (flatInteriors.reduce((sum, index) => sum + Math.abs(values[index] - clean[index]), 0) /
+ flatInteriors.length).toFixed(1);
+}
+
+function edgeContrast(values: number[]) {
+ return Math.abs(values[4] - values[3]).toFixed(0);
+}
+
+function drawProfile(ctx: CanvasRenderingContext2D, x: number, values: number[]) {
+ const first = x + 12;
+ const step = 258 / values.length;
+ ctx.beginPath();
+ values.forEach((value, index) => {
+ const px = first + (index + 0.5) * step;
+ const py = 193 - (value / 255) * 58;
+ if (index === 0) ctx.moveTo(px, py);
+ else ctx.lineTo(px, py);
+ });
+ ctx.stroke();
+}
+
+function drawTilePanel(
+ ctx: CanvasRenderingContext2D,
+ x: number,
+ title: string,
+ values: number[],
+ color: string,
+) {
+ const y = 28;
+ ctx.fillStyle = colors.light;
+ ctx.beginPath();
+ ctx.roundRect(x + 2, y + 4, 282, 184, 12);
+ ctx.fill();
+ ctx.fillStyle = colors.paper;
+ ctx.strokeStyle = color;
+ ctx.lineWidth = 1.5;
+ ctx.beginPath();
+ ctx.roundRect(x, y, 282, 184, 12);
+ ctx.fill();
+ ctx.stroke();
+
+ const bandWidth = 258 / values.length;
+ values.forEach((value, index) => {
+ const gray = Math.round(82 + 160 * value / 255);
+ ctx.fillStyle = 'rgb(' + gray + ',' + (gray + 5) + ',' + (gray + 1) + ')';
+ ctx.fillRect(x + 12 + index * bandWidth, y + 26, bandWidth, 72);
+ });
+ ctx.strokeStyle = colors.line;
+ ctx.lineWidth = 1;
+ ctx.strokeRect(x + 12, y + 107, 258, 60);
+ ctx.strokeStyle = colors.muted;
+ ctx.setLineDash([3, 4]);
+ drawProfile(ctx, x, clean);
+ ctx.setLineDash([]);
+ ctx.strokeStyle = color;
+ ctx.lineJoin = 'round';
+ ctx.lineWidth = 2.25;
+ drawProfile(ctx, x, values);
+ ctx.textAlign = 'left';
+ ctx.font = '600 14px system-ui, sans-serif';
+ ctx.fillStyle = colors.ink;
+ ctx.fillText(title, x + 13, y + 18);
+}
+
+export function RawMotivation() {
+ const [smoothed, setSmoothed] = useState(false);
+ const feedback = smoothed
+ ? `宽纹内部的平均绝对误差从 ${flatError(noisy)} 降到 ${flatError(averaged)},第一处明暗交界的灰度差从 ${edgeContrast(noisy)} 降到 ${edgeContrast(averaged)}。看右侧窄纹,明暗也更难分清了。`
+ : '两边从同一份含噪读数开始。每幅图里,宽纹内部原本应当平坦,右侧的窄纹原本明暗交替。';
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ ctx.fillStyle = colors.bg;
+ ctx.fillRect(0, 0, width, height);
+ drawTilePanel(ctx, 24, '原始读数', noisy, colors.blue);
+ drawTilePanel(ctx, 334, '处理预览', smoothed ? averaged : noisy, smoothed ? colors.red : colors.blue);
+ }
+
+ return (
+
+ setSmoothed((previous) => !previous)}>
+ {smoothed ? '恢复观测' : '应用局部平均'}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-pipeline.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-pipeline.tsx
new file mode 100644
index 00000000..58cb8875
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-pipeline.tsx
@@ -0,0 +1,171 @@
+import { useState } from 'react';
+import { Stage, colors } from './paper-canvas';
+
+type Rgb = [number, number, number];
+const side = 12;
+const phases = ['含噪马赛克', '去噪马赛克', '补色预览'];
+const lastPhase = phases.length - 1;
+
+function integer(value: number) {
+ return Math.max(0, Math.min(255, Math.round(value)));
+}
+
+function channelAt(row: number, col: number) {
+ return row % 2 === 0 ? (col % 2 === 0 ? 1 : 0) : (col % 2 === 0 ? 2 : 1);
+}
+
+function makeScene() {
+ const colorGrid: Rgb[] = [];
+ const original: number[] = [];
+ const noisy: number[] = [];
+ let seed = 14937;
+ const noise = () => {
+ seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0;
+ return seed / 4294967296;
+ };
+ for (let row = 0; row < side; row += 1) {
+ for (let col = 0; col < side; col += 1) {
+ const band = Math.sin((col - row * 0.65) * 0.65) * 16;
+ const illumination = col * 1.6 + row * 2.2;
+ const rgb: Rgb = [integer(139 + band + illumination), integer(165 + band * 0.85 + illumination), integer(128 - band + illumination)];
+ const raw = rgb[channelAt(row, col)];
+ colorGrid.push(rgb);
+ original.push(raw);
+ noisy.push(integer(raw + (noise() + noise() + noise() - 1.5) * 53));
+ }
+ }
+
+ const denoised = noisy.map((value, index) => {
+ const row = Math.floor(index / side);
+ const col = index % side;
+ const offsets = [[-2, 0], [2, 0], [0, -2], [0, 2]];
+ let sum = value * 2;
+ let count = 2;
+ for (const [dy, dx] of offsets) {
+ const yy = row + dy;
+ const xx = col + dx;
+ if (yy >= 0 && yy < side && xx >= 0 && xx < side) {
+ sum += noisy[yy * side + xx];
+ count += 1;
+ }
+ }
+ return integer(sum / count);
+ });
+
+ const demosaicked = denoised.map((value, index): Rgb => {
+ const row = Math.floor(index / side);
+ const col = index % side;
+ const channels: Rgb = [0, 0, 0];
+ for (let channel = 0; channel < 3; channel += 1) {
+ if (channelAt(row, col) === channel) {
+ channels[channel] = value;
+ continue;
+ }
+ let sum = 0;
+ let count = 0;
+ for (let y = Math.max(0, row - 1); y <= Math.min(side - 1, row + 1); y += 1) {
+ for (let x = Math.max(0, col - 1); x <= Math.min(side - 1, col + 1); x += 1) {
+ if (channelAt(y, x) !== channel) continue;
+ sum += denoised[y * side + x];
+ count += 1;
+ }
+ }
+ channels[channel] = integer(sum / count);
+ }
+ return channels;
+ });
+
+ const rmse = (values: number[]) => Math.sqrt(values.reduce((sum, value, index) => sum + (value - original[index]) ** 2, 0) / values.length);
+ return { colorGrid, noisy, denoised, demosaicked, errors: [rmse(noisy), rmse(denoised)] };
+}
+
+const scene = makeScene();
+
+function text(ctx: CanvasRenderingContext2D, value: string, x: number, y: number, size = 14, color = colors.ink, weight = 500) {
+ ctx.font = `${weight} ${size}px sans-serif`;
+ ctx.fillStyle = color;
+ ctx.fillText(value, x, y);
+}
+
+export function RawPipeline() {
+ const [step, setStep] = useState(0);
+ const feedback = [
+ '这里仍有噪点,每个采样点只有一个实测颜色分量。',
+ '此时仍是马赛克,先在实测颜色上压低噪声。',
+ '在去噪马赛克基础上补齐颜色。此处是简化插值的教学预览。',
+ ][step];
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ ctx.fillStyle = colors.paper;
+ ctx.fillRect(0, 0, width, height);
+ text(ctx, '教学模拟', 220, 31, 16, colors.ink, 700);
+
+ ctx.beginPath();
+ ctx.roundRect(20, 47, 168, 160, 12);
+ ctx.fillStyle = colors.light;
+ ctx.fill();
+ ctx.fillStyle = '#eaddba';
+ ctx.fillRect(40, 62, 126, 130);
+ const tileSize = 10.5;
+ scene.colorGrid.forEach(([red, green, blue], index) => {
+ const x = 40 + (index % side) * tileSize;
+ const y = 64 + Math.floor(index / side) * tileSize;
+ ctx.fillStyle = `rgb(${red}, ${green}, ${blue})`;
+ ctx.fillRect(x, y, tileSize + 0.1, tileSize + 0.1);
+ });
+ const paperX = [67, 112, 145][step];
+ ctx.fillStyle = '#fff5e9';
+ ctx.fillRect(paperX, 63, 166 - paperX, 128);
+ ctx.strokeStyle = colors.orange;
+ ctx.lineWidth = 2;
+ ctx.beginPath();
+ ctx.moveTo(paperX, 63);
+ ctx.lineTo(paperX, 191);
+ ctx.stroke();
+
+ const drawColors = step === 0 ? scene.noisy : scene.denoised;
+ const unit = 13;
+ for (let row = 0; row < side; row += 1) {
+ for (let col = 0; col < side; col += 1) {
+ const index = row * side + col;
+ const channel = channelAt(row, col);
+ const active: Rgb = [34, 34, 34];
+ active[channel] = drawColors[index];
+ const rgb = step === lastPhase ? scene.demosaicked[index] : active;
+ const x = 220 + col * unit;
+ const y = 45 + row * unit;
+ ctx.fillStyle = `rgb(${rgb.join(',')})`;
+ ctx.fillRect(x, y, step === lastPhase ? unit + 0.1 : unit - 0.6, step === lastPhase ? unit + 0.1 : unit - 0.6);
+ }
+ }
+
+ const timeline = ['提取并缩放', '马赛克去噪', '去马赛克'];
+ ctx.strokeStyle = colors.line;
+ ctx.lineWidth = 2;
+ ctx.beginPath();
+ ctx.moveTo(429, 60);
+ ctx.lineTo(429, 130);
+ ctx.stroke();
+ timeline.forEach((stage, index) => {
+ const y = 60 + index * 35;
+ const isActive = index === step;
+ const accent = index === 0 ? colors.red : index === 1 ? colors.blue : colors.green;
+ ctx.beginPath();
+ ctx.arc(429, y, isActive ? 6.5 : 4, 0, Math.PI * 2);
+ ctx.fillStyle = isActive ? accent : colors.line;
+ ctx.fill();
+ text(ctx, stage, 446, y + 5, 15, isActive ? accent : colors.muted, isActive ? 700 : 500);
+ });
+
+ const measurement = step === lastPhase ? '每像素 3 个颜色分量' : `采样位 RMSE ${scene.errors[step].toFixed(1)}`;
+ text(ctx, measurement, 424, 187, 15, colors.ink, 700);
+ }
+
+ return (
+
+ setStep(step - 1)}>上一步
+ {step + 1} / {phases.length} · {phases[step]}
+ setStep(step + 1)}>下一步
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-test.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-test.tsx
new file mode 100644
index 00000000..3d8fa32e
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/raw-test.tsx
@@ -0,0 +1,254 @@
+import { useMemo, useState } from 'react';
+import { colors, rounded, Stage } from './paper-canvas';
+
+const WIDTH = 48;
+const HEIGHT = 32;
+const PATCH = 6;
+const READ_SD = 0.018;
+const A = PATCH * PATCH;
+const cells = Array.from({ length: A }, (_, i) => [i % PATCH, Math.floor(i / PATCH)]);
+const regions = [
+ { id: 'all', label: '全图', includes: () => true },
+ { id: 'dark', label: '暗部', includes: (value: number) => value < .30 },
+ { id: 'bright', label: '亮部', includes: (value: number) => value >= .55 },
+] as const;
+
+const atomRules: ((x: number, y: number) => number)[] = [
+ (x) => x < 2 ? -1 : 1,
+ (x) => x < 3 ? -1 : 1,
+ (x) => x < 4 ? -1 : 1,
+ (_, y) => y < 2 ? -1 : 1,
+ (_, y) => y < 3 ? -1 : 1,
+ (_, y) => y < 4 ? -1 : 1,
+ (x, y) => x + y < 6 ? -1 : 1,
+ (x, y) => x - y < 0 ? -1 : 1,
+ (x) => x % 2 === 0 ? -1 : 1,
+ (_, y) => y % 2 === 0 ? -1 : 1,
+ (x, y) => (Math.floor(x / 2) + Math.floor(y / 2)) % 2 === 0 ? -1 : 1,
+];
+
+const atoms = atomRules.map(rule => {
+ const values = cells.map(([x, y]) => rule(x, y));
+ const mean = values.reduce((a, b) => a + b, 0) / A;
+ const centered = values.map(v => v - mean);
+ const norm = Math.hypot(...centered);
+ return centered.map(v => v / norm);
+});
+
+const clamp = (value: number) => Math.min(1, Math.max(0, value));
+
+function cleanScene() {
+ return Array.from({ length: WIDTH * HEIGHT }, (_, index) => {
+ const x = index % WIDTH;
+ const y = Math.floor(index / WIDTH);
+ const left = x < 23;
+ const lintel = y < 8;
+ const stripes = y < 25 && y % 6 >= 3;
+ const tileTone = x % 8 < 2 && stripes ? .12 : 0;
+ const arch = ((x - 32) / 10) ** 2 + ((y - 15) / 11) ** 2 < 1;
+ const border = x === 21 || x === 22 || y === 25 || y === 26;
+ const base = left ? .16 + tileTone : .53 + tileTone;
+ const brightness = border ? .77 : lintel ? base * .65 : arch ? .81 : base;
+ const channel = y % 2 === 0 ? (x % 2 === 0 ? .98 : 1) : (x % 2 === 0 ? 1 : .83);
+ return clamp(brightness * channel);
+ });
+}
+
+const clean = cleanScene();
+
+function seededRandom(seed: number) {
+ let state = seed >>> 0;
+ return () => {
+ state = (Math.imul(1664525, state) + 1013904223) >>> 0;
+ return (state + .5) / 4294967296;
+ };
+}
+
+function sample(photons: number) {
+ const shot = seededRandom(701);
+ const read = seededRandom(2009);
+ return clean.map(value => {
+ const limit = Math.exp(-value * photons);
+ let product = shot();
+ let count = 0;
+ while (product > limit) {
+ product *= shot();
+ count += 1;
+ }
+ const gaussian = Math.sqrt(-2 * Math.log(read())) * Math.cos(2 * Math.PI * read());
+ return count / photons + READ_SD * gaussian;
+ });
+}
+
+function starts(length: number) {
+ const positions: number[] = [];
+ for (let s = 0; s < length - PATCH; s += 3) positions.push(s);
+ positions.push(length - PATCH);
+ return positions;
+}
+
+const X = starts(WIDTH / 2);
+const Y = starts(HEIGHT / 2);
+
+function makePatches(data: number[], planeX: number, planeY: number) {
+ return Y.flatMap(startY => X.map(startX => {
+ const pixels = cells.map(([x, y]) => ((startY + y) * 2 + planeY) * WIDTH + (startX + x) * 2 + planeX);
+ const values = pixels.map(index => data[index]);
+ const mean = values.reduce((total, value) => total + value, 0) / A;
+ return { pixels, values, centered: values.map(value => value - mean) };
+ }));
+}
+
+type Patch = ReturnType[number];
+
+function chooseSupport(ref: Patch, patches: Patch[]) {
+ const matches = patches
+ .filter(candidate => candidate !== ref)
+ .map(candidate => ({
+ patch: candidate,
+ error: candidate.centered.reduce((total, value, i) => total + (value - ref.centered[i]) ** 2, 0),
+ }))
+ .sort((a, b) => a.error - b.error)
+ .slice(0, 2)
+ .map(match => match.patch);
+ const group = [ref, ...matches];
+ let bestIndex = 0;
+ let bestScore = -1;
+ for (const [index, atom] of atoms.entries()) {
+ const score = group.reduce((total, patch) => {
+ const coefficient = patch.centered.reduce((dot, value, i) => dot + value * atom[i], 0);
+ return total + coefficient ** 2;
+ }, 0);
+ if (score > bestScore) {
+ bestScore = score;
+ bestIndex = index;
+ }
+ }
+ return atoms[bestIndex];
+}
+
+function rebuild(
+ patches: { patch: Patch; atom: number[] }[],
+ variance?: number[],
+) {
+ const totals = Array(WIDTH * HEIGHT).fill(0);
+ const visits = Array(WIDTH * HEIGHT).fill(0);
+ for (const { patch, atom } of patches) {
+ let aa = 0;
+ let ab = 0;
+ let bb = 0;
+ let ay = 0;
+ let by = 0;
+ patch.pixels.forEach((pixel, i) => {
+ const weight = variance ? 1 / variance[pixel] : 1;
+ aa += weight;
+ ab += weight * atom[i];
+ bb += weight * atom[i] ** 2;
+ ay += weight * patch.values[i];
+ by += weight * atom[i] * patch.values[i];
+ });
+ // Two-parameter weighted least squares for the constant and the selected atom.
+ const determinant = aa * bb - ab * ab;
+ const offset = (bb * ay - ab * by) / determinant;
+ const coefficient = (aa * by - ab * ay) / determinant;
+ patch.pixels.forEach((pixel, i) => {
+ totals[pixel] += offset + coefficient * atom[i];
+ visits[pixel] += 1;
+ });
+ }
+ return totals.map((sum, index) => clamp(sum / visits[index]));
+}
+
+function assess(values: number[]) {
+ const errors = values.map((value, index) => (value - clean[index]) ** 2);
+ const rmse = regions.map(({ includes }) => {
+ const selected = errors.filter((_, index) => includes(clean[index]));
+ return Math.sqrt(selected.reduce((sum, value) => sum + value, 0) / selected.length);
+ });
+ return { psnr: -20 * Math.log10(rmse[0]), rmse };
+}
+
+function run(photons: number) {
+ const input = sample(photons);
+ const projections = [0, 1, 2, 3].flatMap(plane => {
+ const patches = makePatches(input, plane % 2, Math.floor(plane / 2));
+ return patches.map(patch => ({ patch, atom: chooseSupport(patch, patches) }));
+ });
+ const uniform = rebuild(projections);
+ const variance = uniform.map(pilot => Math.max(.015, pilot) / photons + READ_SD ** 2);
+ const adaptive = rebuild(projections, variance);
+ return { input, uniform, adaptive, baseline: assess(input), first: assess(uniform), second: assess(adaptive) };
+}
+
+function drawMosaic(ctx: CanvasRenderingContext2D, values: number[], x: number, region: number) {
+ const y = 46;
+ const cell = 5;
+ rounded(ctx, x - 4, y - 4, WIDTH * cell + 8, HEIGHT * cell + 8, 5, colors.paper, colors.line);
+ values.forEach((value, index) => {
+ const row = Math.floor(index / WIDTH);
+ const col = index % WIDTH;
+ const shade = Math.round(255 * value ** .64);
+ const red = row % 2 === 0 && col % 2 === 0;
+ const blue = row % 2 === 1 && col % 2 === 1;
+ const tint = red ? [1, .88, .86] : blue ? [.88, .93, 1] : [.92, 1, .90];
+ ctx.fillStyle = 'rgb(' + tint.map(factor => Math.round(factor * shade)).join(',') + ')';
+ ctx.fillRect(x + col * cell, y + row * cell, cell, cell);
+ if (!regions[region].includes(clean[index])) {
+ ctx.fillStyle = 'rgb(247 246 239 / 72%)';
+ ctx.fillRect(x + col * cell, y + row * cell, cell, cell);
+ }
+ });
+}
+
+export function RawTest() {
+ const [photons, setPhotons] = useState(60);
+ const [region, selectRegion] = useState(0);
+ const { uniform, adaptive, baseline, first, second } = useMemo(() => run(photons), [photons]);
+ const area = regions[region].label;
+ const delta = first.rmse[region] - second.rmse[region];
+ const comparison = delta > .0005 ? '方差加权的误差较低' : delta < -.0005 ? '等权拟合的误差较低' : '两种拟合的误差接近';
+ const scores = [
+ { method: '含噪输入', ...baseline },
+ { method: '等权拟合', ...first },
+ { method: '方差加权', ...second },
+ ];
+ return (
+
+ {
+ rounded(ctx, 0, 0, width, height, 10, colors.bg);
+ ctx.textAlign = 'center';
+ ctx.font = '600 20px system-ui';
+ ctx.fillStyle = colors.ink;
+ ctx.fillText('等权拟合', 174, 30);
+ ctx.fillText('方差加权', 466, 30);
+ drawMosaic(ctx, uniform, 54, region);
+ drawMosaic(ctx, adaptive, 346, region);
+ }}
+ feedback={`当前样本的${area}中,${comparison}。加权效果取决于方差估计与图块结构。`}
+ tone={delta > .0005 ? 'good' : 'neutral'}
+ >
+ 光子数参数 λ {photons}
+ setPhotons(Number(event.target.value))} />
+
+ {regions.map(({ id, label }, index) => (
+ selectRegion(index)}>
+ {label}
+
+ ))}
+
+
+
+ 合成 RAW 误差对照
+ 方法 全图 PSNR (dB ↑) {area} RMSE (↓)
+
+ {scores.map(({ method, psnr, rmse }) => (
+ {method} {psnr.toFixed(2)} {rmse[region].toFixed(3)}
+ ))}
+
+
+ 暗部和亮部按归一化真值划分,暗部低于 0.30,亮部至少为 0.55。切换区域只改变统计和高亮范围。
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/real-effects.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/real-effects.tsx
new file mode 100644
index 00000000..0fbe12d6
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/real-effects.tsx
@@ -0,0 +1,118 @@
+import { useId, useState } from 'react';
+import '../styles/gallery.css';
+
+const scenes = [
+ {
+ id: 'night',
+ name: '夜景',
+ observation: '看灯光周围的彩色噪点,再沿着较细的枝条检查轮廓。',
+ subject: '夜间建筑、窗灯和被灯光照亮的树枝',
+ },
+ {
+ id: 'tulips',
+ name: '郁金香',
+ observation: '观察花瓣颜色的渐变和叶片边缘。色调变化也可能来自显影处理。',
+ subject: '红色郁金香花瓣和绿色叶片',
+ },
+ {
+ id: 'sculpture',
+ name: '石雕',
+ observation: '对照雕刻表面的颗粒和右侧背景。作者指出,这个场景的背景仍有部分残噪。',
+ subject: '人物石雕的侧面和右侧的浅色背景',
+ },
+] as const;
+
+const baselines = [
+ { id: 'acr', name: 'Adobe Camera Raw', caption: '关闭降噪 · 原图第 2 行' },
+ { id: 'lsc', name: 'LSC', caption: '自适应字典 · 单块编码 · 原图第 5 行' },
+] as const;
+
+const lssc = { id: 'lssc', name: 'LSSC', caption: '联合稀疏编码 · 原图第 6 行' };
+const paperFigure = 'https://www.di.ens.fr/~fbach/iccv09_mairal.pdf#page=8';
+
+interface PhotoProps {
+ scene: (typeof scenes)[number];
+ method: { id: string; name: string; caption: string };
+}
+
+function ResultPhoto({ scene, method }: PhotoProps) {
+ const src = `${import.meta.env.BASE_URL}images/fig4-${scene.id}-${method.id}.png`;
+
+ return (
+
+
+
+
+
+ {method.name}
+ {method.caption}
+
+
+ );
+}
+
+export function RealEffects() {
+ const [sceneIndex, selectScene] = useState(0);
+ const [baselineIndex, selectBaseline] = useState(0);
+ const sceneLabel = useId();
+ const baselineLabel = useId();
+ const scene = scenes[sceneIndex];
+ const baseline = baselines[baselineIndex];
+
+ return (
+
+
+
+ 实拍场景
+
+ {scenes.map((option, index) => (
+ selectScene(index)}
+ >
+ {option.name}
+
+ ))}
+
+
+
+ 对照方法
+
+ {baselines.map((option, index) => (
+ selectBaseline(index)}
+ >
+ {option.name}
+
+ ))}
+
+
+
+
+
+
+
+
+
+ 观察{scene.name} {scene.observation}
+
+ Canon PowerShot G9,ISO 1600,短曝光。两幅局部取自同一 RAW 拍摄的显影结果,可点击图片查看原始尺寸。
+ 论文对此组样例作定性比较。{baseline.id === 'acr' ? '两种显影流程都可能影响亮度、颜色和纹理。' : 'LSC 与 LSSC 便于比较单块编码和联合编码的效果。'}
+ 查看 Mairal 等人的原论文图 4
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/registry.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/registry.tsx
new file mode 100644
index 00000000..224a1675
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/registry.tsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import { ExampleSlider } from './exampleSlider';
+import { AtomCoding } from './atom-coding';
+import { BayerMask } from './bayer-mask';
+import { CriticalReflections, CriticalReview } from './critical-review';
+import { DictionaryLearn } from './dictionary-learn';
+import { HeroJoint } from './hero-joint';
+import { MaskedRebuild } from './masked-rebuild';
+import { OverlapMerge } from './overlap-merge';
+import { HeroOld } from './paper-canvas';
+import { PatchMatch } from './patch-match';
+import { RawMotivation } from './raw-motivation';
+import { RawPipeline } from './raw-pipeline';
+import { RawTest } from './raw-test';
+import { RealEffects } from './real-effects';
+import { ResultsCompare } from './results-compare';
+import { SharedCoding } from './shared-coding';
+import { TileAnalogy } from './tile-analogy';
+
+export interface WidgetProps {
+ chapterId: string;
+ moduleId: string;
+}
+
+export const widgetRegistry: Record> = {};
+widgetRegistry['example-slider'] = ExampleSlider;
+widgetRegistry['atom-coding'] = AtomCoding;
+widgetRegistry['bayer-mask'] = BayerMask;
+widgetRegistry['critical-review'] = CriticalReview;
+widgetRegistry['critical-reflections'] = CriticalReflections;
+widgetRegistry['dictionary-learn'] = DictionaryLearn;
+widgetRegistry['hero-joint'] = HeroJoint;
+widgetRegistry['masked-rebuild'] = MaskedRebuild;
+widgetRegistry['overlap-merge'] = OverlapMerge;
+widgetRegistry['paper-canvas'] = HeroOld;
+widgetRegistry['patch-match'] = PatchMatch;
+widgetRegistry['raw-motivation'] = RawMotivation;
+widgetRegistry['raw-pipeline'] = RawPipeline;
+widgetRegistry['raw-test'] = RawTest;
+widgetRegistry['real-effects'] = RealEffects;
+widgetRegistry['results-compare'] = ResultsCompare;
+widgetRegistry['shared-coding'] = SharedCoding;
+widgetRegistry['tile-analogy'] = TileAnalogy;
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/results-compare.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/results-compare.tsx
new file mode 100644
index 00000000..3b88daa6
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/results-compare.tsx
@@ -0,0 +1,76 @@
+import { useState } from 'react';
+
+const protocols = ['合成去噪', 'Kodak 去马赛克', '实拍 RAW'];
+const denoisingMethods = ['GSM', 'FoE', 'K-SVD', 'BM3D', 'SC', 'LSC', 'LSSC'];
+const denoisingScores = [
+ { sigma: 5, psnr: [37.05, 37.03, 37.42, 37.62, 37.46, 37.66, 37.67] },
+ { sigma: 10, psnr: [33.34, 33.11, 33.62, 34.00, 33.76, 33.98, 34.06] },
+ { sigma: 15, psnr: [30.58, 30.99, 31.58, 32.05, 31.72, 31.99, 32.12] },
+ { sigma: 20, psnr: [29.91, 29.62, 30.18, 30.73, 30.29, 30.60, 30.78] },
+ { sigma: 25, psnr: [28.84, 28.36, 29.10, 29.72, 29.18, 29.52, 29.74] },
+ { sigma: 50, psnr: [25.66, 24.36, 25.61, 26.38, 25.83, 26.18, 26.57] },
+ { sigma: 100, psnr: [22.80, 21.36, 22.10, 23.25, 22.46, 22.62, 23.39] },
+];
+const demosaicingMethods = ['AP', 'DL', 'LPA', 'SC', 'LSC', 'LSSC'];
+const demosaicingScores = [39.21, 40.05, 40.52, 40.88, 41.13, 41.39];
+
+export function ResultsCompare() {
+ const [protocol, select] = useState(0);
+ const [noiseIndex, setNoiseIndex] = useState(4);
+ const denoising = denoisingScores[noiseIndex];
+ const psnr = protocol === 0 ? denoising.psnr : demosaicingScores;
+ const methods = protocol === 0 ? denoisingMethods : demosaicingMethods;
+
+ return (
+
+
+ {protocols.map((name, index) => (
+ select(index)}>
+ {name}
+
+ ))}
+
+ {protocol === 2 ? (
+
+ 原文图 4 · 定性对照
+ 同一台相机以 ISO 1600 拍摄三种短曝光场景。作者比较显影结果的纹理、伪色和残噪,并指出第三张的背景仍含部分噪声。此组没有可用于计算 PSNR 的无噪声真值。
+ 查看实拍原图与处理流程 →
+
+ ) : (
+ <>
+
+ {protocol === 0 ? (
+ 原文表 2 · 十二张标准图的合成高斯白噪声去噪结果。调整 σ 可对照原文报告的七档噪声强度。
+ ) : (
+ 原文表 3 · 对 24 张 Kodak 图像应用 Bayer 掩码,比较时裁去 15 像素边界。
+ )}
+
+ {protocol === 0 ? (
+
+ 噪声标准差 σ
+ setNoiseIndex(Number(event.target.value))}>
+ {denoisingScores.map(({ sigma }, index) => {sigma} )}
+
+
+ ) : null}
+
+ 平均 PSNR(dB,越高越好)
+ 方法 PSNR
+
+ {methods.map((name, index) => (
+
+ {name} {psnr[index].toFixed(2)}
+
+ ))}
+
+
+
+ {protocol === 0
+ ? `σ=${denoising.sigma} 时,LSSC 与 BM3D 分别为 ${denoising.psnr[6].toFixed(2)} 与 ${denoising.psnr[3].toFixed(2)} dB。`
+ : 'LSSC 比同表的 LPA 高 0.87 dB。这里衡量的是去马赛克后的重建质量。'}
+
+ >
+ )}
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/shared-coding.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/shared-coding.tsx
new file mode 100644
index 00000000..538f71ba
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/shared-coding.tsx
@@ -0,0 +1,176 @@
+import { useEffect, useRef, useState } from 'react';
+import { Stage, bench, colors, rounded } from './paper-canvas';
+import { dotPatch, drawPatch, patchAtoms, patchValues, squaredError } from './atom-coding';
+
+const atoms = [patchAtoms[1], patchAtoms[0], patchAtoms[2], patchAtoms[3]];
+const observed = [[.45, .50, 0, 0], [.48, 0, .51, 0], [.50, 0, 0, -.52]]
+ .map(coefficients => patchValues(coefficients, atoms));
+const clean = [[.45, 0, 0, 0], [.48, 0, 0, 0], [.50, 0, 0, 0]]
+ .map(coefficients => patchValues(coefficients, atoms));
+
+function trace(supports: number[][]) {
+ const coefficients = observed.map((patch, patchIndex) =>
+ atoms.map((atom, atomIndex) => supports[patchIndex].includes(atomIndex) ? dotPatch(patch, atom) : 0),
+ );
+ const blocks = coefficients.map(column => patchValues(column, atoms));
+ const residuals = observed.map((patch, patchIndex) =>
+ patch.map((value, pixelIndex) => value - blocks[patchIndex][pixelIndex]),
+ );
+ const cleanError = clean.reduce((sum, block, index) => sum + squaredError(block, blocks[index]), 0);
+ const observedError = observed.reduce((sum, block, index) => sum + squaredError(block, blocks[index]), 0);
+ return {
+ supports, coefficients, blocks, residuals, cleanError, observedError,
+ activeRows: new Set(supports.flat()),
+ };
+}
+
+function strongest(scores: number[], support: number[]) {
+ let selected = -1;
+ scores.forEach((score, index) => {
+ if (!support.includes(index) && (selected === -1 || score > scores[selected])) {
+ selected = index;
+ }
+ });
+ return selected;
+}
+
+type Trace = ReturnType;
+
+function pursue(previous: Trace, jointly: boolean) {
+ const scores = previous.residuals.map(residual => atoms.map(atom => Math.abs(dotPatch(residual, atom))));
+ if (jointly) {
+ const totals = atoms.map((_, atomIndex) => scores.reduce((sum, patch) => sum + patch[atomIndex], 0));
+ const shared = [...previous.supports[0], strongest(totals, previous.supports[0])];
+ return trace(previous.supports.map(() => shared));
+ }
+ return trace(previous.supports.map((support, index) => [...support, strongest(scores[index], support)]));
+}
+
+function buildTrace(jointly: boolean) {
+ const initial = trace(observed.map(() => []));
+ const first = pursue(initial, jointly);
+ return [initial, first, pursue(first, jointly)];
+}
+
+const separate = buildTrace(false);
+const shared = buildTrace(true);
+const phases = [
+ { value: 0, label: '输入' },
+ { value: 1, label: '第 1 轮' },
+ { value: 2, label: '第 2 轮' },
+] as const;
+const firstSharedCoefficients = shared[1].coefficients.map(column => column[0]);
+const firstSharedScore = firstSharedCoefficients.reduce((sum, value) => sum + Math.abs(value), 0);
+const notes = [
+ '两侧从相同的三块含噪图块出发。三块都含有 1 号原子代表的左右纹,也各自带有不同的干扰。',
+ `独立编码给每块单独打分,图块 1 到 3 分别选中第 2、3、4 行。联合编码共同选中总分最高的第 1 行(${firstSharedScore.toFixed(2)}),三块各自的系数为 ${firstSharedCoefficients.map(value => value.toFixed(2)).join('、')}。`,
+ '联合编码又选入第 4 行,只有第 3 块在这一行的系数非零。第 4 行带入了干扰,含噪输入的残差下降,干净参考的误差随之上升。',
+];
+
+export function SharedCoding() {
+ const [phase, setPhase] = useState<(typeof phases)[number]['value']>(0);
+ const [running, setRunning] = useState(false);
+ const timers = useRef([]);
+
+ useEffect(() => () => timers.current.forEach(timer => window.clearTimeout(timer)), []);
+
+ function selectPhase(nextPhase: typeof phase) {
+ timers.current.forEach(timer => window.clearTimeout(timer));
+ timers.current = [];
+ setRunning(false);
+ setPhase(nextPhase);
+ }
+
+ function start() {
+ const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+ selectPhase(reduceMotion ? 2 : 0);
+ if (reduceMotion) return;
+ setRunning(true);
+ timers.current = [
+ window.setTimeout(() => setPhase(1), 650),
+ window.setTimeout(() => selectPhase(2), 1450),
+ ];
+ }
+
+ const independent = separate[phase];
+ const joint = shared[phase];
+
+ function draw(ctx: CanvasRenderingContext2D, width: number, height: number) {
+ bench(ctx, width, height);
+ ([independent, joint] as const).forEach((result, side) => {
+ const x = side === 0 ? 26 : 332;
+ const prior = (side === 0 ? separate : shared)[Math.max(0, phase - 1)];
+ const label = side === 0 ? '独立编码' : '联合编码';
+ const columnCenters = [x + 86, x + 159, x + 232];
+ rounded(ctx, x, 25, 282, 210, 10, colors.paper, colors.light);
+ ctx.fillStyle = colors.ink;
+ ctx.textAlign = 'left';
+ ctx.font = '600 16px system-ui, sans-serif';
+ ctx.fillText(label, x + 14, 48);
+ ctx.fillStyle = colors.muted;
+ ctx.textAlign = 'right';
+ ctx.font = '13px system-ui, sans-serif';
+ ctx.fillText(phase === 0 ? '含噪输入' : '重建图块', x + 268, 48);
+
+ const displayBlocks = phase === 0 ? observed : result.blocks;
+ displayBlocks.forEach((patch, column) => {
+ const center = columnCenters[column];
+ ctx.fillStyle = colors.ink;
+ ctx.textAlign = 'center';
+ ctx.fillText(`图块 ${column + 1}`, center, 70);
+ drawPatch(ctx, center - 27, 77, 54, patch.map(value => 0.5 + value));
+ });
+
+ atoms.forEach((_, row) => {
+ const top = 142 + row * 21;
+ const active = result.activeRows.has(row);
+ if (active) {
+ rounded(ctx, x + 11, top, 260, 18, 4, colors.bg,
+ prior.activeRows.has(row) ? colors.line : colors.orange,
+ );
+ }
+ ctx.fillStyle = active ? colors.ink : colors.muted;
+ ctx.fillText(`原子 ${row + 1}`, x + 34, top + 13);
+ result.coefficients.forEach((column, columnIndex) => {
+ const value = column[row];
+ const center = columnCenters[columnIndex];
+ rounded(ctx, center - 27, top + 3, 54, 12, 3, '#ffffff', colors.line);
+ ctx.fillStyle = colors.muted;
+ ctx.fillRect(center, top + 5, 1, 8);
+ if (Math.abs(value) > 1e-8) {
+ const extent = value * 47;
+ const stroke = side === 1
+ ? row === 0 ? colors.green : colors.orange
+ : phase === 1 ? colors.red : colors.blue;
+ rounded(ctx, Math.min(center, center + extent), top + 6, Math.abs(extent), 6, 3, stroke);
+ }
+ });
+ });
+ });
+ }
+
+ return (
+
+
+ {phases.map(({ value, label }) => (
+ selectPhase(value)}>
+ {label}
+
+ ))}
+
+
+ {running ? '自动播放中' : '自动播放'}
+
+
+ {phases[phase].label} 独立启用 {independent.activeRows.size} 行,联合启用 {joint.activeRows.size} 行
+
+ 对干净块的平方误差 独立 {independent.cleanError.toFixed(4)},联合 {joint.cleanError.toFixed(4)}
+
+ 对含噪块的平方残差 独立 {independent.observedError.toFixed(4)},联合 {joint.observedError.toFixed(4)}
+
+
+ );
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/tile-analogy.tsx b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/tile-analogy.tsx
new file mode 100644
index 00000000..47bc4916
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/modules/tile-analogy.tsx
@@ -0,0 +1,102 @@
+import type { WidgetProps } from './registry';
+import { bench, colors, MovingCanvas, rounded, tile } from './paper-canvas';
+
+const captions = [
+ '擦拭浮尘后,瓷砖的原有纹样显露出来',
+ '参照砖靠近纹样相似的瓷砖',
+ '用印模补回一个纹样',
+ '同一个印模移向第二块瓷砖,两块纹样的深浅不同',
+ '两块补砖形成重叠范围,重叠区收到两次估计',
+ '揭开遮纸,露出已观测的瓷砖纹样',
+ '用同一把尺检查两块瓷砖的同一处接缝',
+];
+
+function target(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {
+ ctx.save();
+ ctx.setLineDash([4, 5]);
+ ctx.strokeStyle = colors.blue;
+ ctx.lineWidth = 1.5;
+ ctx.strokeRect(x, y, width, height);
+ ctx.restore();
+}
+
+function stamp(ctx: CanvasRenderingContext2D, x: number, y: number) {
+ rounded(ctx, x - 26, y - 7, 52, 14, 4, colors.support);
+ rounded(ctx, x - 10, y - 22, 20, 17, 4, colors.support);
+ rounded(ctx, x - 25, y + 4, 50, 5, 2, colors.orange);
+}
+
+function paint(ctx: CanvasRenderingContext2D, chapter: number, p: number) {
+ bench(ctx, 560, 140);
+ const size = 84;
+ const x = 238;
+ const y = 25;
+ rounded(ctx, 105, 110, 350, 17, 8, colors.support);
+ switch (chapter) {
+ case 1:
+ tile(ctx, x, y, size, 'leaf', colors.blue, .75);
+ for (let i = 0; i < 15; i += 1) {
+ const dirtX = x + 10 + (i * 31 % 67);
+ if (dirtX < x - 5 + 97 * p) continue;
+ const dirtY = y + 9 + (i * 23 % 68);
+ ctx.fillStyle = '#9f7856';
+ ctx.fillRect(dirtX, dirtY, 4, 3);
+ }
+ ctx.save();
+ ctx.translate(x - 30 + 115 * p, y + 46);
+ ctx.rotate(-.33);
+ rounded(ctx, -38, -6, 50, 12, 5, colors.support);
+ rounded(ctx, 4, -9, 25, 18, 4, colors.orange);
+ ctx.restore();
+ break;
+ case 2:
+ tile(ctx, 333, y, size, 'leaf', colors.green, .80);
+ tile(ctx, 425, y + 13, 61, 'cross', colors.dark, .65);
+ target(ctx, 242, y - 3, 90, 90);
+ tile(ctx, 122 + 123 * p, y, size, 'leaf', colors.blue, .78);
+ break;
+ case 3:
+ tile(ctx, x, y, size, 'leaf', colors.blue, .20 + .60 * p);
+ stamp(ctx, x + size / 2, 32 + 33 * p);
+ break;
+ case 4:
+ tile(ctx, 182, y, size, 'leaf', colors.blue, .85);
+ tile(ctx, 297, y, size, 'leaf', colors.blue, .38 + .12 * p);
+ stamp(ctx, 224 + 115 * p, 30 + 28 * Math.abs(2 * p - 1));
+ break;
+ case 5: {
+ const movingX = 330 - 71 * p;
+ tile(ctx, 208, y, size, 'leaf', colors.blue, .58);
+ rounded(ctx, movingX, y + 10, size, size, 7, 'rgba(237, 239, 220, .8)', colors.blue);
+ const overlap = 208 + size - movingX;
+ if (overlap > 0) {
+ rounded(ctx, movingX, y + 10, overlap, size - 10, 4, 'rgba(34, 141, 92, .34)', colors.green);
+ }
+ break;
+ }
+ case 6:
+ tile(ctx, x, y, size, 'leaf', colors.blue, .78);
+ rounded(ctx, 229 + 109 * p, 21, 107, 84, 5, '#e6ddbb', colors.support);
+ ctx.fillStyle = colors.orange;
+ ctx.fillRect(231 + 109 * p, 25, 4, 74);
+ break;
+ case 7:
+ tile(ctx, 180, y, size, 'leaf', colors.blue, .78);
+ tile(ctx, 285, y, size, 'leaf', colors.green, .62);
+ rounded(ctx, 160 + 106 * p, 79, 126, 14, 4, '#e6ddbb', colors.support);
+ ctx.strokeStyle = colors.support;
+ for (let tick = 0; tick < 11; tick += 1) {
+ const tx = 167 + tick * 10 + 106 * p;
+ ctx.beginPath();
+ ctx.moveTo(tx, 79);
+ ctx.lineTo(tx, 84 + (tick % 2) * 3);
+ ctx.stroke();
+ }
+ break;
+ }
+}
+
+export function TileAnalogy({ chapterId }: WidgetProps) {
+ const chapter = Number(chapterId.replace('chap-', '')) || 1;
+ return paint(ctx, chapter, p)} />;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/animation-intro.css b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/animation-intro.css
new file mode 100644
index 00000000..6a819799
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/animation-intro.css
@@ -0,0 +1,20 @@
+.hero-compare > .bg-side {
+ display: flex;
+ flex-direction: column;
+}
+
+.hero-compare > .bg-side > .bg-side-tag {
+ flex: 1;
+ color: var(--ink-2);
+ text-align: start;
+}
+
+.analogy-card.analogy-card--intro-first {
+ flex-direction: column;
+}
+
+.analogy-card.analogy-card--intro-first > .analogy-visual {
+ align-self: center;
+ width: min(100%, 440px);
+ padding-top: 0;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/components.css b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/components.css
new file mode 100644
index 00000000..ad385180
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/components.css
@@ -0,0 +1,1313 @@
+/* Shared UI from the reference template. Import unchanged after tokens.css. */
+
+/* ---------- Foundation ---------- */
+* { box-sizing: border-box; margin: 0; padding: 0; }
+html { scroll-behavior: smooth; }
+body {
+ min-width: 320px;
+ font-family: var(--ui-font-sans);
+ background:
+ radial-gradient(circle at top left, rgba(39, 68, 110, 0.06), transparent 30%),
+ linear-gradient(180deg, var(--ui-bg-page-top) 0%, var(--ui-bg-page) 100%);
+ color: var(--ink);
+ font-size: var(--ui-type-body-size);
+ font-weight: var(--ui-type-body-weight);
+ line-height: var(--ui-type-body-line-height);
+ -webkit-font-smoothing: antialiased;
+}
+a { color: var(--blue); text-decoration: none; }
+a:hover { text-decoration: underline; }
+p { margin: 0.7em 0; }
+main {
+ max-width: 1120px;
+ margin: 0 auto;
+ padding: 0 28px 80px;
+ clear: both;
+}
+
+button, input, select, textarea { font: inherit; }
+button, .chip, [data-tip], .sym, .bg-side, .dl-video-card, .metric {
+ transition:
+ transform var(--t-fast) var(--ease-out),
+ box-shadow var(--t-fast) var(--ease-out),
+ background-color var(--t-fast) var(--ease-out),
+ border-color var(--t-fast) var(--ease-out),
+ color var(--t-fast) var(--ease-out);
+}
+button, .chip, .sym, .dl-video-card { cursor: pointer; }
+button:active, .chip:active, .chap-loader-btn:active { transform: translateY(0) scale(0.97); }
+button:focus-visible, .chip:focus-visible, .sym:focus-visible, [tabindex]:focus-visible,
+a:focus-visible, input:focus-visible {
+ outline: 3px solid rgba(39, 68, 110, 0.4);
+ outline-offset: 3px;
+ border-radius: inherit;
+}
+
+@keyframes chap-reveal {
+ from { opacity: 0; transform: translateY(20px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+@keyframes pulse-blue {
+ 0%, 100% { box-shadow: 0 0 0 0 rgba(39, 68, 110, 0.35); }
+ 50% { box-shadow: 0 0 0 6px rgba(39, 68, 110, 0); }
+}
+@keyframes tip-fade-in {
+ from { opacity: 0; transform: translateX(-50%) translateY(4px); }
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
+}
+@keyframes dl-pulse {
+ 0%, 100% { opacity: 0.55; transform: scale(1); }
+ 50% { opacity: 1; transform: scale(1.08); }
+}
+
+section.chap:not(.chap-hidden) { animation: chap-reveal var(--t-slow) var(--ease-out) both; }
+canvas {
+ display: block;
+ max-width: 100%;
+ margin: 8px auto;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-sm);
+ opacity: 0;
+ transition: opacity var(--t-med) var(--ease-out);
+}
+canvas.is-ready { opacity: 1; }
+
+/* ---------- Hero: reference template shell ---------- */
+section.hero {
+ max-width: 1180px;
+ margin: 28px auto;
+ padding: 48px 32px 36px;
+ text-align: center;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-xl);
+ box-shadow: var(--shadow);
+}
+.hero-inner { max-width: 800px; margin: 0 auto; }
+.hero-venue {
+ display: inline-block;
+ padding: 6px 14px;
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-pill);
+ background: var(--paper-2);
+ color: var(--slate-2);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+ letter-spacing: 0;
+ text-transform: uppercase;
+ margin-bottom: 22px;
+}
+.hero h1 {
+ margin: 0 0 8px;
+ color: var(--ink);
+ font-size: var(--ui-type-display-size);
+ font-weight: var(--ui-type-display-weight);
+ letter-spacing: var(--ui-type-display-letter-spacing);
+ line-height: var(--ui-type-display-line-height);
+ overflow-wrap: anywhere;
+}
+.hero-sub {
+ margin-bottom: 28px;
+ color: var(--slate);
+ font-size: var(--ui-type-subtitle-size);
+ font-weight: var(--ui-type-subtitle-weight);
+ line-height: var(--ui-type-subtitle-line-height);
+}
+.hero-abs {
+ margin: 0 auto 28px;
+ color: var(--ink-2);
+ font-size: var(--ui-type-body-size);
+ font-weight: var(--ui-type-body-weight);
+ line-height: var(--ui-type-body-line-height);
+}
+.hero-abs b { color: var(--ink); font-weight: 700; }
+.hero-meta {
+ display: flex;
+ justify-content: center;
+ gap: 10px;
+ flex-wrap: wrap;
+ margin-bottom: 40px;
+}
+.hero-meta a, .hero-meta span, .hero-meta .tag {
+ padding: 7px 18px;
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-pill);
+ background: var(--paper);
+ color: var(--slate);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+.hero-meta a:hover, .hero-meta .tag:hover {
+ background: var(--blue-soft);
+ border-color: var(--line-2);
+ color: var(--blue);
+ text-decoration: none;
+}
+.hero-compare {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 20px;
+ text-align: left;
+}
+.bg-side {
+ overflow: hidden;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+ box-shadow: var(--shadow-soft);
+}
+.bg-side.old { border-top: 3px solid var(--slate-2); }
+.bg-side.new { border-top: 3px solid var(--blue); }
+.bg-side-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 10px 16px;
+ background: var(--paper-2);
+ border-bottom: 1px solid var(--line);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+.bg-side.old .bg-side-head { color: var(--slate-2); }
+.bg-side.new .bg-side-head { color: var(--blue); }
+.bg-side-canvas {
+ display: block;
+ width: 100%;
+ background: var(--paper);
+}
+.bg-side-canvas canvas {
+ width: 100%;
+ margin: 0;
+ border: 0;
+ border-radius: 0;
+}
+.bg-side-img {
+ display: block;
+ width: 100%;
+}
+.bg-side-tag {
+ padding: 8px 16px 12px;
+ color: var(--slate-2);
+ font-size: var(--ui-type-body-small-size);
+ text-align: center;
+}
+.bg-side-tag b { color: var(--ink); }
+
+/* ---------- Chapters ---------- */
+section.chap {
+ scroll-margin-top: 16px;
+ margin: 32px 0 0;
+ padding: 32px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--radius);
+ box-shadow: var(--shadow);
+}
+section.chap:first-of-type { margin-top: 0; }
+.chap-title {
+ display: flex;
+ align-items: baseline;
+ gap: 12px;
+ flex-wrap: wrap;
+ margin: 0 0 8px;
+ color: var(--ink);
+ font-size: var(--ui-type-h1-size);
+ font-weight: var(--ui-type-h1-weight);
+ letter-spacing: var(--ui-type-h1-letter-spacing);
+ line-height: var(--ui-type-h1-line-height);
+}
+.chap-title .num {
+ color: var(--blue);
+ font-family: Georgia, serif;
+ font-size: var(--ui-type-h2-size);
+ font-style: italic;
+ font-weight: var(--ui-type-h2-weight);
+}
+section.chap .chap-intro, section.chap .module-desc, section.chap .note,
+section.chap p, section.chap li { color: var(--ink-2); }
+.badge-tag {
+ display: inline-block;
+ padding: 3px 10px;
+ border-radius: var(--ui-radius-pill);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+ letter-spacing: 0;
+ margin-left: 2px;
+ vertical-align: 2px;
+}
+.badge-tag.inf { background: var(--green-soft); color: var(--green); }
+.badge-tag.trn { background: var(--orange-soft); color: var(--orange); }
+.badge-tag.both { background: var(--blue-soft); color: var(--blue); }
+
+/* ---------- Chapter progress ---------- */
+.flow-mini {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ flex-wrap: wrap;
+ margin: 0 0 18px;
+ padding: 10px 14px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+.flow-step {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 4px 10px;
+ background: var(--bg);
+ border: 0;
+ border-radius: var(--ui-radius-pill);
+ color: var(--slate-2);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ transition: all var(--t-med) var(--ease-out);
+}
+.flow-step.done { background: var(--green-soft); color: var(--green); }
+.flow-step.active {
+ background: var(--blue);
+ color: #fff;
+ animation: pulse-blue 2s ease-in-out infinite;
+}
+.flow-arrow { color: var(--line-2); font-size: var(--ui-type-body-small-size); }
+
+/* ---------- Chapter bridge ---------- */
+.chap-bridge {
+ display: flex;
+ align-items: stretch;
+ gap: 0;
+ overflow: hidden;
+ margin: 24px 0 20px;
+ background: linear-gradient(135deg, var(--blue-soft) 0%, var(--green-soft) 100%);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+.chap-bridge::before {
+ content: '';
+ width: 5px;
+ flex-shrink: 0;
+ background: linear-gradient(180deg, var(--blue), var(--green));
+}
+.cb-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 56px;
+ flex-shrink: 0;
+ background: rgba(255, 255, 255, 0.6);
+ font-size: 28px;
+ line-height: 1;
+}
+.cb-body { flex: 1; padding: 14px 16px; }
+.cb-title {
+ margin-bottom: 4px;
+ color: var(--blue);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+ letter-spacing: 0;
+ text-transform: uppercase;
+}
+.cb-text { color: var(--ink-2); font-size: var(--ui-type-body-size); font-weight: var(--ui-type-body-weight); line-height: var(--ui-type-body-line-height); }
+.cb-text b { color: var(--ink); font-weight: 700; }
+.cb-text em { color: var(--blue); font-style: normal; font-weight: 600; }
+
+/* ---------- Analogy card ---------- */
+.analogy-card {
+ display: flex;
+ gap: 0;
+ min-height: 160px;
+ overflow: hidden;
+ margin: 12px 0;
+ background: var(--orange-soft);
+ border: 1px solid rgba(240, 126, 71, 0.38);
+ border-radius: var(--radius-sm);
+}
+.analogy-visual {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 580px;
+ flex-shrink: 0;
+ padding: 8px;
+ background: var(--orange-soft);
+}
+.analogy-visual canvas {
+ margin: 0;
+ background: var(--ui-bg-card);
+ border: 0;
+ border-radius: var(--ui-radius-sm);
+}
+.analogy-body {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ justify-content: center;
+ padding: 16px 20px;
+}
+.analogy-title {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 8px;
+ color: var(--orange);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+ letter-spacing: 0;
+}
+.analogy-title::before {
+ content: '';
+ width: 6px;
+ height: 6px;
+ flex-shrink: 0;
+ background: var(--orange);
+ border-radius: 50%;
+}
+.analogy-text { color: var(--ink-2); font-size: var(--ui-type-body-size); font-weight: var(--ui-type-body-weight); line-height: var(--ui-type-body-line-height); }
+.analogy-text b { color: var(--ink); }
+
+/* ---------- Framed interactive modules ---------- */
+.module {
+ overflow: hidden;
+ margin: 18px 0 28px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--radius);
+ animation: chap-reveal var(--t-slow) var(--ease-out) both;
+}
+.module-head {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ flex-wrap: wrap;
+ padding: 14px 20px;
+ background: var(--paper-2);
+ border-bottom: 1px solid var(--line);
+}
+.module-head .num {
+ padding: 2px 8px;
+ background: var(--blue-soft);
+ border-radius: var(--ui-radius-sm);
+ color: var(--blue);
+ font-family: Georgia, serif;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+}
+.module-head h4 {
+ flex: 1;
+ min-width: 200px;
+ color: var(--ink);
+ font-size: var(--ui-type-h3-size);
+ font-weight: var(--ui-type-h3-weight);
+ line-height: var(--ui-type-h3-line-height);
+}
+.module-body { padding: 18px 22px 22px; }
+.module-desc {
+ margin: 0 0 14px;
+ color: var(--ink-2);
+ font-size: var(--ui-type-body-size);
+ font-weight: var(--ui-type-body-weight);
+ line-height: var(--ui-type-body-line-height);
+}
+.module-desc code {
+ padding: 1px 5px;
+ background: var(--paper-2);
+ border-radius: 4px;
+ color: var(--orange);
+ font-family: var(--ui-font-mono);
+ font-size: 0.9em;
+}
+
+/* ---------- Controls ---------- */
+input[type="range"] {
+ appearance: none;
+ width: 100%;
+ height: 6px;
+ background: linear-gradient(90deg, var(--blue-soft), var(--blue));
+ border-radius: var(--ui-radius-pill);
+ outline: none;
+ cursor: pointer;
+}
+input[type="range"]::-webkit-slider-thumb {
+ appearance: none;
+ width: 20px;
+ height: 20px;
+ background: #fff;
+ border: 3px solid var(--blue);
+ border-radius: 50%;
+ box-shadow: 0 2px 8px rgba(25, 42, 70, 0.2);
+ transition: transform var(--t-fast) var(--ease-spring);
+}
+input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
+input[type="range"]::-moz-range-thumb {
+ width: 20px;
+ height: 20px;
+ background: #fff;
+ border: 3px solid var(--blue);
+ border-radius: 50%;
+ box-shadow: 0 2px 8px rgba(25, 42, 70, 0.2);
+}
+.ctrl {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ flex-wrap: wrap;
+ width: 100%;
+ margin: 12px 0 8px;
+ padding: 10px 14px;
+ background: var(--paper-2);
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-sm);
+ font-size: var(--ui-type-body-small-size);
+}
+.ctrl label {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: var(--slate);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+.ctrl input[type="range"] { flex: 1; min-width: 140px; }
+.ctrl .val {
+ min-width: 52px;
+ color: var(--blue);
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ text-align: right;
+}
+.feedback {
+ min-height: 22px;
+ margin-top: 8px;
+ padding: 9px 13px;
+ background: var(--paper-2);
+ border-left: 4px solid var(--line-2);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ color: var(--slate);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ font-style: italic;
+}
+.feedback.good { color: var(--green); background: var(--green-soft); border-left-color: var(--green); font-style: normal; }
+.feedback.bad { color: var(--red); background: var(--red-soft); border-left-color: var(--red); font-style: normal; }
+.chip-row {
+ display: flex;
+ justify-content: center;
+ gap: 8px;
+ flex-wrap: wrap;
+ margin-bottom: 14px;
+}
+.chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 7px 14px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-pill);
+ color: var(--ink-2);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ user-select: none;
+}
+.chip:hover { border-color: var(--blue); }
+.chip.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
+.step-ctrl {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 16px;
+ flex-wrap: wrap;
+ margin: 12px 0 8px;
+}
+.step-label { color: var(--ink); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+.step-label b { color: var(--blue); font-size: var(--ui-type-h3-size); font-weight: var(--ui-type-h3-weight); }
+.step-desc { padding: 8px; color: var(--ink-2); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); text-align: center; }
+button.tiny {
+ padding: 8px 17px;
+ background: var(--blue);
+ border: 1px solid var(--blue);
+ border-radius: var(--ui-radius-pill);
+ color: #fff;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+button.tiny:hover { background: #1f385d; border-color: #1f385d; transform: translateY(-1px); }
+button.tiny.ghost { background: #fff; color: var(--blue); border-color: var(--line); }
+button.tiny.ghost:hover { background: var(--blue-soft); border-color: var(--blue); }
+button.tiny:disabled { opacity: 0.5; cursor: not-allowed; }
+
+/* ---------- Comparisons and metrics ---------- */
+.compare-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 14px 0; }
+.compare-col { display: flex; flex-direction: column; align-items: center; }
+.compare-label { margin-bottom: 8px; font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+.three-col-demo {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 12px;
+ width: 100%;
+ margin: 16px 0;
+}
+.three-col-panel {
+ display: flex;
+ position: relative;
+ flex-direction: column;
+ padding: 14px;
+ background: var(--paper);
+ border: 2px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+.three-col-panel.clean { border-color: var(--green); background: var(--green-soft); }
+.three-col-panel.noisy { border-color: var(--red); background: var(--red-soft); }
+.three-col-panel.recover { border-color: var(--blue); background: var(--blue-soft); }
+.three-col-label { margin-bottom: 8px; font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-h3-weight); text-align: center; }
+.three-col-canvas-wrap {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ min-height: 200px;
+ flex: 1;
+}
+.three-col-canvas-wrap canvas { margin: 0; background: transparent; border: 0; box-shadow: none; }
+.three-col-eq {
+ margin-top: 8px;
+ padding: 6px 8px;
+ background: rgba(255, 255, 255, 0.7);
+ border-radius: 4px;
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ text-align: center;
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 10px;
+ width: 100%;
+ margin: 10px 0;
+}
+.metric {
+ padding: 12px 14px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-sm);
+ text-align: center;
+}
+.metric:hover { border-color: var(--line-2); box-shadow: var(--shadow-soft); }
+.metric .l { color: var(--slate-2); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+.metric .v { margin: 4px 0; color: var(--ink); font-family: var(--ui-font-mono); font-size: var(--ui-type-h2-size); font-weight: var(--ui-type-h2-weight); }
+
+/* ---------- Formula UI: Unicode/HTML, no external renderer ---------- */
+.formula-explain {
+ position: relative;
+ margin: 14px 0;
+ padding: 20px;
+ background: linear-gradient(135deg, var(--blue-soft) 0%, var(--green-soft) 100%);
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+ text-align: center;
+}
+.fe-hint {
+ position: absolute;
+ top: 7px;
+ left: 11px;
+ margin: 0;
+ color: var(--slate-2);
+ font-size: var(--ui-type-body-small-size);
+}
+.fe-formula {
+ display: inline-block;
+ margin: 4px 0 14px;
+ padding: 12px 22px;
+ background: #fff;
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-sm);
+ color: var(--blue);
+ font-family: "Cambria Math", Georgia, serif;
+ font-size: var(--ui-type-formula-size);
+ font-weight: var(--ui-type-formula-weight);
+ line-height: var(--ui-type-formula-line-height);
+ max-width: 100%;
+ overflow-x: auto;
+}
+.sym {
+ padding: 2px 4px;
+ border-radius: 4px;
+ transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
+}
+.sym:hover { background: var(--blue-soft); }
+.sym.active { background: var(--blue); color: #fff; }
+/* Symbols rendered inside the formula itself are clickable too. */
+.fe-formula .fe-formula-sym {
+ cursor: pointer;
+ border-bottom: 1px dotted currentColor;
+ padding: 0 1px;
+ border-radius: 3px;
+}
+.fe-formula .fe-formula-sym:hover { background: var(--blue-soft); }
+.fe-formula .fe-formula-sym.active { background: var(--blue); color: #fff; border-bottom-color: #fff; }
+/* Single inline explanation box: shows the meaning of the clicked symbol only. */
+.fe-explain {
+ display: flex;
+ align-items: baseline;
+ gap: 10px;
+ margin: 6px auto 0;
+ padding: 10px 14px;
+ max-width: 100%;
+ text-align: left;
+ background: #fff;
+ border: 1px solid var(--line);
+ border-left: 4px solid var(--blue);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ box-shadow: var(--shadow-soft);
+ animation: chap-reveal var(--t-fast) var(--ease-out) both;
+}
+.fe-explain-sym {
+ flex: 0 0 auto;
+ font-family: "Cambria Math", Georgia, serif;
+ font-size: var(--ui-type-formula-size);
+ font-weight: var(--ui-type-formula-weight);
+ color: var(--blue);
+}
+.fe-explain-desc { color: var(--slate); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); line-height: var(--ui-type-body-small-line-height); }
+.fe-explain-desc b { color: var(--blue); }
+.formula {
+ display: block;
+ overflow-x: auto;
+ margin: 14px 0;
+ padding: 12px 18px;
+ background: var(--blue-soft);
+ border-left: 4px solid var(--blue);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ color: var(--blue);
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+.algo-formula {
+ display: block;
+ margin: 6px 0 8px;
+ padding: 12px 16px;
+ background: var(--blue-soft);
+ border-left: 3px solid var(--blue);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ color: var(--blue);
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+ overflow-wrap: anywhere;
+ white-space: pre-wrap;
+}
+
+/* ---------- Takeaways ---------- */
+.embed-takeaway, .reversibility-takeaway {
+ display: flex;
+ align-items: stretch;
+ gap: 0;
+ overflow: hidden;
+ margin: 16px 0 0;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+.embed-takeaway { background: linear-gradient(135deg, var(--green-soft) 0%, var(--blue-soft) 50%, var(--orange-soft) 100%); }
+.reversibility-takeaway { background: linear-gradient(90deg, var(--green-soft) 0%, var(--yellow-soft) 50%, var(--red-soft) 100%); }
+.et-item {
+ display: flex;
+ position: relative;
+ flex: 1;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ padding: 16px 14px;
+ text-align: center;
+}
+.et-icon { font-size: 28px; line-height: 1; }
+.et-title { color: var(--ink); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+.et-desc { color: var(--ink-2); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); line-height: var(--ui-type-body-small-line-height); }
+.et-arrow {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ flex-shrink: 0;
+ background: rgba(255, 255, 255, 0.5);
+ color: var(--slate-2);
+ font-size: var(--ui-type-h3-size);
+ font-weight: var(--ui-type-h3-weight);
+}
+
+/* ---------- Insight and tooltip ---------- */
+.insight-bar {
+ display: none;
+ margin: 8px 0;
+ padding: 10px 14px;
+ background: var(--blue-soft);
+ border-left: 4px solid var(--blue);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ color: var(--ink-2);
+ font-size: var(--ui-type-body-size);
+ font-weight: var(--ui-type-body-weight);
+ line-height: var(--ui-type-body-line-height);
+}
+.insight-bar.show { display: block; animation: chap-reveal var(--t-med) var(--ease-out) both; }
+.insight-bar::before { content: '💡 '; }
+[data-tip] { position: relative; cursor: help; }
+[data-tip]:hover::after {
+ content: attr(data-tip);
+ position: absolute;
+ bottom: calc(100% + 8px);
+ left: 50%;
+ z-index: 200;
+ width: max-content;
+ max-width: 260px;
+ padding: 7px 11px;
+ background: var(--ink);
+ border-radius: var(--ui-radius-sm);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
+ color: #fff;
+ font-size: var(--ui-type-body-small-size);
+ font-style: normal;
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+ pointer-events: none;
+ transform: translateX(-50%);
+ white-space: normal;
+ animation: tip-fade-in var(--t-fast) var(--ease-out) both;
+}
+
+/* ---------- Tables ---------- */
+table.paper {
+ width: 100%;
+ overflow: hidden;
+ margin: 12px 0;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-collapse: collapse;
+ border-radius: var(--radius-sm);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+table.paper th, table.paper td {
+ padding: 10px 12px;
+ border-bottom: 1px solid var(--line);
+ text-align: left;
+}
+table.paper th { background: var(--paper-2); color: var(--slate); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+table.paper tr:hover td { background: rgba(39, 68, 110, 0.05); }
+table.paper tr:last-child td { border-bottom: 0; }
+
+/* ---------- Progressive chapter loader ---------- */
+.chap-hidden { display: none !important; }
+.chap-loader {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin: 4px 0;
+ padding: 28px 16px 36px;
+}
+.chap-loader-hint { margin-bottom: 14px; color: var(--ink-2); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); letter-spacing: 0; }
+.chap-loader-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ padding: 13px 32px;
+ background: var(--blue);
+ border: 0;
+ border-radius: var(--ui-radius-pill);
+ box-shadow: var(--shadow);
+ color: #fff;
+ font-size: var(--ui-type-body-size);
+ font-weight: var(--ui-type-body-weight);
+}
+.chap-loader-btn:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow-hover); }
+.chap-loader-arrow { font-size: var(--ui-type-h3-size); transition: transform var(--t-fast) var(--ease-out); }
+.chap-loader-btn:hover .chap-loader-arrow { transform: translateX(4px); }
+
+/* ---------- Bilibili recommendations: reference template horizontal strip ---------- */
+.dl-related-section {
+ margin: 40px 0 0;
+ padding: 24px;
+ background: var(--paper);
+ border: 1px solid var(--line);
+ border-radius: var(--radius);
+ box-shadow: var(--shadow-soft);
+}
+.dl-related-section h3 {
+ margin: 0 0 6px;
+ color: var(--ink);
+ font-size: var(--ui-type-h2-size);
+ font-weight: var(--ui-type-h2-weight);
+ letter-spacing: var(--ui-type-h2-letter-spacing);
+ line-height: var(--ui-type-h2-line-height);
+}
+.dl-related-section > p { margin: 0 0 14px; color: var(--ink-2); font-size: var(--ui-type-body-small-size); font-weight: var(--ui-type-body-small-weight); }
+.dl-video-strip {
+ display: grid;
+ grid-auto-flow: column;
+ grid-auto-columns: calc((100% - 36px) / 4);
+ gap: 12px;
+ overflow-x: auto;
+ overscroll-behavior-inline: contain;
+ padding-bottom: 8px;
+ scroll-snap-type: x proximity;
+ scrollbar-width: thin;
+}
+a.dl-video-card {
+ display: grid;
+ position: relative;
+ gap: 7px;
+ min-width: 0;
+ padding: 0;
+ background: transparent;
+ border: 0;
+ border-radius: var(--ui-radius-sm);
+ color: inherit;
+ scroll-snap-align: start;
+ text-decoration: none;
+}
+.dl-video-link-cover {
+ display: grid;
+ position: relative;
+ overflow: hidden;
+ place-items: center;
+ width: 100%;
+ aspect-ratio: 16 / 9;
+ background: linear-gradient(135deg, #1f385d 0%, var(--ui-accent) 100%);
+ border-radius: var(--ui-radius-sm);
+ box-shadow: 0 8px 18px rgba(33, 50, 74, 0.08);
+}
+a.dl-video-card:hover .dl-video-link-cover {
+ transform: translateY(-2px);
+ box-shadow: 0 12px 24px rgba(18, 31, 48, 0.22);
+}
+.dl-video-link-cover.is-loading .dl-video-play { animation: dl-pulse 1.2s ease-in-out infinite; }
+.dl-video-cover-img {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ opacity: 0;
+ transition: opacity var(--t-med) var(--ease-out);
+}
+.dl-video-link-cover.is-loaded .dl-video-cover-img { opacity: 1; }
+/* Keep the gradient as the backdrop so a failed/unavailable cover still looks clean. */
+.dl-video-link-cover.is-loaded { background: linear-gradient(135deg, #1f385d 0%, var(--ui-accent) 100%); }
+.dl-video-play {
+ display: grid;
+ position: relative;
+ z-index: 2;
+ width: 44px;
+ height: 44px;
+ place-items: center;
+ background: rgba(39, 68, 110, 0.88);
+ border: 1px solid rgba(255, 255, 255, 0.68);
+ border-radius: 50%;
+ box-shadow: 0 6px 16px rgba(18, 31, 48, 0.24);
+ color: #fff;
+ font-size: 17px;
+ line-height: 1;
+ text-indent: 3px;
+}
+.dl-video-badge, .dl-video-link-tag {
+ position: absolute;
+ left: 8px;
+ bottom: 8px;
+ z-index: 3;
+ padding: 3px 8px;
+ background: rgba(18, 31, 48, 0.66);
+ border-radius: 4px;
+ color: #fff;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ letter-spacing: 0;
+}
+.dl-video-duration {
+ position: absolute;
+ right: 8px;
+ bottom: 8px;
+ z-index: 3;
+ padding: 2px 6px;
+ background: rgba(18, 31, 48, 0.78);
+ border-radius: 4px;
+ color: #fff;
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+.dl-video-card strong {
+ display: -webkit-box;
+ overflow: hidden;
+ color: var(--blue);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+}
+.dl-video-meta {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: var(--slate-2);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+}
+.dl-video-meta .views::before { content: '▶ '; font-size: 10px; }
+.hotspot-info {
+ margin-top: 12px;
+ padding: 12px;
+ background: var(--paper);
+ border-left: 3px solid var(--blue);
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+}
+
+/* ---------- Responsive behavior ---------- */
+@media (max-width: 768px) {
+ section.hero {
+ width: calc(100% - 24px);
+ margin: 12px auto 20px;
+ padding: 36px 20px 24px;
+ border-radius: var(--ui-radius-lg);
+ }
+ .hero-compare { grid-template-columns: 1fr; }
+ main { padding: 0 12px 56px; }
+ section.chap { padding: 20px 16px; border-radius: var(--ui-radius-md); }
+ .analogy-card { flex-direction: column; }
+ .analogy-visual { width: 100%; }
+ .module { border-radius: var(--ui-radius-md); }
+ .module-head { padding: 13px 16px; }
+ .module-body { padding: 16px; }
+ .embed-takeaway, .reversibility-takeaway { flex-direction: column; }
+ .et-arrow { width: 100%; height: 24px; transform: rotate(90deg); }
+ .compare-row, .metrics, .three-col-demo { grid-template-columns: 1fr; }
+ .dl-related-section { padding: 20px 16px; border-radius: var(--ui-radius-md); }
+ .dl-video-strip { grid-auto-columns: calc((100% - 12px) / 2); }
+}
+
+@media (max-width: 720px) {
+ .hero-meta a, .hero-meta span, .hero-meta .tag { padding: 6px 12px; }
+ .flow-mini { gap: 3px; padding: 9px 10px; }
+ .flow-step { padding: 4px 8px; }
+ .chap-bridge { flex-wrap: wrap; }
+ .cb-icon { width: 48px; }
+ .ctrl { align-items: stretch; flex-direction: column; }
+ .ctrl label { justify-content: space-between; }
+ .ctrl input[type="range"] { width: 100%; }
+ .chip { padding: 7px 12px; }
+ .step-ctrl { gap: 10px; }
+ table.paper { display: block; overflow-x: auto; white-space: nowrap; }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ html { scroll-behavior: auto; }
+ *, *::before, *::after {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ }
+}
+
+/* ---------- Optional paper figures (public/images or URL) ---------- */
+.paper-figure {
+ margin: 14px 0;
+ text-align: center;
+}
+.paper-figure img {
+ max-width: 100%;
+ border: 1px solid var(--line);
+ border-radius: var(--ui-radius-sm);
+ background: #fff;
+}
+.paper-figure figcaption {
+ margin-top: 6px;
+ color: var(--slate);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+}
+
+/* ---------- Slide layout (PPT-style: sidebar + one slide at a time) ---------- */
+.slide-layout {
+ display: flex;
+ align-items: flex-start;
+}
+
+/* Sidebar */
+.slide-sidebar {
+ width: 288px;
+ flex-shrink: 0;
+ position: sticky;
+ top: 0;
+ align-self: flex-start;
+ height: 100vh;
+ overflow-y: auto;
+ background: var(--ui-bg-card);
+ border-right: 1px solid var(--ui-border);
+ display: flex;
+ flex-direction: column;
+ transition: width var(--t-med) var(--ease-out);
+}
+.slide-layout.sidebar-collapsed .slide-sidebar {
+ width: 0;
+ overflow: hidden;
+ border-right: 0;
+}
+.slide-sidebar-header {
+ padding: 20px 18px 14px;
+ border-bottom: 1px solid var(--ui-border);
+}
+.slide-sidebar-venue {
+ color: var(--ui-text-light);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ text-transform: uppercase;
+ letter-spacing: 0;
+ margin-bottom: 4px;
+}
+.slide-sidebar-title {
+ color: var(--ui-text-main);
+ font-size: var(--ui-type-h3-size);
+ font-weight: var(--ui-type-h3-weight);
+ line-height: var(--ui-type-h3-line-height);
+ overflow-wrap: anywhere;
+}
+.slide-sidebar-nav {
+ padding: 8px;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+.slide-sidebar-item {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 10px 12px;
+ border: 0;
+ border-radius: var(--ui-radius-sm);
+ background: transparent;
+ color: var(--ui-text-muted);
+ text-align: left;
+ cursor: pointer;
+ transition:
+ background-color var(--t-fast) var(--ease-out),
+ color var(--t-fast) var(--ease-out),
+ transform var(--t-fast) var(--ease-out);
+}
+.slide-sidebar-item:hover {
+ background: var(--ui-bg-soft);
+ color: var(--ui-accent);
+}
+.slide-sidebar-item:active { transform: scale(0.98); }
+.slide-sidebar-item.active {
+ background: var(--ui-accent);
+ color: #fff;
+}
+.slide-sidebar-num {
+ flex-shrink: 0;
+ font-family: Georgia, serif;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-h3-weight);
+ min-width: 34px;
+}
+.slide-sidebar-text {
+ flex: 1;
+ min-width: 0;
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ line-height: var(--ui-type-body-small-line-height);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+/* Main content area */
+.slide-main {
+ flex: 1;
+ min-width: 0;
+ max-width: none;
+ margin: 0;
+ padding: 0 0 56px;
+ clear: none;
+}
+.slide-content {
+ max-width: 1400px;
+ margin: 0 auto;
+ padding: 20px clamp(24px, 5vw, 80px);
+ animation: slide-in var(--t-med) var(--ease-out) both;
+}
+.slide-content > section,
+.slide-content > .dl-related-section {
+ margin: 0;
+ max-width: none;
+}
+.slide-chap {
+ margin: 0;
+ scroll-margin-top: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 18px;
+}
+.slide-chap .module + .module { margin-top: 0; }
+/* Takeaway row fills width */
+.slide-chap .embed-takeaway,
+.slide-chap .reversibility-takeaway { margin: 0; }
+/* Hero */
+.slide-content > section.hero {
+ max-width: none;
+ margin: 0;
+}
+.slide-content > section.hero .hero-inner { max-width: 960px; }
+
+@keyframes slide-in {
+ from { opacity: 0; transform: translateX(18px); }
+ to { opacity: 1; transform: translateX(0); }
+}
+
+/* Bottom navigation bar: full-width bar pinned to the viewport bottom.
+ padding-left = sidebar 288px + collapse toggle 24px, so the centered button
+ group aligns with the content card for both sidebar states. */
+.slide-nav {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ z-index: 100;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 16px;
+ padding: 10px 16px 10px 312px;
+ border-top: 1px solid var(--ui-border);
+ background: var(--ui-bg-card);
+ flex-shrink: 0;
+ transition: padding-left var(--t-med) var(--ease-out);
+}
+.slide-layout.sidebar-collapsed .slide-nav { padding-left: 24px; }
+.slide-nav-btn {
+ padding: 9px 22px;
+ border: 1px solid var(--ui-border);
+ border-radius: var(--ui-radius-pill);
+ background: var(--ui-bg-card);
+ color: var(--ui-text-muted);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ cursor: pointer;
+ transition:
+ background-color var(--t-fast) var(--ease-out),
+ border-color var(--t-fast) var(--ease-out),
+ color var(--t-fast) var(--ease-out),
+ transform var(--t-fast) var(--ease-out);
+}
+.slide-nav-btn:hover:not(:disabled) {
+ border-color: var(--ui-accent);
+ color: var(--ui-accent);
+ transform: translateY(-1px);
+}
+.slide-nav-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
+.slide-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
+.slide-nav-btn-primary {
+ background: var(--ui-accent);
+ border-color: var(--ui-accent);
+ color: #fff;
+}
+.slide-nav-btn-primary:hover:not(:disabled) {
+ background: #1f385d;
+ border-color: #1f385d;
+ color: #fff;
+}
+.slide-nav-counter {
+ color: var(--ui-text-light);
+ font-family: var(--ui-font-mono);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ min-width: 64px;
+ text-align: center;
+}
+
+/* Mobile sidebar toggle (hidden on desktop) */
+.slide-sidebar-toggle {
+ display: none;
+ position: fixed;
+ top: 12px;
+ left: 12px;
+ z-index: 300;
+ align-items: center;
+ gap: 6px;
+ padding: 8px 16px;
+ border: 1px solid var(--ui-border);
+ border-radius: var(--ui-radius-pill);
+ background: var(--ui-bg-card);
+ color: var(--ui-accent);
+ font-size: var(--ui-type-body-small-size);
+ font-weight: var(--ui-type-body-small-weight);
+ box-shadow: var(--shadow-soft);
+ cursor: pointer;
+}
+.slide-sidebar-toggle-icon { font-size: 16px; line-height: 1; }
+.slide-sidebar-overlay {
+ display: none;
+ position: fixed;
+ inset: 0;
+ z-index: 200;
+ background: rgba(25, 42, 70, 0.4);
+}
+
+/* Desktop sidebar collapse toggle */
+.slide-sidebar-collapse {
+ position: sticky;
+ top: 14px;
+ z-index: 50;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 24px;
+ height: 48px;
+ flex-shrink: 0;
+ border: 1px solid var(--ui-border);
+ border-left: 0;
+ border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0;
+ background: var(--ui-bg-card);
+ color: var(--ui-text-muted);
+ font-size: 14px;
+ cursor: pointer;
+ transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
+ margin-top: 14px;
+}
+.slide-sidebar-collapse:hover {
+ background: var(--ui-bg-soft);
+ color: var(--ui-accent);
+}
+.slide-layout.sidebar-collapsed .slide-sidebar-collapse {
+ border: 1px solid var(--ui-border);
+ border-radius: var(--ui-radius-sm);
+}
+
+/* Responsive: sidebar becomes a drawer on mobile */
+@media (max-width: 768px) {
+ .slide-sidebar-toggle { display: flex; }
+ .slide-sidebar-collapse { display: none; }
+ .slide-sidebar {
+ position: fixed;
+ left: 0;
+ top: 0;
+ z-index: 250;
+ width: 280px;
+ transform: translateX(-100%);
+ transition: transform var(--t-med) var(--ease-out);
+ box-shadow: var(--shadow);
+ }
+ .slide-layout.sidebar-open .slide-sidebar { transform: translateX(0); }
+ .slide-layout.sidebar-open .slide-sidebar-overlay { display: block; }
+ .slide-content { padding: 48px 16px 16px; }
+ .slide-nav { padding: 8px 12px; gap: 8px; }
+ .slide-nav-btn { padding: 8px 14px; }
+ .slide-nav-counter { min-width: 48px; }
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/gallery.css b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/gallery.css
new file mode 100644
index 00000000..31750a20
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/gallery.css
@@ -0,0 +1,79 @@
+.real-effects {
+ display: grid;
+ gap: 0.875rem;
+}
+
+.real-effects-controls {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.75rem 1.75rem;
+}
+
+.real-effects-control-label {
+ margin: 0 0 0.25rem;
+ color: var(--ink);
+ font-weight: 650;
+}
+
+.real-effects-controls .chip-row {
+ flex-wrap: wrap;
+ justify-content: flex-start;
+ margin-bottom: 0;
+}
+
+.real-effects-pair {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: clamp(0.5rem, 2vw, 1.25rem);
+ width: 100%;
+ max-width: 46rem;
+}
+
+.real-effects-photo {
+ margin: 0;
+}
+
+.real-effects-photo a {
+ display: block;
+ border-radius: 0.375rem;
+}
+
+.real-effects-photo a:focus-visible {
+ outline: 2px solid var(--blue);
+ outline-offset: 3px;
+}
+
+.real-effects-photo img {
+ display: block;
+ width: 100%;
+ height: auto;
+ border: 1px solid var(--line);
+ border-radius: inherit;
+ background: #221d20;
+}
+
+.real-effects-photo figcaption {
+ display: grid;
+ gap: 0.125rem;
+ margin-top: 0.375rem;
+ overflow-wrap: anywhere;
+ line-height: 1.35;
+}
+
+.real-effects-photo figcaption span,
+.real-effects-credit {
+ color: var(--slate);
+ font-size: 0.875em;
+}
+
+.real-effects-observation,
+.real-effects-credit {
+ margin: 0;
+}
+
+.real-effects-credit a {
+ display: inline-block;
+ color: var(--blue);
+ margin-left: 0.35em;
+ text-decoration: underline;
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/paper.css b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/paper.css
new file mode 100644
index 00000000..e7c5dec9
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/paper.css
@@ -0,0 +1,382 @@
+:root {
+ --ui-bg-page: #edf1e8;
+ --ui-bg-page-top: #f7f9f2;
+ --ui-bg-muted: #f5f8f0;
+}
+
+.hero-actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: center;
+ gap: 12px 20px;
+ margin: 0 0 24px;
+}
+
+.paper-source {
+ color: var(--blue);
+ font-weight: 600;
+ text-underline-offset: 3px;
+}
+
+.module-evidence {
+ margin-left: auto;
+ flex: 0 0 auto;
+ color: var(--slate);
+ font-size: .875rem;
+ font-weight: 600;
+}
+
+.module-figure {
+ margin-top: 14px;
+ padding-top: 12px;
+ border-top: 1px solid var(--line);
+}
+
+.module-figure summary {
+ width: fit-content;
+ color: var(--blue);
+ font-weight: 600;
+ cursor: pointer;
+}
+
+.module-figure figcaption {
+ max-width: 46rem;
+ margin-inline: auto;
+}
+
+.module-figure .paper-source {
+ display: inline-block;
+ margin-top: 8px;
+}
+
+.paper-experiment {
+ display: grid;
+ gap: 12px;
+}
+
+.paper-experiment-note {
+ margin: 0;
+ color: var(--slate);
+}
+
+.paper-experiment-note p {
+ margin: 0 0 8px;
+}
+
+.paper-choice {
+ display: flex;
+ gap: 8px 12px;
+ flex-wrap: wrap;
+ align-items: center;
+}
+
+.paper-choice select {
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ background: var(--paper);
+ color: var(--ink);
+ font: inherit;
+ padding: 4px 24px 4px 8px;
+}
+
+.paper-metrics {
+ width: 100%;
+ border-collapse: collapse;
+ font-variant-numeric: tabular-nums;
+ font-size: .9375rem;
+}
+
+.paper-metrics caption {
+ text-align: start;
+ padding-block: 0 7px;
+ color: var(--slate);
+}
+
+.paper-metrics th, .paper-metrics td {
+ padding: 5px 8px;
+ border-bottom: 1px solid var(--line);
+ text-align: start;
+}
+
+.paper-metrics thead {
+ background: var(--paper-2);
+}
+
+.paper-metrics .paper-emphasis {
+ background: var(--green-soft);
+ color: var(--green);
+ font-weight: 700;
+}
+
+.slide-content:focus {
+ outline: none;
+}
+
+.chapter-intro {
+ margin: 0;
+ color: var(--ink-2);
+ line-height: 1.65;
+}
+
+.slide-chap .analogy-card {
+ min-height: 0;
+ margin: 0;
+}
+
+.slide-chap .analogy-visual {
+ width: 45%;
+ align-self: stretch;
+}
+
+.slide-chap .analogy-body {
+ padding: 11px 15px;
+}
+
+.slide-chap .analogy-title {
+ margin-bottom: 3px;
+ color: var(--ink);
+}
+
+.slide-chap .analogy-text {
+ font-size: var(--ui-type-body-small-size);
+ line-height: 1.65;
+}
+
+.chapter-modules {
+ display: grid;
+ min-width: 0;
+ gap: 10px;
+}
+
+.chapter-modules-stacked {
+ gap: 20px;
+}
+
+.chapter-module-options {
+ display: flex;
+ flex-wrap: wrap;
+ min-width: 0;
+ gap: 7px;
+}
+
+.chapter-module-options .chip[aria-pressed="true"] {
+ color: white;
+ background: var(--blue);
+ border-color: var(--blue);
+}
+
+.chapter-modules .module {
+ margin: 0;
+}
+
+.chapter-equations {
+ display: grid;
+ gap: 12px;
+ min-width: 0;
+}
+
+.chapter-equations > h3 {
+ margin: 0;
+ font-size: var(--ui-type-h3-size);
+}
+
+.paper-equation {
+ min-width: 0;
+ padding: 12px 15px;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+
+.paper-equation-heading {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 4px 12px;
+}
+
+.paper-equation-heading > h4 {
+ margin: 0;
+ font-size: 1.04rem;
+}
+
+.paper-equation-heading > .paper-source,
+.paper-equation-heading > span {
+ flex-shrink: 0;
+ font-size: .875rem;
+}
+
+.paper-equation p {
+ margin: 6px 0 0;
+ font-size: var(--ui-type-body-small-size);
+ color: var(--ink-2);
+ line-height: 1.65;
+}
+
+.paper-equation-math {
+ max-width: 100%;
+ margin: 10px 0;
+ padding: 10px 6px;
+ overflow-x: auto;
+ border-radius: 6px;
+ background: var(--paper-2);
+ color: var(--ink);
+}
+
+.paper-equation-math math {
+ width: max-content;
+ margin: 0 auto;
+ font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', math;
+ font-size: clamp(1rem, 2.2vw, 1.56rem);
+}
+
+.paper-equation-symbols {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 5px;
+}
+
+.paper-equation-symbols .chip {
+ font-family: 'Cambria Math', 'STIX Two Math', math;
+ padding: 4px 10px;
+}
+
+.chapter-transition {
+ padding: 10px 14px;
+ border-left: 3px solid var(--blue);
+ background: var(--blue-soft);
+ color: var(--ink);
+ font-size: var(--ui-type-body-small-size);
+}
+
+.chapter-transition > p {
+ margin: 3px 0 0;
+ line-height: 1.6;
+}
+
+.critical-question summary {
+ width: fit-content;
+ color: var(--blue);
+ font-weight: 700;
+ cursor: pointer;
+}
+
+.critical-review {
+ display: grid;
+ gap: 23px;
+}
+
+.critical-review h4,
+.critical-review h5 {
+ margin: 0;
+ color: var(--ink);
+}
+
+.critical-review h4 {
+ margin-bottom: 9px;
+ font-size: 1.14rem;
+}
+
+.critical-review h5 {
+ font-size: 1rem;
+}
+
+.critical-review p {
+ margin: 7px 0 0;
+ color: var(--ink-2);
+ font-size: var(--ui-type-body-small-size);
+ line-height: 1.65;
+}
+
+.critical-review .paper-source {
+ display: inline-block;
+ margin-top: 8px;
+ font-size: .875rem;
+}
+
+.critical-cards,
+.critical-comparison,
+.critical-lineage {
+ display: grid;
+ gap: 10px;
+}
+
+.critical-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+.critical-comparison,
+.critical-lineage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+
+.critical-cards > div,
+.critical-comparison > article,
+.critical-lineage > div,
+.critical-reflections > section,
+.critical-question {
+ padding: 13px;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+}
+
+.critical-cards > div,
+.critical-question { background: var(--paper-2); }
+.critical-reflections { gap: 12px; }
+.critical-lineage > div { border-top: 3px solid var(--green); }
+.critical-lineage > div + div { border-top-color: var(--line-2); }
+
+.critical-links {
+ display: flex;
+ flex-wrap: wrap;
+ column-gap: 12px;
+}
+
+.slide-content {
+ animation-name: paper-slide-in;
+}
+
+@keyframes paper-slide-in {
+ from { opacity: 0; transform: translateY(6px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .slide-content { animation: none; }
+}
+
+@media (min-width: 769px) {
+ .slide-layout.sidebar-collapsed .slide-sidebar {
+ visibility: hidden;
+ }
+}
+
+@media (max-width: 768px) {
+ .slide-layout .slide-sidebar {
+ visibility: hidden;
+ }
+
+ .slide-layout.sidebar-open .slide-sidebar {
+ visibility: visible;
+ }
+
+ .slide-layout.sidebar-collapsed .slide-nav {
+ padding-left: 12px;
+ }
+
+ .module-evidence {
+ margin-left: 0;
+ }
+
+ .paper-experiment .chip-row {
+ flex-wrap: wrap;
+ }
+
+ .slide-chap .analogy-visual {
+ width: 100%;
+ max-width: 440px;
+ align-self: center;
+ }
+
+ .critical-cards,
+ .critical-comparison,
+ .critical-lineage {
+ grid-template-columns: 1fr;
+ }
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/tokens.css b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/tokens.css
new file mode 100644
index 00000000..e1552c24
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/styles/tokens.css
@@ -0,0 +1,118 @@
+/* Visual tokens from the reference template. Import this file unchanged before components.css. */
+:root {
+ /* Core palette */
+ --ui-bg-page: #eef2f7;
+ --ui-bg-page-top: #f7f9fc;
+ --ui-bg-card: #ffffff;
+ --ui-bg-soft: #eef3fb;
+ --ui-bg-muted: #f6f8fc;
+ --ui-text-main: #21324a;
+ --ui-text-muted: #68778f;
+ --ui-text-light: #8b97ab;
+ --ui-border: #d7deea;
+ --ui-border-strong: #9fb0c8;
+ --ui-accent: #27446e;
+ --ui-accent-alt: #f07e47;
+ --ui-success: #228d5c;
+ --ui-warning: #c07100;
+ --ui-danger: #c43f52;
+
+ /* Reference-template semantic aliases */
+ --bg: var(--ui-bg-page);
+ --paper: var(--ui-bg-card);
+ --paper-2: var(--ui-bg-muted);
+ --ink: var(--ui-text-main);
+ --ink-2: var(--ui-text-muted);
+ --slate: var(--ui-text-muted);
+ --slate-2: var(--ui-text-light);
+ --line: var(--ui-border);
+ --line-2: var(--ui-border-strong);
+ --blue: var(--ui-accent);
+ --blue-soft: var(--ui-bg-soft);
+ --green: var(--ui-success);
+ --green-soft: rgba(34, 141, 92, 0.12);
+ --orange: var(--ui-accent-alt);
+ --orange-soft: rgba(240, 126, 71, 0.12);
+ --purple: #7c3aed;
+ --purple-soft: #f5f3ff;
+ --red: var(--ui-danger);
+ --red-soft: rgba(196, 63, 82, 0.10);
+ --yellow: var(--ui-warning);
+ --yellow-soft: rgba(192, 113, 0, 0.14);
+ --olive: var(--ui-success);
+ --sky: #4f7fb5;
+ --rust: var(--ui-accent-alt);
+ /* --accent aliases the primary blue (guidance/current state). Orange is the
+ user-emphasis color and is exposed as --orange / --ui-accent-alt. Do not
+ repurpose --accent for a different semantic role. */
+ --accent: var(--ui-accent);
+ --bad: var(--ui-danger);
+
+ /* Elevation and shape */
+ --ui-shadow-soft: 0 12px 34px rgba(25, 42, 70, 0.08);
+ --ui-shadow-hover: 0 16px 40px rgba(25, 42, 70, 0.12);
+ --shadow: var(--ui-shadow-soft);
+ --shadow-soft: 0 4px 14px rgba(25, 42, 70, 0.05);
+ --shadow-hover: var(--ui-shadow-hover);
+ --ui-radius-xl: 24px;
+ --ui-radius-lg: 18px;
+ --ui-radius-md: 12px;
+ --ui-radius-sm: 8px;
+ --ui-radius-pill: 999px;
+ --radius: var(--ui-radius-lg);
+ --radius-sm: var(--ui-radius-md);
+
+ /* System typography only: the built webpage does not depend on external fonts. */
+ --ui-font-sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
+ --ui-font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
+
+ /* Typography scale tokens (migrated from Shared UIKit Typography spec).
+ All font-size / font-weight / line-height in components.css must reference
+ these tokens — no hardcoded px values. */
+ --ui-type-display-size: clamp(2.25rem, 4vw, 2.625rem);
+ --ui-type-display-weight: 800;
+ --ui-type-display-line-height: 1.08;
+ --ui-type-display-letter-spacing: -0.03em;
+
+ --ui-type-h1-size: clamp(2rem, 3.5vw, 2.25rem);
+ --ui-type-h1-weight: 800;
+ --ui-type-h1-line-height: 1.12;
+ --ui-type-h1-letter-spacing: -0.02em;
+
+ --ui-type-h2-size: clamp(1.5rem, 3vw, 1.75rem);
+ --ui-type-h2-weight: 800;
+ --ui-type-h2-line-height: 1.22;
+ --ui-type-h2-letter-spacing: -0.01em;
+
+ --ui-type-h3-size: 1.5rem;
+ --ui-type-h3-weight: 800;
+ --ui-type-h3-line-height: 1.35;
+
+ --ui-type-subtitle-size: 1.375rem;
+ --ui-type-subtitle-weight: 500;
+ --ui-type-subtitle-line-height: 1.6;
+
+ --ui-type-body-size: 1.25rem;
+ --ui-type-body-weight: 500;
+ --ui-type-body-line-height: 1.7;
+
+ --ui-type-body-small-size: 1rem;
+ --ui-type-body-small-weight: 500;
+ --ui-type-body-small-line-height: 1.7;
+
+ --ui-type-formula-size: var(--ui-type-subtitle-size);
+ --ui-type-formula-weight: 700;
+ --ui-type-formula-line-height: 1.35;
+
+ /* Motion */
+ --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
+ --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
+ --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
+ --t-fast: 160ms;
+ --t-med: 280ms;
+ --t-slow: 480ms;
+}
+
+/* Semantic color contract:
+ error/corruption -> red; repair/correctness -> green; guidance/network -> blue;
+ emphasis/CTA -> orange; auxiliary concepts -> purple. */
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/types.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/types.ts
new file mode 100644
index 00000000..6773fe2e
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/types.ts
@@ -0,0 +1,114 @@
+// Data schema for a paper tutorial. The generator fills `src/data/tutorial.ts`
+// with a `tutorial` object matching `TutorialData`. The `kind` fields are REQUIRED:
+// validate-output.js counts chapters/modules via `kind: "chapter"` / `kind: "module"`
+// so do not omit them.
+
+export type Badge = 'inf' | 'trn' | 'both';
+
+export interface Meta {
+ titleEn: string;
+ titleZh: string;
+ venue: string;
+ authors: string;
+ affiliation: string;
+ domain: string;
+ coreProblem: string;
+ coreInsight: string;
+ keywords: string[];
+ paperSource?: string;
+}
+
+export interface FigureRef {
+ /** Path under public/ (e.g. "./images/fig1.png") or an absolute URL. Optional. */
+ src: string;
+ caption?: string;
+ alt?: string;
+ page?: number;
+}
+
+export interface HeroSide {
+ desc: string;
+ figure?: string; // optional path/URL to the paper's original figure
+ componentId?: string; // optional canvas widget id registered in src/modules/registry.tsx
+}
+
+export interface HeroConfig {
+ oldMethod: HeroSide;
+ newMethod: HeroSide;
+}
+
+export interface SymbolDef {
+ sym: string;
+ desc: string;
+}
+
+export type PaperEquationId = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'psnr';
+
+export interface FormulaDef {
+ label: string;
+ page: number;
+ title: string;
+ lead: string;
+ mathml: string;
+ symbols: SymbolDef[];
+}
+
+export interface AnalogyCard {
+ title: string;
+ text: string;
+ figure?: string; // optional path/URL to a paper figure
+ componentId?: string; // optional canvas widget id for the life-metaphor animation
+}
+
+export interface ModuleDef {
+ kind: 'module';
+ id: string; // e.g. "1.1"
+ title: string;
+ tabLabel?: string;
+ desc: string;
+ componentId: string; // MUST match a key in src/modules/registry.tsx
+ evidence?: 'demo' | 'paper' | 'extension';
+ figure?: FigureRef;
+}
+
+export interface Takeaway {
+ icon: string; // emoji
+ title: string;
+ desc: string;
+}
+
+export interface ChapterDef {
+ kind: 'chapter';
+ id: string; // e.g. "chap-1"
+ route: string;
+ title: string;
+ badge: Badge;
+ badgeLabel: string;
+ bridge: string; // "本节作用" copy
+ analogy?: AnalogyCard;
+ stackModules?: boolean;
+ modules: ModuleDef[];
+ insight?: string;
+ equations?: PaperEquationId[];
+ transition?: string;
+ takeaways: Takeaway[];
+}
+
+export interface BiliDef {
+ bvid: string; // "BV..." or "" if unused
+ title: string;
+ reason: string;
+ /** Optional static cover URL (https). Baked in at generation time so the cover
+ * shows without depending on the runtime Bilibili metadata fetch. */
+ cover?: string;
+ /** Optional static view count string (e.g. "41.5万播放"), baked in at generation
+ * time so 播放量 shows without depending on the runtime metadata fetch. */
+ views?: string;
+}
+
+export interface TutorialData {
+ meta: Meta;
+ hero: HeroConfig;
+ chapters: ChapterDef[];
+ bilibili?: BiliDef[];
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/vite-env.d.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/vite-env.d.ts
new file mode 100644
index 00000000..11f02fe2
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/src/vite-env.d.ts
@@ -0,0 +1 @@
+///
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/tsconfig.json b/html_output/non_local_sparse_models_for_image_restoration/hui1116/tsconfig.json
new file mode 100644
index 00000000..6bfa73af
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "strict": true,
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "noFallthroughCasesInSwitch": true
+ },
+ "include": ["src"]
+}
diff --git a/html_output/non_local_sparse_models_for_image_restoration/hui1116/vite.config.ts b/html_output/non_local_sparse_models_for_image_restoration/hui1116/vite.config.ts
new file mode 100644
index 00000000..772032c3
--- /dev/null
+++ b/html_output/non_local_sparse_models_for_image_restoration/hui1116/vite.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+
+// paper-skill generated tutorial. No external CDN; everything is bundled locally.
+export default defineConfig({
+ plugins: [react()],
+ base: './',
+ server: { port: 5173, open: false },
+ build: { outDir: 'dist', sourcemap: false },
+});
|