文章目录
1 背景
LBP 计算示意图
LBP 计算公式
- IVE_LBP_CMP_NORMAL
- IVE_LBP_CMP_ABS
其中
I(x, y)
对应pstSrc
,lpb(x, y)
对应pstDst
,thr
对应pstLbpCtrl→ un8BitThr
。
2 主要程序
对 LBP 算子的使用主要是参考了win10下的 Hi3519A V100R001C02SPC010\SVP_PC\HiIVE_PC_V2.1.0.7_64bit\sample\LBP 目录下的程序,其实就是照葫芦画瓢咯。
编辑 sample_ive_lbp.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <semaphore.h>
#include <pthread.h>
#include <math.h>
#include <time.h>
#include "sample_comm_ive.h"
typedef struct hiSAMPLE_IVE_LBP_S
{
IVE_SRC_IMAGE_S stSrc; //input frame
IVE_DST_IMAGE_S stDst; //output frame
FILE* pFpSrc; //read from pFpSrc
FILE* pFpDst; //write to pFpDst
}SAMPLE_IVE_LBP_S;
static SAMPLE_IVE_LBP_S s_stLbp;
static HI_VOID SAMPLE_IVE_Lbp_Uninit(SAMPLE_IVE_LBP_S *pstLbp)
{
IVE_MMZ_FREE(pstLbp->stSrc.au64PhyAddr[0], pstLbp->stSrc.au64VirAddr[0]);
IVE_MMZ_FREE(pstLbp->stDst.au64PhyAddr