91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

海思Hi3516A(4)HDR模式開發

發布時間:2020-07-02 01:32:07 來源:網絡 閱讀:12957 作者:shugenyin 欄目:編程語言

1. HDR概述

  HDR(High-Dynamic Range)算法根據不同曝光的圖片,合成最終HDR圖片,比一般圖片具有更寬的動態范圍和圖像細節。

  一般HDR算法有兩種:一種是基于不同曝光時間的連續幾幅圖片合現,這種方法實現簡單,只要能調曝光的sensor都可以實合成一幅圖片;第二種是基于同一行不同曝光,最終成一幅圖片,這種方法需要sensor支持行間長短曝光。

  這里使用500萬分辨率攝像頭芯片實現行間長短曝光實現HDR算法。


2. HDR模式傳輸方式

  在攝像頭芯片中,視頻信號通過MIPI接口傳輸,根據MIPI協議可將長短曝光行數據,通過兩個virtual channel來傳輸。

  行間HDR數據讀出時序如下:

海思Hi3516A(4)HDR模式開發

  • Fram_longFram_short輸出偏差為max short exposure

  • max long exposure={幀長}-max short exposure


3. sensor的庫文件生成(.so)

  Sensor的庫文件需要在Linux服務器中的SDK包中編譯得到,將生成的.so文件放到SDK包中的stream軟件包中的Hi3516A_Stream_xxx/libs目錄下。

XXXX_sensor_ctl.c實現sensor的初始化:

void sensor_init_5M_2lan_10bit_hdr()
{
	sensor_write_register(0x0100,0x00);sensor_write_register(0x363f,0x1c);
	sensor_write_register(0x3e03,0x03);sensor_write_register(0x3e08,0x00);
	sensor_write_register(0x3e09,0x10);sensor_write_register(0x3400,0x52);
	sensor_write_register(0x5000,0x21);sensor_write_register(0x5001,0x04);
	sensor_write_register(0x3627,0x02);sensor_write_register(0x320c,0x06);
	sensor_write_register(0x3f00,0xc6);sensor_write_register(0x3f01,0x04);
	sensor_write_register(0x3306,0x20);sensor_write_register(0x330b,0x38);
	sensor_write_register(0x4503,0xbb);sensor_write_register(0x3623,0x00);
	sensor_write_register(0x3622,0x0e);sensor_write_register(0x3630,0x34);
	sensor_write_register(0x3303,0x30);sensor_write_register(0x3309,0x30);
	sensor_write_register(0x331e,0x28);sensor_write_register(0x331f,0x28);
	sensor_write_register(0x3320,0x2c);sensor_write_register(0x3321,0x2c);
	sensor_write_register(0x3322,0x2c);sensor_write_register(0x3323,0x2c);
	sensor_write_register(0x5001,0x05);sensor_write_register(0x3902,0x05);
	sensor_write_register(0x3909,0x02);sensor_write_register(0x3907,0x00);
	sensor_write_register(0x3908,0x40);sensor_write_register(0x3416,0x00);
	sensor_write_register(0x3621,0x18);
	sensor_write_register(0x3627,0x04);sensor_write_register(0x3333,0x00);
	sensor_write_register(0x3334,0xf0);sensor_write_register(0x3662,0x82);
	sensor_write_register(0x3e09,0x50);sensor_write_register(0x3908,0x00);
	sensor_write_register(0x3620,0x62);sensor_write_register(0x5000,0x21);
	sensor_write_register(0x3e09,0xf0);sensor_write_register(0x3400,0x52);
	sensor_write_register(0x3638,0x84);sensor_write_register(0x3637,0x82);
	sensor_write_register(0x363f,0x0c);sensor_write_register(0x3622,0x02);
	sensor_write_register(0x330b,0x3c);sensor_write_register(0x363a,0x1c);
	sensor_write_register(0x3c00,0x41);sensor_write_register(0x3e01,0x10);
	sensor_write_register(0x3e05,0x00);sensor_write_register(0x3e06,0xf0);
	sensor_write_register(0x3221,0x80);sensor_write_register(0x4816,0x11);
	sensor_write_register(0x3e04,0x03);sensor_write_register(0x6000,0x21);
	sensor_write_register(0x320e,0x0f); //max inttime
	sensor_write_register(0x320f,0x80); //max inttime
	sensor_write_register(0x3e15,0x00); //max short exposure
	sensor_write_register(0x3e16,0x40); //max short exposure
	sensor_write_register(0x3c00,0x00); //[2]: 0  mipi->fifo
	sensor_write_register(0x303f,0x02); //[7]: 0  sel pll_pclk
	sensor_write_register(0x3031,0x0a); //[3:0] 10bit
	sensor_write_register(0x3018,0x33); //[7:5]  sel lane=reg+1
	sensor_write_register(0x3c03,0x10); //fifo for 4lane
	sensor_write_register(0x3030,0x04);
	sensor_write_register(0x303d,0x01);sensor_write_register(0x303b,0x02);
	sensor_write_register(0x303c,0x08);sensor_write_register(0x3650,0x37);
	sensor_write_register(0x363f,0x0c);sensor_write_register(0x3300,0x10);
	sensor_write_register(0x3654,0x45);sensor_write_register(0x3902,0x45);
	sensor_write_register(0x3909,0x00);sensor_write_register(0x390a,0x00);
	sensor_write_register(0x3400,0x53);sensor_write_register(0x3039,0x10);
	sensor_write_register(0x303a,0x18);sensor_write_register(0x330a,0x01);
	sensor_write_register(0x330b,0x40);sensor_write_register(0x3306,0x80);
	sensor_write_register(0x3308,0x08);sensor_write_register(0x3416,0x20);
	sensor_write_register(0x320c,0x04);sensor_write_register(0x3907,0x03);
	sensor_write_register(0x3626,0x30); //0909
	sensor_write_register(0x5000,0x21);sensor_write_register(0x330b,0xa0);
	sensor_write_register(0x3630,0x24); //0x14
	sensor_write_register(0x3620,0x48);sensor_write_register(0x3f05,0xf0);
	sensor_write_register(0x320c,0x05);sensor_write_register(0x3e09,0x10);
	sensor_write_register(0x320d,0xa0); //25fps
	sensor_write_register(0x3c00,0x41); //fifo configsensor_write_register(0x3622,0x02);
	sensor_write_register(0x3638,0x83);sensor_write_register(0x3306,0x90);
	sensor_write_register(0x3f05,0xe0);sensor_write_register(0X3620,0X42);
	sensor_write_register(0x363a,0x14);sensor_write_register(0x3416,0x11);
	sensor_write_register(0x3334,0xa0);sensor_write_register(0x3333,0x90);
	sensor_write_register(0x3620,0x46); //0x66  gain<2
	sensor_write_register(0x3303,0x48);sensor_write_register(0x3309,0x48);
	sensor_write_register(0x3627,0x08);
	sensor_write_register(0x335d,0x00);sensor_write_register(0x330e,0x10);
	sensor_write_register(0x303c,0x08); //half mipi speed
	sensor_write_register(0x363c,0xc3);
	sensor_write_register(0x3010,0xe0); //close dvp out
	sensor_write_register(0x300f,0xff);sensor_write_register(0x300e,0x0f);
	sensor_write_register(0x3635,0x38);sensor_write_register(0x3636,0x38);
	sensor_write_register(0x363f,0x80);sensor_write_register(0x3631,0x02);
	sensor_write_register(0x3637,0x82);sensor_write_register(0x3035,0xca);
	sensor_write_register(0x3300,0x30);sensor_write_register(0x330b,0x60);
	sensor_write_register(0x3f04,0x03);sensor_write_register(0x3f05,0x30);
	sensor_write_register(0x3633,0x1e);sensor_write_register(0x3630,0x1c);
	sensor_write_register(0x3622,0x06);sensor_write_register(0x0100,0x01);
}

  XXXX_cmos.c主要實現ISP需要的回調函數,傳遞參數,包括ISP、AE、AWB等。還需將變量genSensorMode賦值為WDR_MODE_2To1_LINE,以選擇行間HDR模式。

