mcpField
D
depth-map-generation

depth-map-generation

github.com/eachlabsクリエイティブ・メディア44204 回インストール今日更新
リポジトリ

depth-map-generation について

each::senseで画像から奥行きを推定し、深度マップを生成するスキルです。エフェクト、3D表示、VR/ARの制作に携わる人向けで、グレースケールやメートル単位などの出力に対応します。

主な機能

  1. 01単一画像からの奥行き推定
  2. 02ポートレートや風景の深度マップ生成
  3. 03グレースケール、正規化、実距離形式での出力
  4. 04視差アニメーションとステレオ画像の制作支援
  5. 05深度対応のぼかしとフォーカス選択

活用シーン

  1. 01ポートレートの背景に自然なぼかしを追加
  2. 02静止画から視差アニメーションを作成
  3. 03AR/VRシーン用の深度データを準備
  4. 042D画像からステレオビューを作成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/eachlabs/skills --skill depth-map-generation

インストール後、Claude Code で/depth-map-generationを入力して読み込まれたか確認します。

同梱ファイルreferences/SSE-EVENTS.md

詳細

深度マップの生成

each::sense を使用して、あらゆる画像から正確な深度マップを生成します。このスキルは、3D 効果、視差アニメーション、VR/AR アプリケーション、計算写真などに活用できるよう、2D 画像から深度情報を抽出します。

特徴

  • 単眼深度推定:単一画像から深度を抽出します
  • ポートレート深度マップ:ポートレート写真の効果に適した、精密な深度を生成します
  • 風景の深度:パノラマ画像や風景画像のシーン深度を生成します
  • 製品の深度:eコマース向けの3D対応深度マップを生成します
  • 建築物の深度:建物や室内の深度を解析します
  • 3D 視差効果:ケン・バーンズ風アニメーション用の深度データを生成します
  • VR/AR の深度:没入型体験向けのリアルタイム深度推定を行います
  • ステレオ画像の生成:2D 画像を立体3Dに変換します
  • フォーカススタッキング:深度に基づいて焦点面を選択します
  • 背景ぼかし:深度を考慮したボケ効果やぼかし効果を適用します

クイックスタート

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": "Generate a depth map from this photo"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/photo.jpg"],
    "mode": "max"
  }'

深度マップの出力形式

形式説明用途
グレースケール8ビット深度(白=近、黒=遠)汎用、可視化
反転グレースケール8ビット深度(黒=近、白=遠)一部の3Dソフトウェアとの互換性
正規化0~1の範囲の深度値機械学習パイプライン
メートル法実世界の距離を推定AR/VR、ロボティクス

ユースケースの例

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": "Generate a depth map from this image. Output as grayscale where white represents closer objects and black represents distant objects."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/scene.jpg"],
    "mode": "max"
  }'
2. ポートレート深度マップ

ボケ効果や3Dポートレート向けに、ポートレート写真から精密な深度情報を抽出します。

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": "Create a high-precision depth map from this portrait photo. Focus on accurate edge detection around the subject, especially hair and facial features. I need this for applying realistic depth-of-field effects."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/portrait.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": "Generate a depth map from this landscape photo. The scene has foreground elements, mid-ground terrain, and distant mountains. Capture the full depth range from near to far with good separation between depth layers."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/landscape.jpg"],
    "mode": "max"
  }'
4. 3D 効果用の製品深度

製品画像の深度マップを作成し、3D表示を可能にします。

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": "Extract a depth map from this product photo. I need accurate depth information to create a 3D interactive view for an e-commerce website. Focus on capturing the product shape and surface details."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/product-sneaker.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": "Create a depth map from this interior architecture photo. Capture the spatial relationships between walls, furniture, and architectural elements. I need this for a virtual tour with depth-based transitions."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/interior.jpg"],
    "mode": "max"
  }'
6. 3D 視差効果の作成

視差アニメーションやケン・バーンズ効果の作成に最適化された深度マップを生成します。

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": "Generate a depth map from this photo that I will use for a 3D parallax animation. I need clear depth separation between foreground, midground, and background elements. The depth should be smooth with distinct layers for a compelling parallax effect."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/scene-for-parallax.jpg"],
    "mode": "max"
  }'
7. VR/AR 向け深度推定

仮想現実や拡張現実のアプリケーションに適した深度マップを作成します。

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": "Generate a depth map from this room photo for AR/VR use. I need metric depth estimation that accurately represents real-world distances. This will be used for placing virtual objects in an augmented reality application."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/room.jpg"],
    "mode": "max"
  }'
8. ステレオ画像の生成

