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格式
未完待續。