fix(heal): eliminate boundary seams by windowing inpaint clusters to 1:1 scale and smoothing feather transition

This commit is contained in:
2026-10-14 17:35:27 +07:00
parent 8df0a03414
commit 4b5e55bc50
4 changed files with 35 additions and 11 deletions
+3 -2
View File
@@ -253,7 +253,7 @@ export function fastLocalInpaint(
const fG = new Float32Array(w * h);
const fB = new Float32Array(w * h);
const bStep = Math.max(1, Math.floor(bLen / 32));
const bStep = bLen <= 96 ? 1 : Math.max(1, Math.floor(bLen / 64));
for (let y = 0; y < h; y++) {
const row = y * w;
@@ -329,7 +329,8 @@ export function fastLocalInpaint(
}
noiseVariance /= Math.max(1, count);
// High-frequency noise standard deviation (adjacent difference / sqrt(2))
const noiseAmp = Math.min(5, Math.max(0.6, Math.sqrt(noiseVariance * 0.5)));
const rawAmp = Math.sqrt(noiseVariance * 0.5);
const noiseAmp = rawAmp < 0.3 ? 0 : Math.min(4, rawAmp);
let seed = (w * 31 + h * 17 + holeCount) | 0;
function prng(): number {