资讯 社区 文档
技术能力
语音技术
文字识别
人脸与人体
图像技术
语言与知识
视频技术

物体识别

此类封装lua Logo识别接口

Public methods
function logo_callBack(string logo_status)
logo识别状态回调
Logo LogoDemo()
demo.
Logo start_recg (int code)
开启logo识别
Logo stop_recg (int code)
关闭logo识别

LogoDemo()

demo示例

sample:
app.on_loading_finish=function()
   Logo.start_recg(0)
end
Logo.callBack = function(data)
  local logo_status = data['logo_code']
  if(logo_status ~= nil) then
     if(logo_status == MSG_TYPE_LOGO_START) then

     end
     if(logo_status == MSG_TYPE_LOGO_HIT)then
       matchResult(str)
     end
     if(logo_status == MSG_TYPE_LOGO_STOP)then
        
     end
  end
end
function matchResult(str)
   if(str=='baidu')then
    scene.bear:set_visible(true)
    scene.bear:pod_anim()
              :anim_repeat(true)
              :start() 
    Logo.stop_recg(2)
end

start_recg

version 140

static start_recg (int code)

开启logo识别

Parameters

  • code | int : 预留字段

Returns

  • static | self
sample:
Logo.start_recg(0)

stop_recg

version 140

static stop_recg (int code)

关闭logo识别

Parameters

  • code | int : 预留字段

Returns

  • static | self
sample:
Logo.stop_recg(0)

logo_callBack

version 140

static logo_callBack(string logo_status)

logo识别状态回调

Parameters

  • logo_status | string : 当前logo识别状态,包含:MSG_TYPE_LOGO_START(开始识别),MSG_TYPE_LOGO_HIT(识别命中),MSG_TYPE_LOGO_STOP(停止识别)。

Returns

  • static | self
sample:
Logo.callBack = function(data)
    local logo_status = data['logo_code']
    if(logo_status ~= nil) then
        if(logo_status == MSG_TYPE_LOGO_START) then

        end
        if(logo_status == MSG_TYPE_LOGO_HIT)then

        end
        if(logo_status == MSG_TYPE_LOGO_STOP)then

        end
    end
end

PaddleGesture

此类封装paddle手势相关操作

Public methods
void on_gesture_detected(MapData mapData)
开启手势能力后,接收手势检测结果的信息。
void send_control_msg(int open)
控制手势能力的开启和关闭。

on_gesture_detected

version 24

void on_gesture_detected (MapData mapData)

开启手势能力后,接收手势检测结果的信息

Parameters

  • mapData | MapData : 手势检测结果,MapData类型。 包含gesture_count字段,number类型,表示结果个数n; 另含n个gesture_result字段,如gesture_result1,gesture_result2...; gesture_result也为MapData类型,包含7个浮点类型的字段: reserved 为预留字段,现在恒为0.0; type 表示手势类型,只有5个固定值,1.0为point一个手指(GestureType.Point),2.0为palm手掌(GestureType.Palm),3.0为fist拳头(GestureType.Fist),4.0为ok手势(GestureType.OK),5.0为其他类型(GestureType.Other); score 表示手势得分,取值从0.0-1.0,值越接近1手势越有效; x1 表示手势轮廓框左上角点横坐标在屏幕上的占比,取值从0.0-1.0,1为百分百; y1 表示手势轮廓框左上角点纵坐标在屏幕上的占比,取值从0.0-1.0,1为百分百; x2 表示手势轮廓框右下角点横坐标在屏幕上的占比,取值从0.0-1.0,1为百分百; y2 表示手势轮廓框右下角点纵坐标在屏幕上的占比,取值从0.0-1.0,1为百分百。
sample:
PaddleGesture.on_gesture_detected = function (mapData)
    count = mapData['gesture_count']
    resultMap = mapData['gesture_result1']
    result = resultMap['type']
    result = resultMap['type']
    type = resultMap['type']
    score = resultMap['score']
    x1 = resultMap['x1']
    y1 = resultMap['y1']
    x2 = resultMap['x2']
    y2 = resultMap['y2']
end

send_control_msg

version 24

void send_control_msg (int open)

控制手势能力的开启和关闭

Parameters

  • open | int:控制信息,0 关闭,1 开启
sample:
PaddleGesture:send_control_msg(1)
上一篇
基础
下一篇
相机控制