JCV AR SDK(Effects)Windows開発マニュアル
  • 1.環境準備
  • 2.開発の事前準備
  • 3.OpenCLの利用
  • 4.SDK API の使用
  • 5.ファイルの説明
  • 6.画像の回転とミラーリング
Powered by GitBook
On this page
  • 5.1 st_mobile_common
  • 5.2 st_mobile_license
  • 5.3 st_mobile_human_action
  • 5.4 st_mobile_face_attribute
  • 5.5 st_mobile_beautify
  • 5.6 st_mobile_sticker
  • 5.7 st_mobile_filter
  • 5.8 st_mobile_object
  • 5.9 st_mobile_makeup
  • 5.10 st_mobile_animal
  • 5.11 st_mobile_body_beautify
  • 5.12 st_mobile_avatar
Export as PDF

5.ファイルの説明

一部重要なファイルの内容を説明します。

5.1 st_mobile_common

画像の形式やエラーコードなどを定義するファイルです。それに関するメソッドも含まれます。

//// @brief Blink動作の閾値設定。[0,1]の範囲内で設定可能であり,デフォルト設定値は0.5である 
ST_SDK_API void
st_mobile_set_eyeblink_threshold( 
    float threshold
);
/// @brief 口開ける動作の閾値設定。[0,1]の範囲内で設定可能であり,デフォルト設定値は0.5である
ST_SDK_API void
st_mobile_set_mouthah_threshold( 
    float threshold
);
/// @brief 頭振る動作の閾値設定。[0,1]の範囲内で設定可能であり,デフォルト設定値は0.5である
ST_SDK_API void
st_mobile_set_headyaw_threshold( 
    float threshold
);
/// @brief 頷く動作の閾値設定。[0,1]の範囲内で設定可能であり,デフォルト設定値は0.5である
ST_SDK_API void
st_mobile_set_headpitch_threshold( 
    float threshold
);
/// @brief 眉毛動く動作の閾値設定。[0,1]の範囲内で設定可能であり,デフォルト設定値は0.5である
ST_SDK_API void
st_mobile_set_browjump_threshold( 
    float threshold
);
/// @brief 顔識別のスムーズさを設定する。デフォルトは0.8である

ST_SDK_API void
st_mobile_set_smooth_threshold( 
    float threshold
);
/// @brief 顔識別の3D回転角度を設定する。デフォルトは0.8である

ST_SDK_API void
st_mobile_set_headpose_threshold( 
    float threshold
);
/// @brief SSE命令集のみ利用可能の設定 
ST_SDK_API void st_mobile_set_sse_only( 
    bool sse_only 
);

/// @brief 画像色の転換 
ST_SDK_API st_result_t
st_mobile_color_convert( 
    const unsigned char *image_src,
    unsigned char *image_dst,
    int image_width,
    int image_height,
    st_color_convert_type type
);

/// @brief 画像の回転
ST_SDK_API st_result_t st_mobile_image_rotate( 
    const unsigned char *image_src,
    unsigned char *image_dst,
    int image_width,
    int image_height,
    int image_stride,
    st_pixel_format pixel_format,
    st_rotate_type rotate_type
);

/// @brief st_mobileのカレントログレベルを設定

/// ST_LOG_DISABLEで設定した場合はログを禁止する

///
 @param[in] level ログレベルを設定する
///
 @return 正常の場合はST_OKで返す、異常の場合はエラーで返す


ST_SDK_API st_result_t
st_mobile_set_log_level(
    st_log_level_t level
);

/// @brief ログのレベルを取得する
/// @param[out] p_level カレントログレベルの結果

/// @return 正常の場合はST_OKで返す、異常の場合はエラーで返す

ST_SDK_API st_result_t
st_mobile_get_log_level(
    st_log_level_t* p_level
);

/// @brief ログパスを設定する 
/// @param[in] p_file_path ログファイルのパスを設定する
/// @param[in] b_tranc_file ファイル内容削除可否,true - 削除可,false - 削除不可 
/// @return 正常の場合はST_OKで返す、異常の場合はエラーで返す

ST_SDK_API st_result_t
st_mobile_redirect_log_to_file(
    const char* p_file_path, bool b_tranc_file
); 
/// @brief sdkバージョンを取得する
ST_SDK_API
const char* st_mobile_get_version(); 

5.2 st_mobile_license

ライセンス認証関連メソッドが含まれます。

