Soul_Thread / lib /aopHoodieMappingRules.ts
3rdaiOhpinFully's picture
Create lib/aopHoodieMappingRules.ts
192e656 verified
Raw
History Blame Contribute Delete
2.64 kB
export type RegionType =
| "PRIMARY_FOCAL_REGION"
| "SECONDARY_FOCAL_REGION"
| "ENVIRONMENT_REGION"
| "LOWER_ANCHOR_REGION"
| "LEFT_EDGE_FLOW_REGION"
| "RIGHT_EDGE_FLOW_REGION"
| "TEXT_REGION"
| "LOGO_REGION";
export type CropStrategy =
| "centered_focal"
| "wide_dramatic"
| "vertical_texture"
| "upper_continuation"
| "dark_texture"
| "lower_anchor"
| "texture_band";
export type HoodiePieceRule = {
pieceId: string;
preferredRegions: RegionType[];
forbiddenRegions: RegionType[];
allowText: boolean;
allowFace: boolean;
allowLogo: boolean;
avoidSeams: boolean;
avoidBleed: boolean;
avoidPocketOverlap: boolean;
cropStrategy: CropStrategy;
minSafePaddingPercent: number;
uniquenessRequired: boolean;
qualityWeight: number;
};
export const AOP_HOODIE_MAPPING_RULES: HoodiePieceRule[] = [
{
pieceId: "front_body",
preferredRegions: ["PRIMARY_FOCAL_REGION"],
forbiddenRegions: [],
allowText: true,
allowFace: true,
allowLogo: true,
avoidSeams: true,
avoidBleed: true,
avoidPocketOverlap: true,
cropStrategy: "centered_focal",
minSafePaddingPercent: 12,
uniquenessRequired: true,
qualityWeight: 1.0,
},
{
pieceId: "back_body",
preferredRegions: ["SECONDARY_FOCAL_REGION", "ENVIRONMENT_REGION"],
forbiddenRegions: [],
allowText: true,
allowFace: true,
allowLogo: true,
avoidSeams: true,
avoidBleed: true,
avoidPocketOverlap: false,
cropStrategy: "wide_dramatic",
minSafePaddingPercent: 10,
uniquenessRequired: true,
qualityWeight: 0.95,
},
{
pieceId: "left_sleeve",
preferredRegions: ["LEFT_EDGE_FLOW_REGION", "ENVIRONMENT_REGION"],
forbiddenRegions: ["PRIMARY_FOCAL_REGION", "TEXT_REGION", "LOGO_REGION"],
allowText: false,
allowFace: false,
allowLogo: false,
avoidSeams: true,
avoidBleed: true,
avoidPocketOverlap: false,
cropStrategy: "vertical_texture",
minSafePaddingPercent: 8,
uniquenessRequired: true,
qualityWeight: 0.65,
},
{
pieceId: "right_sleeve",
preferredRegions: ["RIGHT_EDGE_FLOW_REGION", "ENVIRONMENT_REGION"],
forbiddenRegions: ["PRIMARY_FOCAL_REGION", "TEXT_REGION", "LOGO_REGION"],
allowText: false,
allowFace: false,
allowLogo: false,
avoidSeams: true,
avoidBleed: true,
avoidPocketOverlap: false,
cropStrategy: "vertical_texture",
minSafePaddingPercent: 8,
uniquenessRequired: true,
qualityWeight: 0.65,
},
];
export function getHoodieRule(pieceId: string) {
return AOP_HOODIE_MAPPING_RULES.find((rule) => rule.pieceId === pieceId);
}