玩瞳文档中心


指读

<h3>概述</h3> <p>该文档是<strong>指读识别</strong>接口,主要用于接收<strong>手指识别结果</strong>通知,开发者需要实现指定的方法函数,并注册该方法实例到sdk内部。 通过该函数方法可用于扩展实现其它功能,例如:表情灯显示表情,播放语音,音效。</p> <h3>注意:</h3> <p><strong><em>我们的通知回调不能处理太多业务,否则会造成识别线程阻塞</em></strong></p> <hr /> <h4>1. 函数定义</h4> <p>该接口实例会被绘本sdk内部调用,用于将手指识别结果通知给sdk外部的应用, 通过此接口,可以获取识别到的手指相对图像的坐标、手指相对书本的坐标、点中热区及扩展数据。</p> <ul> <li><strong>函数原型:</strong></li> </ul> <pre><code>typedef int (*vtFingerStateCb)(vtFingerData_t &amp;data, void *userp);</code></pre> <ul> <li><strong>参数:</strong></li> </ul> <table> <thead> <tr> <th>参数</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>data</td> <td>vtFingerData_t &amp;</td> <td>手指识别结果的信息</td> </tr> <tr> <td>userp</td> <td>void *</td> <td>用户参数,可扩展功能使用</td> </tr> </tbody> </table> <ul> <li><strong>返回值:</strong> int</li> </ul> <table> <thead> <tr> <th>返回值</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>-</td> <td>int</td> <td>返回值,默认0</td> </tr> </tbody> </table> <ul> <li><strong>数据结构定义:</strong></li> </ul> <p>``` c++ typedef struct tag_vtFingerData_s { /<em>手指相对图像X坐标</em>/ int finger_img_x; /<em>手指相对图像Y坐标</em>/ int finger_img_y; /<em>手指相对书本X坐标</em>/ int finger_bk_x; /<em>手指相对书本Y坐标</em>/ int finger_bk_y; /<em>热区index</em>/ int hot_index; /<em>扩展数据</em>/ std::string extraData; /<em>热区名字</em>/ std::string positionName; } vtFingerData_t;</p> <pre><code> #### 2. 更新状态 该接口实例会被绘本sdk内部调用,用于将识别结果通知给sdk外部的应用, 通过此接口,可以获取识别到的书本信息、书页信息及翻书状态。 - **接口原型:** </code></pre> <p>void onUpdateStatus(int RecogStatus, RecogInfo info);;</p> <pre><code>- **参数:** | 参数 | 类型 | 说明 | | ------------ | ------------ | ---- | | RecogStatus | int | 翻书状态值 | | info | RecogInfo | 书本及书页信息 | - **返回值:** 无 | 返回值 | 类型 | 说明 | | ------------ | ------------ | ----- | | - | - | - | #### 3. 注册函数实例 该接口将**vtFingerStateCb**函数实例注册到sdk内部 - **接口原型:** ``` c++ int registerFingerStateCb(vtFingerStateCb stateCb, int mode, void *userp); </code></pre> <ul> <li><strong>参数:</strong></li> </ul> <table> <thead> <tr> <th>参数</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>data</td> <td>vtFingerStateCb</td> <td>手指识别结果的信息</td> </tr> <tr> <td>mode</td> <td>int</td> <td>1:回调的同时也播放顽瞳点读热区资源 0:仅回调不播放</td> </tr> <tr> <td>userp</td> <td>void *</td> <td>用户参数,可扩展功能使用</td> </tr> </tbody> </table> <ul> <li><strong>返回值:</strong> int</li> </ul> <table> <thead> <tr> <th>返回值</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td>-</td> <td>int</td> <td>返回值,默认0</td> </tr> </tbody> </table> <ul> <li><strong>例程:</strong> </li> </ul> <p>``` c++ int FingerCallback(vtFingerData_t &amp;data, void *userp) { printf(&quot;\nimgx:%d, imgy:%d; bookx:%d, booky:%d\n&quot;, data.finger_img_x, data.finger_img_y, data.finger_bk_x, data.finger_bk_y);</p> <h1>ifdef USE_QT</h1> <pre><code>g_points_canvas-&gt;move(data.finger_img_x - 5, data.finger_img_y - 30); g_points_canvas-&gt;update();</code></pre> <h1>endif</h1> <pre><code>return 0;</code></pre> <p>}</p> <p>storybk-&gt;registerFingerStateCb(FingerCallback, 1, NULL);</p> <pre><code></code></pre>

页面列表

ITEM_HTML