海思鱼眼矫正

查看具体芯片的GDC 硬件规格,主要看以下参数:

视频输入数据格式
输入图像分辨率
视频输出数据格式
输出图像分辨率
PTZ参数范围
性能

一般鱼眼矫正是在 VI的扩展通道

即:初始化VI模块后:

VI_EXT_CHN_ATTR_S   stExtChnAttr;
VI_CHN   ViExtChn    = VI_EXT_CHN_START;
SIZE_S              stDstSize;

    s32Ret = HI_MPI_VI_GetChnAttr(ViPipe, ViChn, &stChnAttr);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("get vi chn:%d attr failed with:0x%x!\n", ViChn, s32Ret);
        goto EXIT_VI_STOP;
    }

    stExtChnAttr.s32BindChn                   = ViChn; //扩展通道绑定vi通道
    stExtChnAttr.enCompressMode               = stChnAttr.enCompressMode;
    stExtChnAttr.enPixFormat                  = stChnAttr.enPixelFormat;
    stExtChnAttr.stFrameRate.s32SrcFrameRate  = stChnAttr.stFrameRate.s32SrcFrameRate;
    stExtChnAttr.stFrameRate.s32DstFrameRate  = stChnAttr.stFrameRate.s32DstFrameRate;
    stExtChnAttr.stSize.u32Width              = stChnAttr.stSize.u32Width;
    stExtChnAttr.stSize.u32Height             = stChnAttr.stSize.u32Height;
    stExtChnAttr.u32Depth                     = 0;
    stExtChnAttr.enDynamicRange               = stChnAttr.enDynamicRange;
    stExtChnAttr.enSource                     = VI_EXT_CHN_SOURCE_TAIL;

    stDstSize.u32Width = stChnAttr.stSize.u32Width;
    stDstSize.u32Height = stChnAttr.stSize.u32Height;

    /* start vi dev extern chn */
    s32Ret = HI_MPI_VI_SetExtChnAttr(ViPipe, ViExtChn, &stExtChnAttr);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("set vi extern chn attr failed with: 0x%x.!\n", s32Ret);
        goto EXIT_VI_STOP;
    }

    /*Enable ext-channel*/
    s32Ret = HI_MPI_VI_EnableChn(ViPipe,ViExtChn);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("enable vi extern chn failed with: 0x%x.!\n", s32Ret);
        goto EXIT_VI_STOP;
    }

使能vi扩展通道后,将后面的绑定关系绑定在vi扩展通道上,例如:

VI -----VIEXT-----VPSS-----VENC

之后设置鱼眼属性:

    FISHEYE_ATTR_S      stFisheyeAttr;

    stFisheyeAttr.bEnable             = HI_TRUE;
    stFisheyeAttr.bLMF                = HI_FALSE;
    stFisheyeAttr.bBgColor            = HI_FALSE;
    stFisheyeAttr.u32BgColor          = COLOR_RGB_BLUE;
    stFisheyeAttr.s32HorOffset        = 0;
    stFisheyeAttr.s32VerOffset        = 0;
    stFisheyeAttr.u32TrapezoidCoef    = 10;
    stFisheyeAttr.s32FanStrength      = 300;
    stFisheyeAttr.enMountMode         = FISHEYE_WALL_MOUNT;
    stFisheyeAttr.u32RegionNum        = 1;


    stFisheyeAttr.astFishEyeRegionAttr[0].enViewMode            = FISHEYE_VIEW_180_PANORAMA;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32InRadius           = 0;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32OutRadius          = 1200;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32Pan                = 180;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32Tilt               = 165;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32HorZoom            = 4095;
    stFisheyeAttr.astFishEyeRegionAttr[0].u32VerZoom            = 4095;
    stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.s32X        = 0;
    stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.s32Y        = 0;
    stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.u32Width    = stDstSize.u32Width;
    stFisheyeAttr.astFishEyeRegionAttr[0].stOutRect.u32Height    = ALIGN_DOWN(stDstSize.u32Height, 2);
   
    s32Ret =  HI_MPI_VI_SetExtChnFisheye(ViPipe,ViExtChn,&stFisheyeAttr);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("set fisheye attr failed with s32Ret:0x%x!\n", s32Ret);
        goto END;
    }

具体参数设置参看GDC调试指南

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值