溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

海思Hi3516A(5)3D降噪

發(fā)布時間:2020-07-21 05:59:18 來源:網(wǎng)絡(luò) 閱讀:14158 作者:shugenyin 欄目:編程語言

1. 概述

3D降噪算法是將前后兩幀的圖像進行對比處理,找出噪點位置,然后對其增益控制。3D數(shù)字降噪功能能夠降低弱信號圖像的噪波干擾。


2. 函數(shù)接口

HI_S32 HI_MPI_VPSS_SetGrpParam(VPSS_GRP VpssGrp, VPSS_GRP_PARAM_S*pstVpssParam);

參數(shù)名稱描述輸入/輸出
VpssGrpVPSS GROUP號輸入
pstVpssParam高級屬性設(shè)置輸入

 VPSS_GRP_PARAM_S結(jié)構(gòu)體:

typedef struct hiVPSS_GRP_PARAM_S
{
HI_U32 u32Contrast;                  //保留
HI_S32 s32GlobalStrength;            //3DNR降噪強度,[0.1408]
HI_S32 s32IeStrength;                //圖像紋理增強,[-1,100]
HI_S32 s32YSFStrength;               //亮度空域去噪強度,[-1,100]
HI_S32 s32YTFStrength;               //亮度時域去噪強度,[-1,15]
HI_S32 s32CSFStrength;               //色度空域去噪強度,[-1,255]
HI_S32 s32CTFStrength;               //色域時域去噪強度,[-1,32]
HI_S32 s32MotionLimen;               //運動閾值,表示NR強度,[-1,32]
}VPSS_GRP_PARAM_S;

空域降噪是對單幀進行采樣,降噪會犧牲更多的細節(jié);時域降噪是對前后幀進行分析,盡量保留畫面細節(jié),但是拍攝劇烈運動可能會有拖影。在實際應(yīng)用中可根據(jù)不同的側(cè)重點(細節(jié)、運動、亮度、色度)來調(diào)整VPSS_GRP_PARAM_S結(jié)構(gòu)體的成員變量。


3. PQTools設(shè)置界面

海思Hi3516A(5)3D降噪


4. 代碼設(shè)計

在SDK包的mpp/tools目錄下編寫應(yīng)用程序代碼,具體代碼如下:

/* File Name: vpss_attr_3dnr.c
   Author:    shugen.yin
   Date:      2017.2.10
   Function:  3DNR setting
   log:
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hi_common.h"
#include "hi_comm_video.h"
#include "hi_comm_sys.h"
#include "hi_comm_vo.h"
#include "hi_comm_vi.h"
#include "hi_comm_vpss.h"
#include "hi_type.h"
#include "mpi_vb.h"
#include "mpi_sys.h"
#include "mpi_vi.h"
#include "mpi_vo.h"
#include "mpi_vpss.h"


#define CHECK_RET(express,name)\
    do{\
        if (HI_SUCCESS != express)\
        {\
            printf("%s failed at %s: LINE: %d ! errno:%#x \n", \
                   name, __FUNCTION__, __LINE__, express);\
            return HI_FAILURE;\
        }\
    }while(0)


HI_S32 main()
{
    HI_S32 s32Ret=0;
    HI_U8 u8Index = 0;
    VPSS_GRP VpssGrp = 0;
    VPSS_GRP_ATTR_S stVpssGrpAttr = {0};
    VPSS_GRP_PARAM_S stVpssGrpParam = {0};
	
   HI_S32 s32NrParam[4][8] = {	
	{0x0, 0x2f8, 0x0, 0x20, 0xc, 0x8, 0x6, 0x0},
	{0x0, 0x330, 0x0, 0x20, 0xc, 0x8, 0x6, 0x0},
	{0x0, 0x3ea, 0x0, 0x20, 0xc, 0x8, 0x6, 0x0},
	{0x0, 0x458, 0x0, 0x20, 0xc, 0xe, 0xc, 0x0}
    };
    
    s32Ret = HI_MPI_VPSS_GetGrpAttr(VpssGrp, &stVpssGrpAttr);
    CHECK_RET(s32Ret, "HI_MPI_VPSS_GetGrpAttr");
    s32Ret = HI_MPI_VPSS_GetGrpParam(VpssGrp, &stVpssGrpParam);
    CHECK_RET(s32Ret, "HI_MPI_VPSS_GetGrpParam");

	stVpssGrpAttr.bNrEn = 1;
	stVpssGrpParam.u32Contrast = s32NrParam[u8Index][0];
	stVpssGrpParam.s32GlobalStrength = s32NrParam[u8Index][1];
	stVpssGrpParam.s32IeStrength = s32NrParam[u8Index][2];
	stVpssGrpParam.s32YSFStrength = s32NrParam[u8Index][3];
	stVpssGrpParam.s32YTFStrength = s32NrParam[u8Index][4];
	stVpssGrpParam.s32CSFStrength = s32NrParam[u8Index][5];
	stVpssGrpParam.s32CTFStrength = s32NrParam[u8Index][6];
	stVpssGrpParam.s32MotionLimen = s32NrParam[u8Index][7];


    s32Ret = HI_MPI_VPSS_SetGrpAttr(VpssGrp, &stVpssGrpAttr);
	CHECK_RET(s32Ret, "HI_MPI_VPSS_SetGrpAttr");
    s32Ret = HI_MPI_VPSS_SetGrpParam(VpssGrp, &stVpssGrpParam);
    CHECK_RET(s32Ret, "HI_MPI_VPSS_SetGrpParam");
    return 0;
}


5. 編譯運行

在mpp/tools目錄下執(zhí)行make命令,生成vpss_attr_3dnr可執(zhí)行程序,將此可執(zhí)行程序復(fù)制到目標板卡中,執(zhí)行./vpss_attr_3dnr,3DNR算法模塊開始工作。

海思Hi3516A(5)3D降噪


6. 最終結(jié)果

在沒有運行vpss_attr_3dnr時,視頻顯示結(jié)果如下圖所示,畫面有明顯的弱噪聲。

海思Hi3516A(5)3D降噪

運行vpss_attr_3dnr后,視頻顯示結(jié)果如下圖所示,弱噪聲得到明顯抑制。

海思Hi3516A(5)3D降噪

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI