IVE API 参考
前言
本文档为使用媒体处理芯片的IVE协处理器进行_识别_分析方案开发的程序员而写,目的是供您在开发过程中查阅IVE协处理器支持的各种参考信息,包括API、头文件、错误码、Proc信息等。
说明:
本文未有特殊说明,Hi3516DV500与Hi3519DV500内容完全一致。
与本文档相对应的产品版本如下。
本文档(本指南)主要适用于以下工程师:
- 技术支持工程师
- 软件开发工程师
概述
概述
IVE是媒体处理芯片_识别_分析系统中的硬件加速模块。用户基于IVE开发_识别_分析方案可以加速_识别_分析,降低CPU占用。当前IVE提供的算子可以支撑开发视频诊断、周界防范等_识别_分析方案。
PC端运行环境说明如表 表1所示。
表 1 IVE PC端编译环境
功能描述
重要概念
-
句柄(handle)
用户在调用算子创建任务时,系统会为每个任务分配一个handle,用于标识不同的任务。
-
及时返回结果标志is_instant
用户在创建某个任务后,希望及时得到该任务完成的信息,则需要在创建该任务时,将is_instant设置为TD_TRUE。否则,如果用户不关心该任务是否完成,建议将is_instant设置为TD_FALSE,这样可以与后续任务组链执行,减少中断次数,提升性能。
-
查询(query)
用户根据系统返回的handle,调用ss_mpi_ive_query可以查询对应算子任务是否完成。
-
及时刷cache
IVE硬件只能从DDR中获取数据。如果用户在调用IVE任务时,访问空间可cache而且CPU曾经访问,为了保证IVE输入输出数据不被CPU cache干扰,此时用户需要调用ss_mpi_sys_mmz_flush_cache接口刷cache(详细信息请参见《MPP 媒体处理软件Vx.y 开发参考》),将数据从cache刷到DDR,以供IVE使用。
-
跨度(stride):与图像或二维数据的width度量一致的量,如图1所示。
- ot_svp_img图像数据跨度,表示图像一行以“像素”计算的单元个数,“像素”位宽可以是8bit,16bit等。
- ot_svp_data二维数据跨度,表示二维数据一行的字节数,即为图1中n=8的情况。
可以将ot_svp_data看成一个“像素”用8bit表示的图像,那么跨度即统一表述为图像或二维数据的一行以“像素”计算的单元个数。

-
对齐
硬件为了快速访问内存首地址或者跨行访问数据,要求内存地址或内存跨度必须为对齐系数的倍数。
-
数据内存首地址对齐
当前IVE算子对其输入输出有要求1byte对齐、2byte对齐以及16byte对齐的,具体见各算子API参考中的参数要求。
-
跨度对齐
对于二维广义图像、二维单分量数据以及一维数组数据的跨度均必须满足16“像素”对齐。
-
须知:
在使用DDR4时,为提高访存效率,建议首地址使用256字节对齐,stride使用256“像素”的奇数倍对齐。如果是使用64位操作系统,需要使用到的MMZ地址必须是在一个4GB空间内,否则会出现异常。
-
输入、输出数据类型(具体结构定义请参见“数据类型和数据结构”)
-
二维广义图像数据
ot_svp_img、ot_svp_src_img、ot_svp_dst_img,图像的类型参考ot_svp_img_type,具体的内存分配如Figur 2~图10所示。
注意:当前所有算子输入输出的二维广义图像数据的高宽均需为偶数。
-
二维单分量数据
ot_svp_data,以byte为单位的二维数据,主要用于dma等,其内存如图11所示;根据类型ot_svp_img可以转化为单个或多个ot_svp_data。
-
一维数据
ot_svp_mem_info、ot_svp_src_mem_info、ot_svp_dst_mem_info,表示一维数据,如hist的统计数据、gmm的模型数据、lk_optical_flow的角点输入等;其内存如图12所示。
-
-
二维广义图像类型
表 1 二维广义图像类型表1
8bit无符号单通道图像,如Figur 2所示 |
|||
8bit有符号单通道图像,如图2所示 |
|||
YCbCr420 SemiPlannar数据格式图像,如图3所示 |
内存地址仅用到ot_svp_img中的phys_addr[0]、virt_addr[0](亮度Y)和phys_addr[1]、virt_addr[1](色度,VU间隔排列);亮度和色度内存可以不连续,但不推荐 |
||
YcbCr422 SemiPlannar数据格式图像,如Figur 4所示 |
内存地址仅用到ot_svp_img中的phys_addr[0]、virt_addr[0](亮度Y)和phys_addr[1]、virt_addr[1](色度,VU间隔存储);亮度和色度内存可以不连续,但不推荐 |
||
YCbCr420 Planar数据格式图像,如图5所示 |
内存地址用到ot_svp_img中的phys_addr[0]、virt_addr[0](亮度Y),phys_addr[1]、virt_addr[1](色度U)和phys_addr[2]、virt_addr[2](色度V);Y、U、V内存可不连续,但不推荐 |
||
YCbCr422 Planar数据格式图像,如图6所示 |
内存地址用到ot_svp_img中的phys_addr[0]、virt_addr[0](亮度Y),phys_addr[1]、virt_addr[1](色度U)和phys_addr[2]、virt_addr[2](色度V) |
||
8bit有符号双通道且以Package格式存储的图像,如Figur 7所示 |
|||
8bit有符号双通道且以Planar格式存储的图像,如Figur 8所示 |
内存地址仅用到ot_svp_img中的phys_addr[0]、virt_addr[0]和phys_addr[1]、virt_addr[1] |
||
16bit有符号单通道图像,如Figur 2所示 |
|||
16bit无符号单通道图像,如Figur 2所示 |
|||
8bit无符号三通道且以Package格式存储的图像,如Figure 9所示 |
|||
8bit无符号三通道且以Planar格式存储的图像,如Figure 10所示; |
内存地址用到了ot_svp_img中的phys_addr[0]、virt_addr[0],phys_addr[1]、virt_addr[1]和phys_addr[2]、virt_addr[2]; |
||
32bit有符号单通道图像,如Figur 2所示; |
|||
32bit无符号单通道图像,如Figur 2所示; |
|||
64bit有符号单通道图像,如Figur 2所示; |
|||
64bit无符号单通道图像,如Figur 2所示。 |
- 特殊输出数据类型
图 2 OT_SVP_IMG_TYPE_U8C1 \ OT_SVP_IMG_TYPE_S8C1 \ OT_SVP_IMG_TYPE_S16C1 \ OT_SVP_IMG_TYPE_U16C1 \ OT_SVP_IMG_TYPE_S32C1 \ OT_SVP_IMG_TYPE_U32C1 \ OT_SVP_IMG_TYPE_S64C1 \ OT_SVP_IMG_TYPE_U64C1 类型的ot_svp_img图像

图 3 OT_SVP_IMG_TYPE_YUV420SP类型的ot_svp_img图像

注:格式与ot_pixel_format的OT_PIXEL_FORMAT_YVU_SEMIPLANAR_420对应。
图 4 OT_SVP_IMG_TYPE_YUV422SP类型的ot_svp_img图像

注:格式与ot_pixel_format的OT_PIXEL_FORMAT_YVU_SEMIPLANAR_422对应。
图 5 OT_SVP_IMG_TYPE_YUV420P类型的ot_svp_img图像

图 6 OT_SVP_IMG_TYPE_YUV422P类型的ot_svp_img图像

图 7 OT_SVP_IMG_TYPE_S8C2_PACKAGE类型的ot_svp_img图像

图 8 OT_SVP_IMG_TYPE_S8C2_PLANAR类型的ot_svp_img图像

图 9 OT_SVP_IMG_TYPE_U8C3_PACKAGE类型的ot_svp_img图像

注:对于RGB_PACKAGE图像,是以“B0G0R0B1G1R1…”形式存储,B在最前面;
对于HSV_PACKAGE图像,是以“H0S0V0H1S1V1…”形式存储,H在最前面;
对于LAB_PACKAGE图像,是以“L0A0B0L1A1B1…”形式存储,L在最前面。
图 10 OT_SVP_IMG_TYPE_U8C3_PLANAR类型的ot_svp_img图像

注:
对于RGB_PLANAR图像,指针数组virt_addr[3]按顺序分别存储B、G、R的指针,而数组stride[3]分别为B、G、R的跨度;
对于HSV_PLANAR图像,指针数组virt_addr[3]按顺序分别存储H、S、V的指针,而数组stride[3]分别为H、S、V的跨度;
对于LAB_PLANAR图像,指针数组virt_addr[3]按顺序分别存储L、A、B的指针,而数组stride[3]分别为L、A、B的跨度;

图 12 ot_svp_mem_info 类型的数据内存示意

图 13 积分图(OT_SVP_IMG_TYPE_U64C1)组合输出示意


-
块数据类型
ot_svp_blob、ot_svp_src_blob、ot_svp_dst_blob,类型参考ot_svp_blob_type,具体的内存分配如图15~图31所示。
表 2 BLOB内存排布类型表
多帧多通道S20Q12类型数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图15所示。
多帧无符号8bit多通道数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图16所示。
多帧YCbCr420 SemiPlannar数据格式图像顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn=3,如图17所示。色度部分V在前,U在后。注意此时高、宽必须为偶数。
多帧YCbCr422 SemiPlannar数据格式图像顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn=3,如图18所示。色度部分V在前,U在后。注意此时宽必须为偶数。
多帧S20Q12类型向量数据顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示向量数据维度,height表示单帧有多少个向量(一般height=1),chn=1,如图19所示。
多段S20Q12类型序列数据排布。此时ot_svp_blob结构体中,num表示段数,dim表示序列向量数据维度,virt_addr_step是一个num长度的数组地址,数组元素表示每段序列有多少个向量,如图20所示。
多帧多通道S20Q12类型数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width=4,height表示bbox个数,chn=1,如图21所示。
多帧多通道32bit量化数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示坐标最大个数,height=6,chn表述类别个数,如图22所示。
多帧多通道S12Q20类型数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图23所示。
多帧S12Q20类型向量数据顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示向量数据维度,height表示单帧有多少个向量(一般height=1),chn=1,如图24所示。
多帧多通道有符号32bit数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图25所示。
多帧多通道无符号32bit数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图26所示。
多帧多通道32bit浮点数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图27所示。
多帧多通道16bit浮点数据Planar格式存储顺序排布。此时ot_svp_blob图像通道数,如图28所示。
多帧多通道有符号8bit数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图29所示。
多帧多通道有符号16bit数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图30所示。
多帧多通道无符号8bit数据Planar格式存储顺序排布。此时ot_svp_blob结构体中,num表示帧数,width表示图像宽,height表示图像高,chn表示单帧图像通道数,如图31所示。
图 15 OT_SVP_BLOB_TYPE_S20Q12类型ot_svp_blob(2通道2帧示意图)

图 16 OT_SVP_BLOB_TYPE_U8类型ot_svp_blob(3通道2帧示意图)

注:典型的RGB\HSV\LAB图像Planar格式存储。
图 17 OT_SVP_BLOB_TYPE_YVU420SP类型ot_svp_blob(2帧YVU420SP示意图)

注:这里V在前,U在后。
图 18 OT_SVP_BLOB_TYPE_YVU422SP类型ot_svp_blob(2帧YVU422SP示意图)

注:这里V在前,U在后。
图 19 OT_SVP_BLOB_TYPE_VEC_S20Q12类型ot_svp_blob(2帧示意图)

图 20 OT_SVP_BLOB_TYPE_SEQ_S20Q12类型ot_svp_blob (num=N帧示意图)

图 21 OT_SVP_BLOB_TYPE_BBOX_S20Q12类型ot_svp_blob(1通道1帧示意图)

图 22 OT_SVP_BLOB_TYPE_BSI_SQ32类型ot_svp_blob(2通道2帧示意图)

注:align32表示32字节对齐。
图 23 OT_SVP_BLOB_TYPE_S12Q20类型ot_svp_blob(2通道2帧示意图)

图 24 OT_SVP_BLOB_TYPE_VEC_S12Q20类型ot_svp_blob(2帧示意图)

图 25 OT_SVP_BLOB_TYPE_S32类型ot_svp_blob(2通道2帧示意图)

图 26 OT_SVP_BLOB_TYPE_U32类型ot_svp_blob(2通道2帧示意图)

图 27 OT_SVP_BLOB_TYPE_FP32类型ot_svp_blob(2通道2帧示意图)

图 28 OT_SVP_BLOB_TYPE_FP16类型ot_svp_blob(2通道2帧示意图)

图 29 OT_SVP_BLOB_TYPE_S8类型ot_svp_blob(2通道2帧示意图)

图 30 OT_SVP_BLOB_TYPE_S16类型ot_svp_blob(2通道2帧示意图)

图 31 OT_SVP_BLOB_TYPE_U16类型ot_svp_blob(2通道2帧示意图)

使用示意
- 用户根据需求调用相应的算子接口创建任务,指定is_instant类型,并记录该任务返回的handle号。
-
根据返回的handle号,指定阻塞方式,可以查询到该任务的完成状态。
具体可参见ss_mpi_ive_query中的【举例】。
API参考
IVE模块提供了创建任务和查询任务的基本接口。
该功能模块提供以下MPI:
- ss_mpi_ive_dma:创建直接内存访问任务。
- ss_mpi_ive_filter:创建模板滤波任务,通过配置不同的模板系数及模板大小,可以实现不同的滤波。
- ss_mpi_ive_csc:创建色彩空间转换任务。
- ss_mpi_ive_filter_and_csc:创建模板滤波加色彩空间转换复合任务
- ss_mpi_ive_sobel:创建5x5模板sobel-like梯度计算任务。
- ss_mpi_ive_mag_and_ang:创建5x5模板计算梯度幅值与幅角任务。
- ss_mpi_ive_dilate:创建膨胀任务。
- ss_mpi_ive_erode:创建腐蚀任务。
- ss_mpi_ive_threshold:创建图像二值化任务。
- ss_mpi_ive_and:创建两二值图像相与任务。
- ss_mpi_ive_sub:创建两灰度图像相减任务。
- ss_mpi_ive_or:创建两二值图像相或任务。
- ss_mpi_ive_integ:创建积分图统计任务。
- ss_mpi_ive_hist:创建直方图统计任务。
- ss_mpi_ive_threshold_s16:创建s16数据到8bit数据阈值化任务。
- ss_mpi_ive_threshold_u16:创建u16数据到u8数据阈值化任务。
- ss_mpi_ive_16bit_to_8bit:创建16bit数据到8bit数据线性转化任务。
- ss_mpi_ive_order_stats_filter:创建3x3模板顺序统计量滤波任务。
- ss_mpi_ive_map:创建Map(映射u8->u8\u8->u16\u8->s16赋值)任务。
- ss_mpi_ive_equalize_hist:创建灰度图像的直方图均衡化计算任务。
- ss_mpi_ive_add:创建两灰度图像的加权加计算任务。
- ss_mpi_ive_xor:创建两二值图的异或计算任务。
- ss_mpi_ive_ncc:创建两相同分辨率图像的归一化互相关系数计算任务。
- ss_mpi_ive_ccl:创建二值图像的连通区域标记任务。
- ss_mpi_ive_gmm:创建gmm背景建模任务。
- ss_mpi_ive_gmm2:创建gmm2背景建模任务。
- ss_mpi_ive_canny_hys_edge:创建灰度图的canny强弱边缘提取任务。
- ss_mpi_ive_canny_edge:灰度图的canny边缘提取的后半部:连接边缘点,形成canny边缘图。
- ss_mpi_ive_lbp:创建lbp计算任务。
- ss_mpi_ive_norm_grad:创建归一化梯度计算任务,梯度均分量均归一化到s8。
- ss_mpi_ive_lk_optical_flow_pyr:创建多层金字塔LK光流计算任务。
- ss_mpi_ive_st_cand_corner:灰度图像Shi-Tomasi-like角点计算的前半部:计算候选角点。
- ss_mpi_ive_st_corner:灰度图像Shi-Tomasi-like角点计算的后半部:按规则挑选角点。
- ss_mpi_ive_sad:计算两幅图像按4x4\8x8\16x16分块的16 bit\8 bit SAD图像,以及对SAD进行阈值化输出。
- ss_mpi_ive_resize:创建图像缩放任务。
- ss_mpi_ive_grad_fg:根据背景图像和当前帧图像的梯度信息计算梯度前景图像。
- ss_mpi_ive_match_bg_model:基于CodeBook演进的背景模型匹配。
- ss_mpi_ive_update_bg_model:基于CodeBook演进的背景模型更新。
- ss_mpi_ive_ann_mlp_load_model:读取ann_mlp模型文件,初始化模型数据。
- ss_mpi_ive_ann_mlp_unload_model:去初始化ann模型数据。
- ss_mpi_ive_ann_mlp_predict:创建同一模型多个样本ann_mlp预测任务。
- ss_mpi_ive_svm_load_model:读取svm模型文件,初始化模型数据。
- ss_mpi_ive_svm_unload_model:去初始化svm模型数据。
- ss_mpi_ive_svm_predict:创建同一模型的多个样本svm预测任务。
- ss_mpi_ive_cnn_load_model:读取cnn模型文件,生成cnn网络模型。
- ss_mpi_ive_cnn_unload_model:卸载cnn网络模型,释放内存。
- ss_mpi_ive_cnn_predict:用已有模型对一个或多个输入样本进行预测,并输出预测结果。
- ss_mpi_ive_cnn_get_result:接收cnn_predict结果,执行softmax运算来预测每个样本图像的类别,并输出置信度最高的类别(rank-1)以及对应的置信度。
- ss_mpi_ive_persp_trans:根据输入源图的区域位置和点对信息做相应的透视变换。
- ss_mpi_ive_kcf_get_mem_size:获取需要创建目标对象数的内存大小。
- ss_mpi_ive_kcf_create_obj_list:创建目标链表。
- ss_mpi_ive_kcf_destroy_obj_list:销毁目标链表。
- ss_mpi_ive_kcf_create_gauss_peak:创建高斯峰值。
- ss_mpi_ive_kcf_create_cos_win:创建汉宁窗。
- ss_mpi_ive_kcf_get_train_obj:获取需要训练的目标对象。
- ss_mpi_ive_kcf_proc:提交目标给硬件处理。
- ss_mpi_ive_kcf_get_obj_bbox:获取目标区域跟踪结果信息。
- ss_mpi_ive_kcf_judge_obj_bbox_track_state:判断目标区域跟踪状态。
- ss_mpi_ive_kcf_obj_update:更新目标信息。
- ss_mpi_ive_hog:计算给定区域的HOG(Histogram of Oriented Gradient)特征。
- ss_mpi_ive_query:查询已创建任务完成情况。
- ss_mpi_ive_get_perspective_transform:根据输入源图的区域位置和点对信息计算相应的透视变换矩阵。
- ss_mpi_ive_warp_perspective:根据输入源图的区域位置和点对信息做相应的透视变换。
- ss_mpi_ive_alpha_blending:执行图像个别权重乘积任务。
- ss_mpi_ive_acc:执行两灰度图像的累积运算任务。
- ss_mpi_ive_image_dot:执行图像点乘积任务。
须知:
用户开辟的内存需要用户保证开辟的内存的正确性,例如ss_mpi_ive_kcf_create_gauss_peak中的gauss_peak的内存由用户开辟,但是随意更改虚拟地址的值就会造成段错误。
ss_mpi_ive_dma
【描述】
创建直接内存访问任务,支持快速拷贝、间隔拷贝、内存填充:可实现数据从一块内存快速拷贝到另一块内存,或者从一块内存有规律的拷贝一些数据到另一块内存,或者对一块内存进行填充操作。
【语法】
td_s32 ss_mpi_ive_dma(ot_ive_handle *handle, const ot_svp_data *src, const ot_svp_dst_data *dst, const ot_ive_dma_ctrl *ctrl, td_bool is_instant);
【参数】
注:
- Copy模式是指OT_IVE_DMA_MODE_DIRECT_COPY和OT_IVE_DMA_MODE_INTERVAL_COPY及OT_IVE_DMA_MODE_MASK模式;
- Set模式是指OT_IVE_DMA_MODE_SET_3BYTE和OT_IVE_DMA_MODE_SET_8BYTE模式。
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
OT_IVE_DMA_MODE_DIRECT_COPY:快速拷贝模式。
可实现从大块内存中扣取小块内存,如图1所示,计算公式如下:
Iout (x, y) =I(x, y) (0≤x≤width, 0≤y≤height)
其中_I_(x, y) 对应src,Iout(x, y)对应dst。

-
OT_IVE_DMA_MODE_INTERVAL_COPY:间隔拷贝模式
- 要求源数据宽度为hor_seg_size的倍数;
- 间隔拷贝的方式:将每ver_seg_rows行中第一行数据分割为hor_seg_size大小的段,拷贝每段中的前elem_size大小的字节。如图2所示。
-
OT_IVE_DMA_MODE_SET_3BYTE:3字节填充模式
仅使用src,用val的低3字节对源数据进行填充操作;当一行末尾不够3字节时,用val的低字节填充。
-
OT_IVE_DMA_MODE_SET_8BYTE:8字节填充模式
仅使用src,用val对源数据进行填充操作;当一行的末尾不足8字节时,用val的低字节填充。

-
OT_IVE_DMA_MODE_MASK:掩码拷贝模式
- 水平和竖直可以各自掩码拷贝;
- 当掩码比特位为1时,对应字节/行不拷贝,水平掩码值一比特对应源图一个字节,竖直掩码值一比特对应源图一行;
- 掩码拷贝分为32比特掩码和24比特掩码,32比特掩码拷贝时掩码值都是有效,24比特掩码拷贝时掩码值低24比特有效。如图3和图4所示。
- 输出宽为dst_width = hor_mask_valid_num * (src_width/hor_mask_bits_num) + left_hor_mask_valid_num,其中hor_mask_valid_num为水平不需要掩码的比特数,hor_mask_bits_num为水平掩码模式比特数单位(OT_IVE_DMA_MASK_MODE_32BIT为32,OT_IVE_DMA_MASK_MODE_24BIT为24),left_hor_mask_valid_num为非整数倍剩余需要拷贝的字节数(即src_width % hor_mask_bits_num此长度非掩码的字节数)。
- 输出高为dst_height = ver_mask_valid_num * (src_height/ver_mask_bits_num) + left_ver_mask_valid_num,其中ver_mask_valid_num为竖直不需要掩码的比特数,ver_mask_bits_num为竖直掩码模式比特数单位(OT_IVE_DMA_MASK_MODE_32BIT为32,OT_IVE_DMA_MASK_MODE_24BIT为24),left_ver_mask_valid_num为非整数倍剩余需要拷贝的行数(即src_height % ver_mask_bits_num此长度非掩码的行数)。


【举例】
无。
【相关主题】
无。
ss_mpi_ive_filter
【描述】
创建模板滤波任务,通过配置不同的模板系数及模板大小,可以实现不同的滤波。
【语法】
td_s32 ss_mpi_ive_filter(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_filter_ctrl *ctrl, td_bool is_instant);
【参数】
U8C1/S8C1/YUV420SP Y分量/YUV422SP Y分量为1byte, YUV420SP UV分量/YUV422SP UV分量/S16C1/U16C1 为2byte |
|||
注:U8C1\YUV420SP\YUV422SP\S8C1\S16C1\U16C1均为ot_svp_img_type成员的简写,后续其他的成员在表述中也用相同的规则简写。
【返回值】
失败,参见错误码。 |
【解决方案差异】
src和dst支持图像类型为U8C1、YUV420SP、YUV422SP、S8C1、S16C1、U16C1,分辨率为64x64~8192x8192 |
|
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- filter计算公式示意如图1所示。

其中,I (x, y)对应src,I__out (x, y)对应dst,coef (mask)对应ctrl中的mask[121],norm对应ctrl中的norm,以5x5滤波为示例。
- 经典高斯模板如下。

norm =4 norm =8 norm =8
【举例】
无。
【相关主题】
ss_mpi_ive_csc
【描述】
创建色彩空间转换任务,可实现YUV_TO_RGB\YUV_TO_HSV\YUV_TO_LAB\RGB_TO_YUV的色彩空间转换。
【语法】
td_s32 ss_mpi_ive_csc(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_csc_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 当输出数据为U8C3_PLANAR、YUV420SP、YUV422SP类型时,要求输出数据跨度一致。
- 支持12种工作模式,不同的模式其输出的取值范围不一样,具体请参见ot_ive_csc_mode。
- YUV_TO_HSV、YUV_TO_LAB参考OpenCV中的实现方法。
说明:
本文档中所提到的OpenCV,均指OpenCV 2.4.8版本。
【举例】
无。
【相关主题】
ss_mpi_ive_filter_and_csc
【描述】
创建5x5模板滤波和YUV_TO_RGB色彩空间转换复合任务,通过一次创建完成两种功能。
【语法】
td_s32 ss_mpi_ive_filter_and_csc(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_filter_and_csc_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 当输出数据为U8C3_PLANAR类型时,要求输出数据跨度一致。
- 仅支持YUV_TO_RGB的4种工作模式,具体参见ot_ive_csc_mode。
【举例】
无。
【相关主题】
ss_mpi_ive_sobel
【描述】
创建5x5模板sobel-like梯度计算任务。
【语法】
td_s32 ss_mpi_ive_sobel(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst_h, const ot_svp_dst_img *dst_v, const ot_ive_sobel_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置3种输出模式,参考ot_ive_sobel_out_ctrl。
- 当输出模式为OT_IVE_SOBEL_OUT_CTRL_BOTH时,要求dst_h和dst_v跨度一致。
- sobel计算公式示意如图1所示。

其中,
对应src,
对应dst_h,
对应dst_v,
(mask)为ctrl中的mask[25]
-
sobel模板


-
scharr模板

-
拉普拉斯模板


【举例】
无。
【相关主题】
ss_mpi_ive_mag_and_ang
【描述】
创建5x5模板梯度幅值与幅角计算任务。
【语法】
td_s32 ss_mpi_ive_mag_and_ang (ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst_mag, const ot_svp_dst_img *dst_ang, const ot_ive_mag_and_ang_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置2种输出模式,具体参见ot_ive_mag_and_ang_out_ctrl。
- 当输出模式为OT_IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG时,要求dst_mag和dst_ang跨度一致。
-
用户可以通过ctrl->threshold对幅值图进行threshold操作(可以用来实现EOH),计算公式如下:

其中,
对应dst_mag。



根据
、
以及
取对应上图中0~7的方向值。其中,
对应src,
对应dst_mag,
对应dst_ang,
(mask)为ctrl中的mask[25]。
【举例】
无。
【相关主题】
ss_mpi_ive_dilate
【描述】
创建二值图像5x5模板膨胀任务。
【语法】
td_s32 ss_mpi_ive_dilate(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_dilate_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 模板系数只能为0或255。
-
模板样例






其中,公式中|为位或运算,&为位与运算,%为取余运算。
对应src,
对应dst,
(mask)对应ctrl中的mask[25]。
【举例】
无。
【相关主题】
ss_mpi_ive_erode
【描述】
创建二值图像5x5模板腐蚀任务。
【语法】
td_s32 ss_mpi_ive_erode(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_erode_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 模板系数只能为0或255。
-
模板样例






其中,公式中|为位或运算,&为位与运算,%为取余运算。
对应src,
对应dst,
(mask)对应ctrl中的mask[25]。
【举例】
无。
【相关主题】
ss_mpi_ive_threshold
【描述】
创建灰度图像阈值化任务。
【语法】
td_s32 ss_mpi_ive_threshold (ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_threshold_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可以配置8种运算模式,具体参见ot_ive_threshold_mode。
-
计算公式
-
OT_IVE_THRESHOLD_MODE_BINARY:

、
无需赋值。 -
OT_IVE_THRESHOLD_MODE_TRUNC:

、
、
无需赋值。 -
OT_IVE_THRESHOLD_MODE_TO_MINVAL:

、
、
无需赋值。 -
OT_IVE_THRESHOLD_MODE_MIN_MID_MAX:

-
OT_IVE_THRESHOLD_MODE_ORIG_MID_MAX:

无需赋值。 -
OT_IVE_THRESHOLD_MODE_MIN_MID_ORI:

无需赋值。 -
OT_IVE_THRESHOLD_MODE_MIN_ORIG_MAX:

无需赋值。 -
OT_IVE_THRESHOLD_MODE_ORI_MID_ORIG:

、
无需赋值。
其中,
对应src,
对应dst,mode、low_thr、high_thr、min_val、mid_val和max_val分别对应ctrl的mode、low_threshold、high_threshold、min_val、mid_val和max_val。具体示意图如图1所示。 -
-
ctrl中的min_val、mid_val和max_val并不需要满足变量命名含义中的大小关系。

【举例】
无。
【相关主题】
ss_mpi_ive_and
【描述】
创建两二值图像相与任务。
【语法】
td_s32 ss_mpi_ive_and(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, td_bool is_instant );
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:

其中,
对应src1,
对应src2,
对应dst
【举例】
无。
【相关主题】
ss_mpi_ive_sub
【描述】
创建两灰度图像相减任务。
【语法】
td_s32 ss_mpi_ive_sub(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, const ot_ive_sub_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可以配置2种输出格式,具体参见ot_ive_sub_mode。
-
OT_IVE_SUB_MODE_ABS
- 计算公式:

- 输出格式:U8C1
- 计算公式:
-
OT_IVE_SUB_MODE_SHIFT
- 计算公式:

- 输出格式:S8C1
其中,
对应src1,
对应src2,
对应dst。 - 计算公式:
【举例】
无。
【相关主题】
ss_mpi_ive_or
【描述】
创建两二值图像相或任务。
【语法】
td_s32 ss_mpi_ive_or(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:

其中,
对应src1,
对应src2,
对应dst。
【举例】
无。
【相关主题】
ss_mpi_ive_integ
【描述】
创建灰度图像的积分图计算任务。
【语法】
td_s32 ss_mpi_ive_integ(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_integ_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
OT_IVE_INTEG_OUT_CTRL_COMBINE,组合输出模式,输出图像类型必须为OT_SVP_IMG_TYPE_U64C1,参见图13,计算公式如下:

-
OT_IVE_INTEG_OUT_CTRL_SUM,仅和积分图输出模式,输出图像类型必须为OT_SVP_IMG_TYPE_U32C1,计算公式如下:

-
OT_IVE_INTEG_OUT_CTRL_SQRT_SUM,仅平方和积分图输出,输出图像类型必须为OT_SVP_IMG_TYPE_U64C1,计算公式如下:

其中,
对应src,
对应dst。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_hist
【描述】
创建灰度图像的直方图统计任务。
【语法】
td_s32 ss_mpi_ive_hist(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_mem_info *dst, td_bool is_instant);
【参数】
|
内存至少配置1024字节,如图14; |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:

其中,
对应src,
对应dst。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_threshold_s16
【描述】
创建s16数据到8bit数据的阈值化任务。
【语法】
td_s32 ss_mpi_ive_threshold_s16(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_threshold_s16_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置4种运算模式,参考ot_ive_threshold_s16_mode。
-
计算公式
-
OT_IVE_THRESHOLD_S16_MODE_S16_TO_S8_MIN_MID_MAX:

要求:-32768≤
≤
≤32767;-128≤
、
、
≤127。 -
OT_IVE_THRESHOLD_S16_MODE_S16_TO_S8_MIN_ORIG_MAX:

要求:-129≤
≤
≤127;-128≤
、
≤127; -
OT_IVE_THRESHOLD_S16_MODE_S16_TO_U8_MIN_MID_MAX:

要求:-32768≤
≤
≤32767;0≤
、
、
≤255。 -
OT_IVE_THRESHOLD_S16_MODE_S16_TO_U8_MIN_ORIG_MAX:

要求:-1≤
≤
≤255;0≤
、
≤255。
其中,
对应src,
对应dst,mode、low_thr、high_thr、min_val、mid_val和max_val分别对应thrS16Ctrl的mode、low_threshold、high_threshold、min_val、mid_val和max_val。具体示意图如图1所示。 -
-
ctrl中的min_val、mid_val和max_val并不需要满足变量命名含义中的大小关系。

【举例】
无。
【相关主题】
ss_mpi_ive_threshold_u16
【描述】
创建u16数据到u8数据的阈值化任务。
【语法】
td_s32 ss_mpi_ive_threshold_u16(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_threshold_u16_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置2种运算模式,参考ot_ive_threshold_u16_mode。
-
计算公式
-
OT_IVE_THRESHOLD_U16_MODE_U16_TO_U8_MIN_MID_MAX:

要求:0≤
≤
≤65535; -
OT_IVE_THRESHOLD_U16_MODE_U16_TO_U8_MIN_ORIG_MAX:

要求:0≤
≤
≤255;
其中,
对应src,
对应dst,mode、low_thr、high_thr、min_val、mid_val和max_val分别对应ctrl的mode、low_threshold、high_threshold、min_val、mid_val和max_val。具体示意图如图1所示。 -
-
ctrl中的min_val、mid_val和max_val并不需要满足变量命名含义中的大小关系。

【举例】
无。
【相关主题】
ss_mpi_ive_16bit_to_8bit
【描述】
创建16bit图像数据到8bit图像数据的线性转化任务。
【语法】
td_s32 ss_mpi_ive_16bit_to_8bit(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_16bit_to_8bit_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置4种模式,具体参考ot_ive_16bit_to_8bit_mode。
-
计算公式
-
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_S8:

-
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS:

-
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS:

-
OT_IVE_16BIT_TO_8BIT_MODE_U16_TO_U8:

其中,
对应src,其中,
对应dst,mode、
、
和
分别对应ctrl的mode、num、den、bias。具体示意图如图1所示。要求:num ≤ den,且den≠0。

-
【举例】
无。
【相关主题】
ss_mpi_ive_order_stats_filter
【描述】
创建3x3模板顺序统计量滤波任务,可进行Median、Max、Min滤波。
【语法】
td_s32 ss_mpi_ive_order_stats_filter(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_order_stats_filter_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可配置3种滤波模式,参考ot_ive_order_stats_filter_mode。
-
计算公式
-
OT_IVE_ORDER_STATS_FILTER_MODE_MEDIAN:

-
OT_IVE_ORDER_STATS_FILTER_MODE_MAX:

-
OT_IVE_ORDER_STATS_FILTER_MODE_MIN:

其中,
对应src,
对应dst。 -
【举例】
无。
【相关主题】
ss_mpi_ive_map
【描述】
创建map(映射赋值)任务,对源图像中的每个像素,查找map查找表中的值,赋予目标图像相应像素查找表中的值,支持U8C1→U8C1、U8C1→U16C1、U8C1→S16C1 3种模式的映射。
【语法】
td_s32 ss_mpi_ive_map(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_src_mem_info *map, const ot_svp_dst_img *dst, const ot_ive_map_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
计算公式如下:

其中,
对应src,
对应dst,
对应map。 -
map的内存配置根据ctrl->mode配置不同:
- OT_IVE_MAP_MODE_U8,配置sizeof(ot_ive_map_u8bit_lut_mem);
- OT_IVE_MAP_MODE_U16,配置sizeof(ot_ive_map_u16bit_lut_mem);
- OT_IVE_MAP_MODE_S16,配置sizeof(ot_ive_map_s16bit_lut_mem).
【举例】
无。
【相关主题】
无。
ss_mpi_ive_equalize_hist
【描述】
创建灰度图像的直方图均衡化计算任务。
【语法】
td_s32 ss_mpi_ive_equalize_hist(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_equalize_hist_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- ctrl中的mem,至少需开辟sizeof(ot_ive_equalize_hist_ctrl_mem)字节大小。
- 与OpenCV中直方图均衡化计算过程一致。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_add
【描述】
创建两灰度图像的加权加计算任务。
【语法】
td_s32 ss_mpi_ive_add(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, const ot_ive_add_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:
其中,
对应src1,
对应src2,
对应dst;x,y为ctrl中的x,y;若定点化前,x和y满足x+y>1,则当计算结果超过8bit取低8bit作为最终结果。
【举例】
无。
【相关主题】
ss_mpi_ive_xor
【描述】
创建两二值图的异或计算任务。
【语法】
td_s32 ss_mpi_ive_xor(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:

其中,
对应src1,
对应src2,
对应dst。
【举例】
无。
【相关主题】
ss_mpi_ive_ncc
【描述】
创建两相同分辨率灰度图像的归一化互相关系数计算任务。
【语法】
td_s32 ss_mpi_ive_ncc(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_mem_info *dst, td_bool is_instant);
【参数】
|
内存至少需配置:sizeof (ot_ive_ncc_dst_mem)。 |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
计算公式如下

-
仅输出上面公式的分子、开方之前的两个分母项,即num、quad_sum1、quad_sum2,每个变量占64bit,在内存中按照上述顺序依次排布,分别对应上面公式的
、
、
。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_ccl
【描述】
创建二值图像的连通区域标记任务。
【语法】
td_s32 ss_mpi_ive_ccl(ot_ive_handle *handle, const ot_svp_img *src_dst, const ot_svp_dst_mem_info *blob, const ot_ive_ccl_ctrl *ctrl, td_bool is_instant);
【参数】
|
内存至少需配置为sizeof (ot_ive_ccblob)大小,最多输出254个有效的连通区域。 |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 连通区域的信息保存在blob->rgn中。
- blob->info.bits.rgn_num表示有效的连通区域数目,最多254个有效的连通区域;有效的连通区域的面积大于blob->info.cur_area_threshold,标记号为其所在blob->rgn数组元素的下标+1。有效的连通区域并不一定连续地存储在数组中,而很可能是间断的分布在数组中。
- 若blob->info.label_status为0,则标记成功(一个区域一个标记);若为-1,则标记失败(一个区域多个标记或者多个区域共用一个标记)。对于后者,若用户需要正确的标记号,还需要再次根据blob中的外接矩形信息重新标记。不管标记是否成功,连通区域的外接矩形信息一定是正确可用的。
- 输出的连通区域会用ctrl->init_area_threshold进行筛选,面积小于等于ctrl->init_area_threshold均会被置为0。
- 当连通区域数目大于254,会用ctrl->init_area_threshold删除面积小的连通区域;若ctrl->init_area_threshold不满足删除条件,会以ctrl->step为步长,增大删除连通区域的面积阈值。
- 最终的面积阈值存储在blob->cur_area_threshold中。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_gmm
【描述】
创建GMM背景建模任务,支持灰度图、RGB_PACKAGE图像的GMM背景建模,高斯模型个数为3或者5。
【语法】
td_s32 ss_mpi_ive_gmm(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *fg, const ot_svp_dst_img *bg, const ot_svp_mem_info *model, const ot_ive_gmm_ctrl *ctrl, td_bool is_instant );
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- GMM的实现方式参考了OpenCV中的MOG和MOG2。
- 源图像类型只能为U8C1或U8C3_PACKAGE,分别用于灰度图和RGB图的GMM背景建模。
- 前景图像是二值图,类型只能为U8C1;背景图像与源图像类型一致。
-
灰度图像GMM采用n个(n=3 或 5)高斯模型,model的内存排列方式如图1所示。

一个像素的单个高斯模型参数weight用2字节、mean用2字节、var用3字节;因此model需要分配的内存大小:
model->size = 7 * src->width * src->height * ctrl->model_num
-
RGB图像GMM采用n个(n=3 或 5})高斯模型,model的内存排列方式如图2所示。

一个像素的单个高斯模型参数weight用2字节、mean[3]用2*3字节、var用3字节;因此model需要分配的内存大小:
model->size = 11 * src->width * src->height * ctrl->model_num
【举例】
无。
【相关主题】
ss_mpi_ive_gmm2
【描述】
创建GMM背景建模任务,支持1-5个高斯模型,支持灰度图和RGB_PACKAGE图输入,支持全局及像素级别的灵敏度系数以及前景模型时长更新系数。
【语法】
td_s32 ss_mpi_ive_gmm2(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_src_img *factor, const ot_svp_dst_img *fg, const ot_svp_dst_img *bg, const ot_svp_dst_img *match_model_info, const ot_svp_mem_info *model, const ot_ive_gmm2_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- GMM2在参考了OPENCV的MOG和MOG2的基础上,增加了像素级别的参数控制。
- 源图像src类型只能为U8C1或U8C3_PACKAGE,分别用于灰度图和RGB图的GMM背景建模。
- 模型更新参数factor为U16C1图像:每个元素用16 bit表示,低8 bit为灵敏度系数,用于控制模型匹配时方差倍数;高8 bit为前景模型时长更新参数,用于控制背景模型形成时间。
- 模型匹配系数指针match_model_info为U8C1图像:每个元素用8bit表示,低1 bit为高斯模型匹配标志,0表示匹配失败,1表示匹配成功;高7 bit为频率最大模型序号。
-
GMM2的频率参数(ctrl中的freq_init_val、freq_redu_factor、freq_add_factor freq_threshold)用于控制模型排序和模型有效时间。
- freq_init_val 越大,模型有效时间越大;
- freq_redu_factor 越大,模型有效时间越长,模型频率通过乘以频率衰减系数freq_redu_factor /65536,达到频率衰减的目的;
- freq_add_factor 越大,模型有效时间越长;
- freq_threshold 越大,模型有效时间越短。
-
GMM2的模型时长参数(ctrl中的life_threshold )用于控制前景模型成为背景的间。
- life_threshold越大,前景持续时间越长;
- 单高斯模型下,模型时长参数不生效。
-
灰度图像GMM2采用n个(1≤n≤5)高斯模型,model的内存排列方式如图1所示。

一个像素的单个高斯模型参数mean用2字节,var用2字节,freq用2字节,life用2字节;因此model需要分配的内存大小:
model->size = 8 * src->width*src->height * ctrl->model_num
-
RGB图像GMM2采用n个(1≤n≤5)高斯模型,model的内存排列方式如图2所示。

一个像素的单个高斯模型参数mean[3]用6字节,var用2字节,freq用2字节,life用2字节;因此model需要分配的内存大小:
model->size = 12 * src->width*src->height * ctrl->model_num
【举例】
无。
【相关主题】
ss_mpi_ive_canny_hys_edge
【描述】
灰度图的Canny边缘提取的前半部:求梯度、计算梯度幅值幅角、磁滞阈值化及非极大抑制。
【语法】
td_s32 ss_mpi_ive_canny_hys_edge(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *edge, const ot_svp_dst_mem_info *stack, const ot_ive_canny_hys_edge_ctrl *ctrl, td_bool is_instant);
【参数】
|
src->width * src->height * (sizeof(ot_svp_point_u16)) + sizeof(ot_ive_canny_stack_size) |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
edge仅有0、1、2三个取值:
- 0表示弱边缘点
- 1表示非边缘点
- 2表示强边缘点
-
stack中存储强边缘点的坐标信息。
-
ctrl->mem至少需要分配的内存大小
ctrl->mem.size
= (src->width + (16 - src->width % 16) % 16)* 3 * src->height。
-
该任务完成后,必须要使用ss_mpi_ive_canny_edge函数才能输出Canny边缘图像。
【举例】
无。
【相关主题】
ss_mpi_ive_canny_edge
【描述】
灰度图的Canny边缘提取的后半部:连接边缘点,形成Canny边缘图。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
使用该接口前必须调用ss_mpi_ive_canny_hys_edge,在保证ss_mpi_ive_canny_hys_edge任务完成的情况下,使用ss_mpi_ive_canny_hys_edge的输出edge、stack作为该接口的参数输入。
【举例】
无。
【相关主题】
ss_mpi_ive_lbp
【描述】
创建lbp计算任务。
【语法】
td_s32 ss_mpi_ive_lbp(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst, const ot_ive_lbp_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
LBP计算公式如图1所示。

-
OT_IVE_LBP_COMPARE_MODE_NORMAL
,其中
; -
OT_IVE_LBP_COMPARE_MODE_ABS
,其中
;
其中,
对应src,
对应dst,
对应ctrl->bit_threshold。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_norm_grad
【描述】
创建归一化梯度计算任务,梯度分量均归一化到s8。
【语法】
td_s32 ss_mpi_ive_norm_grad(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *dst_h, const ot_svp_dst_img *dst_v, const ot_svp_dst_img *dst_hv, const ot_ive_norm_grad_ctrl *ctrl, td_bool is_instant);
【参数】
由模板和转置后的模板直接滤波,并且均归一到s8后,采用package格式存储(如图7)的图像指针。 |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
控制参数中输出模式如下:
- OT_IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER时,dst_h和dst_v指针不能为空,且要求跨度一致;
- OT_IVE_NORM_GRAD_OUT_CTRL_HOR时,dst_h不能为空;
- OT_IVE_NORM_GRAD_OUT_CTRL_VER时,dst_v不能为空;
- OT_IVE_NORM_GRAD_OUT_CTRL_COMBINE时,dst_hv不能为空。
-
norm_grad计算公式如图1所示。


【举例】
无。
【相关主题】
ss_mpi_ive_lk_optical_flow_pyr
【描述】
创建多层金字塔LK光流计算任务。
【语法】
td_s32 ss_mpi_ive_lk_optical_flow_pyr(ot_ive_handle *handle, const ot_svp_src_img src_prev_pyr[], const ot_svp_src_img src_next_pyr[],const ot_svp_src_mem_info *prev_points, const ot_svp_mem_info *next_points, const ot_svp_dst_mem_info *status, const ot_svp_dst_mem_info *err, const ot_ive_lk_optical_flow_pyr_ctrl *ctrl, td_bool is_instant);
【参数】
前一帧图像金字塔第0层(src_prev_pyr[0])的初始特征点数组。 坐标只能为ot_svp_point_s25q7类型;内存至少需分配:ctrl->points_num *sizeof(ot_svp_point_s25q7)。 |
||
特征点prev_pts经过金字塔计算LK光流得到对应于下一帧图像金字塔第0层(src_next_pyr[])的坐标。当ctrl->use_init_flow为true时,需要初始化该特征点数组。 坐标只能为ot_svp_point_s25q7类型;内存至少需分配:ctrl->points_num * sizeof(ot_svp_point_s25q7)。 |
||
对next_pts中每个跟踪成功的特征点,对比prev_pts中对应特征点周边进行的相似度误差估计(td_u9q7类型),跟踪失败的特征点不做估计。 |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- src_prev_pyr[0]的宽、高必须是
的倍数。 - ctrl-> max_level取值范围[0, 3],对应金字塔层数为[1, 4]。
-
求解下面的光流方程中,仅用到特征点周围7X7像素的来计算对应的
、
、

其中,
、
、
分别表示当前图像在x、y方向的偏导,当前图像与前一帧图像的差分。 -
以3层金字塔LK光流计算为例,要求每层图像的高、宽是上一层图像高、宽的一半,其计算示意图如图1所示。

- 根据输入的特征点坐标,计算出3层金字塔特征点对应的坐标:p0,p1,p2;若需要初始光流,计算出m0,m1,m2;否则m0=p0,m1=p1,m2=p2;
- 以m2作为输入求出在第2层上的光流终点n2;
- 计算出n2在第1层的对应坐标n1,以n1作为输入求出第1层上的光流终点q1;
- 计算出q1在第一层的对应坐标q0,以q0作为输入求出第0层上的光流终点q;
- 若第0层不是原始图像,根据第0层与原始图像的的比例关系可以得到LK光流的最终点p。
请注意设计和使用限制:每个特征点仅以该特征点为中心固定大小窗口的数据进行计算,若迭代计算过程中,该特征点位移目标点超出该固定大小窗口会导致计算光流失败。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_st_cand_corner
【描述】
灰度图像Shi-Tomasi-like角点计算的前半部:计算候选角点。
【语法】
td_s32 ss_mpi_ive_st_cand_corner(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_dst_img *cand_corner, const ot_ive_st_cand_corner_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 与OpenCV中ShiTomas角点计算原理类似。
-
ctrl->mem至少需开辟的内存大小:
ctrl->mem.size= 4 * (src->width + (16 - src->width % 16) % 16)* src->height+ sizeof(ot_ive_st_max_eig_val)。
-
该任务完成后,必须要使用ss_mpi_ive_st_corner函数才能得到真正的角点。
【举例】
无。
【相关主题】
ss_mpi_ive_st_corner
【描述】
灰度图像Shi-Tomasi-like角点计算的后半部:按规则挑选角点。
【语法】
td_s32 ss_mpi_ive_st_corner(const ot_svp_src_img *cand_corner, const ot_svp_dst_mem_info *corner, const ot_ive_st_corner_ctrl *ctrl);
【参数】
|
内存至少需配置:sizeof(ot_ive_st_corner_info) |
||
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 与OpenCV中ShiTomas角点计算原理类似。
- corner->corner_num表示最终得到的角点数目。
- 使用该接口前必须调用ss_mpi_ive_st_cand_corner,在保证ss_mpi_ive_st_cand_corner任务完成的情况下,使用ss_mpi_ive_st_cand_corner的输出cand_corner作为该接口的参数输入。
【举例】
无。
【相关主题】
ss_mpi_ive_sad
【描述】
计算两幅图像按4x4\8x8\16x16分块的16 bit\8 bit SAD图像,以及对SAD进行阈值化输出。
【语法】
td_s32 ss_mpi_ive_sad(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *sad, const ot_svp_dst_img *threshold, const ot_ive_sad_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:
;

其中,
对应src1,
对应src2,
对应sad,
与ctrl->mode相关,对应OT_IVE_SAD_MODE_MB_4X4、OT_IVE_SAD_MODE_MB_8X8、OT_IVE_SAD_MODE_MB_16X16时分别取4、8、16;
对应thr,Thr、minVal和maxVal分别对应ctrl->threshold、ctrl->min_val和ctrl->max_val。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_resize
【描述】
创建图像缩放任务,支持bilinear插值缩放,支持多张U8C1\ U8C3_PLANAR\YUV420SP\YUV422SP\S8C1\U16C1\S16C1图像同时输入做一种类型的缩放。
【语法】
td_s32 ss_mpi_ive_resize(ot_ive_handle *handle, const ot_svp_src_img src[], const ot_svp_dst_img dst[], const ot_ive_resize_ctrl *ctrl, td_bool is_instant);
【参数】
U8C1/U8C3_PLANAR/S8C1/YUV420SP Y分量/YUV422SP Y分量为1byte, YUV420SP UV分量/YUV422SP UV分量/S16C1/U16C1 为2byte |
|||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 基于OpenCV中resize实现,OT_IVE_RESIZE_MODE_LINEAR、OT_IVE_RESIZE_MODE_AREA分别对应OpenCV resize的INTER_LINEAR、INTER_AREA。
- 支持U8C1\U8C3_PLANAR\YUV420SP\YUV422SP\S8C1\U16C1\S16C1混合图像数组输入,但所有图像的缩放模式相同。
- 最大支持16倍缩放。
- ctrl->mem内存不同解决方案需要的大小不一样,具体见上面解决方案差异。
【举例】
无。
【相关主题】
无
ss_mpi_ive_grad_fg
【描述】
根据背景图像和当前帧图像的梯度信息计算梯度前景图像。
【语法】
td_s32 ss_mpi_ive_grad_fg(ot_ive_handle *handle, const ot_svp_src_img *bg_diff_fg, const ot_svp_src_img *cur_grad, const ot_svp_src_img *bg_grad, const ot_svp_dst_img *grad_fg, const ot_ive_grad_fg_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
背景梯度图像和当前梯度图像的类型为S8C2_PACKAGE,水平和竖直方向梯度按照
格式存储。
【举例】
无。
【相关主题】
ss_mpi_ive_match_bg_model
【描述】
基于Codebook演进的背景模型匹配。
【语法】
td_s32 ss_mpi_ive_match_bg_model(ot_ive_handle *handle, const ot_svp_src_img *cur_img, const ot_svp_data *bg_model, const ot_svp_img *fg_flag, const ot_svp_dst_img *bg_diff_fg, const ot_svp_dst_img *frm_diff_fg, const ot_svp_dst_mem_info *state_data, const ot_ive_match_bg_model_ctrl *ctrl, td_bool is_instant);
【参数】
|
高同cur_img,宽 = cur_img->width * sizeof(ot_ive_bg_model_pixel)。 |
||
|
内存至少需配置sizeof(ot_ive_fg_status_data)。 |
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
要求fg_flag、bg_diff_fg、frm_diff_fg跨度一致。
背景模型数据bg_model中每个像素以ot_ive_bg_model_pixel(24字节)表示,即model->width = sizeof(ot_ive_bg_model_pixel) * src->width,model->height = src->height,至少需要分配内存大小为(sizeof(ot_ive_bg_model_pixel) * src->width + (16 - (sizeof(ot_ive_bg_model_pixel) * src->width % 16) % 16) * model->height。
-
前景状态图像fg_flag为U8C1类型,其各比特位表示不同的状态信息,单个像素各比特位示意图如图1,按从右到左由低位到高位的顺序排布:

其各个比特位表示的含义如下:
- 比特位只用到bit0、bit1、bit2、bit5、bit6;其中bit0、bit1、bit2是由本算子计算作为输出,bit5、bit6是由外部函数计算作为输入。
- bit1为1时表示像素为前景;
- bit1为1且bit0为1时表示像素为运动前景;
- bit1为1且bit0为0时表示像素为变化前景;
- bit2为1时表示像素的背景模型处于工作状态;
- bit5和bit6表示外部函数对前景状态的反馈,bit5为1时表示前景像素需要短时间保持,bit6为1时表示前景像素需要长时间保持。
【举例】
无。
【相关主题】
ss_mpi_ive_update_bg_model
【描述】
基于Codebook演进的背景模型更新,对背景模型的内部状态进行更新。
【语法】
td_s32 ss_mpi_ive_update_bg_model(ot_ive_handle *handle, const ot_svp_data *bg_model, const ot_svp_img *fg_flag, const ot_svp_dst_img *bg_img, const ot_svp_dst_img *chg_status_img, const ot_svp_dst_img *chg_status_fg, const ot_svp_dst_img *chg_status_life, const ot_svp_dst_mem_info *state_data, const -ot_ive_update_bg_model_ctrl *ctrl, td_bool is_instant);
【参数】
|
内存至少需配置sizeof(ot_ive_bg_status_data)。 |
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 要求fg_flag、bg_img、chg_status_img(不为空时)、chg_status_fg(不为空时)跨度一致。
- 背景模型数据model参考ss_mpi_ive_match_bg_model中的说明。
- chg_status_fg表示变化状态前景图像,其中像素非0表示前景,否则表示背景。
- chg_status_life表示变化状态前景像素的生命时间图像,其像素值表示变化前景的持续时间。
- 变化状态指像素值发生变化而成为前景,并且变化后的像素值较长时间都保持稳定的状态,这一般是由静止遗留物或者静止移走物在图像中产生。
【举例】
无。
【相关主题】
ss_mpi_ive_ann_mlp_load_model
【描述】
读取ann_mlp模型文件,初始化模型数据。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 文件名必须以.bin为后缀;.bin文件必须用配套工具ive_tool_xml2bin.exe生成。
- 用户需保证.bin文件的完整性和正确性。
- 该接口必须和ss_mpi_ive_ann_mlp_unload_model配套使用。
【相关主题】
ss_mpi_ive_ann_mlp_unload_model
【描述】
去初始化ANN模型数据。
【语法】
【参数】
【返回值】
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
该接口必须和ss_mpi_ive_ann_mlp_load_model配套使用。
【举例】
无。
【相关主题】
ss_mpi_ive_ann_mlp_predict
【描述】
创建同一模型多个样本ann_mlp预测任务。
【语法】
td_s32 ss_mpi_ive_ann_mlp_predict(ot_ive_handle *handle, const ot_svp_src_data *src, const ot_svp_lut *actv_func_table, const ot_ive_ann_mlp_model *model, const ot_svp_dst_data *dst, td_bool is_instant);
【参数】
注:SQ16.16、SQ8.16等定点表示说明参看“定点数据类型”。
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 原理与OpenCV中ann_mlp类似。
- 激活函数公式
Identity激活函数:
。
Sigmoid对称激活函数:
。
- Gaussian激活函数:
。 - 输入样本向量(输入层)维数最大1024维,输出预测结果向量(输出层)维数及各隐藏层神经元个数最大为256。
- 支持2中数据精度类型,参考ot_ive_ann_mlp_accurate。
- activ_func_table是用于激活函数
计算的查找表,其数据均为S1Q15类型数据,最多4096个;鉴于当前ANN中支持的Identify、Sigmoid、Gaussian激活函数为奇或偶函数,查找表仅对输入
[0, actv_func_table->table_in_upper]建表及查表;对ANN激活函数建立查找表时用于归一化的table_out_norm是表示移位的数目。 -
以layer_num = 4,layer_cnt[8] = {m0, m1, m2, m3, 0, 0, 0, 0},样本数量 = n,为例:
- 输入n个样本向量(输入层),每个向量均是包含m0个src_elem类型为SQ16.16或者SQ18.14的向量,实际计算时每个elem截断到SQ8.16或者SQ10.14:

- 输出n个预测结果向量,每个向量均是包含m3个dst_elem类型为SQ16.16或者SQ18.14的向量:

【举例】
无。
【相关主题】
ss_mpi_ive_svm_load_model
【描述】
读取SVM模型文件,初始化模型数据。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 文件名必须以.bin为后缀;.bin文件必须用配套工具ive_tool_xml2bin.exe生成。
- 用户必需保证.bin文件的完整性和正确性。
- 该接口必须和ss_mpi_ive_svm_unload_model配套使用。
【举例】
无。
【相关主题】
ss_mpi_ive_svm_unload_model
【描述】
去初始化SVM模型数据。
【语法】
【参数】
【返回值】
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
该接口必须和ss_mpi_ive_svm_load_model配套使用。
【举例】
无。
【相关主题】
ss_mpi_ive_svm_predict
【描述】
创建同一模型的多个样本svm预测任务。
【语法】
td_s32 ss_mpi_ive_svm_predict(ot_ive_handle *handle, const ot_svp_src_data *src, const ot_svp_lut *kernel_table, const ot_ive_svm_model *svm_model, const ot_svp_dst_data *dst_vote, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 原理与OpenCV中SVM_Predict类似。
-
核函数计算公式
线性核函数:

多项式核函数:

径向基核函数:

Sigmoid核函数:

-
判决函数计算公式:

-
kernel_tab是用于核函数
计算的查找表,其数据均为S1Q15类型数据,查找表元素个数参考“解决方案差异”说明;对SVM核函数建立查找表时,查找表的输入是
或者
,table_out_norm可以表示除法的除数(不能为0,SvmDivisor = table_out_norm)或者移位的数目(可以为0,此时SvmDivisor = 1 << table_out_norm),同样使用工具ive_tool_xml2bin.exe时需要将SvmDivisor作为参数传入,SvmDivisor见ive_tool_xml2bin.exe的使用说明。 -
以feature_dim = n,class_count = N,样本数量 = r,为例:
- r个输入样本向量,每个都是SQ16.16类型的n维向量(最大1024维),实际上仅支持SQ8.16,超出部分会截断:

- 输出r个预测结果向量,每个均为td_u16类型的N维向量:

【举例】
无。
【相关主题】
ss_mpi_ive_cnn_load_model
【描述】
读取cnn模型文件,初始化cnn模型数据。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 文件名必须以.bin为后缀;.bin文件必须用配套工具ive_tool_caffe(参考《IVE 工具使用指南》)生成。
- 用户必需保证.bin文件的完整性和正确性。
- 该接口必须和ss_mpi_ive_cnn_unload_model配套使用。
【举例】
无。
【相关主题】
ss_mpi_ive_cnn_unload_model
【描述】
去初始化cnn模型数据。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
该接口必须和ss_mpi_ive_cnn_load_model配套使用。
【举例】
无。
【相关主题】
ss_mpi_ive_cnn_predict
【描述】
创建一个CNN模型的单个或多个样本预测任务,并输出特征向量。
【语法】
td_s32 ss_mpi_ive_cnn_predict(ot_ive_handle *handle, const ot_svp_src_img src[], const ot_ive_cnn_model *model, const ot_svp_dst_data *dst, const ot_ive_cnn_ctrl *ctrl, td_bool is_instant);
【参数】
|
维数实际值:model-> fc_info. layer_cnt [model-> fc_info. layer_num-1] |
注:SQ18.14定点表示说明参看“定点数据类型”。
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 若训练时对数据做了预处理(如减去均值),则需要输入数据在调用该接口前做同样的数据预处理(调用接口前减去均值)。
- 训练要求对数据做[0, 255]到[0, 1]的归一化,即训练的.prototxt中对原始数据必须有“transform_param{scale: 0.00390625}”;在调用该接口预测时不需要做归一化,硬件内部会自动处理。
-
ctrl->mem内存分配至少需分配:
ive_align(m * ctrl->num * sizeof(td_u32), 16) + ive_align(model->fc_info.layer_cnt[0]* sizeof(td_u32), 16)* ctrl->num,
其中,model->type为U8C1时,m=1;为U8C3_PLANAR时,m=3。
-
样本数组src[]的图像类型、宽、高必须与CNN网络模型中model中的type、width、height一致,数组元素个数为ctrl-> num。
-
特征向量数组dst的向量数目dst->height与图像数目ctrl->num相等。
输出的特征向量内存如图1所示,每个向量维数dim = model-> fc_info. layer_cnt [model-> fc_info. layer_num-1],向量的元素elem类型为SQ18.14,向量个数height=ctrl->num。

-
该接口和ss_mpi_ive_cnn_get_result配套使用,特征向量数组dst是ss_mpi_ive_cnn_get_result的输入。
- CNN网络模型支持最多8层Conv-ReLU-Pooling和8层全连接层;Conv-ReLU-Pooling层的卷积核仅支持3x3,ReLU(Rectified Linear Units)和Pooling可配(见ot_ive_cnn_actv_func和ot_ive_cnn_pooling),每层Conv-ReLU-Pooling最多输出50张feature map;全连接层仅支持ReLU激活函数,层数范围[3, 8]:全连接输入层(即Conv-ReLU-Pooling的最终输出)维数[1, 1024],中间隐藏层神经元数目[2,256],输出层维数[1, 256]。具体参数配置参见下列表格:
表 1 cnn模型中单层Conv-ReLU-Pooling运算包参数配置表
表 2 cnn模型中全连接运算包参数配置表
-
以单个输入样本,n+1(1≤n+1≤8)层Conv-ReLU-Pooling和m+1(3≤m+1≤8)层全连接层为例,CNN网络模型如图2所示。注意图示中,FCL-0是Pooling-n各图像数据拉成的列向量,实际计算过程中Pooling-n的结果会直接以FCL-0的形式输出。

【举例】
无。
【相关主题】
ss_mpi_ive_cnn_get_result
【描述】
接收cnn_predict结果,执行softmax运算来预测每个样本图像的类别,并输出置信度最高的类别(Rank-1)以及对应的置信度。
【语法】
td_s32 ss_mpi_ive_cnn_get_result(const ot_svp_src_data *src, const ot_svp_dst_mem_info *dst, const ot_ive_cnn_model *model, const ot_ive_cnn_ctrl *ctrl);
【参数】
源数据指针。源数据为ss_mpi_ive_cnn_predict的输出。不能为空。 |
||
预测结果结构体指针,指向ot_ive_cnn_result的数组,表示各个样本的类别和置信度。 |
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 源数据src必须为ss_mpi_ive_cnn_predict的输出,model和ctrl必须与调用时的参数一致。
- 预测结果dst指向ot_ive_cnn_result的数组,数组元素数目n=ctrl->num,其内存排布如图1所示。

- 该接口实现的rank-1版本,用户可根据自己的需求实现rank-n(表示最可能的n类)版本,步骤如下:
- 通过softmax计算出每个类别的置信度;
- 对置信度进行排序;
- 输出rank-n的结果。
【举例】
无。
【相关主题】
ss_mpi_ive_persp_trans
【描述】
根据输入源图的区域位置和点对信息做相应的透视变换。
【语法】
td_s32 ss_mpi_ive_persp_trans(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_rect_u16 roi[], const ot_svp_src_mem_info point_pair[], const ot_svp_dst_img dst[], const ot_ive_persp_trans_ctrl *ctrl, td_bool is_instant);
【参数】
|
||
做透视变换的点对信息。点对坐标基于roi图像,坐标系原点位于roi左上角点,x方向朝右,y方向朝下,点对坐标不能超过roi区域。另外当点对坐标超过256,结果有可能不对,建议roi大小及点对坐标在256之内。 |
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 所有区域的透视变换算法模式相同。
-
点对point_pair在内存的排布格式:

SrcX_PPN为第N个点对源X坐标,SrcY_PPN为第N个点对源Y坐标,DstX_PPN为第N个点对目的X坐标,DstY_PPN为第N个点对目的Y坐标。坐标都是用u14q2表示。
-
算法原理描述:
仿射变换是投影变换的一种特殊形式,从数学的角度看,仿射变换就是向量经过一次线性变换加一次平移变换,用公式可以表示为:
其中,
为变换前原始向量,
为变换后目标向量,A为线性变换矩阵,
为平移变换向量。公式可以统一描述成下面的矩阵的形式以方便计算和理解:
在图像处理中,向量就是二维坐标(x, y),所以上面的矩阵可以改写成下面的坐标表达形式:

对于一幅图像,如果我们知道变换矩阵T,便可对图像中任何一点进行仿射变换。由于T是一个3x3的矩阵,要求解该矩阵需要至少三组已知点对。根据不同的变换矩阵系数的组合,图像几何矫正就是在各种选定的图像变换(例如平移,缩放,旋转,斜切和透视等,如图1所示)方式下,利用标定的原图像和目标图像的基准点对,求解得到变换矩阵,然后用该变换矩阵对源图像做变化得到矫正后的目标图像:

图像透视变换应用广泛,下面以_图像分析_中的人脸矫正为例进行说明。典型的_图像分析_应用如图2所示,首先利用人脸的关键点检测算法将人脸的关键点Landmark(LMK)检测出来,不同的关键点检测算法检测到的关键点的个数各异,persp_trans算子支持最大68个关键点基准点对,通过人脸的关键点点对,建立超定线性方程并求解得到变换矩阵,将检测到的人脸几何矫正后裁剪到标准图像大小。

本算子目前支持的变换方式包括平移、缩放、旋转和斜切,求解得到的变换矩阵系数是这些变换方式的融合,变换矩阵各参数对应的变换模式的物理意义分解如图3所示。

图4给出一个具体的利用5个基准点对,眼睛(2)、鼻子(1)、嘴(2)用例,利用图示的点对,求解得到图示的变换矩阵,将250x250的人脸图像变换到标准图像库96x112分辨率的图像进行_图像分析_。

【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_get_mem_size
【描述】
获取需要创建目标对象数的内存大小。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
申请通过本接口获取到的内存大小的内存,作为ss_mpi_ive_kcf_create_obj_list接口输入来创建目标链表。
【举例】
无
【相关主题】
ss_mpi_ive_kcf_create_obj_list
ss_mpi_ive_kcf_create_obj_list
【描述】
创建目标链表。
【语法】
td_s32 ss_mpi_ive_kcf_create_obj_list(const ot_svp_mem_info *mem, td_u32 max_obj_num, ot_ive_kcf_obj_list *obj_list);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 创建的目标链表只能是单线程访问。
- 多线程做跟踪不同目标,需要每个线程单独创建一个目标链表。
- obj_list只能通过调用接口操作,不能通过其他方式操作。
- 必须使用ss_mpi_ive_kcf_destroy_obj_list进行销毁,否则会造成内存泄露。
- max_obj_num必须和ss_mpi_ive_kcf_get_mem_size接口的max_obj_num保持一致。
- 如果需要多线程操作obj_list,则需要用户保证obj_list操作的同步和正确性。
- mem管理的内存和obj_list是一一对应关系,不能对应多个obj_list,否则会出现异常。
【举例】
无
【相关主题】
ss_mpi_ive_kcf_destroy_obj_list
【描述】
销毁目标链表。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
无
【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_create_gauss_peak
【描述】
创建高斯峰值。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- gauss_peak 需要用户申请内存。
- 创建高斯峰值接口只需要执行一次。
- 确保一个padding对应一个gauss_peak。如果需要多个padding,则需要多个gauss_peak。
【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_create_cos_win
【描述】
创建汉宁窗。
【语法】
td_s32 ss_mpi_ive_kcf_create_cos_win(const ot_svp_dst_mem_info *cos_win_x, const ot_svp_dst_mem_info *cos_win_y)
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- cos_win_x,cos_win_y需要用户申请内存。
- 创建汉宁窗接口只需要执行一次。
【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_get_train_obj
【描述】
获取需要训练的目标对象。
【语法】
td_s32 ss_mpi_ive_kcf_get_train_obj(td_u3q5 padding, const ot_ive_roi_info roi_info[], td_u32 obj_num, const ot_svp_mem_info *cos_win_x, const ot_svp_mem_info *cos_win_y, const ot_svp_mem_info *gauss_peak, ot_ive_kcf_obj_list *obj_list);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 本接口依赖ss_mpi_ive_kcf_create_obj_list、ss_mpi_ive_kcf_create_gauss_peak、ss_mpi_ive_kcf_create_cos_win等接口创建的信息。
-
roi_info的roi区域与padding需要满足下面的约束关系:
- width * padding / 32 必须小于等于1024,大于等于40;
- height * padding / 32 必须小于等于1024,大于等于40。
- width、height取值范围为[8, 684]。
-
使用本接口前必须确保以下三个接口调用来初始化参数cos_win_x、cos_win_y、gauss_peak和obj_list。
【举例】
无
【相关主题】
ss_mpi_ive_kcf_proc
【描述】
提交目标给硬件处理。
【语法】
td_s32 ss_mpi_ive_kcf_proc(ot_ive_handle *handle, const ot_svp_src_img *src, ot_ive_kcf_obj_list *obj_list, const ot_ive_kcf_proc_ctrl *ctrl, td_bool is_instant);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 调用本接口前必须确保至少调用一次ss_mpi_ive_kcf_get_train_obj获取到要训练的对象。
-
软件调用流程如图1所示,具体代码示例请参考sample实现。

-
算法描述如下:
KCF算法利用循环矩阵对角化等性质,将跟踪问题核化,使核化后跟踪比对的操作简化成易于并行加速的矩阵运算,提升跟踪解决方案的系统性能,KCF算法可以和HOG算子联合使用,典型的算法用例如图2所示。

跟踪问题核化、相关滤波器训练等数学推导参阅“High-speed tracking with kernelized correlation filters”,IEEE Trans. PAMI, vol.37, No. 3, March 2015.
算法的总体流程:在It帧中,在当前位置pt附近采样,训练一个回归器。来计算一个小窗口采样的响应。在It+1帧中,在前一帧位置pt附近采样,用已经训练的回归器来判断每个采样的响应。响应最强的采样作为本帧的位置pt+1。
用一个人脸跟踪图解一下上面的跟踪算法过程,如图3所示,首先对初始帧做初始化,框定一个待跟踪的ROI,对输入图像做特征提取用余弦函数窗对提取到的特征加权后, 将其用FFT变换到频域,与训练得到的相关滤波器在频域做点乘,反变换到空域后找到最强的响应位置,就是得到人脸在当前帧的预测。

图3的相关滤波器参数训练问题通过核函数和循环矩阵对角化的性质简化为矩阵运算操作,详细数学推导参阅上面里出的参考论文。
【举例】
无
【相关主题】
- ss_mpi_ive_kcf_create_obj_list
- ss_mpi_ive_kcf_create_gauss_peak
- ss_mpi_ive_kcf_create_cos_win
- ss_mpi_ive_kcf_get_train_obj
ss_mpi_ive_kcf_get_obj_bbox
【描述】
获取目标区域跟踪结果信息。
【语法】
td_s32 ss_mpi_ive_kcf_get_obj_bbox(ot_ive_kcf_obj_list *obj_list, ot_ive_kcf_bbox bbox[], td_u32 *bbox_obj_num, const ot_ive_kcf_bbox_ctrl *ctrl);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
无
【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_judge_obj_bbox_track_state
【描述】
判断目标区域跟踪状态。
【语法】
td_s32 ss_mpi_ive_kcf_judge_obj_bbox_track_state(const ot_ive_roi_info *roi_info, const ot_ive_kcf_bbox *bbox, td_bool *is_track_ok);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
当新检测的目标区域与跟踪的目标区域是同一个目标时,本接口可以利用新检测目标区域信息来判断正在跟踪的目标区域是否已经跟踪失败。
【举例】
无
【相关主题】
无
ss_mpi_ive_kcf_obj_update
【描述】
更新目标信息。
【语法】
td_s32 ss_mpi_ive_kcf_obj_update(ot_ive_kcf_obj_list *obj_list, const ot_ive_kcf_bbox bbox[], td_u32 bbox_obj_num);
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
无
【举例】
无
【相关主题】
无
ss_mpi_ive_hog
【描述】
计算给定区域的HOG(Histogram of Oriented Gradient)特征。
【语法】
td_s32 ss_mpi_ive_hog(ot_ive_handle *handle, const ot_svp_src_img *src, const ot_svp_rect_u16 roi[],const ot_svp_dst_blob dst[], const ot_ive_hog_ctrl *ctrl, td_bool is_instant);
【参数】
|
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
HOG特征存储格式:
如图1所示,HOG特征是由一个三维空间来存储:
- C表示特征的channel(固定为31)
- W表示特征的width
- H表示特征的height,每个HOG特征需要2byte存储空间
-
HOG特征的W/H 的计算公式如下:
假设ROI区域宽为RectW,高为RectH。则
W = min(136, RectW) / 4 – 2;
H = min(136, RectH) / 4 – 2;

存储格式分别是垂直切面和水平切面两个格式。图2表示垂直切面格式。图3表示水平切面格式。

垂直切面存储格式时,Stride是W做16byte对齐,需要分配的内存大小为2 * Stride * H*C

水平切面存储格式时,Stride是C (固定为31) 做16byte对齐,需要分配的内存大小为Stride * 2 * W * H。
- ROI区域的宽度和高度必须在[64, 1024]范围内,而且是8的倍数。
- HOG特征通过ot_svp_blob结构描述,类型为OT_SVP_BLOB_TYPE_U16,存储格式按照HOG特征描述的格式存储。
-
算法描述如下:
HOG是Histogram of Oriented Gridients的缩写为 HOG,是目前计算机视觉、模式识别领域很常用的一种描述图像局部纹理的特征,整体计算处理流程如图4所示。

梯度计算可以有多种方法,IVE首先计算图像每个像素各颜色分量的水平梯度
:



和垂直梯度
:



其中
为图像的像素值,计算每个像素点处各颜色分量的梯度幅值:



每个图像像素的梯度幅值:

梯度方向:

本HOG算子把图像分成若干个cells,每个cell按照360度划分为9个bin(即9维特征向量),如图5所示。

【举例】
无
【相关主题】
无
ss_mpi_ive_query
【描述】
查询已创建任务完成情况。
【语法】
【参数】
【返回值】
失败,参见错误码。 |
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 输入handle必须为调用的算子函数返回的handle。
- 在用户使用IVE任务结果前,为确保IVE任务已完成,用户可以使用阻塞方式调用此接口查询。
- IVE内部是按任务创建顺序依次执行任务的,所以用户不必每次都使用查询接口,如用户依次创建了A,B两个任务,那么如果B任务完成了,这个时候A任务肯定也完成了,此时使用A任务的结果时不必再次调用查询接口。
- 返回值为OT_ERR_IVE_QUERY_TIMEOUT(查询超时)时,可以继续查询。
- 返回值为OT_ERR_IVE_SYS_TIMEOUT(系统超时)时,用户的IVE任务必须全部重新提交。
【举例】
td_s32 ret = TD_SUCCESS;
ot_ive_handle handle;
ot_svp_src_data src;
ot_svp_dst_data dst;
ot_ive_dma_ctrl ctrl = {OT_IVE_DMA_MODE_DIRECT_COPY, 0};
td_bool is_instant;
td_bool is_finish, is_block;
src.phys_addr = 0;
src.virt_addr = 0;
src.stride = 352;
src.height = 288;
src.width = 352;
dst.phys_addr = 0;
dst.virt_addr = 0;
dst.stride = 352;
dst.height = 288;
dst.width = 352;
is_instant = TD_TRUE;
ret = ss_mpi_sys_mmz_alloc_cached(&src.phys_addr,
&((td_void*)(td_uintptr_t)src.virt_addr), "User", TD_NULL, src.height
* src.stride);
if (ret != TD_SUCCESS) {
return ret;
}
memset((td_void*)(td_uintptr_t)src.virt_addr, 1, src.height * src.stride);
ret = ss_mpi_sys_mmz_alloc_cached(&dst.phys_addr,
&((td_void*)(td_uintptr_t)dst.virt_addr), "User", TD_NULL,
dst.height * dst.stride);
if(ret != TD_SUCCESS) {
ss_mpi_sys_mmz_free(src.phys_addr,
(td_void*)(td_uintptr_t)src.virt_addr));
return ret;
}
memset((td_void*)(td_uintptr_t)dst.virt_addr, 0, dst.height * dst.stride);
ret = ss_mpi_sys_mmz_flush_cache(0, NULL, 0);
if(ret != TD_SUCCESS) {
ss_mpi_sys_mmz_free(src.phys_addr,
((td_void*)(td_uintptr_t)src.virt_addr));
ss_mpi_sys_mmz_free(dst.phys_addr,
((td_void*)(td_uintptr_t)dst.virt_addr));
return ret;
}
ret = ss_mpi_ive_dma(&handle, &src, &dst, &ctrl, is_instant);
if(ret != TD_SUCCESS) {
ss_mpi_sys_mmz_free(src.phys_addr,
((td_void*)(td_uintptr_t)src.virt_addr));
ss_mpi_sys_mmz_free(dst.phys_addr,
((td_void*)(td_uintptr_t)dst.virt_addr));
return ret;
}
is_block = TD_FALSE;
ret = ss_mpi_ive_query(handle, &is_finish, is_block);
if (ret == TD_SUCCESS) {
printf("is_finish=%d\n", is_finish);
}
ss_mpi_sys_mmz_free(src.phys_addr, ((td_void*)(td_uintptr_t)src.virt_addr));
ss_mpi_sys_mmz_free(dst.phys_addr, ((td_void*)(td_uintptr_t)dst.virt_addr));
return ret;
【相关主题】
无。
ss_mpi_ive_get_perspective_transform
【描述】
根据输入源图的区域位置和点对信息计算相应的透视变换矩阵。
【语法】
td_s32 ss_mpi_ive_get_perspective_transform(const ot_svp_src_img *src, const ot_svp_rect_u32 roi[], const ot_ive_warp_perspective_points points[], const ot_svp_dst_mem_info *inverse_matrix, const ot_ive_warp_perspective_transform_ctrl*ctrl)
【参数】
|
||
做透视变换的点对信息。点对坐标基于roi图像,坐标系原点位于roi左上角点,x方向朝右,y方向朝下,点对坐标必须小于roi区域。 |
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 所有roi区域计算透视变换矩阵的算法模式相同,与OpenCV中getPerspectiveTransform计算透视变换矩阵原理类似,通过对roi图和目标图上对应的4个点对坐标使用线性最小二乘方式计算透视变换矩阵。
- 每个roi的x、y坐标以及宽高必须是偶数。
- 当点对信息points的src_point对应roi区域,dst_point对应目标图像时,得到的透视变换矩阵inverse_matrix是正向透视变换矩阵;当点对信息points的src_point对应目标图像,dst_point对应ROI区域时,得到的透视变换矩阵inverse_matrix是反向透视变换矩阵。
- 该任务完成后,若想进一步对图像进行反向透视变换得到变换图像,需要调用ss_mpi_ive_warp_perspective接口。
【举例】
无
【相关主题】
ss_mpi_ive_warp_perspective
【描述】
根据输入源图的区域位置和点对信息做相应的透视变换。
【语法】
td_s32 ss_mpi_ive_warp_perspective(ot_ive_handle *handle, const ot_svp_src_img*src, const ot_svp_rect_u32 roi[], const ot_svp_src_mem_info *inverse_matrix, const ot_svp_dst_img dst[], const -ot_ive_warp_perspective_ctrl*ctrl, td_bool is_instant);
【参数】
|
||
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 所有roi区域的透视变换算法模式相同,与OpenCV中warpPerspective透视变换原理类似,通过后向坐标映射和像素插值得到ROI变换图像。
- 每个roi区域必须与其得到的变换图像dst的宽高保持一致。
-
roi区域的透视变换矩阵inverse_matrix在内存的排布格式:

inverse_matrix_n为第N个ROI区域对应的透视变换矩阵,每个透视变换矩阵包含9个元素,每个元素都是用float表示。每个透视变换矩阵的宽度为9*4Byte=36Byte,按照48Byte的跨度对齐。
-
使用该接口前,必须已知所有ROI区域的反向透视变换矩阵,可以选择调用ss_mpi_ive_get_perspective_transform函数获取。
【举例】
无
【相关主题】
ss_mpi_ive_get_perspective_transform
ss_mpi_ive_alpha_blending
【描述】
执行图像个别权重乘积任务。
【语法】
td_s32 ss_mpi_ive_alpha_blending(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_src_img *alpha, const ot_svp_dst_img *dst, td_bool is_instant)
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
计算公式如下:

其中,
对应src1,
对应src2,
对应alpha,
对应dst。
【举例】
无。
【相关主题】
无。
ss_mpi_ive_acc
【描述】
执行两灰度图像的累积运算任务。
【语法】
td_s32 ss_mpi_ive_acc(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, const ot_ive_acc_ctrl*ctrl, td_bool is_instant)
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
- 可以配置3种输出格式,具体参见ot_ive_acc_mode。
-
OT_IVE_ACC_MODE_INCREASE
- 计算公式:

- 计算公式:
-
OT_IVE_ACC_MODE_DECREASE
- 计算公式:

- 计算公式:
-
OT_IVE_ACC_MODE_INCREASE_MAP_255TO1
- 计算公式:

其中,
对应src1,
对应src2,
对应dst。 - 计算公式:
【举例】
无。
【相关主题】
无。
ss_mpi_ive_image_dot
【描述】
执行图像点乘积任务。
【语法】
td_s32 ss_mpi_ive_image_dot(ot_ive_handle *handle, const ot_svp_src_img *src1, const ot_svp_src_img *src2, const ot_svp_dst_img *dst, const ot_ive_image_dot_ctrl *ctrl, td_bool is_instant)
【参数】
【返回值】
失败,参见错误码。 |
【解决方案差异】
【需求】
- 头文件:ot_common_ive.h、ot_common_svp.h、ss_mpi_ive.h
- 库文件:libss_mpi_ive.a(PC上模拟用ss_ive_clib2.x.lib)
【注意】
-
计算公式如下:

每一个输入源的元素都是由16个整数,15个小数和1个符号所组成的。
【举例】
无。
【相关主题】
无
数据类型和数据结构
SVP相关数据类型、数据结构定义如下:
- ot_svp_img_type:定义二维广义图像支持的图像类型。
- ot_svp_img:定义二维广义图像信息。
- ot_svp_src_img:定义源图像。
- ot_svp_dst_img:定义输出图像。
- ot_svp_blob_type:定义blob的数据内存排布。
- ot_svp_blob:定义多个连续存放的blob信息。
- ot_svp_src_blob:定义源序列。
- ot_svp_dst_blob:定义输出序列。
- ot_svp_mem_info:定义一维内存信息。
- ot_svp_src_mem_info:定义一维输入内存信息。
- ot_svp_dst_mem_info:定义一维输出内存信息。
- OT_SVP_IMG_ADDR_NUM:定义地址通道数目。
- OT_SVP_IMG_STRIDE_NUM:定义跨度数组长度。
定点数据类型:
- ot_svp_data:定义以byte为单位的二维图像信息。
- ot_svp_src_data:定义以byte为单位的二维源数据信息。
- ot_svp_dst_data:定义byte为单位的二维输出数据信息。
- ot_svp_8bit:定义8bit数据联合体。
- ot_svp_point_u16:定义u16bit的点信息结构体。
- ot_svp_point_s16:定义s16bit的点信息结构体。
- ot_svp_point_s25q7:定义s25q7表示的点信息结构体。
- ot_svp_point_u14q2:定义u14q2表示的点信息结构体。
- ot_svp_rect_u32:定义u32表示的矩形信息结构体。
- ot_svp_rect_u16:定义u16表示的矩形信息结构体。
- ot_svp_rect_s24q8:定义s24q8表示的矩形信息结构体。
- ot_svp_lut:定义查找表结构体。
IVE相关数据类型、数据结构定义如下:
- ot_ive_handle:定义IVE句柄。
- OT_IVE_HIST_NUM:定义直方图统计bin数目。
- OT_IVE_MAP_NUM:定义映射查找表项数目。
- OT_IVE_MAX_RGN_NUM:定义最大连通区域数目。
- OT_IVE_ST_MAX_CORNER_NUM:定义Shi-Tomasi-like角点最大数目。
- OT_IVE_MASK_NUM:掩码mask数组长度
- OT_IVE_MASK_NUM_121:定义掩码mask数组长度121。
- OT_IVE_PADDING_ARR_NUM:定义补边数组长度。
- OT_IVE_ARR_RESERVED_NUM_TWO:保留字段数组长度2
- OT_IVE_ARR_RESERVED_NUM_THREE:保留字段数组长度3
- OT_IVE_ARR_RESERVED_NUM_EIGHT:保留字段数组长度8
- OT_IVE_ARR_RESERVED_NUM_TWELVE:保留字段数组长度12
- OT_IVE_ARR_RESERVED_NUM_FOURTEEN:保留字段数组长度14
- OT_IVE_ARR_NUM_THREE:数组长度3
- OT_IVE_ARR_NUM_EIGHT:数组长度8
- OT_IVE_DEV_NAME_LENGTH:IVE设备名字的长度。
- OT_IVE_DEFAULT_NODE_NUM:默认的IVE节点个数。
- ot_ive_mod_param:IVE模块相关参数定义。
- ot_ive_err_code:定义错误码。
- ot_ive_dma_mode:定义DMA运算模式。
- ot_ive_dma_mask_mode:定义DMA 掩码操作模式。
- ot_ive_dma_ctrl:定义DMA控制信息。
- ot_ive_padding_mode:定义补边模式。
- ot_ive_filter_ctrl:定义模板滤波控制信息。
- ot_ive_csc_mode:定义色彩空间转换模式。
- ot_ive_csc_ctrl:定义色彩空间转换控制信息。
- ot_ive_filter_and_csc_ctrl:定义模板滤波加色彩空间转换复合功能控制信息。
- ot_ive_sobel_out_ctrl:定义sobel输出控制信息。
- ot_ive_sobel_ctrl:定义sobel边缘提取控制信息。
- ot_ive_mag_and_ang_out_ctrl:定义canny边缘幅值与角度计算的输出格式。
- ot_ive_mag_and_ang_ctrl:定义canny边缘幅值和幅角计算的控制信息。
- ot_ive_dilate_ctrl:定义膨胀控制信息。
- ot_ive_erode_ctrl:定义腐蚀控制信息。
- ot_ive_threshold_mode:定义图像二值化输出格式。
- ot_ive_threshold_ctrl:定义图像二值化控制信息。
- ot_ive_sub_mode:定义两图像相减输出格式。
- ot_ive_sub_ctrl:定义两图像相减控制参数。
- ot_ive_integ_out_ctrl:定义积分图输出控制参数。
- ot_ive_integ_ctrl:定义积分图计算控制参数。
- ot_ive_threshold_s16_mode:定义16bit有符号图像的阈值化模式。
- ot_ive_threshold_s16_ctrl:定义16bit有符号图像的阈值化控制参数。
- ot_ive_threshold_u16_mode:定义16bit无符号图像的阈值化模式。
- ot_ive_threshold_u16_ctrl:定义16bit无符号图像的阈值化控制参数。
- ot_ive_16bit_to_8bit_mode:定义16bit图像到8bit图像的转化模式。
- ot_ive_16bit_to_8bit_ctrl:定义16bit图像到8bit图像的转化控制参数。
- ot_ive_order_stats_filter_mode:定义顺序统计量滤波模式。
- ot_ive_order_stats_filter_ctrl:定义顺序统计量滤波控制参数。
- ot_ive_map_u8bit_lut_mem:定义Map U8C1→U8C1的查找表内存。
- ot_ive_map_u16bit_lut_mem:定义Map U8C1→U16C1的查找表内存。
- ot_ive_map_s16bit_lut_mem:定义Map U8C1→S16C1的查找表内存。
- ot_ive_map_mode:定义Map的模式。
- ot_ive_map_ctrl:定义Map控制参数。
- ot_ive_equalize_hist_ctrl_mem:定义直方图均衡化辅助内存。
- ot_ive_equalize_hist_ctrl:定义直方图均衡化控制参数。
- ot_ive_add_ctrl:定义两图像的加权加控制参数。
- ot_ive_ncc_dst_mem:定义NCC的输出内存信息。
- ot_ive_rgn:定义连通区域信息。
- ot_ive_ccblob:定义连通区域标记的输出信息。
- ot_ive_ccl_mode:定义连通区域模式。
- ot_ive_ccl_ctrl:定义连通区域标记控制参数。
- ot_ive_gmm_ctrl:定义GMM背景建模的控制参数。
- ot_ive_gmm2_sns_factor_mode:定义灵敏度系数模式。
- ot_ive_gmm2_life_update_factor_mode:定义模型时长参数更新模式。
- ot_ive_gmm2_ctrl:定义GMM2背景建模的控制参数。
- ot_ive_canny_stack_size:定义Canny边缘前半部分计算时强边缘点栈大小结构体。
- ot_ive_canny_hys_edge_ctrl:定义Canny边缘前半部分计算任务的控制参数。
- ot_ive_lbp_compare_mode:定义LBP纹理计算控制参数。
- ot_ive_lbp_ctrl:定义LBP纹理计算控制参数。
- ot_ive_norm_grad_out_ctrl:定义归一化梯度信息计算任务输出控制枚举类型。
- ot_ive_norm_grad_ctrl:定义归一化梯度信息计算控制参数。
- ot_ive_lk_optical_flow_pyr_out_mode:定义金字塔LK光流计算输出模式。
- ot_ive_lk_optical_flow_pyr_ctrl:定义金字塔LK光流计算控制参数。
- ot_ive_st_max_eig_val:定义Shi-Tomas-like角点计算时最大角点响应值结构体。
- ot_ive_st_cand_corner_ctrl:定义Shi-Tomas-like候选角点计算控制参数。
- ot_ive_st_corner_info:定义Shi-Tomas-like角点计算输出的角点信息结构体。
- ot_ive_st_corner_ctrl:定义Shi-Tomas-like角点筛选控制参数。
- ot_ive_sad_mode:定义SAD计算模式。
- ot_ive_sad_out_ctrl:定义SAD输出控制模式。
- ot_ive_sad_ctrl:定义SAD控制参数。
- ot_ive_resize_mode:定义Resize的模式。
- ot_ive_resize_ctrl:定义Resize控制参数。
- ot_ive_grad_fg_mode:定义梯度前景计算模式。
- ot_ive_grad_fg_ctrl:定义计算梯度前景控制参数。
- ot_ive_cand_bg_pixel:定义候选背景模型数据。
- ot_ive_wrok_bg_pixel:定义工作背景模型数据。
- ot_ive_bg_life:定义背景生命力数据。
- ot_ive_bg_model_pixel:定义背景模型数据。
- ot_ive_fg_status_data:定义前景状态数据。
- ot_ive_bg_status_data:定义背景状态数据。
- ot_ive_match_bg_model_ctrl:定义背景匹配控制参数。
- ot_ive_update_bg_model_ctrl:定义背景更新控制参数。
- ot_ive_ann_mlp_accurate:定义ann_mlp输入特征向量类型。
- ot_ive_ann_mlp_actv_func:定义ann_mlp激活函数枚举类型。
- ot_ive_ann_mlp_model:定义ann_mlp模型数据结构体。
- ot_ive_svm_type:定义SVM类型。
- ot_ive_svm_kernel_type:定义SVM核函数类型。
- ot_ive_svm_model:定义SVM模型数据结构体。
- ot_ive_cnn_actv_func:定义CNN激活函数枚举类型。
- ot_ive_cnn_pooling:定义CNN汇聚操作枚举类型。
- ot_ive_cnn_conv_pooling:定义CNN单层Conv-ReLU-Pooling运算包参数结构体。
- ot_ive_cnn_fc_info:定义CNN全链接网络参数结构体。
- ot_ive_cnn_model:定义CNN模型参数结构体。
- ot_ive_cnn_ctrl:定义CNN预测任务的控制参数。
- ot_ive_cnn_result:定义CNN单个样本预测结果结构体。
- ot_ive_persp_trans_point_pair:定义透视变换点对结构体。
- ot_ive_persp_trans_alg_mode:定义透视变换算法模式枚举。
- ot_ive_persp_trans_csc_mode:定义透视变换色彩空间转换模式。
- ot_ive_persp_trans_ctrl:定义透视变换控制参数。
- ot_ive_kcf_core_id:定义KCF的核ID。
- ot_ive_roi_info:定义目前区域信息参数。
- ot_ive_kcf_proc_ctrl:定义跟踪处理控制参数。
- ot_ive_list_head:定义链表头结构体参数。
- ot_ive_kcf_obj:定义目标信息结构体参数。
- ot_ive_kcf_obj_node:定义目标链表节点参数。
- ot_ive_kcf_list_state:定义目标链表状态枚举类型。
- ot_ive_kcf_obj_list:定义目标链表结构参数。
- ot_ive_kcf_bbox:定义目标区域信息参数。
- ot_ive_kcf_bbox_ctrl:定义目标区域信息控制参数。
- ot_ive_hog_mode:定义HOG(Histogram of Oriented Gradient)特征存储模式枚举类型。
- ot_ive_hog_ctrl:定义计算HOG(Histogram of Oriented Gradient)特征控制参数。
SVP相关数据类型、数据结构
ot_svp_img_type
【说明】
定义二维广义图像支持的图像类型。
【定义】
/* Img type */
typedef enum {
OT_SVP_IMG_TYPE_U8C1 = 0x0,
OT_SVP_IMG_TYPE_S8C1 = 0x1,
OT_SVP_IMG_TYPE_YUV420SP = 0x2, /* YUV420 SemiPlanar */
OT_SVP_IMG_TYPE_YUV422SP = 0x3, /* YUV422 SemiPlanar */
OT_SVP_IMG_TYPE_YUV420P = 0x4, /* YUV420 Planar */
OT_SVP_IMG_TYPE_YUV422P = 0x5, /* YUV422 planar */
OT_SVP_IMG_TYPE_S8C2_PACKAGE = 0x6,
OT_SVP_IMG_TYPE_S8C2_PLANAR = 0x7,
OT_SVP_IMG_TYPE_S16C1 = 0x8,
OT_SVP_IMG_TYPE_U16C1 = 0x9,
OT_SVP_IMG_TYPE_U8C3_PACKAGE = 0xa,
OT_SVP_IMG_TYPE_U8C3_PLANAR = 0xb,
OT_SVP_IMG_TYPE_S32C1 = 0xc,
OT_SVP_IMG_TYPE_U32C1 = 0xd,
OT_SVP_IMG_TYPE_S64C1 = 0xe,
OT_SVP_IMG_TYPE_U64C1 = 0xf,
OT_SVP_IMG_TYPE_BUTT
} ot_svp_img_type;
【成员】
每个像素用1个8bit无符号数据表示的单通道图像。请参见图2。 |
|
每个像素用1个8bit有符号数据表示的单通道图像。请参见图2。 |
|
|
请参见图3。 |
|
|
请参见图4。 |
|
YUV420 Planar格式的图像。请参见图5。 |
|
YUV422 Planar格式的图像。请参见图6。 |
|
每个像素用2个8bit有符号数据表示,且以package格式存储2通道图像。 请参见图7。 |
|
每个像素用2个8bit有符号数据表示,且以planar格式存储2通道图像。 请参见图8。 |
|
每个像素用1个16bit有符号数据表示单通道图像。请参见图2。 |
|
每个像素用1个16bit无符号数据表示单通道图像。请参见图2。 |
|
每个像素用3个8bit无符号数据表示且以Package格式存储3通道图像。 请参见图9。 |
|
每个像素用3个8bit无符号数据表示1个像素的3通道图像,且以planar格式存储。 请参见图10。 |
|
每个像素用1个32bit有符号数据表示单通道图像。请参见图2。 |
|
每个像素用1个32bit无符号数据表示单通道图像。请参见图2。 |
|
每个像素用1个64bit有符号数据表示单通道图像。请参见图2。 |
|
每个像素用1个64bit无符号数据表示单通道图像。请参见图2。 |
【注意事项】
无。
【相关数据类型及接口】
ot_svp_img
【说明】
定义二维广义图像信息。
【定义】
typedef struct {
td_u64 phys_addr[OT_SVP_IMG_ADDR_NUM]; /* RW;The physical address of the image */
td_u64 virt_addr[OT_SVP_IMG_ADDR_NUM]; /* RW;The virtual address of the image */
td_u32 stride[OT_SVP_IMG_STRIDE_NUM]; /* RW;The stride of the image */
td_u32 width; /* RW;The width of the image */
td_u32 height; /* RW;The height of the image */
ot_svp_img_type type; /* RW;The type of the image */
} ot_svp_img;
【成员】
phys_addr[OT_SVP_IMG_ADDR_NUM] |
|
virt_addr[OT_SVP_IMG_ADDR_NUM] |
|
stride[OT_SVP_IMG_STRIDE_NUM] |
|
【注意事项】
【相关数据及接口】
ot_svp_src_img
【说明】
定义源图像。
【定义】
【成员】
无
【注意事项】
无
【相关数据及接口】
ot_svp_dst_img
【说明】
定义输出图像。
【定义】
【成员】
无
【注意事项】
无
【相关数据及接口】
ot_svp_blob_type
【说明】
定义blob的数据内存排布。
【定义】
typedef enum {
OT_SVP_BLOB_TYPE_S20Q12 = 0x0,
OT_SVP_BLOB_TYPE_U8 = 0x1,
OT_SVP_BLOB_TYPE_YVU420SP = 0x2, /* channel = 3 */
OT_SVP_BLOB_TYPE_YVU422SP = 0x3, /* channel = 3 */
OT_SVP_BLOB_TYPE_VEC_S20Q12 = 0x4,
OT_SVP_BLOB_TYPE_SEQ_S20Q12 = 0x5,
OT_SVP_BLOB_TYPE_BBOX_S20Q12 = 0x6,
OT_SVP_BLOB_TYPE_BSI_SQ32 = 0x7,
OT_SVP_BLOB_TYPE_S12Q20 = 0x8,
OT_SVP_BLOB_TYPE_VEC_S12Q20 = 0x9,
OT_SVP_BLOB_TYPE_S32 = 0xa,
OT_SVP_BLOB_TYPE_U32 = 0xb,
OT_SVP_BLOB_TYPE_FP32 = 0xc,
OT_SVP_BLOB_TYPE_FP16 = 0xd,
OT_SVP_BLOB_TYPE_S8 = 0xe,
OT_SVP_BLOB_TYPE_S16 = 0xf,
OT_SVP_BLOB_TYPE_U16 = 0x10,
OT_SVP_BLOB_TYPE_BUTT
}ot_svp_blob_type;
【成员】
Blob数据元素为S20Q12类型,参考图15 |
|
Blob数据元素为U8类型,参考图16 |
|
Blob数据内存排布为YVU420SP,参考图17。 |
|
Blob数据内存排布为YVU422SP,参考图18。 |
|
Blob中存储向量,每个元素为S20Q12类型,参考图19。 |
|
Blob中存储序列,数据元素为S20Q12类型,排布见图20。 |
|
Blob中存储坐标,数据元素为S20Q12类型,排布见图21。 |
|
Blob中存储坐标、分值和类别,数据元素为32bit的量化数据,排布见图22。 |
|
Blob数据元素为S12Q20类型,参考图22 |
|
Blob中存储向量,每个元素为S12Q20类型,参考图24。 |
|
Blob数据元素为32bit有符号整型,参考图25 |
|
Blob数据元素为32bit无符号整型,参考图26 |
|
Blob数据元素为32bit浮点型,参考图27 |
|
Blob数据元素为16bit浮点型,参考图28 |
|
Blob数据元素为8bit有符号整型,参考图29 |
|
Blob数据元素为16bit有符号整型,参考图30 |
|
Blob数据元素为16bit无符号整型,参考图31 |
【注意事项】
无。
【相关数据类型及接口】
ot_svp_blob
【说明】
定义多个连续存放的blob信息。
【定义】
typedef struct {
ot_svp_blob_type type;
td_u32 stride;
td_u64 virt_addr;
td_u64 phys_addr;
td_u32 num;
union {
struct {
td_u32 width;
td_u32 height;
td_u32 chn;
} whc;
struct {
td_u32 dim;
td_u64 virt_addr_step;
} seq;
} shape;
} ot_svp_blob;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_svp_src_blob
【说明】
定义源序列。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
ot_svp_dst_blob
【说明】
定义输出序列。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
ot_svp_mem_info
【说明】
定义一维内存信息。
【定义】
【成员】
内存块字节数。见图12。 |
【注意事项】
无。
【相关数据类型及接口】
ot_svp_src_mem_info
【说明】
定义一维输入内存信息。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
ot_svp_dst_mem_info
【说明】
定义一维输出内存信息。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
OT_SVP_IMG_ADDR_NUM
【说明】
定义地址通道数目。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_SVP_IMG_STRIDE_NUM
【说明】
定义跨度数组长度。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
ot_svp_point_float
【说明】
定义float表示的点信息结构体。
【定义】
typedef struct {
td_float x; /* RW;The X coordinate of the point */
td_float y; /* RW;The Y coordinate of the point */
} ot_svp_point_float;
【成员】
【注意事项】
无
【相关数据类型及接口】
无
定点数据类型
【说明】
定义定点化的数据类型。
【定义】
typedef unsigned char td_u0q8;
typedef unsigned char td_u1q7;
typedef unsigned char td_u5q3;
typedef unsigned char td_u3q5;
typedef unsigned short td_u0q16;
typedef unsigned short td_u4q12;
typedef unsigned short td_u6q10;
typedef unsigned short td_u8q8;
typedef unsigned short td_u9q7;
typedef unsigned short td_u12q4;
typedef unsigned short td_u14q2;
typedef unsigned short td_u5q11;
typedef unsigned short td_u1q15;
typedef unsigned short td_u2q14;
typedef td_u6q10 td_ufp16;
typedef short td_s9q7;
typedef short td_s14q2;
typedef short td_s1q15;
typedef unsigned int td_u22q10;
typedef unsigned int td_u25q7;
typedef unsigned int td_u21q11;
typedef unsigned int td_u14q18;
typedef unsigned int td_u8q24;
typedef unsigned int td_u4q28;
typedef int td_s25q7;
typedef int td_s16q16;
typedef int td_s14q18;
typedef int td_s20q12;
typedef int td_s24q8;
typedef unsigned short td_u8q4f4;
【成员】
【注意事项】
td_uxqyfz\td_sxqy:
- u后面的数字x表示是用x bit无符号数据表示整数部分;
- s后面的数字x表示用x bit有符号数据表示整数部分;
- q后面的数字y表示用y bit 数据表示小数部分;
- f后面的数字z表示用z bit 来表示标志位;
- 从左到右依次表示高bit位到低bit位。
【相关数据类型及接口】
无。
ot_svp_data
【说明】
定义以byte为单位的二维数据信息。
【定义】
typedef struct {
td_u64 phys_addr; /* RW;The physical address of the data */
td_u64 virt_addr; /* RW;The virtual address of the data */
td_u32 stride; /* RW;The stride of 2D data by byte */
td_u32 width; /* RW;The width of 2D data by byte */
td_u32 height; /* RW;The height of 2D data by byte */
td_u32 reserved;
} ot_svp_data;
【成员】
【注意事项】
表示以byte为单位的二维数据;可以与ot_svp_img图像进行转换。
【相关数据类型及接口】
无。
ot_svp_src_data
【说明】
定义以byte为单位的二维源数据信息。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
ot_svp_dst_data
【说明】
定义byte为单位的二维输出数据信息。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
ot_svp_8bit
【说明】
定义8bit数据联合体。
【定义】
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_svp_point_u16
【说明】
定义u16表示的点信息结构体。
【定义】
typedef struct {
td_u16 x; /* RW;The X coordinate of the point */
td_u16 y; /* RW;The Y coordinate of the point */
} ot_svp_point_u16;
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_svp_point_s16
【说明】
定义s16表示的点信息结构体。
【定义】
typedef struct {
td_s16 x; /* RW;The X coordinate of the point */
td_s16 y; /* RW;The Y coordinate of the point */
} ot_svp_point_s16;
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_svp_point_s25q7
【说明】
定义s25q7表示的点信息结构体。
【定义】
typedef struct {
td_s25q7 x; /* RW;The X coordinate of the point */
td_s25q7 y; /* RW;The Y coordinate of the point */
} ot_svp_point_s25q7;
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_svp_point_u14q2
【说明】
定义u14q2表示的点信息结构体。
【定义】
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_svp_rect_u32
【说明】
定义u32表示的矩形信息结构体。
【定义】
typedef struct {
td_u32 x; /* RW;The location of X axis of the rectangle */
td_u32 y; /* RW;The location of Y axis of the rectangle */
td_u32 width; /* RW;The width of the rectangle */
td_u32 height; /* RW;The height of the rectangle */
} ot_svp_rect_u32;
【成员】
【注意事项】
无
【相关数据类型及结构】
无
ot_svp_rect_u16
【说明】
定义u16表示的矩形信息结构体。
【定义】
typedef struct {
td_u16 x; /* RW;The location of X axis of the rectangle */
td_u16 y; /* RW;The location of Y axis of the rectangle */
td_u16 width; /* RW;The width of the rectangle */
td_u16 height; /* RW;The height of the rectangle */
} ot_svp_rect_u16;
【成员】
【注意事项】
无
【相关数据类型及结构】
无
ot_svp_rect_s24q8
【说明】
定义s24q8表示的矩形信息结构体。
【定义】
【成员】
【注意事项】
无
【相关数据类型及结构】
无
ot_svp_lut
【说明】
定义查找表结构体。
【定义】
typedef struct {
ot_svp_mem_info table;
td_u16 elem_num; /* RW;LUT's elements number */
td_u8 table_in_precision;
td_u8 table_out_norm;
td_s32 table_in_lower; /* RW;LUT's original input lower limit */
td_s32 table_in_upper; /* RW;LUT's original input upper limit */
} ot_svp_lut;
【成员】
建立查找表的精度,(table_in_upper - table_in_lower)/(1<< table_in_precision)表示建立查找表的间隔 |
|
【注意事项】
无
【相关数据类型及结构】
无
IVE相关数据类型、数据结构
ot_ive_handle
【说明】
定义IVE句柄。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_IVE_HIST_NUM
【说明】
定义直方图统计bin数目。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_IVE_MAP_NUM
【说明】
定义映射查找表项数目。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_IVE_MAX_RGN_NUM
【说明】
定义最大连通区域数目。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_IVE_ST_MAX_CORNER_NUM
【说明】
定义Shi-Tomasi-like角点最大数目。
【定义】
【成员】
无。
【注意事项】
无。
【相关数据类型及接口】
无。
OT_IVE_MASK_NUM
【说明】
掩码mask对应的数组长度。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_MASK_NUM_121
【说明】
定义掩码mask数组长度121。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_PADDING_ARR_NUM
【说明】
定义补边数组长度。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_RESERVED_NUM_TWO
【说明】
保留字段数组长度2。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_RESERVED_NUM_THREE
【说明】
保留字段数组长度3。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_RESERVED_NUM_EIGHT
【说明】
保留字段数组长度8。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_RESERVED_NUM_TWELVE
【说明】
保留字段数组长度12。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_RESERVED_NUM_FOURTEEN
【说明】
保留字段数组长度14。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_NUM_THREE
【说明】
数组长度3。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_ARR_NUM_EIGHT
【说明】
数组长度8。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_DEV_NAME_LENGTH
【说明】
IVE设备名字的长度。
【定义】
【成员】
无
【相关数据类型及接口】
无
OT_IVE_DEFAULT_NODE_NUM
【说明】
默认的IVE节点个数。
【定义】
Hi3519DV500:
Hi3516CV610:
【成员】
无
【相关数据类型及接口】
无
OT_IVE_WARP_PERSPECTIVE_POINT_NUM
【说明】
透视变换点对数量。
【定义】
【成员】
无
【相关数据类型及接口】
无
ot_ive_mod_param
【说明】
IVE模块相关参数定义。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ive_std_mod_init
ot_ive_err_code
【说明】
定义错误码。
【定义】
typedef enum {
OT_IVE_ERR_SYS_TIMEOUT = 0x40, /* IVE process timeout */
OT_IVE_ERR_QUERY_TIMEOUT = 0x41, /* IVE query timeout */
OT_IVE_ERR_BUS_ERR = 0x42, /* IVE BUS error */
OT_IVE_ERR_OPEN_FILE = 0x43, /* IVE open file error */
OT_IVE_ERR_READ_FILE = 0x44, /* IVE read file error */
OT_IVE_ERR_BUTT
} ot_ive_err_code;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_dma_mode
【说明】
定义dma操作模式。
【定义】
typedef enum {
OT_IVE_DMA_MODE_DIRECT_COPY = 0x0,
OT_IVE_DMA_MODE_INTERVAL_COPY = 0x1,
OT_IVE_DMA_MODE_SET_3BYTE = 0x2,
OT_IVE_DMA_MODE_SET_8BYTE = 0x3,
OT_IVE_DMA_MODE_MASK = 0x4,
OT_IVE_DMA_MODE_BUTT
} ot_ive_dma_mode;
【成员】
间隔拷贝模式,请参见ss_mpi_ive_dma【注意】说明。 |
|
3byte赋值模式,请参见ss_mpi_ive_dma【注意】说明。 |
|
8byte赋值模式,请参见ss_mpi_ive_dma【注意】说明。 |
|
掩码拷贝模式,请参见ss_mpi_ive_dma【注意】说明。 |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_dma_mask_mode
【说明】
定义dma 掩码操作模式。
【定义】
typedef enum {
OT_IVE_DMA_MASK_MODE_32BIT = 0x0,
OT_IVE_DMA_MASK_MODE_24BIT = 0x1,
OT_IVE_DMA_MASK_MODE_BUTT
} ot_ive_dma_mask_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_dma_ctrl
【说明】
定义dma控制信息。
【定义】
typedef struct {
ot_ive_dma_mode mode;
ot_ive_dma_mask_mode hor_mask_mode;
ot_ive_dma_mask_mode ver_mask_mode;
td_u64 val;
td_u32 hor_mask;
td_u32 ver_mask;
td_u8 hor_seg_size;
td_u8 elem_size;
td_u8 ver_seg_rows;
} ot_ive_dma_ctrl;
【成员】
仅间隔拷贝模式使用,将每ver_seg_rows行中第一行数据分割为hor_seg_size大小的段,拷贝每段中的前elem_size大小的字节 |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_padding_mode
【说明】
定义补边模式。
【定义】
typedef enum {
OT_IVE_PADDING_MODE_EDGE = 0x0,
OT_IVE_PADDING_MODE_CONSTANT = 0x1,
OT_IVE_PADDING_MODE_BUTT
} ot_ive_padding_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_filter_ctrl
【说明】
定义模板滤波控制信息。
【定义】
typedef struct {
td_s8 mask[OT_IVE_MASK_NUM_121]; /* Template parameter filter coefficient */
td_u8 norm; /* Normalization parameter, by right shift */
td_u8 kernel_w;
td_u8 kernel_h;
ot_ive_padding_mode padding_mode;
td_s32 padding_val[OT_IVE_PADDING_ARR_NUM];
} ot_ive_filter_ctrl;
【成员】
mask[OT_IVE_MASK_NUM_121] |
|
【注意事项】
- 通过配置不同的模板系数可以达到不同的滤波效果。
- 目前支持为模板为5x5,7x7,9x9,11x11。
【相关数据类型及接口】
无。
ot_ive_csc_mode
【说明】
定义色彩空间转换模式。
【定义】
typedef enum {
OT_IVE_CSC_MODE_VIDEO_BT601_YUV_TO_RGB = 0x0, /* CSC: YUV_TO_RGB, video transfer mode, RGB value range [16, 235] */
OT_IVE_CSC_MODE_VIDEO_BT709_YUV_TO_RGB = 0x1, /* CSC: YUV_TO_RGB, video transfer mode, RGB value range [16, 235] */
OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB = 0x2, /* CSC: YUV_TO_RGB, picture transfer mode, RGB value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_RGB = 0x3, /* CSC: YUV_TO_RGB, picture transfer mode, RGB value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_HSV = 0x4, /* CSC: YUV_TO_HSV, picture transfer mode, HSV value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_HSV = 0x5, /* CSC: YUV_TO_HSV, picture transfer mode, HSV value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_LAB = 0x6, /* CSC: YUV_TO_LAB, picture transfer mode, Lab value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_LAB = 0x7, /* CSC: YUV_TO_LAB, picture transfer mode, Lab value range [0, 255] */
OT_IVE_CSC_MODE_VIDEO_BT601_RGB_TO_YUV = 0x8, /* CSC: RGB_TO_YUV, video transfer mode, YUV value range [0, 255] */
OT_IVE_CSC_MODE_VIDEO_BT709_RGB_TO_YUV = 0x9, /* CSC: RGB_TO_YUV, video transfer mode, YUV value range [0, 255] */
OT_IVE_CSC_MODE_PIC_BT601_RGB_TO_YUV = 0xa, /* CSC: RGB_TO_YUV, picture transfer mode, Y:[16, 235],U\V:[16, 240] */
OT_IVE_CSC_MODE_PIC_BT709_RGB_TO_YUV = 0xb, /* CSC: RGB_TO_YUV, picture transfer mode, Y:[16, 235],U\V:[16, 240] */
OT_IVE_CSC_MODE_BUTT
} ot_ive_csc_mode
【成员】
【注意事项】
- OT_IVE_CSC_MODE_VIDEO_BT601_YUV_TO_RGB和OT_IVE_CSC_MODE_VIDEO_BT709_YUV_TO_RGB模式,输出满足16≤R、G、B≤235。
- OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB和OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_RGB模式,输出满足0≤R、G、B≤255。
- OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_HSV和OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_HSV模式,输出满足0≤H、S、V≤255。
- OT_IVE_CSC_MODE_PIC_BT601_YUV_TO_LAB和OT_IVE_CSC_MODE_PIC_BT709_YUV_TO_LAB模式,输出满足0≤L、A、B≤255。
- OT_IVE_CSC_MODE_VIDEO_BT601_RGB_TO_YUV和OT_IVE_CSC_MODE_VIDEO_BT709_RGB_TO_YUV模式,输出满足0≤Y、U、V≤255。
- OT_IVE_CSC_MODE_PIC_BT601_RGB_TO_YUV和OT_IVE_CSC_MODE_PIC_BT709_RGB_TO_YUV模式,输出满足0≤Y≤235,0≤U、V≤240。
【相关数据类型及接口】
ot_ive_csc_ctrl
【说明】
定义色彩空间转换控制信息。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_filter_and_csc_ctrl
【说明】
定义模板滤波加色彩空间转换复合功能控制信息。
【定义】
typedef struct {
ot_ive_csc_mode mode; /* CSC working mode */
td_s8 mask[OT_IVE_MASK_NUM]; /* Template parameter filter coefficient */
td_u8 norm; /* Normalization parameter, by right shift */
} ot_ive_filter_and_csc_ctrl ;
【成员】
mask[OT_IVE_MASK_NUM] |
|
【注意事项】
仅支持YUV2RGB的4种模式。
【相关数据类型及接口】
ot_ive_sobel_out_ctrl
【说明】
定义sobel输出控制信息。
【定义】
typedef enum {
OT_IVE_SOBEL_OUT_CTRL_BOTH = 0x0, /* Output horizontal and vertical */
OT_IVE_SOBEL_OUT_CTRL_HOR = 0x1, /* Output horizontal */
OT_IVE_SOBEL_OUT_CTRL_VER = 0x2, /* Output vertical */
OT_IVE_SOBEL_OUT_CTRL_BUTT
} ot_ive_sobel_out_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_sobel_ctrl
【说明】
定义sobel-like梯度计算控制信息。
【定义】
typedef struct {
ot_ive_sobel_out_ctrl out_ctrl; /* Output format */
td_s8 mask[OT_IVE_MASK_NUM]; /* Template parameter */
} ot_ive_sobel_ctrl;
【成员】
mask[OT_IVE_MASK_NUM] |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_mag_and_ang_out_ctrl
【说明】
定义梯度幅值与角度计算的输出格式。
【定义】
typedef enum {
OT_IVE_MAG_AND_ANG_OUT_CTRL_MAG = 0x0,/* Only the magnitude is output.*/
OT_IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG = 0x1, /* The magnitude and angle are output.*/
OT_IVE_MAG_AND_ANG_OUT_CTRL_BUTT
} ot_ive_mag_and_ang_out_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_mag_and_ang_ctrl
【说明】
定义梯度幅值和幅角计算的控制信息。
【定义】
typedef struct {
ot_ive_mag_and_ang_out_ctrl out_ctrl;
td_u16 threshold;
td_s8 mask[OT_IVE_MASK_NUM]; /* Template parameter. */
} ot_ive_mag_and_ang_ctrl;
【成员】
mask[OT_IVE_MASK_NUM] |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_dilate_ctrl
【说明】
定义膨胀控制信息。
【定义】
typedef struct {
td_u8 mask[OT_IVE_MASK_NUM]; /* The template parameter value must be 0 or 255. */
} ot_ive_dilate_ctrl;
【成员】
mask[OT_IVE_MASK_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_erode_ctrl
【说明】
定义腐蚀控制信息。
【定义】
typedef struct {
td_u8 mask[OT_IVE_MASK_NUM]; /* The template parameter value must be 0 or 255. */
} ot_ive_erode_ctrl;
【成员】
mask[OT_IVE_MASK_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_threshold_mode
【说明】
定义图像二值化输出格式。
【定义】
typedef enum {
OT_IVE_THRESHOLD_MODE_BINARY = 0x0, /* src_val <= low_threshold, dst_val = min_val; src_val > low_threshold, dst_val = max_val. */
OT_IVE_THRESHOLD_MODE_TRUNC = 0x1, /* src_val <= low_threshold, dst_val = src_val; src_val > low_threshold, dst_val = max_val. */
OT_IVE_THRESHOLD_MODE_TO_MIN_VAL = 0x2, /* src_val <= low_threshold, dst_val = min_val; src_val > low_threshold, dst_val = src_val. */
OT_IVE_THRESHOLD_MODE_MIN_MID_MAX = 0x3, /* src_val <= low_threshold, dst_val = min_val; low_threshold < src_val <= high_threshold, dst_val = mid_val; src_val > high_threshold, dst_val = max_val. */
OT_IVE_THRESHOLD_MODE_ORIG_MID_MAX = 0x4, /* src_val <= low_threshold, dst_val = src_val; low_threshold < src_val <= high_threshold, dst_val = mid_val; src_val > high_threshold, dst_val = max_val. */
OT_IVE_THRESHOLD_MODE_MIN_MID_ORI = 0x5, /* src_val <= low_threshold, dst_val = min_val; low_threshold < src_val <= high_threshold, dst_val = mid_val; src_val > high_threshold, dst_val = src_val. */
OT_IVE_THRESHOLD_MODE_MIN_ORIG_MAX = 0x6, /* src_val <= low_threshold, dst_val = min_val; low_threshold < src_val <= high_threshold, dst_val = src_val; src_val > high_threshold, dst_val = max_val. */
OT_IVE_THRESHOLD_MODE_ORI_MID_ORIG = 0x7, /* src_val <= low_threshold, dst_val = src_val; low_threshold < src_val <= high_threshold, dst_val = mid_val; src_val > high_threshold, dst_val = src_val. */
OT_IVE_THRESHOLD_MODE_BUTT
} ot_ive_threshold_mode;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_threshold中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_threshold_ctrl
【说明】
定义图像二值化控制信息。
【定义】
typedef struct {
ot_ive_threshold_mode mode;
td_u8 low_threshold; /* user-defined threshold, 0<=u8LowThr<=255 */
td_u8 high_threshold; /* user-defined threshold, if mode<OT_IVE_THRESHOLD_MODE_MIN_MID_MAX, high_threshold is not used,
else 0<=low_threshold<= high_threshold <=255; */
td_u8 min_val; /* Minimum value when tri-level thresholding */
td_u8 mid_val; /* Middle value when tri-level thresholding, if enMode<2, u32MidVal is not used; */
td_u8 max_val; /* Maxmum value when tri-level thresholding */
} ot_ive_thresh_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_sub_mode
【说明】
定义两图像相减输出格式。
【定义】
typedef enum {
OT_IVE_SUB_MODE_ABS = 0x0, /* Absolute value of the difference */
OT_IVE_SUB_MODE_SHIFT = 0x1, /* The output result is obtained by shifting the result one digit right to reserve the signed bit. */
OT_IVE_SUB_MODE_BUTT
} ot_ive_sub_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_sub_ctrl
【说明】
定义两图像相减控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_integ_out_ctrl
【说明】
定义积分图输出控制参数。
【定义】
typedef enum ot_ive_integ_out_ctrl {
OT_IVE_INTEG_OUT_CTRL_COMBINE = 0x0,
OT_IVE_INTEG_OUT_CTRL_SUM = 0x1,
OT_IVE_INTEG_OUT_CTRL_SQRT_SUM = 0x2,
OT_IVE_INTEG_OUT_CTRL_BUTT
}ot_ive_integ_out_ctrl;
【成员】
和、平方和积分图组合输出,如图13。 |
|
【注意事项】
无。
【相关数据类型及接口】
ot_ive_integ_ctrl
【说明】
定义积分图计算控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_threshold_s16_mode
【说明】
定义16bit有符号图像的阈值化模式。
【定义】
typedef enum {
OT_IVE_THRESHOLD_S16_MODE_S16_TO_S8_MIN_MID_MAX = 0x0,
OT_IVE_THRESHOLD_S16_MODE_S16_TO_S8_MIN_ORIG_MAX = 0x1,
OT_IVE_THRESHOLD_S16_MODE_S16_TO_U8_MIN_MID_MAX = 0x2,
OT_IVE_THRESHOLD_S16_MODE_S16_TO_U8_MIN_ORIG_MAX = 0x3,
OT_IVE_THRESHOLD_S16_MODE_BUTT
} ot_ive_threshold_s16_mode;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_threshold_s16中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_threshold_s16_ctrl
【说明】
定义16bit有符号图像的阈值化控制参数。
【定义】
typedef struct {
ot_ive_threshold_s16_mode mode;
td_s16 low_threshold; /* User-defined threshold */
td_s16 high_threshold; /* User-defined threshold */
ot_svp_8bit min_val; /* Minimum value when tri-level thresholding */
ot_svp_8bit mid_val; /* Middle value when tri-level thresholding */
ot_svp_8bit max_val; /* Maxmum value when tri-level thresholding */
} ot_ive_threshold_s16_ctrl;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_threshold_s16中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_threshold_u16_mode
【说明】
定义16bit无符号图像的阈值化模式。
【定义】
typedef enum {
OT_IVE_THRESHOLD_U16_MODE_U16_TO_U8_MIN_MID_MAX = 0x0,
OT_IVE_THRESHOLD_U16_MODE_U16_TO_U8_MIN_ORIG_MAX = 0x1,
OT_IVE_THRESHOLD_U16_MODE_BUTT
} ot_ive_threshold_u16_mode;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_threshold_u16中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_threshold_u16_ctrl
【说明】
定义16bit无符号图像的阈值化控制参数。
【定义】
typedef struct {
ot_ive_threshold_u16_mode mode;
td_u16 low_threshold;
td_u16 high_threshold;
td_u8 min_val;
td_u8 mid_val;
td_u8 max_val;
} ot_ive_threshold_u16_ctrl;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_threshold_u16中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_16bit_to_8bit_mode
【说明】
定义16bit图像数据到8bit图像数据的的转化模式。
【定义】
typedef enum {
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_S8 = 0x0,
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS = 0x1,
OT_IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS = 0x2,
OT_IVE_16BIT_TO_8BIT_MODE_U16_TO_U8 = 0x3,
OT_IVE_16BIT_TO_8BIT_MODE_BUTT
} ot_ive_16bit_to_8bit_mode;
【成员】
【注意事项】
计算公式请参见ss_mpi_ive_16bit_to_8bit中的【注意】,示意图请参见图1。
【相关数据类型及接口】
ot_ive_16bit_to_8bit_ctrl
【说明】
定义16bit图像数据到8bit图像数据的转化控制参数。
【定义】
typedef struct {
ot_ive_16bit_to_8bit_mode mode;
td_u16 denominator;
td_u8 num;
td_s8 bias;
} ot_ive_16bit_to_8bit_ctrl;
【成员】
【注意事项】
- 计算公式请参见ss_mpi_ive_16bit_to_8bit中的【注意】,示意图请参见图1。
- num≤denominator,且denominator≠0
【相关数据类型及接口】
ot_ive_order_stats_filter_mode
【说明】
定义顺序统计量滤波模式。
【定义】
typedef enum {
OT_IVE_ORDER_STATS_FILTER_MODE_MEDIAN = 0x0,
OT_IVE_ORDER_STATS_FILTER_MODE_MAX = 0x1,
OT_IVE_ORDER_STATS_FILTER_MODE_MIN = 0x2,
OT_IVE_ORD_STAT_FILTER_MODE_BUTT
} ot_ive_order_stats_filter_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_order_stats_filter_ctrl
ot_ive_order_stats_filter_ctrl
【说明】
定义顺序统计量滤波控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_order_stats_filter_mode
ot_ive_map_u8bit_lut_mem
【说明】
定义map U8C1→U8C1的查找表内存。
【定义】
【成员】
map[OT_IVE_MAP_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_map_u16bit_lut_mem
【说明】
定义map U8C1→U16C1的查找表内存。
【定义】
【成员】
map[OT_IVE_MAP_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_map_s16bit_lut_mem
【说明】
定义map U8C1→S16C1的查找表内存。
【定义】
【成员】
map[OT_IVE_MAP_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_map_mode
【说明】
定义map的模式。
【定义】
typedef enum {
OT_IVE_MAP_MODE_U8 = 0x0,
OT_IVE_MAP_MODE_S16 = 0x1,
OT_IVE_MAP_MODE_U16 = 0x2,
OT_IVE_MAP_MODE_BUTT
} ot_ive_map_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_map_ctrl
【说明】
定义map控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_equalize_hist_ctrl_mem
【说明】
定义直方图均衡化辅助内存。
【定义】
typedef struct {
td_u32 hist[OT_IVE_HIST_NUM];
td_u8 map[OT_IVE_MAP_NUM];
} ot_ive_equalize_hist_ctrl_mem;
【成员】
hist[OT_IVE_HIST_NUM] |
|
map[OT_IVE_MAP_NUM] |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_equalize_hist_ctrl
【说明】
定义直方图均衡化控制参数。
【定义】
【成员】
需开辟sizeof(ot_ive_equalize_hist_ctrl_mem)字节大小的内存。 |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_add_ctrl
【说明】
定义两图像的加权加控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_ncc_dst_mem
【说明】
定义ncc的输出内存信息。
【定义】
typedef struct {
td_u64 num;
td_u64 quad_sum1;
td_u64 quad_sum2;
td_u8 reserved[OT_IVE_ARR_RESERVED_NUM_EIGHT];
} ot_ive_ncc_dst_mem;
【成员】
reserved[OT_IVE_ARR_RESERVED_NUM_EIGHT] |
【注意事项】
计算公式请参见ss_mpi_ive_ncc中的【注意】。
【相关数据类型及接口】
无。
ot_ive_rgn
【说明】
定义连通区域信息。
【定义】
typedef struct {
td_u32 area; /* Represented by the pixel number */
td_u16 left; /* Circumscribed rectangle left border */
td_u16 right; /* Circumscribed rectangle right border */
td_u16 top; /* Circumscribed rectangle top border */
td_u16 bottom; /* Circumscribed rectangle bottom border */
} ot_ive_rgn;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_ccblob_info
【说明】
定义连通区域统计信息在Memory中的存储信息。
【定义】
typedef union {
struct {
td_u32 cur_area_threshold: 23;/*Threshold of the result rgns' area*/
td_u32 label_status: 1; /*1: Labeled failed ; 0: Labeled successfully*/
td_u32 rgn_num: 8; /*Number of valid rgn, non-continuous stored*/
}bits;
td_u32 u32;
} ot_ive_ccblob_info;
【成员】
【注意事项】
- cur_area_threshold:32bit中的前23bit表示有效区域的面积阈值。
- label_status:32bit中的第24bit表示的是连通区域是否标记成功。
- rgn_num:32bit中后8bit表示是有效连通区域的个数。
【相关数据类型及接口】
ot_ive_ccblob
【说明】
定义连通区域标记的输出信息。
【定义】
typedef struct {
ot_ive_ccblob_info info;
ot_ive_rgn rgn[OT_IVE_MAX_RGN_NUM]; /* Valid rgns with 'cur_area_thr>0' and 'label = array_index+1' */
} ot_ive_ccblob;
【成员】
rgn[OT_IVE_MAX_RGN_NUM] |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_ccl_mode
【说明】
定义连通区域模式。
【定义】
typedef enum {
OT_IVE_CCL_MODE_4C = 0x0, /* 4-connected */
OT_IVE_CCL_MODE_8C = 0x1, /* 8-connected */
OT_IVE_CCL_MODE_BUTT
} ot_ive_ccl_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_ccl_ctrl
【说明】
定义连通区域标记控制参数。
【定义】
typedef struct {
ot_ive_ccl_mode mode; /* Mode */
td_u16 init_area_threshold; /* Init threshold of rgn area */
td_u16 step; /* Increase area step for once */
} ot_ive_ccl_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_gmm_ctrl
【说明】
定义GMM背景建模的控制参数。
【定义】
typedef struct {
td_u22q10 noise_var; /* Initial noise Variance */
td_u22q10 max_var; /* Max Variance */
td_u22q10 min_var; /* Min Variance */
td_u0q16 learn_rate; /* Learning rate */
td_u0q16 bg_ratio; /* Background ratio */
td_u8q8 var_threshold; /* Variance Threshold */
td_u0q16 init_wgt; /* Initial Weight */
td_u8 model_num; /* Model number: 3 or 5 */
} ot_ive_gmm_ctrl;
【成员】
|
对灰度的GMM,对应OpenCV MOG中灰度模型中的noiseSigma * noiseSigma。 |
|
|
参考取值: if (frameNum<500) (1/frameNum)*((1<<16)-1);else ((1/500)*((1<<16)-1)。 |
|
【注意事项】
无。
【相关数据类型及接口】
无
ot_ive_gmm2_sns_factor_mode
【说明】
定义灵敏度系数模式。
【定义】
typedef enum {
OT_IVE_GMM2_SNS_FACTOR_MODE_GLOBAL = 0x0, /* Global sensitivity factor mode */
OT_IVE_GMM2_SNS_FACTOR_MODE_PIXEL = 0x1, /* Pixel sensitivity factor mode */
OT_IVE_GMM2_SNS_FACTOR_MODE_BUTT
} ot_ive_gmm2_sns_factor_mode;
【成员】
全局灵敏度系数模式,每个像素在模型匹配过程中,方差灵敏度使用ot_ive_gmm2_ctrl的global_sns_factor。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_gmm2_life_update_factor_mode
【说明】
定义模型时长参数更新模式。
【定义】
typedef enum {
OT_IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_GLOBAL = 0x0, /* Global life update factor mode */
OT_IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_PIXEL = 0x1, /* Pixel life update factor mode */
OT_IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_BUTT
} ot_ive_gmm2_life_update_factor_mode;
【成员】
模型时长参数全局更新模式,每个像素模型时长参数在更新时使用ot_ive_gmm2_ctrl的global_life_update_factor。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_gmm2_ctrl
【说明】
定义GMM2背景建模的控制参数。
【定义】
typedef struct {
ot_ive_gmm2_sns_factor_mode sns_factor_mode; /* Sensitivity factor mode */
ot_ive_gmm2_life_update_factor_mode life_update_factor_mode; /* Life update factor mode */
td_u16 global_life_update_factor; /* Global life update factor (default: 4) */
td_u16 life_threshold; /* Life threshold (default: 5000) */
td_u16 freq_init_val; /* Initial frequency (default: 20000) */
td_u16 freq_reduce_factor; /* Frequency reduction factor (default: 0xFF00) */
td_u16 freq_add_factor; /* Frequency adding factor (default: 0xEF) */
td_u16 freq_threshold; /* Frequency threshold (default: 12000) */
td_u16 var_rate; /* Variation update rate (default: 1) */
td_u9q7 max_var; /* Max variation (default: (16 * 16)<<7) */
td_u9q7 min_var; /* Min variation (default: ( 8 * 8)<<7) */
td_u8 global_sns_factor; /* Global sensitivity factor (default: 8) */
td_u8 model_num; /* Model number (range: 1~5, default: 3) */
} ot_ive_gmm2_ctrl;
【成员】
灵敏度模式,默认全局模式。全局模式使用global_sns_factor作为灵敏度系数;像素模式使用ss_mpi_ive_gmm2中factor的低8bit值作为灵敏度系数。 |
|
模型时长更新模式,默认全局模式。全局模式使用global_life_update_factor作为前进模型更新参数;像素模式使用ss_mpi_ive_gmm2中factor的高8bit值作为前进模型时长更新参数。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_canny_stack_size
【说明】
定义Canny边缘前半部分计算时强边缘点栈大小结构体。
【定义】
typedef struct {
td_u32 stack_size; /* Stack size for output */
td_u8 reserved[OT_IVE_ARR_RESERVED_NUM_TWELVE]; /* For 16 byte align */
} ot_ive_canny_stack_size;
【成员】
reserved [OT_IVE_ARR_RESERVED_NUM_TWELVE] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_canny_hys_edge_ctrl
【说明】
定义Canny边缘前半部分计算任务的控制参数。
【定义】
typedef struct {
ot_svp_mem_info mem;
td_u16 low_threshold;
td_u16 high_threshold;
td_s8 mask[OT_IVE_MASK_NUM];
} ot_ive_canny_hys_edge_ctrl;
【成员】
辅助内存。内存配置大小说明见ss_mpi_ive_canny_hys_edge的【注意】。 |
|
mask[OT_IVE_MASK_NUM] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_lbp_compare_mode
【说明】
定义lbp计算的比较模式。
【定义】
typedef enum {
OT_IVE_LBP_COMPARE_MODE_NORMAL= 0x0, /* P(x)-P(center)>= bit_thr.s8Val, s(x)=1; else s(x)=0; */
OT_IVE_LBP_COMPARE_MODE_ABS= 0x1, /* Abs(P(x)-P(center))>=bit_thr.u8Val, s(x)=1; else s(x)=0; */
OT_IVE_LBP_COMPARE_MODE_BUTT
} ot_ive_lbp_compare_mode;
【成员】
【注意事项】
计算公式参考ss_mpi_ive_lbp中的【注意】,示意图请参考图1。
【相关数据类型及接口】
ot_ive_lbp_ctrl
【说明】
定义lbp纹理计算控制参数。
【定义】
【成员】
【注意事项】
计算公式参考ss_mpi_ive_lbp中的【注意】,示意图请参考图1。
【相关数据类型及接口】
ot_ive_norm_grad_out_ctrl
【说明】
定义归一化梯度信息计算任务输出控制枚举类型。
【定义】
typedef enum {
OT_IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER = 0x0,
OT_IVE_NORM_GRAD_OUT_CTRL_HOR = 0x1,
OT_IVE_NORM_GRAD_OUT_CTRL_VER = 0x2,
OT_IVE_NORM_GRAD_OUT_CTRL_COMBINE = 0x3,
OT_IVE_NORM_GRAD_OUT_CTRL_BUTT
} ot_ive_norm_grad_out_ctrl;
【成员】
同时输出梯度信息的H、V分量图(H、V定义见ss_mpi_ive_norm_grad的【参数】)。 |
|
输出梯度信息以package 存储(如图7)的HV图。 |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_norm_grad_ctrl
【说明】
定义归一化梯度信息计算控制参数。
【定义】
typedef struct {
ot_ive_norm_grad_out_ctrl out_ctrl;
td_s8 mask[OT_IVE_MASK_NUM];
td_u8 norm;
} ot_ive_norm_grad_ctrl;
【成员】
mask[OT_IVE_MASK_NUM] |
|
【注意事项】
无。
【相关数据类型及接口】
ot_ive_lk_optical_flow_pyr_out_mode
【说明】
定义金字塔LK光流计算输出模式。
【定义】
typedef enum {
OT_IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_NONE = 0, /* Output none */
OT_IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_STATUS = 1, /* Output status */
OT_IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_BOTH = 2, /* Output status and err */
OT_IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_BUTT
} ot_ive_lk_optical_flow_pyr_out_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_lk_optical_flow_pyr_ctrl
【说明】
定义金字塔LK光流计算控制参数。
【定义】
typedef struct {
ot_ive_lk_optical_flow_pyr_out_mode out_mode;
td_bool use_init_flow; /* where to use initial flow */
td_u16 points_num; /* Number of the feature points,<=500 */
td_u8 max_level; /* 0<=max_level<=3 */
td_u0q8 min_eig_val_threshold; /* Minimum eigenvalue threshold */
td_u8 iter_cnt; /* Maximum iteration times, <=20 */
td_u0q8 eps; /* Used for exit criteria: dx^2 + dy^2 < eps */
} ot_ive_lk_optical_flow_pyr_ctrl;
【成员】
是否使用初始光流计算(next_pts是否需要初始化):TD_TRUE表示使用初始光流,TD_FALSE表示不使用初始光流。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_st_max_eig_val
【说明】
定义Shi-Tomas-like角点计算时最大角点响应值结构体。
【定义】
typedef struct {
td_u16 max_eig_val; /* Shi-Tomasi second step output MaxEig */
td_u8 reserved[OT_IVE_ARR_RESERVED_NUM_FOURTEEN]; /* For 16 byte align */
} ot_ive_st_max_eig_val;
【成员】
reserved [OT_IVE_ARR_RESERVED_NUM_FOURTEEN] |
【注意事项】
无
【相关数据类型及接口】
无
ot_ive_st_cand_corner_ctrl
【说明】
定义Shi-Tomas-like候选角点计算控制参数。
【定义】
【成员】
辅助内存。内存配置大小见ss_mpi_ive_st_cand_corner的【注意】。 |
|
ShiTomasi角点质量控制参数,角点响应值小于 “quality_level *最大角点响应值”的点将直接被确认为非角点。 |
【注意事项】
无。
【相关数据类型及接口】
无
ot_ive_st_corner_info
【说明】
定义Shi-Tomas-like角点计算输出的角点信息结构体。
【定义】
typedef struct {
td_u16 corner_num;
ot_svp_point_u16 corner[OT_IVE_ST_MAX_CORNER_NUM];
} ot_ive_st_corner_info;
【成员】
corner [OT_IVE_ST_MAX_CORNER_NUM] |
【注意事项】
无
【相关数据类型及接口】
无
ot_ive_st_corner_ctrl
【说明】
定义Shi-Tomas-like角点筛选控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_sad_mode
【说明】
定义SAD计算模式。
【定义】
typedef enum {
OT_IVE_SAD_MODE_MB_4X4 = 0x0, /* 4x4 */
OT_IVE_SAD_MODE_MB_8X8 = 0x1, /* 8x8 */
OT_IVE_SAD_MODE_MB_16X16 = 0x2, /* 16x16 */
OT_IVE_SAD_MODE_BUTT
} ot_ive_sad_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_sad_out_ctrl
【说明】
定义SAD输出控制模式。
【定义】
typedef enum {
OT_IVE_SAD_OUT_CTRL_16BIT_BOTH = 0x0, /* Output 16 bit sad and 8 bit thresh */
OT_IVE_SAD_OUT_CTRL_8BIT_BOTH = 0x1, /* Output 8 bit sad and 8 bit thresh */
OT_IVE_SAD_OUT_CTRL_16BIT_SAD = 0x2, /* Output 16 bit sad */
OT_IVE_SAD_OUT_CTRL_8BIT_SAD = 0x3, /* Output 8 bit sad */
OT_IVE_SAD_OUT_CTRL_THRESHOLD = 0x4, /* Output 8 bit thresh */
OT_IVE_SAD_OUT_CTRL_BUTT
} ot_ive_sad_out_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_sad_ctrl
【说明】
定义SAD控制参数。
【定义】
typedef struct {
ot_ive_sad_mode mode;
ot_ive_sad_out_ctrl out_ctrl;
td_u16 threshold; /* src_val <= thr, dst_val = min_val; src_val > thr, dst_val = max_val. */
td_u8 min_val; /* Min value */
td_u8 max_val; /* Max value */
} ot_ive_sad_ctrl;
【成员】
|
|
【注意事项】
无
【相关数据类型及接口】
ot_ive_resize_mode
【说明】
定义resize的模式。
【定义】
typedef enum {
OT_IVE_RESIZE_MODE_LINEAR = 0x0, /* Bilinear interpolation */
OT_IVE_RESIZE_MODE_BUTT
} ot_ive_resize_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_resize_ctrl
【说明】
定义resize控制参数。
【定义】
【成员】
辅助内存。开辟参照ss_mpi_ive_resize中【注意】。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_grad_fg_mode
【说明】
定义梯度前景计算模式。
【定义】
typedef enum {
OT_IVE_GRAD_FG_MODE_USE_CUR_GRAD = 0x0,
OT_IVE_GRAD_FG_MODE_FIND_MIN_GRAD = 0x1,
OT_IVE_GRAD_FG_MODE_BUTT
} ot_ive_grad_fg_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_grad_fg_ctrl
【说明】
定义计算梯度前景控制参数。
【定义】
typedef struct {
ot_ive_grad_fg_mode mode; /* Calculation mode */
td_u16 edw_factor; /* Edge width adjustment factor (range: 500 to 2000; default: 1000) */
td_u8 crl_coef_threshold; /* Gradient vector correlation coefficient threshold
(ranges: 50 to 100; default: 80) */
td_u8 mag_crl_threshold; /* Gradient amplitude threshold (range: 0 to 20; default: 4) */
td_u8 min_mag_diff; /* Gradient magnitude difference threshold (range: 2 to 8; default: 2) */
td_u8 noise_val; /* Gradient amplitude noise threshold (range: 1 to 8; default: 1) */
td_u8 edw_dark; /* Black pixels enable flag (range: 0 (no), 1 (yes); default: 1) */
} ot_ive_grad_fg_ctrl;
【成员】
梯度前景计算模式。参考ot_ive_grad_fg_mode。 |
|
【注意事项】
无。
【相关数据类型及接口】
ot_ive_cand_bg_pixel
【说明】
定义候选背景模型数据。
【定义】
typedef struct {
td_u8q4f4 mean; /* Candidate background grays value */
td_u16 start_time; /* Candidate Background start time */
td_u16 sum_access_time; /* Candidate Background cumulative access time */
td_u16 short_keep_time; /* Candidate background short hold time */
td_u8 chg_condition; /* Time condition for candidate background into the changing state */
td_u8 poten_bg_life; /* Potential background cumulative access time */
} ot_ive_cand_bg_pixel;
【成员】
【注意事项】
无
【相关数据类型及接口】
ot_ive_wrok_bg_pixel
【说明】
定义工作背景模型数据。
【定义】
typedef struct {
td_u8q4f4 mean; /* 0# background grays value */
td_u16 access_time; /* Background cumulative access time */
td_u8 prev_gray; /* Gray value of last pixel */
td_u5q3 diff_threshold; /* Differential threshold */
td_u8 access_flag; /* Background access flag */
td_u8 bg_gray[OT_IVE_ARR_NUM_THREE]; /* 1# ~ 3# background grays value */
} ot_ive_wrok_bg_pixel;
【成员】
bg_gray [OT_IVE_ARR_NUM_THREE] |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_bg_life
【说明】
定义背景生命力数据。
【定义】
typedef struct {
td_u8 work_bg_life[OT_IVE_ARR_NUM_THREE]; /* 1# ~ 3# background vitality */
td_u8 cand_bg_life; /* Candidate background vitality */
} ot_ive_bg_life;
【成员】
work_bg_life [OT_IVE_ARR_NUM_THREE] |
|
【注意事项】
无。
【相关数据类型及接口】
ot_ive_bg_model_pixel
【说明】
定义背景模型数据。
【定义】
typedef struct {
ot_ive_wrok_bg_pixel work_bg_pixel; /* Working background */
ot_ive_cand_bg_pixel cand_pixel; /* Candidate background */
ot_ive_bg_life bg_life; /* Background vitality */
} ot_ive_bg_model_pixel;
【成员】
【注意事项】
无
【相关数据类型及接口】
ot_ive_fg_status_data
【说明】
定义前景状态数据。
【定义】
typedef struct {
td_u32 pixel_num;
td_u32 sum_luma;
td_u8 reserved[OT_IVE_ARR_NUM_EIGHT];
} ot_ive_fg_status_data;
【成员】
reserved[OT_IVE_ARR_NUM_EIGHT] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_bg_status_data
【说明】
定义背景状态数据。
【定义】
typedef struct {
td_u32 pixel_num;
td_u32 sum_luma;
td_u8 reserved[OT_IVE_ARR_NUM_EIGHT];
} ot_ive_bg_status_data;
【成员】
reserved[OT_IVE_ARR_NUM_EIGHT] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_match_bg_model_ctrl
【说明】
定义背景匹配控制参数。
【定义】
typedef struct {
td_u32 cur_frame_num; /* Current frame timestamp, in frame units */
td_u32 prev_frame_num; /* Previous frame timestamp, in frame units */
td_u16 time_threshold; /* Potential background replacement time threshold range: 2 to 100 frames; default: 20) */
td_u8 diff_threshold_crl_coef; /* Correlation coefficients between differential threshold and gray value (range: 0 to 5; default: 0) */
td_u8 diff_max_threshold; /* Maximum of background differential threshold (range: 3 to 15; default: 6) */
td_u8 diff_min_threshold; /* Minimum of background differential threshold (range: 3 to 15; default: 4) */
td_u8 diff_threshold_inc; /* Dynamic Background differential threshold increment (range: 0 to 6; default: 0) */
td_u8 fast_learn_rate; /* Quick background learning rate (range: 0 to 4; default: 2) */
td_u8 detected_chg_rgn; /* Whether to detect change rgn (range: 0 (no), 1 (yes); default: 0) */
} ot_ive_match_bg_model_ctrl;
【成员】
【注意事项】
无
【相关数据类型及接口】
无
ot_ive_update_bg_model_ctrl
【说明】
定义背景更新控制参数。
【定义】
typedef struct {
td_u32 cur_frame_num; /* Current frame timestamp, in frame units */
td_u32 prev_check_time; /* The last time when background status is checked */
td_u32 frame_check_period; /* Background status checking period (range: 0 to 2000 frames; default: 50) */
td_u32 init_min_time; /* Background initialization shortest time
(range: 20 to 6000 frames; default: 100) */
td_u32 steady_bg_min_blend_time; /* Steady background integration shortest time (range: 20 to 6000 frames; default: 200) */
td_u32 steady_bg_max_blend_time; /* Steady background integration longest time (range: 20 to 40000 frames; default: 1500) */
td_u32 dynamic_bg_min_blend_time; /* Dynamic background integration shortest time (range: 0 to 6000 frames; default: 0) */
td_u32 static_detection_min_time; /* Still detection shortest time (range: 20 to 6000 frames; default: 80) */
td_u16 fg_max_fade_time; /* Foreground disappearing longest time
(range: 1 to 255 seconds; default: 15) */
td_u16 bg_max_fade_time; /* Background disappearing longest time
(range: 1 to 255 seconds ; default: 60) */
td_u8 steady_bg_access_time_rate_thr; /* Steady background access time ratio threshold
(range: 10 to 100; default: 80) */
td_u8 chg_bg_access_time_rate_thr; /* Change background access time ratio threshold (range: 10 to 100; default: 60) */
td_u8 dynamic_bg_access_time_threshold; /* Dynamic background access time ratio threshold (range: 0 to 50; default: 0) */
td_u8 dynamic_bg_depth; /* Dynamic background depth (range: 0 to 3; default: 3) */
td_u8 bg_eff_state_rate_threshold; /* Background state time ratio threshold when initializing (range: 90 to 100; default: 90) */
td_u8 acc_bg_learn; /* Whether to accelerate background learning (range: 0 (no), 1 (yes); default: 0) */
td_u8 detected_chg_rgn; /* Whether to detect change rgn (range: 0 (no), 1 (yes); default: 0) */
} ot_ive_update_bg_model_ctrl;
【成员】
【注意事项】
要求init_min_time≤ steady_bg_min_blend_time≤ steady_bg_max_blend_time。
【相关数据类型及接口】
无。
ot_ive_ann_mlp_accurate
【说明】
定义ann_mlp输入特征向量类型。
【定义】
typedef enum {
OT_IVE_ann_mlp_ACCURATE_SRC16_WGT16 = 0x0, /* input decimals' accurate 16 bit, weight 16bit */
OT_IVE_ann_mlp_ACCURATE_SRC14_WGT20 = 0x1, /* input decimals' accurate 14 bit, weight 20bit */
OT_IVE_ann_mlp_ACCURATE_BUTT
} ot_ive_ann_mlp_accurate;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_ann_mlp_actv_func
【说明】
定义ann_mlp激活函数枚举类型。
【定义】
typedef enum {
OT_IVE_ANN_MLP_ACTV_FUNC_IDENTITY = 0x0,
OT_IVE_ANN_MLP_ACTV_FUNC_SIGMOID_SYM = 0x1,
OT_IVE_ANN_MLP_ACTV_FUNC_GAUSSIAN = 0x2,
OT_IVE_ANN_MLP_ACTV_FUNC_BUTT
} ot_ive_ann_mlp_actv_func;
【成员】
【注意事项】
对应函数定义参见ss_mpi_ive_ann_mlp_predict中【注意】。
【相关数据类型及接口】
无。
ot_ive_ann_mlp_model
【说明】
定义ann_mlp模型数据结构体。
【定义】
typedef struct {
ot_ive_ann_mlp_actv_func actv_func;
ot_ive_ann_mlp_accurate accurate;
ot_svp_mem_info wgt;
td_u32 total_wgt_size;
td_u16 layer_cnt[OT_IVE_ARR_NUM_EIGHT]; /* 8 layers, including input and output layer */
td_u16 max_cnt; /* MaxCount<=1024 */
td_u8 layer_num; /* 2<layerNum<=8 */
td_u8 reserved;
} ot_ive_ann_mlp_model;
【成员】
layer_cnt[OT_IVE_ARR_NUM_EIGHT] |
输入层1层->隐含层若干层(至少1层,最多6层)->输出层1层,分别存储输入、输出层的特征维度(取值范围:[1, 256]),各隐藏层的神经元数目(取值范围:[2,256])。 |
【注意事项】
无。
【相关数据类型及接口】
ot_ive_svm_type
【说明】
定义svm类型。
【定义】
typedef enum {
OT_IVE_SVM_TYPE_C_SVC = 0x0,
OT_IVE_SVM_TYPE_NU_SVC = 0x1,
OT_IVE_SVM_TYPE_BUTT
} ot_ive_svm_type;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_svm_kernel_type
【说明】
定义svm核函数类型。
【定义】
typedef enum {
OT_IVE_SVM_KERNEL_TYPE_LINEAR = 0x0,
OT_IVE_SVM_KERNEL_TYPE_POLY = 0x1,
OT_IVE_SVM_KERNEL_TYPE_RBF = 0x2,
OT_IVE_SVM_KERNEL_TYPE_SIGMOID = 0x3,
OT_IVE_SVM_KERNEL_TYPE_BUTT
} ot_ive_svm_kernel_type;
【成员】
【注意事项】
对应核函数定义参见ss_mpi_ive_svm_predict中【注意】。
【相关数据类型及接口】
无。
ot_ive_svm_model
【说明】
定义svm模型数据结构体。
【定义】
typedef struct {
ot_ive_svm_type type;
ot_ive_svm_kernel_type kernel_type;
ot_svp_mem_info sv; /* SV memory */
ot_svp_mem_info df; /* Decision functions memory */
td_u32 total_df_size; /* All decision functions coef size in byte */
td_u16 feature_dim;
td_u16 sv_total;
td_u8 class_cnt;
} ot_ive_svm_model;
【成员】
svm核函数类型,参考ot_ive_svm_kernel_type。 |
|
模型数据中的支持向量,其内存排布参看ss_mpi_ive_svm_predict的【注意】。 |
|
|
取值范围:[1, 256]或[1, 1024],跟ss_mpi_ive_cnn_predict 中的输入特征向量维度一致。 |
|
【注意事项】
无。
【相关数据类型及接口】
ot_ive_cnn_actv_func
【说明】
定义CNN 激活函数枚举类型。
【定义】
typedef enum {
OT_IVE_CNN_ACTV_FUNC_NONE = 0x0, /* Do not taking a activation, equivalent f(x)=x */
OT_IVE_CNN_ACTV_FUNC_RELU = 0x1, /* f(x)=max(0, x) */
OT_IVE_CNN_ACTV_FUNC_SIGMOID = 0x2, /* f(x)=1/(1+exp(-x)), not support */
OT_IVE_CNN_ACTV_FUNC_BUTT
} ot_ive_cnn_actv_func;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_cnn_pooling
【说明】
定义CNN汇聚操作枚举类型。
【定义】
typedef enum {
OT_IVE_CNN_POOLING_NONE = 0x0, /* Do not taking a pooling action */
OT_IVE_CNN_POOLING_MAX = 0x1, /* Using max value of every pooling area */
OT_IVE_CNN_POOLING_AVG = 0x2, /* Using average value of every pooling area */
OT_IVE_CNN_POOLING_BUTT
} ot_ive_cnn_pooling;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_cnn_conv_pooling
【说明】
定义CNN单层Conv-ReLU-Pooling运算包参数结构体。
【定义】
typedef struct {
ot_ive_cnn_actv_func actv_func; /* Type of activation function */
ot_ive_cnn_pooling pooling; /* Mode of pooling method */
td_u8 feature_map_num; /* Number of feature maps */
td_u8 kernel_size; /* Kernel size, only support 3 currently */
td_u8 conv_step; /* Convolution step, only support 1 currently */
td_u8 pool_size; /* Pooling size, only support 2 currently */
td_u8 pool_step; /* Pooling step, only support 2 currently */
td_u8 reserved[OT_IVE_ARR_RESERVED_NUM_THREE];
} ot_ive_cnn_conv_pooling;
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_cnn_fc_info
【说明】
定义CNN全链接网络参数结构体。
【定义】
typedef struct {
td_u16 layer_cnt[OT_IVE_ARR_NUM_EIGHT]; /* Neuron number of every fully connected layers */
td_u16 max_cnt; /* Max neuron number in all fully connected layers */
td_u8 layer_num; /* Number of fully connected layer */
td_u8 reserved;
} ot_ive_cnn_fc_info;
【成员】
layer_cnt[OT_IVE_ARR_NUM_EIGHT] |
全连接各层神经元节点数目。输入层(即Conv-ReLU-Pooling的输出)支持范围:[1, 1024];中间隐藏层支持范围:[2, 256];输出层支持范围:[1, 256]。 |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_cnn_model
【说明】
定义CNN模型参数结构体。
【定义】
typedef struct {
ot_ive_cnn_conv_pooling conv_pool[OT_IVE_ARR_NUM_EIGHT]; /* Conv-ReLU-Pooling layers info */
ot_ive_cnn_fc_info fc_info; /* Fully connected layers info */
ot_svp_mem_info conv_kernel_bias; /* Conv-ReLU-Pooling layers' kernels and bias */
td_u32 conv_kernel_bias_size; /* Size of Conv-ReLU-Pooling layer' kernels and bias */
ot_svp_mem_info fc_wgt_bias; /* Fully Connection Layers' weights and bias */
td_u32 fc_wgt_bias_size; /* Size of fully connection layers weights and bias */
td_u32 total_mem_size; /* Total memory size of all kernels, weights, bias */
ot_svp_img_type type; /* Image type used for the CNN model */
td_u32 width; /* Image width used for the model */
td_u32 height; /* Image height used for the model */
td_u16 class_cnt; /* Number of classes */
td_u8 conv_pool_layer_num; /* Number of Conv-ReLU-Pooling layers */
td_u8 reserved;
} ot_ive_cnn_model;
【成员】
conv_pool[OT_IVE_ARR_NUM_EIGHT] |
|
【注意事项】
CNN网络模型结构参考ss_mpi_ive_cnn_predict中的【注意】。
【相关数据类型及接口】
ot_ive_cnn_ctrl
【说明】
定义CNN预测任务的控制参数。
【定义】
typedef struct {
ot_svp_mem_info mem; /* Assist memory */
td_u32 num; /* Input img number */
} ot_ive_cnn_ctrl;
【成员】
CNN预测计算过程的辅助内存,所需内存大小参考ss_mpi_ive_cnn_predict中的【注意】。 |
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_cnn_result
【说明】
定义CNN单个样本预测结果结构体。
【定义】
typedef struct {
td_s32 class_idx; /* The most possible index of the classification */
td_s32 conf; /* The confidence of the classification */
} ot_ive_cnn_result;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_persp_trans_point_pair
【说明】
定义透视变换点对结构体。
【定义】
typedef struct {
ot_svp_point_u14q2 src_point; /* Source point */
ot_svp_point_u14q2 dst_point; /* Destination point */
} ot_ive_persp_trans_point_pair;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_persp_trans_alg_mode
【说明】
定义透视变换算法模式枚举。
【定义】
typedef enum {
OT_IVE_PERSP_TRANS_ALG_MODE_NR_SIM = 0x0, /* Non-reflective similarity transform mode */
OT_IVE_PERSP_TRANS_ALG_MODE_SIM = 0x1, /* Reflective similarity transform mode */
OT_IVE_PERSP_TRANS_ALG_MODE_AFFINE = 0x2, /* Affine transform mode */
OT_IVE_PERSP_TRANS_ALG_MODE_BUTT
} ot_ive_persp_trans_alg_mode;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_persp_trans_csc_mode
【说明】
定义透视变换色彩空间转换模式。
【定义】
typedef enum {
OT_IVE_PERSP_TRANS_CSC_MODE_NONE = 0x0, /* No do csc */
OT_IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT601_YUV_TO_RGB = 0x1, /* CSC: YUV2RGB, video transfer mode, RGB value range [16, 235] */
OT_IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT709_YUV_TO_RGB = 0x2, /* CSC: YUV2RGB, video transfer mode, RGB value range [16, 235] */
OT_IVE_PERSP_TRANS_CSC_MODE_PIC_BT601_YUV_TO_RGB = 0x3, /* CSC: YUV2RGB, picture transfer mode, RGB value range [0, 255] */
OT_IVE_PERSP_TRANS_CSC_MODE_PIC_BT709_YUV_TO_RGB = 0x4, /* CSC: YUV2RGB, picture transfer mode, RGB value range [0, 255] */
OT_IVE_PERSP_TRANS_CSC_MODE_BUTT
} ot_ive_persp_trans_csc_mode;
【成员】
【注意事项】
- OT_IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT601_YUV_TO_RGB和OT_IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT709_YUV_TO_RGB模式,输出满足16≤R、G、B≤235。
- OT_IVE_PERSP_TRANS_CSC_MODE_PIC_BT601_YUV_TO_RGB和OT_IVE_PERSP_TRANS_CSC_MODE_PIC_BT709_YUV_TO_RGB模式,输出满足0≤R、G、B≤255。
【相关数据类型及接口】
无。
ot_ive_persp_trans_ctrl
【说明】
定义透视变换控制参数。
【定义】
typedef struct {
ot_ive_persp_trans_alg_mode alg_mode; /* Alg mode */
ot_ive_persp_trans_csc_mode csc_mode; /* CSC mode */
td_u16 roi_num; /* Roi number */
td_u16 point_pair_num; /* Point pair number */
} ot_ive_persp_trans_ctrl;
【成员】
|
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_core_id
【说明】
定义KCF的核ID。
【定义】
【成员】
【注意事项】
不同解决方案Kcf核数不一样,请具体参考发布包中ot_common_ive.h头文件中ot_ive_kcf_core_id定义。
【相关数据类型及接口】
ot_ive_roi_info
【说明】
定义目前区域信息参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_proc_ctrl
【说明】
定义跟踪处理控制参数。
【定义】
typedef struct {
ot_ive_csc_mode csc_mode; /* Only support:
IVE_CSC_MODE_VIDEO_BT601_YUV_TO_RGB CSC: YUV2RGB, video transfer mode,RGB value range [16, 235]
IVE_CSC_MODE_VIDEO_BT709_YUV_TO_RGB CSC: YUV2RGB, video transfer mode,RGB value range [16, 235]
IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB CSC: YUV2RGB, picture transfer mode,RGB value range [0, 255]
IVE_CSC_MODE_PIC_BT709_YUV_TO_RGB CSC: YUV2RGB, picture transfer mode,RGB value range [0, 255] */
ot_svp_mem_info tmp_buf;
td_u1q15 interp_factor; /* Blend coefficient. [0, 32768] */
td_u0q16 lamda; /* The regularization coefficient. [0, 65535] */
td_u4q12 norm_trunc_alfa; /* The normalization thresh. [0, 4095] */
td_u0q8 sigma; /* The gaussian kernel bandwidth. [0, 255] */
td_u8 resp_threshold;
ot_ive_kcf_core_id core_id;
} ot_ive_kcf_proc_ctrl;
【成员】
【解决方案差异】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_list_head
【说明】
定义链表头结构体参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_obj
【说明】
定义目标信息结构体参数。
【定义】
typedef struct {
ot_ive_roi_info roi_info;
ot_svp_mem_info cos_win_x;
ot_svp_mem_info cos_win_y;
ot_svp_mem_info gauss_peak;
ot_svp_mem_info hog_feature;
ot_svp_mem_info alpha;
ot_svp_mem_info dst;
td_u3q5 padding; /* [48, 160] */
td_u8 reserved[OT_IVE_ARR_RESERVED_NUM_THREE];
} ot_ive_kcf_obj;
【成员】
reserved [OT_IVE_ARR_RESERVED_NUM_THREE] |
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_obj_node
【说明】
定义目标链表节点参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_list_state
【说明】
定义目标链表状态枚举类型。
【定义】
typedef enum {
OT_IVE_KCF_LIST_STATE_CREATE = 0x1,
OT_IVE_KCF_LIST_STATE_DESTORY = 0x2,
OT_IVE_KCF_LIST_STATE_BUTT
} ot_ive_kcf_list_state;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_obj_list
【说明】
定义目标链表结构参数。
【定义】
typedef struct {
ot_ive_kcf_obj_node *obj_node_buf; /* The object list node address */
ot_ive_list_head free_obj_list; /* The free list of object list */
ot_ive_list_head train_obj_list; /* The training list of object list */
ot_ive_list_head track_obj_list; /* The tracking list of object list */
td_u32 free_obj_num; /* The numbers of free list */
td_u32 train_obj_num; /* The numbers of training list */
td_u32 track_obj_num; /* The numbers of tracking list */
td_u32 max_obj_num; /* The maximum numbers of object list */
ot_ive_kcf_list_state list_state; /* The object list state */
td_u8 *tmp_buf; /* Assist buffer */
td_u32 width; /* image width */
td_u32 height; /* image height */
} ot_ive_kcf_obj_list;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_bbox
【说明】
定义目标区域信息参数。
【定义】
typedef struct {
ot_ive_kcf_obj_node *node;
td_s32 response; /* Bbox Response value. */
ot_ive_roi_info roi_info;
td_bool is_track_ok;
td_bool is_roi_refresh;
} ot_ive_kcf_bbox;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_kcf_bbox_ctrl
【说明】
定义目标区域信息控制参数。
【定义】
typedef struct {
td_u32 max_bbox_num; /* The member numbers of Bbox Array. */
td_s32 response_threshold; /* Select Bbox when Bbox'Response value is greater than or equal to RespThr. */
} ot_ive_kcf_bbox_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_hog_mode
【说明】
定义HOG(Histogram of Oriented Gradient)特征存储模式枚举类型。
【定义】
typedef enum {
OT_IVE_HOG_MODE_VER_TANGENT_PLANE = 0x1,
OT_IVE_HOG_MODE_HOR_TANGENT_PLANE = 0x2,
OT_IVE_HOG_MODE_BUTT
} ot_ive_hog_mode;
【成员】
【注意事项】
无
【相关数据类型及接口】
ot_ive_hog_ctrl
【说明】
定义计算HOG(Histogram of Oriented Gradient)特征控制参数。
【定义】
typedef struct {
ot_ive_csc_mode csc_mode; /* Only support:
IVE_CSC_MODE_VIDEO_BT601_YUV_TO_RGB CSC: YUV2RGB, video transfer mode,
RGB value range [16, 235]
IVE_CSC_MODE_VIDEO_BT709_YUV_TO_RGB CSC: YUV2RGB, video transfer mode,
RGB value range [16, 235]
IVE_CSC_MODE_PIC_BT601_YUV_TO_RGB CSC: YUV2RGB, picture transfer mode,
RGB value range [0, 255]
IVE_CSC_MODE_PIC_BT709_YUV_TO_RGB CSC: YUV2RGB, picture transfer mode,
RGB value range [0, 255] */
ot_ive_hog_mode hog_mode; /* Hog mode */
td_u32 roi_num; /* Roi number. [1, 64] */
td_u4q12 norm_trunc_alfa; /* The normalization thresh. [0, 4095] */
ot_ive_kcf_core_id core_id;
} ot_ive_hog_ctrl;
【成员】
【解决方案差异】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_acc_mode
【说明】
定义两图的累积枚举类型。
【定义】
typedef enum {
OT_IVE_ACC_MODE_INCREASE = 0x0,
OT_IVE_ACC_MODE_DECREASE = 0x1,
OT_IVE_ACC_MODE_INCREASE_MAP_255TO1 = 0x2,
OT_IVE_ACC_MODE_BUTT
} ot_ive_acc_mode;
【成员】
【注意事项】
无
【相关数据类型及接口】
ot_ive_acc_ctrl
【说明】
定义两图的累积控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_image_dot_mode
【说明】
定义点乘积枚举类型。
【定义】
typedef enum {
OT_IVE_IMAGE_DOT_MODE_ROUND_INT = 0x0,
OT_IVE_IMAGE_DOT_MODE_BUTT
} ot_ive_image_dot_mode;
【成员】
【注意事项】
无
【相关数据类型及接口】
ot_ive_image_dot_ctrl
【说明】
定义两图的点乘积控制参数。
【定义】
【成员】
【注意事项】
无。
【相关数据类型及接口】
ot_ive_warp_perspective_point_pair
【说明】
定义透视变换点对结构体。
【定义】
typedef struct {
ot_svp_point_float src_point; /* Source point */
ot_svp_point_float dst_point; /* Destination point */
} ot_ive_warp_perspective_point_pair;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_warp_perspective_points
【说明】
定义透视变换点对结构体。
【定义】
typedef struct {
ot_ive_persp_trans_point_pair point[OT_IVE_WARP_PERSPECTIVE_POINT_NUM];
} ot_ive_warp_perspective_points;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
ot_ive_warp_perspective_transform_ctrl
【说明】
定义透视变换控制参数。
【定义】
typedef struct {
td_u32 roi_num; /* Roi number */
td_u32 norm;
} ot_ive_warp_perspective_transform_ctrl;
【成员】
【注意事项】
norm值必须为2的整数次幂,使用时建议设为1。
【相关数据类型及接口】
无。
ot_ive_warp_perspective_ctrl
【说明】
定义透视变换控制参数。
【定义】
typedef struct {
td_u32 roi_num; /* Roi number */
ot_ive_padding_mode padding_mode; /* Border mode */
td_s32 padding_val[OT_IVE_PADDING_ARR_NUM];
} ot_ive_warp_perspective_ctrl;
【成员】
【注意事项】
无。
【相关数据类型及接口】
无。
错误码
IVE错误码
识别加速引擎API错误码如表1所示。
表 1 识别加速引擎API错误码
Proc调试信息
概述
调试信息采用了Linux下的proc文件系统,可实时反映当前系统的运行状态,所记录的信息可供问题定位及分析时使用。
【文件目录】
/proc/umap
【信息查看方法】
- 在控制台上可以使用cat命令查看信息,cat /proc/umap/ive;也可以使用其他常用的文件操作命令,例如 cp /proc/umap/ive ./,将文件拷贝到当前目录。
- 在应用程序中可以将上述文件当作普通只读文件进行读操作,例如fopen、fread等。
说明:
参数在描述时有以下2种情况需要注意:
- 取值为{0, 1}的参数,如未列出具体取值和含义的对应关系,则参数为1时表示肯定,为0时表示否定。
- 取值为{aaa, bbb, ccc}的参数,未列出具体取值和含义的对应关系,但可直接根据取值aaa、bbb或ccc判断参数含义
Proc信息说明
【调试信息】
Hi3519DV500:
~ # cat /proc/umap/ive
[IVE] Version: [Vx.x.x.x B0xx Release], Build Time[Aug 2 2019, 10:08:05]
------------------------------- ive moudle param------------------------------
save_power max_node_num
0 20
-------------------------------ive queue info----------------------------
wait busy wait_cur_id wait_end_id busy_cur_id busy_end_id
1 -1 0 0 0 0
--------------------------------ive task info----------------------------
handle task_finish last_id task_id handle_wrap finish_wrap
5 5 0 0 0 0
-----------------------------------ive runtime info---------------------
last_inst cnt_per_sec max_cnt_per_sec total_int_cnt_last_sec
0 1 2 4
total_int_cnt qt_cnt st_cnt
5 0 0
cost_tm m_cost_tm cost_tm_per_sec m_cost_tm_per_sec
7 17 17 17
total_int_cost_tm last_task_hw_tm run_tm
64 20 20
----------------------------------ive invoke info------------------------
dma filter csc filter_csc sobel mag_ang dilate erode
5 0 0 0 0 0 0 0
thresh and sub or integ hist thresh_s16 thresh_u16
0 0 0 0 0 0 0 0
16to8 ord_stat_filter bernsen map equal_hist add xor ncc
0 0 0 0 0 0 0
ccl gmm canny lbp norm_grad lk shi_tomasi grad_fg
0 0 0 0 0 0 0 0
match_mod update_mod radon ann svm adp_thr line_filter_h
0 0 0 0 0 0 0
noise_remove_h plate_char sad gmm2 resize cnn persp_trans kcf hog
0 0 0 0 0 0 0 0 0
----------------------------------------ive utili info---------------------------------------------------
utili
26
Hi3516CV610:
~ # cat /proc/umap/ive
[IVE] Version: [Vx.x.x.x B0xx Release], Build Time[Aug 2 2019, 10:08:05]
----------------------------------------ive module param----------------------------------------
save_power max_node_num
0 64
--------------------------------------ive queue info---------------------------------------------
wait busy wait_cur_id wait_end_id busy_cur_id busy_end_id
0 0 44 44 0 0
----------------------------------------ive task info---------------------------------------------
handle task_finish last_id task_id handle_wrap finish_wrap
108 108 44 43 0 0
----------------------------------------ive runtime info---------------------------------------------
last_inst cnt_per_sec max_cnt_per_sec total_int_cnt_last_sec total_int_cnt qt_cnt st_cnt
1 64 64 65 108 0 0
cost_tm m_cost_tm cost_tm_per_sec m_cost_tm_per_sec total_int_cost_tm last_task_hw_tm
66 87 2946 2946 4954 2677
run_tm
8
----------------------------------------ive invoke info------------------------------------------------
dma filter csc sobel mag_ang dilate erode threshold
54 0 0 0 0 0 0 0
and sub or integ hist thresh_s16 thresh_u16 16to8
0 0 0 54 0 0 0 0
map ord_stat_filter equal_hist add xor ncc ccl canny
0 0 0 0 0 0 0 0
lbp norm_grad LK sot_tomasi sad gmm2 resize persp_trans
0 0 0 0 0 0 0 0
acc alpha_blending image_dot
0 0 0
----------------------------------------ive utili info---------------------------------------------------
utili
3
【调试信息分析】
记录当前IVE工作状态资源信息和算子调用信息。
【参数说明】
【注意】
- 建议代码调试阶段关闭低功耗,调试完成再打开低功耗。
- 在非低功耗场景时,才会统计IVE硬件利用率。
FAQ
使用PC端IVE Clib与板端IVE SDK开发算法的差异
表 1 使用PC端IVE Clib与板端IVE SDK开发算法的差异
当有需要时与ss_mpi_ive_query配合查询算子是否完成。详细参考重要概念的“句柄(handle)” |
|||
当用户需要使用IVE硬算子的结果时,必须查询任务是否完成。详细参考重要概念的“查询(query)”以及ss_mpi_ive_query接口说明。 |
|||
内存使用malloc开辟。由于malloc出来均为虚拟地址,所以赋值给虚拟地址。为模拟IVE硬件使用物理地址的特性,Clib也使用物理地址,所以物理地址必须赋值,且必须赋值为虚拟地址的td_u32强制类转化。 |
IVE硬件使用物理地址。内存使用ss_mpi_sys_mmz_alloc/ss_mpi_sys_mmz_alloc_cached接口详细信息请参见《MPP 媒体处理软件Vx.y 开发参考》)开辟,物理地址和虚拟地址由此生成;或者使用其他模块的VB内存。 |
||
IVE硬件与CPU异步执行,可以此特性让IVE与CPU并行工作,提高性能。但是在CPU需要使用IVE的结果数据时,需要同步。 |
使用IVE与OpenCV开发算法的区别
- IVE与CPU异步,CPU必须查询IVE任务是否完成;用OpenCV开发算法不需要;
- IVE的参数一般是定点化的,内部计算也是定点的;OpenCV一般是浮点的参数和计算;故同样的功能,IVE相比OpenCV有范围和精度上的限制。
- IVE使用物理地址,且对起始地址以及跨度有对齐要求;OpenCV不需要物理地址,也无对齐要求;
- IVE有软硬件分工,有些算子硬件实现一部分,软件实现一部分,也就是会有硬件+软件多个接口实现一个OpenCV算子的情况。
- IVE算子的控制参数尽可能与OpenCV算子对齐,方便客户从OpenCV算子适配到IVE。例如金字塔LK光流计算控制参数ot_ive_lk_optical_flow_pyr_ctrl结构体内的成员变量与对应的OpenCV算子输入参数变量的含义是一一对齐的;对应的浮点转定点方式可以通过IVE算子参数变量的类型(例如td_u0q8、td_u3q5)和sample样例中参数变量的赋值(例如0.1 * 256、1.5 * 32)来分析其转换关系。
- 若从OpenCV算子适配到IVE算子的开发过程中报错导致无法运行或结果与预期不一致,建议参考sample代码先检查IVE算子的输入是否配置完备、规格和数值范围是否符合规格要求;根据检查代码的报错打印和错误码确认问题范围和原因等。
ANN/SVM查找表的建立
说明:
以函数f(u)建立查找表为例,建立查找表的步骤如下(下面提到的table_in_lower,table_in_upper,table_in_precision,elem_num,table_out_norm,table请参ot_svp_lut结构体说明).
- 明确自变量u的范围:若u在[a, b]之间,假设r=b-a; a、b分别对应table_in_lower,table_in_upper;(ANN建表时u即为自变量u;svm建表时u对应
或者
,具体公式可参考ss_mpi_ive_ann_mlp_predict和ss_mpi_ive_svm_predict的【注意】) - 明确自变量1个单位的采样数g,则g=1<< table_in_precision;整个查找表的元素个数elem_num =r*g=r<< table_in_precision; (ANN和SVM均对查找表有最大数目限制要求,具体参考ss_mpi_ive_ann_mlp_predict和ss_mpi_ive_svm_predict的【注意】)
- 明确值域f(u)的范围,由于一般需要将值域约束到[-1, 1],这时候,可以使用table_out_norm或者1<<table_out_norm做除数来对f(u)做归一化;(ANN仅支持1<<table_out_norm做除数;SVM支持2种,所以ive_xml2bin_ui.exe中对svm的模型转换时要求输入divisor,且divisor必须与建立查找表的归一化除数一致)
- 根据f(u)的具体公式以及u的采样值,生成对应的f(u)查找表,保存在table中。
Cache内存的使用
内存开辟是否带cache,与算法软件对这片内存的使用主体相关。由于IVE是直接读取DDR内存数据,若此时使用的内存带有cache,必须刷cache来保证数据的一致性。所以若使用主体为IVE,CPU不使用或者仅使用一次,那么建议这片内存不带cache;若CPU是使用主体,建议这片内存带cache。
打开/关闭低功耗方法
IVE低功耗开关是通过模块参数传递。在加载IVE ko时把模块参数save_power值设为1(save_power=1),即可打开低功耗,反之为关闭低功耗。默认情况下是打开低功耗。





