守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1360|回复: 0
打印 上一主题 下一主题

AIR-OpenCV-Extension

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52695
    钢镚
    1422

    开源英雄守望者

    跳转到指定楼层
    楼主
    发表于 2014-12-29 13:58:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    应用下载
    应用名称: AIR-OpenCV-Extension
    支持64位:
    当前版本: 未知
    运行平台: Windows linux 
    开发语言: C++ 
    应用类别: ANE-C/C++
    应用简介: OpenCV的本机扩展
    OpenCV的本机扩展
    项目地址:https://github.com/wouterverweirder/AIR-OpenCV-Extension

    Copyright (c) 2012, Wouter VerweirderAll rights reserved.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


    This AIR Native Extension exposes HAAR cascade executions with OpenCV to Adobe AIR. It's implemented as an asynchronous library and uses a separate thread for the OpenCV execution. This way your AIR application doesn't lock up during the image processing.
    First of all, you’ll create an instance of the extension, add a detection listener and load a haar cascade xml file:
    1. ///
    2. openCV = new OpenCV();
    3. openCV.addEventListener(DetectionEvent.DETECTION_UPDATE, detectionUpdateHandler);
    4. openCV.loadCascade("/Users/wouter/haarcascades/haarcascade_frontalface_alt2.xml");
    5. ///
    复制代码

    You will also need to send bitmap data to the extension. In this example, I’m sending a bitmap snapshot of the webcam image to the extension, using the updateImage method. You can also set minimum & maximum sizes for the detection area’s, so area’s smaller then the mnimum size of larger then the maximum size are ignored. I recommend supplying a minimum size for the detection (for example: face must be at least 40×40 pixels), as this will improve performance of the application:
    1. ///
    2. bmpData.draw(video);
    3. openCV.updateImage(bmpData, minSize, maxSize);
    4. ///
    复制代码

    In the event handler, you’ll get the detected area’s with the event object that is provided:
    1. ///
    2. protected function detectionUpdateHandler(event:DetectionEvent):void
    3. {
    4.         for each(var r:Rectangle in event.rectangles)
    5.         {
    6.                 //draw rectangles here
    7.         }
    8. }
    9. ///
    复制代码





    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏1 分享分享 支持支持1 反对反对 微信
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-4-20 11:22 , Processed in 0.059952 second(s), 34 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表