MediaPipe + Three.js实现摄像头人脸口型捕获 + 3D数字人口型驱动代码

代码语言:html

所属分类:多媒体

代码描述:MediaPipe + Three.js实现摄像头人脸口型捕获 + 3D数字人口型驱动代码

代码标签: MediaPipe Three 摄像头 人脸 口型 捕获 3D 数字人 口型 驱动 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>摄像头人脸口型捕获 + 3D数字人口型驱动</title>
<style>
  body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, 'PingFang SC', 'Noto Sans CJK', 'Microsoft YaHei', Arial, sans-serif; background:#0b1020; color:#eaeef3; }
  h1 { margin:16px; font-size:20px; }
  .wrap { display:flex; flex-wrap:wrap; gap:16px; padding:16px; }
  .panel { background:#12182a; border:1px solid #233; border-radius:10px; padding:12px; flex:1 1 420px; }
  .row { display:flex; gap:12px; align-items:center; margin:8px 0; flex-wrap:wrap; }
  label { color:#9fb3c8; font-size:12px; }
  button, select { background:#1c2440; color:#eaeef3; border:1px solid #2c3e57; border-radius:8px; padding:8px 12px; cursor:pointer; }
  button:disabled { opacity:.6; cursor:not-allowed; }
  .small { font-size:12px; color:#93a4b8; }
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
  a { color:#58a6ff; text-decoration:none; } a:hover { text-decoration:underline; }

  #videoWrap { position:relative; width:100%; max-width:560px; aspect-ratio:4/3; margin:auto; }
  #video, #overlay { position:absolute; left:0; top:0; width:100%; height:100%; border-radius:8px; background:black; }

  #bars { display:flex; gap:8px; margin-top:8px; }
  .bar { flex:1; background:#0d1527; border-radius:8px; padding:8px; }
  .bar h4 { margin:0 0 6px 0; font-weight:600; font-size:12px; color:#9fb3c8;}
  .bar .track { height:12px; background:#223047; border-radius:6px; overflow:hidden; }
  .bar .fill { height:100%; width:0%; background:linear-gradient(90deg,#3af,#4f8cff); }

  #three { width:100%; height:420px; background:#0a0f1a; border-radius:8px; }
</style>
</head>
<body>
  <h1>摄像头人脸口型捕获 + 3D数字人口型驱动 (MediaPipe + Three.js)</h1>

  <div class="wrap">
    <div class="panel" style="max-width:600px;">
      <div class="row">
        <button id="btnStart">开启摄像头</button>
        <label>摄像头</label>
        <select id="camList"></select>
        <span id="status" class="small">等待启动...</span>
      </div>

      <div id="videoWrap">
        <video id="video" autoplay playsinline muted></video>
        <canvas id="overlay"></canvas>
      </div>

      <div id="bars">
        <div class="bar".........完整代码请登录后点击上方下载按钮下载查看

网友评论0