You need to enable JavaScript to run this app.
导航

运动健身

最近更新时间2022.02.25 17:16:51

首次发布时间2022.02.25 17:16:51

C接口

函数列表

1. 创建动作识别的句柄

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_create(
	const char * model_path
	bef_effect_handle_t * handle
	);

参数说明

参数名参数类型参数说明
model_pathconst char *模型文件路径
handlebef_effect_handle_t *Created action_recognition handle 创建的动作识别句柄

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

2. 销毁动作识别句柄

函数定义

BEF_SDK_API void
bef_effect_ai_action_recognition_destroy(
	bef_effect_handle_t handle
	);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_tDestroy the created action_recognition handle 销毁创建的动作识别句柄

返回值: BEF_SDK_API void

3. 设置动作识别模板

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_set_template(
	bef_effect_handle_t handle
	const char * template_path
	);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_tCreated action_recognition handle 已创建的动作识别句柄
template_pathconst char *模板文件路径

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

4. 动作识别开始姿态检测

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_start_pose_detect(
	bef_effect_handle_t handle
	const unsigned char * image
	bef_ai_pixel_format pixel_format
	int image_width
	int image_height
	int image_stride
	bef_ai_rotate_type orientation
	bef_ai_action_recognition_start_pose_type type
	bef_ai_action_recognition_start_pose_result * result
	);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_tCreated action_recognition handle 已创建的骨骼句柄
imageconst unsigned char *Image base address 输入图片的数据指针
pixel_formatbef_ai_pixel_formatPixel format of input image 输入图片的格式
image_widthintImage width 输入图像的宽度 (以像素为单位)
image_heightintImage height 输入图像的高度 (以像素为单位)
image_strideintImage stride in each row 输入图像每一行的步长 (以像素为单位)
orientationbef_ai_rotate_typeImage orientation 输入图像的转向,具体请参考 bef_effect_ai_public_define.h 中的 bef_rotate_type
typebef_ai_action_recognition_start_pose_typepose type 姿势类型
resultbef_ai_action_recognition_start_pose_result *result

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

5. 动作识别计数

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_count(
	bef_effect_handle_t handle
	const unsigned char * image
	bef_ai_pixel_format pixel_format
	int image_width
	int image_height
	int image_stride
	bef_ai_rotate_type orientation
	int confirm_time
	bef_ai_action_recognition_result * action_recognition_result
	);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_tCreated action_recognition handle 已创建的骨骼句柄
imageconst unsigned char *Image base address 输入图片的数据指针
pixel_formatbef_ai_pixel_formatPixel format of input image 输入图片的格式
image_widthintImage width 输入图像的宽度 (以像素为单位)
image_heightintImage height 输入图像的高度 (以像素为单位)
image_strideintImage stride in each row 输入图像每一行的步长 (以像素为单位)
orientationbef_ai_rotate_typeImage orientation 输入图像的转向,具体请参考 bef_effect_ai_public_define.h 中的 bef_rotate_type
confirm_timeintcount confirmation time 计数确认时长
action_recognition_resultbef_ai_action_recognition_result *不可为nullptr

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

6. Android 人体关键点授权

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_check_license(
	JNIEnv * env
	jobject context
	bef_effect_handle_t handle
	const char * licensePath
	);

参数说明

参数名参数类型参数说明
envJNIEnv *JNIEnv 环境
contextjobjectAndroid Context 对象
handlebef_effect_handle_tCreated action_recognition handle 已创建的动作识别句柄
licensePathconst char *licensePath

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 授权码非法返回 BEF_RESULT_INVALID_LICENSE ,其它失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

7. iOS 人体关键点授权

函数定义

BEF_SDK_API bef_effect_result_t
bef_effect_ai_action_recognition_check_license(
	bef_effect_handle_t handle
	const char * licensePath
	);

参数说明

参数名参数类型参数说明
handlebef_effect_handle_tCreated action_recognition handle 已创建的动作识别句柄
licensePathconst char *licensePath

返回值: BEF_SDK_API bef_effect_result_t

成功返回 BEF_RESULT_SUC, 授权码非法返回 BEF_RESULT_INVALID_LICENSE ,其它失败返回相应错误码, 具体请参考 bef_effect_ai_public_define.h

结构体

1. bef_ai_action_recognition_result

动作计数结果信息

参数名参数类型参数说明
keypointsbef_ai_tt_key_point[BEF_AI_ACTION_RECOGNITION_MAX_POINT_NUM]检测到的骨骼信息
feed_body_partbef_ai_action_recognition_feedback_body_part反馈的身体部位类别
feedback_keypointsbef_ai_tt_key_point[BEF_AI_ACTION_RECOGNITION_MAX_POINT_NUM *2]检测到的反馈骨骼信息
feedback_kp_countint检测到的反馈骨骼信息数量,feedback_keypoints的实际长度
recognize_succeedbool是否计数成功,为true时,表示计数成功,界面可以增加计数
is_feedback_validbool反馈信息是否有效,为true时,表示信息有效,界面可以显示反馈信息