/// @brief ライセンスファイルからアクティベーションコードを生成し、新しいライセンスファイルを使用する際に使用します。Androidでは、以下の使用を推奨しています。st_mobile_generate_activecode_from_buffer
ST_SDK_API 
st_result_t
st_mobile_generate_activecode( 
    const char* license_path,
    char* activation_code,
    int* activation_code_len
);

/// @brief アクティベーションコードを確認するためには、すべてのインターフェースの前に呼び出す必要があります。Androidにおすすめです。 
st_mobile_check_activecode_from_buffer
ST_SDK_API 
st_result_t
st_mobile_check_activecode( 
    const char* license_path,
    const char* activation_code,
    int activation_code_len
);

/// @brief ライセンスファイルキャッシュからアクティベーションコードを生成し、新しいライセンスファイルを使用する際に呼び出される 
ST_SDK_API st_result_t st_mobile_generate_activecode_from_buffer( 
    const char* license_buf,
    int license_size,
    char* activation_code,
    int* activation_code_len
);

/// @brief アクティベーションコードのチェック、すべてのインターフェースの前に呼び出される必要があります。 
ST_SDK_API st_result_t st_mobile_check_activecode_from_buffer( 
    const char* license_buf,
    int license_size,
    const char* activation_code,
    int activation_code_len
);

/// @brief ライセンスファイルからオンラインでアクティベーションコードを生成、オンラインライセンスとインターネットアクセスが必要です 
ST_SDK_API st_result_t st_mobile_generate_activecode_online( 
 		const char* license_path,
                  char* activation_code,
                  int* activation_code_len
  );
/// @brief ライセンスファイルバッファからオンラインでアクティベーションコードを生成、オンラインライセンスとインターネットアクセスが必要です。 
ST_SDK_API st_result_t st_mobile_generate_activecode_from_buffer_online( 
                      const char* license_buf,
                      int license_size,
                      char* activation_code,
                      int* activation_code_len
  );

5.3 st_mobile_human_action

st_mobile_human_actionのAPI関連設定が含まれます。

/// @brief 人間行動探知機のハンドルを作成する。Androidではst_mobile_human_action_create_from_buffer ST_SDK_API st_result_t
st_mobile_human_action_create(
    const char *model_path,
    unsigned int config,
    st_handle_t *handle
);
/// @brief サブモデルの追加 Androidではst_mobile_human_action_add_sub_model_from_buffer ST_SDK_API st_result_t
st_mobile_human_action_add_sub_model(
    st_handle_t handle,
    const char *model_path
);
/// @brief 人間行動探知機のハンドルを解除する ST_SDK_API
void st_mobile_human_action_destroy(
    st_handle_t handle
);
/// @brief 人体行動検知 ST_SDK_API st_result_t st_mobile_human_action_detect(
    st_handle_t handle,
    const unsigned char *image,
    st_pixel_format pixel_format,
    int image_width,
    int image_height,
    int image_stride,
    st_rotate_type orientation,
    unsigned long long detect_config,
    st_mobile_human_action_t *p_human_action
);
/// @brief Human_Actionの検出結果のミラーリング。フレーム間検出では、結果をコピーしてミラーリングします ST_SDK_API void
st_mobile_human_action_mirror(
    int image_width,
    st_mobile_human_action_t *p_human_action
    );
/// @brief human_actionの検出結果を回転させる。ST_SDK_API void st_mobile_human_action_rotate(
    int image_width,
    int image_height,
    st_rotate_type orientation,
    bool b_rotate_image,
    st_mobile_human_action_t* p_human_action
);

5.4 st_mobile_face_attribute

st_mobile_face_attributeのAPI関連設定が含まれます。

/// @brief 顔属性検出ハンドルの作成 ST_SDK_API st_result_t st_mobile_face_attribute_create(
    const char *model_path,
    st_handle_t *handle
);
/// @brief 初期化された顔属性検出ハンドルを破棄する ST_SDK_API void st_mobile_face_attribute_destroy(
    st_handle_t handle
);
ST_SDK_API st_result_t
st_mobile_face_attribute_detect_ext2(
st_handle_t handle,
const unsigned char *image,
st_pixel_format pixel_format,
int image_width,
int image_height,
int image_stride,
const st_mobile_face_t *p_face_array,
int face_count,
float** p_attribute_array
);

5.5 st_mobile_beautify

st_mobile_beautifyのAPI関連設定が含まれます。

/// @brief 美化ハンドル作成 ST_SDK_API st_result_t st_mobile_beautify_create(
    st_handle_t *handle
);
/// @brief 美化パラメータを設定、デフォルトですべての機能パラメータと強度パラメータが含まれている ST_SDK_API st_result_t st_mobile_beautify_setparam(
st_handle_t handle,
  st_beautify_type type,
    float value
);
/// @brief 画像バッファを美化するためには、OpenGL環境下で呼び出す必要があります。 ST_SDK_API st_result_t st_mobile_beautify_process_buffer(
    st_handle_t handle,
    const unsigned char *img_in, st_pixel_format fmt_in,
    int image_width, int image_height, int image_stride,
    st_rotate_type rotate,
    const st_mobile_human_action_t* p_human,
    unsigned char *img_out, st_pixel_format fmt_out,
    st_mobile_human_action_t* p_human_out
);
/// @brief このインターフェースは,OpenGL環境で関数を実行しないユーザーを対象としており,内部で環境を初期化し,速度が遅く,単一の画像にしか適していない ST_SDK_API st_result_t
st_mobile_beautify_process_picture(
    st_handle_t handle,
    const unsigned char *img_in, st_pixel_format fmt_in,
    int image_width, int image_height, int image_stride,
    st_rotate_type rotate,
    const st_mobile_human_action_t* p_human,
    unsigned char *img_out, st_pixel_format fmt_out,
    st_mobile_human_action_t* p_human_out
);
/// @brief OpenGLにおけるテクスチャの装飾 ST_SDK_API st_result_t st_mobile_beautify_process_texture(
    st_handle_t handle,
    unsigned int textureid_src,
    int image_width, int image_height,
    st_rotate_type rotate,
    const st_mobile_human_action_t* p_human,
    unsigned int textureid_dst,
    st_mobile_human_action_t* p_human_out
);
/// @brief OpenGLのテクスチャを美化し、出力テクスチャをバッファ出力に変換する ST_SDK_API st_result_t st_mobile_beautify_process_and_output_texture(
    st_handle_t handle,
    unsigned int textureid_src,
    int image_width, int image_height,
    st_rotate_type rotate,
    const st_mobile_human_action_t* p_human,
    unsigned int textureid_dst,
    unsigned char *img_out, st_pixel_format fmt_out,
    st_mobile_human_action_t* p_human_out
);
/// @brief 美化ハンドルを解除する。OpenGLスレッドで呼び出す必要があります ST_SDK_API void st_mobile_beautify_destroy(
    st_handle_t handle
);

5.6 st_mobile_sticker

st_mobile_stickerのAPI関連設定が含まれます。

/// @brief ステッカーハンドルを作成 ST_SDK_API st_result_t st_mobile_sticker_create(
    st_handle_t* handle
);
/// @brief パッケージの置き換え(既存パッケージの削除) ST_SDK_API st_result_t st_mobile_sticker_change_package(
    st_handle_t handle,
    const char* zip_path,
    int* package_id
);
/// @brief トリガーアクションの種類を取得します。 現在、表示する必要がある ST_SDK_API st_result_t st_mobile_sticker_get_trigger_action(
    st_handle_t handle,
    unsigned long long *action
);
/// @brief OpenGLESでのテクスチャのデカップリングとバッファリング、openglでの実行が必要、RGBAイメージのみサポート texture
ST_SDK_API st_result_t
st_mobile_sticker_process_and_output_texture(
    st_handle_t handle,
    unsigned int textureid_src, int image_width, int image_height,
    st_rotate_type rotate, st_rotate_type frontRotate, bool need_mirror,
    st_mobile_human_action_t* human_action,
    st_mobile_input_params_t* input_params,
    unsigned int textureid_dst,
    unsigned char* img_out, st_pixel_format fmt_out
);
/// @brief OpenGLスレッドで呼び出される必要がありますST_SDK_API void
st_mobile_sticker_destroy(
    st_handle_t handle
);

5.7 st_mobile_filter

st_mobile_filter(顔のフィルター)のAPI関連設定が含まれます。

/// cpu filter インターフェース /// @brief フィルタハンドルの作成 ST_SDK_API st_result_t st_mobile_filter_create( 
    st_handle_t *handle
);
/// @brief フィルタースタイルを設定する ST_SDK_API st_result_t 
st_mobile_filter_set_style(
    st_handle_t handle,
    const char* style_model_path
);
/// @brief フィルターパラメーターの設定 ST_SDK_API st_result_t st_mobile_filter_set_param( 
    st_handle_t handle,
    st_filter_type type,
    float value
);
/// @brief 画像のフィルタリング ST_SDK_API st_result_t st_mobile_filter_process( 
    st_handle_t handle,
    unsigned char *img_in, st_pixel_format fmt_in, int image_width, int image_height, int
image_stride,
    unsigned char *img_out, st_pixel_format fmt_out
);
/// @brief フィルターハンドルを離す ST_SDK_API void st_mobile_filter_destroy( 
    st_handle_t handle
);
/// gpu filter interface, glスレッドで実行する必要があります。

/// @brief OpenGLフィルタハンドルの作成 ST_SDK_API st_result_t st_mobile_gl_filter_create( st_handle_t *handle)
);

/// ST_SDK_API st_result_t st_mobile_gl_filter_set_style( st_handle_t handle.handle.handle)を呼び出す必要があります。

    const char* style_model_path
);

/// @brief フィルターパラメーターの設定 ST_SDK_API st_result_t st_mobile_gl_filter_set_param( st_handle_t handle.St_gl_filter_type type),
    st_gl_filter_type type,
    フロート値

); 

///  OpenGLでのテクスチャのフィルタリング、OpenGLスレッドで呼び出す必要がある ST_SDK_API st_result_t st_mobile_gl_filter_process_texture( 
    st_handle_t handle,
    unsigned int textureid_src,
    int image_width, int image_height,
    unsigned int textureid_dst
); /// @brief OpenGLでテクスチャにフィルタ処理を施し、バッフルを出力します。 OpenGLスレッドで呼び出す必要があります。
ST_SDK_API st_result_t
St_mobile_gl_filter_process_texture_and_output_buffer(
    st_handle_t handle,
    unsigned int textureid_src,
    int image_width, int image_height,
    unsigned int textureid_dst,
    unsigned char *img_out, st_pixel_format fmt_out
); /// @brief 画像バッファのフィルタリング、OpenGLスレッドで呼び出す必要があります。 ST_SDK_API st_result_t st_mobile_gl_filter_process_buffer( 
    st_handle_t handle,
    const unsigned char *img_in, st_pixel_format fmt_in, int image_width, int image_height,
int image_stride,
    unsigned char *img_out, st_pixel_format fmt_out
);
/// @brief OpenGLフィルターハンドルを解放するために、OpenGLスレッドでST_SDK_APIを呼び出す必要があります。 void st_mobile_gl_filter_destroy( ). 
    st_handle_t handle
);

5.8 st_mobile_object

st_mobile_object(物体識別)のAPI関連設定が含まれます。

/// @brief 汎用オブジェクト追跡ハンドルの作成 
ST_SDK_API 
st_result_t st_mobile_object_tracker_create(
    st_handle_t* handle
);
/// @brief 連続したビデオフレーム内のターゲットをリアルタイムで高速追跡します。 
ST_SDK_API st_result_t 
st_mobile_object_tracker_track(
    st_handle_t handle,
    const unsigned char *image,
    st_pixel_format pixel_format,
    int image_width,
    int image_height,
    int image_stride,
    st_rect_t *rects,
    float *score
);
/// @brief 初期化された汎用オブジェクトトラッキングハンドルを破棄する 
ST_SDK_API void 
st_mobile_object_tracker_destroy(
    st_handle_t handle
);

5.9 st_mobile_makeup

st_mobile_makeup(メークアップ)のAPI関連設定が含まれます。

/// @brief ビューティハンドル作成 ST_SDK_API st_result_t st_mobile_makeup_create( 
    st_handle_t* handle
);
/// @brief パッケージの置き換え(既存パッケージの削除) ST_SDK_API st_result_t st_mobile_makeup_set_makeup_for_type( 
    st_handle_t handle,
    st_makeup_type makeup_type,
    const char* zip_path,
    int* package_id
);
/// @brief OpenGLESでテクスチャのビューティー処理を行い、バッファに出力するには、opengl環境で実行する必要があり、RGBA画像フォーマットのみをサポートしています texture
ST_SDK_API st_result_t
st_mobile_makeup_process_and_output_texture( 
    st_handle_t handle,
    unsigned int textureid_src, int image_width, int image_height,
    st_rotate_type rotate,
    st_mobile_human_action_t* human_action,
    unsigned int textureid_dst,
    unsigned char* img_out, st_pixel_format fmt_out
);
/// @brief 指定した種類の美しさの強さを調整する ST_SDK_API void st_mobile_makeup_set_strength_for_type( 
    st_handle_t handle,
    st_makeup_type makeup_type,
    float value
);
/// @brief 指定された種類のピールの強度を調整します。 ST_SDK_API void st_mobile_makeup_set_smooth_strength( 
    st_handle_t handle,
    st_makeup_type makeup_type,
    float value
);
/// @brief 美のハンドルを解放する、OpenGLスレッドで呼び出されなければならない ST_SDK_API void
st_mobile_makeup_destroy( 
    st_handle_t handle
);

