mcpField
V
Virtual Try-On

Virtual Try-On

github.com/eachlabs创意与媒体44215 次安装今天更新
代码仓库

关于 Virtual Try-On

Virtual Try-On 使用 each::sense API,将服装、配饰、美妆或发型效果呈现在人物照片上,适合探索造型或预览商品。它支持组合多件商品,并可在连续会话中尝试不同搭配。

主要功能

  1. 01虚拟试穿服装与鞋履
  2. 02预览眼镜、珠宝和手表
  3. 03尝试妆容与发型变化
  4. 04组合多件商品搭配
  5. 05通过会话连续尝试造型

适用场景

  1. 01比较不同西装的效果
  2. 02预览眼镜或珠宝佩戴效果
  3. 03为正式活动组合完整造型

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/eachlabs/skills --skill virtual-try-on

安装后在 Claude Code 中输入/virtual-try-on确认已加载。

附带文件references/SSE-EVENTS.md

详细介绍

虚拟试穿

AI 驱动的虚拟试穿解决方案,让用户无需实际试穿,就能直观查看服装、配饰、妆容和发型穿戴在自己身上的效果。

概述

虚拟试穿技能利用 each::sense API,逼真地呈现以下效果:

  • 服装试穿:衬衫、连衣裙、夹克、裤子和整套穿搭
  • 配饰:眼镜、太阳镜、珠宝、手表、围巾、帽子
  • 妆容:口红、眼影、粉底、腮红和完整妆容
  • 发型:不同的发型、发色和造型选择
  • 鞋履:运动鞋、高跟鞋、靴子、凉鞋
  • 珠宝:项链、耳环、手链、戒指

快速开始

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me wearing this dress"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/person-photo.jpg",
      "https://example.com/dress-product.jpg"
    ],
    "mode": "max"
  }'

试穿类别

类别描述示例物品
服装衣物和服饰衬衫、连衣裙、夹克、裤子、大衣
鞋履鞋类运动鞋、高跟鞋、靴子、凉鞋、乐福鞋
眼镜眼镜类处方眼镜、太阳镜、阅读眼镜
珠宝装饰性配饰项链、耳环、手链、戒指
妆容化妆品口红、眼影、粉底、腮红
发型头发造型变化发型、发色、造型
手表腕表指针式手表、智能手表、奢华手表

使用场景示例

1. 服装试穿

直观查看特定服装穿在某人身上的效果。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me wearing this blue blazer. Keep my face and body proportions accurate."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/my-photo.jpg",
      "https://example.com/blue-blazer.jpg"
    ],
    "mode": "max"
  }'
2. 眼镜试戴

虚拟试戴不同款式的眼镜。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Put these round tortoiseshell glasses on me. Make sure the fit looks natural on my face shape."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/face-photo.jpg",
      "https://example.com/tortoiseshell-glasses.jpg"
    ],
    "mode": "max"
  }'
3. 珠宝试戴

直观查看项链、耳环或手链等珠宝的佩戴效果。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me wearing this gold necklace. Position it naturally on my neckline."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/portrait-photo.jpg",
      "https://example.com/gold-necklace.jpg"
    ],
    "mode": "max"
  }'
4. 手表试戴

试戴手表,查看佩戴在手腕上的效果。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Put this luxury watch on my wrist. Show how it looks from a natural angle."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/wrist-photo.jpg",
      "https://example.com/luxury-watch.jpg"
    ],
    "mode": "max"
  }'
5. 妆容试用

尝试虚拟妆容或特定化妆品。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Apply this red lipstick shade to my lips. Keep the rest of my makeup natural."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/face-closeup.jpg",
      "https://example.com/red-lipstick-product.jpg"
    ],
    "mode": "max"
  }'
6. 发型试换

尝试不同的发型和发色。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Give me this bob haircut style. Match the hair color to the reference image."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/my-current-photo.jpg",
      "https://example.com/bob-hairstyle-reference.jpg"
    ],
    "mode": "max"
  }'
7. 鞋履试穿

直观查看不同鞋履的上脚效果。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me wearing these white sneakers. Display a full body view."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/full-body-photo.jpg",
      "https://example.com/white-sneakers.jpg"
    ],
    "mode": "max"
  }'
8. 全套穿搭造型

搭配多件服装,打造完整造型。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Style me in this complete outfit - the jacket, pants, and shoes together. Create a cohesive look."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/my-photo.jpg",
      "https://example.com/leather-jacket.jpg",
      "https://example.com/black-jeans.jpg",
      "https://example.com/boots.jpg"
    ],
    "mode": "max"
  }'
9. 配饰组合

