fix: tighten product lock scale adjust clip mask
This commit is contained in:
parent
fb9f0541fa
commit
00a6ac08df
@ -2687,6 +2687,15 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: {
|
|||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
const sourceEditBaseMask = filteredSourceBbox
|
||||||
|
? filteredSourceMask
|
||||||
|
: highConfidenceSourceMask;
|
||||||
|
const sourceEditMaskBbox = getScaleAdjustMaskBoundingBox({
|
||||||
|
height: placement.sourceBox.height,
|
||||||
|
mask: sourceEditBaseMask,
|
||||||
|
width: placement.sourceBox.width,
|
||||||
|
});
|
||||||
|
if (!sourceEditMaskBbox) return null;
|
||||||
const sourceWashBaseMask = filteredSourceBbox
|
const sourceWashBaseMask = filteredSourceBbox
|
||||||
? solidifyScaleAdjustStructureMask({
|
? solidifyScaleAdjustStructureMask({
|
||||||
box: placement.sourceBox,
|
box: placement.sourceBox,
|
||||||
@ -2707,15 +2716,26 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: {
|
|||||||
});
|
});
|
||||||
const sourceCompositeClipMask = dilateScaleAdjustStructureMask({
|
const sourceCompositeClipMask = dilateScaleAdjustStructureMask({
|
||||||
height: placement.sourceBox.height,
|
height: placement.sourceBox.height,
|
||||||
mask: sourceWashBaseMask,
|
mask: sourceEditBaseMask,
|
||||||
radius: Math.max(
|
radius: Math.max(
|
||||||
1,
|
4,
|
||||||
Math.round(
|
Math.round(
|
||||||
Math.min(placement.sourceBox.width, placement.sourceBox.height) * 0.003
|
Math.min(placement.sourceBox.width, placement.sourceBox.height) *
|
||||||
|
(protectedPersonSide ? 0.018 : 0.014)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
width: placement.sourceBox.width,
|
width: placement.sourceBox.width,
|
||||||
});
|
});
|
||||||
|
const sourceWashMaskBbox = getScaleAdjustMaskBoundingBox({
|
||||||
|
height: placement.sourceBox.height,
|
||||||
|
mask: sourceWashMask,
|
||||||
|
width: placement.sourceBox.width,
|
||||||
|
});
|
||||||
|
const sourceCompositeClipBbox = getScaleAdjustMaskBoundingBox({
|
||||||
|
height: placement.sourceBox.height,
|
||||||
|
mask: sourceCompositeClipMask,
|
||||||
|
width: placement.sourceBox.width,
|
||||||
|
});
|
||||||
const sourceWashPatch = await buildScaleAdjustMaskWashPatch({
|
const sourceWashPatch = await buildScaleAdjustMaskWashPatch({
|
||||||
background,
|
background,
|
||||||
box: placement.sourceBox,
|
box: placement.sourceBox,
|
||||||
@ -2833,7 +2853,25 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: {
|
|||||||
protectedPersonMaskApplied: Boolean(protectedPersonMask),
|
protectedPersonMaskApplied: Boolean(protectedPersonMask),
|
||||||
sameSizeCutout,
|
sameSizeCutout,
|
||||||
alphaBandingStats,
|
alphaBandingStats,
|
||||||
|
sourceClipAlphaRatio: Number(
|
||||||
|
(
|
||||||
|
(sourceCompositeClipBbox?.count || 0) /
|
||||||
|
Math.max(1, placement.sourceBox.width * placement.sourceBox.height)
|
||||||
|
).toFixed(3)
|
||||||
|
),
|
||||||
|
sourceEditAlphaRatio: Number(
|
||||||
|
(
|
||||||
|
sourceEditMaskBbox.count /
|
||||||
|
Math.max(1, placement.sourceBox.width * placement.sourceBox.height)
|
||||||
|
).toFixed(3)
|
||||||
|
),
|
||||||
sourceHeight: placement.sourceBox.height,
|
sourceHeight: placement.sourceBox.height,
|
||||||
|
sourceWashAlphaRatio: Number(
|
||||||
|
(
|
||||||
|
(sourceWashMaskBbox?.count || 0) /
|
||||||
|
Math.max(1, placement.sourceBox.width * placement.sourceBox.height)
|
||||||
|
).toFixed(3)
|
||||||
|
),
|
||||||
sourceWidth: placement.sourceBox.width,
|
sourceWidth: placement.sourceBox.width,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user