5.10 st_mobile_animal

st_mobile_animal(猫顔の識別)のAPI関連設定が含まれます。

/// @brief 猫の顔のキーポイントをリアルタイムで追跡するハンドルの作成 
ST_SDK_API 
st_result_t st_mobile_tracker_animal_face_create( 
  const char *model_path,
  unsigned int config,
  st_handle_t *handle
);
/// @brief 連続したビデオフレームに対するリアルタイム高速猫顔キーポイントトラッキング 
ST_SDK_API st_result_t 
st_mobile_tracker_animal_face_track( 
  st_handle_t handle, 
  const unsigned char *image,
  st_pixel_format pixel_format,
  int image_width,
  int image_height,
  int image_stride,
st_rotate_type orientation, 
  st_mobile_animal_face_t **p_faces_array, 
  int *p_faces_count

);

/// @brief 初期化された猫の顔追跡ハンドルを破棄する 
ST_SDK_API void st_mobile_tracker_animal_face_destroy( 
  st_handle_t handle

); 

5.11 st_mobile_body_beautify

st_mobile_body_beautify(体型の美化)のAPI関連設定が含まれます。

/// @brief 本体ハンドルを作成します。Androidでは
st_mobile_body_beautify_create_from_buffer 
ST_SDK_API st_result_t
st_mobile_body_beautify_create( 
    st_handle_t *handle,
    unsigned int config,
    const char *model_path
);
/// @brief 既存のボディハンドルからボディハンドルを作成する 
ST_SDK_API st_result_t 
st_mobile_body_beautify_create_from_handle( 
    st_handle_t *handle,
    st_handle_t handle_src,
    unsigned int config
);
/// @brief 画像バッファは綺麗に処理されているので、OpenGL環境で呼び出す必要があります。
ST_SDK_API st_result_t 
st_mobile_body_beautify_process_buffer( 
    st_handle_t handle,
    const unsigned char *image_in,
    st_pixel_format format_in,
    int image_width,
    int image_height,
    int image_stride,
    st_rotate_type rotate,
    st_rect_t* process_region,
    unsigned char *image_out,
    st_pixel_format format_out,
  st_body_beautify_result *p_result
);
/// @brief OpenGLテクスチャに対して美的処理を行うには、OpenGL環境内から呼び出す必要があります。image_in と texture_src の画像は同じである必要があります。 
ST_SDK_API st_result_t
st_mobile_body_beautify_process_texture( 
    st_handle_t handle,
    unsigned int texture_src,
    const unsigned char *image_in,
    st_pixel_format format_in,
    int image_width,
    int image_height,
    int image_stride,
    st_rotate_type rotate,
    st_rect_t* process_region,
    unsigned int texture_dst,
    unsigned char *image_out,
    st_pixel_format format_out,
    st_body_beautify_result *p_result
);

/// @brief ボディワークのパラメータを設定する
ST_SDK_API st_result_t 
st_mobile_body_beautify_set_param( 
    st_handle_t handle,
    st_body_beautify_param_type type,
    float value
);

/// @brief US本体のハンドルを離す。呼び出されない場合st_mobile_body_beautify_gl_release, OpenGLスレッドで呼び出される必要がある 
ST_SDK_API void
st_mobile_body_beautify_destroy( 
    st_handle_t handle
);

5.12 st_mobile_avatar

st_mobile_avatar(アバターの設定)のAPI関連設定が含まれます。

/// @brief アバターハンドルの作成、ノンスレッドセーフ 
ST_SDK_API st_result_t st_mobile_avatar_create( 
    st_handle_t *p_handle,
    const char* p_model_file_path
);
/// @brief アバターハンドルの破壊、非スレッドセーフ 
ST_SDK_API void st_mobile_avatar_destroy( 
    st_handle_t handle
);
/// @brief Avatarに必要な検出設定を取得する(非スレッドセーフ)
ST_SDK_API unsigned long long st_mobile_avatar_get_detect_config( 
    st_handle_t handle
);
/// @brief 入力されたキーポイントに Avatar の表現係数を当てはめた結果を取得します(ノンスレッドセーフ) 
ST_SDK_API st_result_t
st_mobile_avatar_get_expression(
    st_handle_t handle,
    int width, int height,
    st_rotate_type rotate,
    const st_mobile_face_t* p_face,
    float* p_expression_array
); 
Previous4.SDK API の使用Next6.画像の回転とミラーリング

Last updated 2 years ago