//ISP function
HI_S32 cmos_init_sensor_exp_function(ISP_SENSOR_EXP_FUNC_S *pstSensorExpFunc)
{
    memset(pstSensorExpFunc, 0, sizeof(ISP_SENSOR_EXP_FUNC_S));
  
    pstSensorExpFunc->pfn_cmos_sensor_init = sensor_init;
    pstSensorExpFunc->pfn_cmos_sensor_exit = sensor_exit;
    pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init;
    pstSensorExpFunc->pfn_cmos_set_p_w_picpath_mode = cmos_set_p_w_picpath_mode;
    pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode;
      
    pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default;
    pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_isp_black_level;
    pstSensorExpFunc->pfn_cmos_set_pixel_detect = cmos_set_pixel_detect;
    pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info;
  
    return 0;
}
  
//AE function
HI_S32 cmos_init_ae_exp_function(AE_SENSOR_EXP_FUNC_S *pstExpFuncs)
{
    memset(pstExpFuncs, 0, sizeof(AE_SENSOR_EXP_FUNC_S));
  
    pstExpFuncs->pfn_cmos_get_ae_default    = cmos_get_ae_default;
    pstExpFuncs->pfn_cmos_fps_set           = cmos_fps_set;
    pstExpFuncs->pfn_cmos_slow_framerate_set= cmos_slow_framerate_set;    
    pstExpFuncs->pfn_cmos_inttime_update    = cmos_inttime_update;
    pstExpFuncs->pfn_cmos_gains_update      = cmos_gains_update;
    pstExpFuncs->pfn_cmos_again_calc_table  = cmos_again_calc_table;
    pstExpFuncs->pfn_cmos_get_inttime_max   = cmos_get_inttime_max; 
  
    return 0;
}
  
//AWB function
HI_S32 cmos_init_awb_exp_function(AWB_SENSOR_EXP_FUNC_S *pstExpFuncs)
{
    memset(pstExpFuncs, 0, sizeof(AWB_SENSOR_EXP_FUNC_S));
  
    pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default;
  
    return 0;
}