2. bef_ai_action_recognition_start_pose_result

初始姿态检测结果信息

参数名参数类型参数说明
is_detectedbool是否通过初始姿态检测,为true时,表示通过检测,可以开始计数

枚举类型

1. bef_ai_action_recognition_feedback_body_part

反馈的身体部位类别

参数名参数说明
BEF_AI_ACTION_RECOGNITION_FeedbackNone
BEF_AI_ACTION_RECOGNITION_FeedbackLeftArm左臂
BEF_AI_ACTION_RECOGNITION_FeedbackRightArm右臂
BEF_AI_ACTION_RECOGNITION_FeedbackLeftLeg左腿
BEF_AI_ACTION_RECOGNITION_FeedbackRightLeg右腿

2. bef_ai_action_recognition_start_pose_type

初始姿态类别

参数名参数说明
BEF_AI_ACTION_RECOGNITION_Stand站立
BEF_AI_ACTION_RECOGNITION_Lying平躺
BEF_AI_ACTION_RECOGNITION_Sitting坐姿

宏定义

参数名参数值参数说明
BEF_AI_ACTION_RECOGNITION_MAX_POINT_NUM18最大骨骼点数量
Java接口

com.bytedance.labcv.effectsdk.ActionRecognition

动作计数 API 类

1. 初始化算法

函数定义

int
init(
	Context context
	String modelPath
	String licensePath
	);

参数说明

参数名参数类型参数说明
contextContextAndroid Context 对象
modelPathString模型文件路径
licensePathString授权文件路径

返回值: int

2. 设置动作识别模版

函数定义

int
setTemplate(
	String templatePath
	);

参数说明

参数名参数类型参数说明
templatePathString模版文件路径

返回值: int

3. 动作识别开始姿态检测

函数定义

BefActionRecognitionInfo.PoseDetectResult
detectPose(
	ByteBuffer buffer
	BytedEffectConstants.PixlFormat pixelFormat
	int width
	int height
	int stride
	BefActionRecognitionInfo.ActionRecognitionPoseType poseType
	BytedEffectConstants.Rotation orientation
	);

参数说明

参数名参数类型参数说明
bufferByteBuffer图片数据
pixelFormatBytedEffectConstants.PixlFormat图片格式
widthint
heightint
strideint步长
poseTypeBefActionRecognitionInfo.ActionRecognitionPoseType姿态类型
orientationBytedEffectConstants.Rotation图像旋转方向,具体见 Rotation

返回值: BefActionRecognitionInfo.PoseDetectResult

姿态检测结果,具体见 PoseDetectResult

4. 动作识别计数

函数定义

BefActionRecognitionInfo
detect(
	ByteBuffer buffer
	BytedEffectConstants.PixlFormat pixelFormat
	int width
	int height
	int stride
	BytedEffectConstants.Rotation orientation
	int confirmTime
	);

参数说明

参数名参数类型参数说明
bufferByteBuffer图片数据
pixelFormatBytedEffectConstants.PixlFormat图片格式
widthint
heightint
strideint步长
orientationBytedEffectConstants.Rotation图像旋转方向,具体见 Rotation
confirmTimeint计数确认时长

返回值: BefActionRecognitionInfo

动作计数结果,具体见 BefActionRecognitionInfo

5. 销毁算法

函数定义

void
destroy(
	);

返回值: void

com.bytedance.labcv.effectsdk.BefActionRecognitionInfo

动作计数检测结果

参数名参数类型参数说明
keyPointsBefPublicDefine.BefKeyPoint[]检测到的骨骼信息
feedbackPartint反馈的身体部位类别
feedbackKeyPointsBefPublicDefine.BefKeyPoint[]检测到的反馈骨骼信息
recognizeSucceedboolean是否计数成功,为true时,表示计数成功,界面可以增加计数
isFeedbackValidboolean反馈信息是否有效,为true时,表示信息有效,界面可以显示反馈信息

com.bytedance.labcv.effectsdk.BefActionRecognitionInfo.PoseDetectResult

初始姿态检测结果信息

参数名参数类型参数说明
isDetectedboolean是否通过初始姿态检测,为true时,表示通过检测,可以开始计数

com.bytedance.labcv.effectsdk.BefActionRecognitionInfo

动作计数检测结果

参数名参数类型参数说明
keyPointsBefPublicDefine.BefKeyPoint[]检测到的骨骼信息
feedbackPartint反馈的身体部位类别
feedbackKeyPointsBefPublicDefine.BefKeyPoint[]检测到的反馈骨骼信息
recognizeSucceedboolean是否计数成功,为true时,表示计数成功,界面可以增加计数
isFeedbackValidboolean反馈信息是否有效,为true时,表示信息有效,界面可以显示反馈信息