深度推定を使用して、2D 画像を立体3Dに変換します。

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": "Generate a depth map from this photo and use it to create a stereoscopic 3D image pair (left and right eye views). The stereo effect should be subtle enough for comfortable viewing but noticeable enough to create depth perception."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/photo-for-stereo.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": "Create a depth map from this macro/close-up photo. I need precise depth information to identify focus planes for computational focus stacking. Each depth layer should be clearly defined so I can select which areas should be in focus."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/macro-photo.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": "Generate a depth map from this photo for applying depth-aware background blur. The subject in the foreground should be clearly separated from the background. I need accurate edge detection so the blur transition looks natural, similar to a portrait mode effect."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/photo-for-blur.jpg"],
    "mode": "max"
  }'

マルチターン深度処理

session_id を使用して、深度マップを調整したり、関連する複数の画像を処理したりできます。

# Initial depth estimation
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": "Generate a depth map from this photo"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/scene.jpg"],
    "session_id": "depth-project-001"
  }'

# Refine the depth map
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": "The depth map looks good but can you enhance the edge detection around the main subject? The boundaries are a bit fuzzy."}],
    "model": "eachsense/beta",
    "stream": true,
    "session_id": "depth-project-001"
  }'

# Apply the depth map for an effect
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 use this depth map to create a 3D parallax video animation with subtle camera movement"}],
    "model": "eachsense/beta",
    "stream": true,
    "session_id": "depth-project-001"
  }'

バッチ深度処理

複数の画像を処理して、一貫性のある深度推定を行います。

# Process first image
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": "Generate a depth map from this product photo. I will be sending more product images that need consistent depth estimation."}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/product1.jpg"],
    "session_id": "product-depth-batch",
    "mode": "eco"
  }'

# Process second image with same settings
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": "Generate depth map for this product using the same approach as before"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/product2.jpg"],
    "session_id": "product-depth-batch",
    "mode": "eco"
  }'

モードの選択

モード最適な用途速度品質
max最終制作向け深度マップ、VR/AR アプリケーション、プロ向け合成遅め最高精度
ecoクイックプレビュー、バッチ処理、プロトタイピング速め良好

推奨: 深度の精度が重要な場合(VR/AR、3D変換、プロ向け合成)は、max モードを使用してください。迅速な反復やバッチ処理には、eco モードを使用してください。

ベストプラクティス

入力画像の品質
  • 解像度:高解像度の入力画像ほど、詳細な深度マップを生成できます
  • 照明:均一な照明は、正確な深度推定に役立ちます
  • コントラスト:オブジェクト間のコントラストが明確だと、深度をより適切に分離できます
  • フォーカス:鮮明な画像ほど、深度マップでのエッジ検出の精度が向上します
深度マップの用途
  • 視差効果:最良の結果を得るには、3~5個の明確な深度レイヤーを使用します
  • ボケ/ぼかし:自然にぼかしが弱まるよう、被写体のエッジをきれいに保ちます
  • 3D変換:メートル法の深度を得るには、シーンのスケールに関する情報を指定します
  • VR/AR:実世界の距離を正確に表すには、メートル法の深度を指定します
プロンプトのヒント
  1. 出力形式を指定する:グレースケール、正規化、またはメートル単位の深度
  2. シーンを説明する:空間的な位置関係をモデルが理解できるようにします
  3. ユースケースを明示する:用途によって、適した深度特性は異なります
  4. エッジ品質を指定する:深度の変化をシャープにするか、滑らかにするかを指定します

エラー処理

エラー原因解決策
Failed to create prediction: HTTP 422残高不足eachlabs.ai で残高を追加してください
画像の読み込みに失敗しました画像 URL が無効、またはアクセスできません画像 URL に誰でもアクセスできることを確認してください
タイムアウト複雑な画像、または高解像度の画像クライアントのタイムアウトを最低 10 分に設定してください
深度出力の品質が低い入力画像の品質が低いより高解像度で、明るく撮影された画像を使用してください

技術的な注意事項

  • クライアントのタイムアウト:複雑な深度推定では、HTTP クライアントのタイムアウトを最低 10 分に設定してください
  • 画像形式:入力画像は JPEG、PNG、WebP に対応しています
  • 出力形式:深度マップは通常、グレースケールの PNG 画像として出力されます
  • 深度範囲:デフォルトでは相対深度(0~1)です。リクエストに応じてメートル単位の深度も利用できます

関連スキル

  • each-sense - コア API ドキュメント
  • image-to-3d - 画像から完全な 3D モデルを生成
  • image-editing - 深度ベースのエフェクトを画像に適用
  • video-generation - 深度マップから視差動画を作成

コメント