组合多件配饰,打造完整造型。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Put these sunglasses and this scarf on me together. Make the accessories complement each other."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/portrait.jpg",
      "https://example.com/aviator-sunglasses.jpg",
      "https://example.com/silk-scarf.jpg"
    ],
    "mode": "max"
  }'
10. 特定场合造型

为特定场合打造造型。

curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Dress me for a formal wedding. Use this evening gown and add elegant jewelry to complete the look."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": [
      "https://example.com/my-photo.jpg",
      "https://example.com/evening-gown.jpg",
      "https://example.com/pearl-earrings.jpg"
    ],
    "mode": "max"
  }'

使用 image_urls

image_urls 参数接受一个图片 URL 数组,用于虚拟试穿:

位置用途要求
第一张图片人物照片清晰、光线充足的人物照片
第二张图片商品/物品照片中性背景上的清晰商品图片
其他图片多件商品用于在一次试穿中组合多件物品
图片指南
  • 人物照片:正面拍摄、光线良好,并显示相关身体部位
  • 商品照片:高分辨率、商品细节清晰、背景杂物尽量少
  • 支持的格式:JPEG、PNG、WebP
  • 建议分辨率:1024x1024 或更高,以获得最佳效果

最佳实践

照片质量
  1. 人物照片要求:

    • 使用光线充足的高分辨率图片
    • 确保清晰显示相关身体部位(试戴眼镜时显示面部,试穿服装时显示全身)
    • 避免使用过重的滤镜或极端拍摄角度
    • 对大多数试穿场景而言,正面照片效果最佳
  2. 商品照片要求:

    • 有官方商品图片时,优先使用官方图片
    • 确保物品清晰可见,且未被遮挡
    • 白色或中性色背景效果最佳
    • 多个角度有助于提高准确度
提示词技巧
  • 具体描述:准确说明你希望物品如何摆放
  • 说明贴合度:要求贴合自然、比例协调
  • 提及颜色:说明颜色匹配是否重要
  • 补充背景:提及场合或风格目标

好的提示词:

  • "展示我穿着这件海军蓝西装外套的效果,肩部贴合自然"
  • "用这组眼影盘打造晚间妆容"
  • "把这副眼镜戴在我脸上,并根据我的脸型进行调整"

效果较差的提示词:

  • "试试这个"(太笼统)
  • "穿上衣服"(没有指定具体物品)

模式选择

模式描述适用场景
max最高质量,渲染细致最终可视化效果、重要决策
eco处理速度更快,质量良好快速预览、浏览多个选项
# High quality for final decision
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me in this wedding dress with maximum detail"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/me.jpg", "https://example.com/dress.jpg"],
    "mode": "max"
  }'

# Quick preview mode
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Quick preview of this t-shirt on me"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/me.jpg", "https://example.com/tshirt.jpg"],
    "mode": "eco"
  }'

多轮会话

使用 session_id 在连续会话中尝试多个物品,同时保留之前交互的上下文。

开始会话
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "This is my photo. I want to try on several outfits for a job interview."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/my-photo.jpg"],
    "session_id": "tryon-session-12345",
    "mode": "max"
  }'
继续会话
# Try first outfit
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Now show me in this navy suit"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/navy-suit.jpg"],
    "session_id": "tryon-session-12345",
    "mode": "max"
  }'

# Try second outfit
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "How about this charcoal blazer with khakis instead?"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/charcoal-blazer.jpg", "https://example.com/khakis.jpg"],
    "session_id": "tryon-session-12345",
    "mode": "max"
  }'

# Compare options
curl -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Which outfit looked more professional on me?"}],
    "model": "eachsense/beta",
    "stream": true,
    "session_id": "tryon-session-12345",
    "mode": "max"
  }'

错误处理

常见问题与解决方案
错误原因解决方案
结果质量低输入图像质量差使用分辨率更高、光线充足的照片
摆放位置不正确身体姿势不明确使用正面照片,并确保目标区域清晰可见
颜色不匹配产品图像存在偏色使用颜色呈现准确的产品图像
物品不可见产品被图像中的其他内容遮挡使用中性背景上的清晰产品图像
处理 API 错误
# Check response status and handle errors
response=$(curl -s -w "\n%{http_code}" -X POST "https://eachsense-agent.core.eachlabs.run/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Show me in this jacket"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/me.jpg", "https://example.com/jacket.jpg"],
    "mode": "max"
  }')

http_code=$(echo "$response" | tail -n 1)
body=$(echo "$response" | head -n -1)

if [ "$http_code" -eq 200 ]; then
  echo "Success: $body"
elif [ "$http_code" -eq 401 ]; then
  echo "Error: Invalid API key"
elif [ "$http_code" -eq 400 ]; then
  echo "Error: Invalid request - check image URLs and parameters"
else
  echo "Error $http_code: $body"
fi

相关技能

评论

支持 Markdown