HI_U8 gu8SensorImageMode = SENSOR_5M_25FPS_MODE;
WDR_MODE_E genSensorMode = WDR_MODE_2To1_LINE;

  與一般sensor設置曝光不同,HDR行間模式需要行間交替實現曝光時間設置,也是在XXXX_cmos.c中實現,具體函數如下:

static HI_VOID cmos_inttime_update(HI_U32 u32IntTime)
{
    static HI_BOOL bFirst = HI_TRUE;

    if (WDR_MODE_2To1_LINE == genSensorMode)
    {
        if (bFirst) //short exposure
        {
            au32WDRIntTime[0] = u32IntTime;
            g_stSnsRegsInfo.astI2cData[4].u32Data = (u32IntTime >> 4) & 0xFF; ;
            g_stSnsRegsInfo.astI2cData[5].u32Data = (u32IntTime<<4) & 0xF0;
            bFirst = HI_FALSE;
        }
        else //long exposure 
        {
            au32WDRIntTime[1] = u32IntTime;
            g_stSnsRegsInfo.astI2cData[0].u32Data = (u32IntTime >> 4) & 0xFF; ;
            g_stSnsRegsInfo.astI2cData[1].u32Data = (u32IntTime<<4) & 0xF0;
            bFirst = HI_TRUE;
        }
    }
    else
    {
        g_stSnsRegsInfo.astI2cData[0].u32Data = (u32IntTime >> 4) & 0xFF; ;
        g_stSnsRegsInfo.astI2cData[1].u32Data = (u32IntTime<<4) & 0xF0;
        bFirst = HI_TRUE;
    }

    return;
}


4. 修改stream軟件包的.ini文件

[sensor]
Sensor_type   =XXXX                   ;sensor name
Mode          =2                        ;WDR_MODE_NONE = 0
                                        ;WDR_MODE_BUILT_IN = 1
                                        ;WDR_MODE_2To1_LINE = 2
                                        ;WDR_MODE_2To1_FRAME = 3
                                        ;WDR_MODE_2To1_FRAME_FULL_RATE =4 ...etc
DllFile   =libs/libsns_XXXX_2lan.so        ;sensor lib path
 
[mode]                               
input_mode =0                           ;INPUT_MODE_MIPI = 0
                                        ;INPUT_MODE_SUBLVDS = 1
                                        ;INPUT_MODE_LVDS = 2 ...etc
 
dev_attr = 0                             ;mipi_dev_attr_t = 0
                                        ;lvds_dev_attr_t = 1
                                        ;NULL =2
 
[mipi]    
;----------only for mipi_dev---------               
data_type = 1                         ;raw data type: 8/10/12/14 bit
                                        ;RAW_DATA_8BIT = 0
                                        ;RAW_DATA_10BIT = 1
                                        ;RAW_DATA_12BIT = 2 
                                        ;RAW_DATA_14BIT = 3 
lane_id = 0| 1 | -1 | -1 |-1|-1|-1|-1|        ;lane_id: -1 - disable
 
[isp_p_w_picpath]
Isp_x      =0
Isp_y      =0
Isp_W      =2560
Isp_H      =1920
Isp_FrameRate=25
Isp_Bayer  =3   ;BAYER_RGGB=0, BAYER_GRBG=1, BAYER_GBRG=2, BAYER_BGGR=3


5. 運行stream軟件

  運行stream軟件包中的HiIspTool.sh腳本,通過以太網卡與上位機的PQTools建立通信。

cd Hi3516A_Stream_V1.0.5.0
./HiIspTools.sh -a -p XXXX_5m_2lan.ini


6. 運行PQ Tools

  雙擊PQ Tools圖片,彈出如下對話框,設置IP地址。

海思Hi3516A(4)HDR模式開發

  在下拉菜單中選擇TTP_Stream.exe選項.

海思Hi3516A(4)HDR模式開發


7. 結果對比

  正常光照下的圖片,日光燈顯示模糊。

海思Hi3516A(4)HDR模式開發

  打開燈板后,無法捕捉寬動態范圍的的場景,盒中的水果不能正常顯示(偏黑),燈板的LED陣列無法識別,背景也非常昏暗。

海思Hi3516A(4)HDR模式開發

  開啟行間HDR功能后,盒中中的水果可以清晰辨認,燈板的LED陣列也可清晰辨認,背景可見度有很大提升。

海思Hi3516A(4)HDR模式開發

向AI問一下細節

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

AI

安陆市| 城固县| 昌宁县| 潞西市| 麻阳| 府谷县| 黑水县| 赞皇县| 梓潼县| 安新县| 江安县| 资源县| 苗栗县| 泗洪县| 宜兰县| 高平市| 莒南县| 噶尔县| 宝坻区| 游戏| 吉首市| 红桥区| 涞源县| 吉林市| 抚松县| 宁远县| 利辛县| 康保县| 建平县| 长岭县| 织金县| 山东省| 泽普县| 阳泉市| 柳州市| 扶余县| 南宁市| 乌拉特前旗| 威信县| 富源县| 宣化县|