虎牙开放平台文档

hyExt.reg.onHumanSkeletonDetection

  • 监听当前直播间肢体骨骼点检测消息
  • 双面镜、两屏、三屏的时候提示接口不支持
  • 开启左右翻转后点的下标和识别部位的对应关系会发生变化
  • 引入版本 1.8.0
  • 适用终端
    • 虎牙直播助手-iOS:未实现
    • 虎牙直播助手-安卓:未实现
    • 虎牙直播PC客户端-主播侧:4.20.0.0

接口签名

declare namespace hyExt { module reg { /** * 监听当前直播间肢体骨骼点检测消息 * @param param 输入参数 */ function onHumanSkeletonDetection( param: HumanSkeletonDetectionReq ): Promise<void> } /** * 骨骼识别消息 */ type HumanSkeletonDetectionReq = { /** * 骨骼识别回调 */ callback: SkeletonCallback } /** * 骨骼识别回调 * @param recognition 骨骼识别消息 */ type SkeletonCallback = (recognition: SkeletonInfo) => void /** * 骨骼识别消息 */ type SkeletonInfo = { /** * 画布信息 */ canvas: CanvasInfo /** * 骨骼点 */ keypoints: KeypointInfo[] } /** * 画布信息 */ type CanvasInfo = { /** * 画布宽度 */ width: number /** * 画布高度 */ height: number } /** * 骨骼点信息 */ type KeypointInfo = { /** * 横坐标(值域 [0, 画布宽],单位是像素) */ x: number /** * 纵坐标(值域 [0, 画布宽],单位是像素) */ y: number /** * 置信度(值越高表示识别得越准确) */ score: number /** * 骨骼点的标识;取值说明: * "0" NOSE; * "1" LEFT_EYE; * "2" RIGHT_EYE; * "3" LEFT_EAR; * "4" RIGHT_EAR; * "5" LEFT_SHOULDER; * "6" RIGHT_SHOULDER; * "7" LEFT_ELBOW; * "8" RIGHT_ELBOW; * "9" LEFT_WRIST; * "10" RIGHT_WRIST; * "11" LEFT_HIP; * "12" RIGHT_HIP; * "13" LEFT_KNEE; * "14" RIGHT_KNEE; * "15" LEFT_ANKLE; * "16" RIGHT_ANKLE; * "17" LEFT_HAND; * "18" RIGHT_HAN; */ id: string } }

示例代码

hyExt.reg .onHumanSkeletonDetection({ callback: (recognition) => { const { canvas, keypoints } = recognition console.log("回调触发", recognition) }, }) .then(() => { console.log("调用hyExt.reg.onHumanSkeletonDetection成功") }) .catch((err) => { console.log("调用hyExt.reg.onHumanSkeletonDetection失败", err) })