FastCV主要接口分析之二

来源:互联网 发布:delphi算法与数据结构 编辑:程序博客网 时间:2024/05/15 23:46

FastCV主要接口分析之二

    FastCV为计算机视觉(CV,computer vision)的应用开发者提供了两个主要功能:提供CV常用的函数库,其已经进行了优化且可以高效的运行在移动设备上;提供干净的processor-agnostic硬件加速API,基于此芯片厂商能够在其硬件上进行硬件加速FastCV函数。最新版本FastCV1.5.0支持安卓和Windows移动开发,可以从高通网站developer.qualcomm.com上免费下载,其采用二进制文件统一发布,包含两种库的实现:一种运行在ARM处理器上被称为“FastCV for ARM”,一种运行在高通Snapdragon芯片上被称为“FastCV for Snapdragon”。

    FastCV提供的接口函数(fastcv.h文件中)部分如下:

    1.基本函数

       FASTCV_API void fcvGetVersion( char* version, unsigned int versionLength ); 获取版本信息

       FASTCV_API int fcvSetOperationMode( fcvOperationMode mode ); 选择硬件运行单元实例

       FASTCV_API void fcvCleanUp( void ); 清理资源,程序退出前必须调用

    2.内存管理函数

       FASTCV_API int fcvPyramidAllocate( fcvPyramidLevel* pyr,
                    unsigned int     baseWidth,
                    unsigned int     baseHeight,
                    unsigned int     bytesPerPixel,
                    unsigned int     numLevels,
                    int              allocateBase ); 为pyramid分配内存

       FASTCV_API void fcvPyramidDelete( fcvPyramidLevel* pyr,
                   unsigned int     numLevels,
                   unsigned int     startLevel ); 为pyramid重新分配内存

       FASTCV_API void* fcvMemAlloc( unsigned int nBytes,
                   unsigned int byteAlignment );分配对齐后的内存

       FASTCV_API void fcvMemFree( void* ptr ); 释放分配的内存
       FASTCV_API void fcvMemInit(void); 初始化FastCV的内存子系统

    3.模糊化图像函数

       FASTCV_API void fcvFilterMedian_xxx( const uint8_t* __restrict srcImg,
                    unsigned int              srcWidth,
                    unsigned int              srcHeight,
                    uint8_t* __restrict       dstImg ); 基于中值滤波器模糊化图像
       FASTCV_API void fcvFilterGaussian_xxx( const uint8_t* __restrict src,
                    unsigned int              srcWidth,
                    unsigned int              srcHeight,
                    uint8_t* __restrict       dst,
                    int                       blurBorder );基于高斯滤波器模糊化图像

    4.色彩转换函数

      FASTCV_API void fcvColorYUVxxxtoRGBxxx( const uint8_t* __restrict src,
                     unsigned int              srcWidth,
                     unsigned int              srcHeight,
                     uint32_t* __restrict      dst );  转换YUV到RGB格式.

      FASTCV_API void fcvColorRGBxxxtoYUVxxx( const uint8_t* __restrict src,
                     unsigned int              srcWidth,
                     unsigned int              srcHeight,
                     uint8_t* __restrict       dst ); 转换GRB到YUV格式

    未完待续。

1 0