fix: accept visual shrink scale edits
This commit is contained in:
parent
48a0f2ee73
commit
6baeb57cde
@ -2625,10 +2625,9 @@ async function createScaleAdjustPatchReference(params: {
|
||||
} = params;
|
||||
const workspaceRect = getScaleAdjustPatchWorkspaceRect(regions, scalePercent);
|
||||
const workspacePixelRect = rectToPixels(workspaceRect, sourceWidth, sourceHeight);
|
||||
const structureLockedDraft = hasScaleAdjustStructureTarget(
|
||||
regions,
|
||||
scalePercent
|
||||
);
|
||||
// Pixel-mask structure drafts are useful for enlargement, but in shrink
|
||||
// cases they can turn dense interior details into black mask blocks.
|
||||
const structureLockedDraft = hasScaleAdjustEnlargeTarget(regions, scalePercent);
|
||||
const targetDraftBuffer = await buildScaleAdjustVisualLayoutGuideBuffer({
|
||||
regions,
|
||||
scalePercent,
|
||||
|
||||
@ -189,6 +189,7 @@ const SCALE_ADJUST_MARKER_CLEANUP_MARGIN = 0.035;
|
||||
const SCALE_ADJUST_MARKER_DILATE_RADIUS = 3;
|
||||
const SCALE_ADJUST_MARKER_MIN_PIXEL_COUNT = 18;
|
||||
const SCALE_ADJUST_DIFF_SAMPLE_SIZE = 112;
|
||||
const SCALE_ADJUST_FOOTPRINT_FALLBACK_DIFF_THRESHOLD = 18;
|
||||
const SCALE_ADJUST_FALLBACK_MASK_DISTANCE_THRESHOLD = 42;
|
||||
const SCALE_ADJUST_FALLBACK_MASK_LUMA_GAP = 18;
|
||||
const SCALE_ADJUST_FALLBACK_INPAINT_ITERATIONS = 180;
|
||||
@ -1582,7 +1583,15 @@ async function applyScaleAdjustVerificationToImages(params: {
|
||||
const visuallyChangedInside = changeDiffScores.some(
|
||||
(score) => score >= SCALE_ADJUST_VISUAL_DIFF_THRESHOLD
|
||||
);
|
||||
const changedInside = visuallyChangedInside && footprintStats.passed;
|
||||
const footprintFallbackAccepted =
|
||||
visuallyChangedInside &&
|
||||
!footprintStats.passed &&
|
||||
changeDiffScores.some(
|
||||
(score) => score >= SCALE_ADJUST_FOOTPRINT_FALLBACK_DIFF_THRESHOLD
|
||||
);
|
||||
const changedInside =
|
||||
(visuallyChangedInside && footprintStats.passed) ||
|
||||
footprintFallbackAccepted;
|
||||
const outsideChanged =
|
||||
isScaleAdjustOutsideChanged(outsideDiffScores) ||
|
||||
isScaleAdjustOutsidePixelChanged(outsidePixelStats);
|
||||
@ -1591,6 +1600,7 @@ async function applyScaleAdjustVerificationToImages(params: {
|
||||
console.info("[Canvas Generate Image] Scale adjust result guard:", {
|
||||
debugLabel,
|
||||
changedInside,
|
||||
footprintFallbackAccepted,
|
||||
footprintChanged: footprintStats.passed,
|
||||
footprintStats: {
|
||||
failedRegionCount: footprintStats.failedRegionCount,
|
||||
@ -1669,6 +1679,7 @@ async function applyScaleAdjustVerificationToImages(params: {
|
||||
imageIndex: index,
|
||||
reasons: guardWarnings,
|
||||
changedInside,
|
||||
footprintFallbackAccepted,
|
||||
footprintChanged: footprintStats.passed,
|
||||
footprintStats: {
|
||||
failedRegionCount: footprintStats.failedRegionCount,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user