Hi3519 设置crop动态调节输出分辨率
Posted 红尘六欲
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hi3519 设置crop动态调节输出分辨率相关的知识,希望对你有一定的参考价值。
正常出图后,客户要求调整视角,所以需要在开始编码后设置crop,测试过好多办法都不行,单独只设置venc的crop不行,设置vpss,再设置venc也不行,设置isp,vpss在设置venc也不行,最后找到一个同样要设置crop的说是要先设置vi,最后测试成功。主要代码如下
void mycamera_setCrop(int width,int height,int x,int y)
HI_S32 s32Ret;
VI_CROP_INFO_S pstCropInfo;
s32Ret = HI_MPI_VI_GetChnCrop(myViPipe,myViChn,&pstCropInfo);
printf("HI_MPI_VI_GetChnCrop s32Ret=:0x%lx\\n",s32Ret);
pstCropInfo.bEnable = 1;
pstCropInfo.enCropCoordinate = 1;
pstCropInfo.stCropRect.s32X = x;
pstCropInfo.stCropRect.s32Y = y;
pstCropInfo.stCropRect.u32Width = width;
pstCropInfo.stCropRect.u32Height = height;
s32Ret = HI_MPI_VI_SetChnCrop(myViPipe,myViChn,&pstCropInfo);
printf("HI_MPI_VI_SetChnCrop s32Ret=:0x%lx\\n",s32Ret);
VENC_CHN_ATTR_S stChnAttr;
s32Ret = HI_MPI_VENC_GetChnAttr(myVencChn[0],&stChnAttr);
if (HI_SUCCESS != s32Ret)
SAMPLE_PRT("HI_MPI_VENC_GetChnAttr failed s32Ret:0x%lx!\\n",s32Ret);
return;
printf("HI_MPI_VENC_GetChnAttr u32PicWidth:%ld u32PicHeight:%ld\\n",stChnAttr.stVencAttr.u32PicWidth,stChnAttr.stVencAttr.u32PicHeight);
stChnAttr.stVencAttr.u32PicWidth = width;
stChnAttr.stVencAttr.u32PicHeight = height;
s32Ret =HI_MPI_VENC_StopRecvFrame(myVencChn[0]);
printf("HI_MPI_VENC_StopRecvFrame s32Ret=:0x%lx\\n",s32Ret);
s32Ret = HI_MPI_VENC_SetChnAttr(myVencChn[0],&stChnAttr);
if (HI_SUCCESS != s32Ret)
SAMPLE_PRT("HI_MPI_VENC_SetChnAttr failed s32Ret:0x%lx!\\n",s32Ret);
return;
else
printf("HI_MPI_VENC_SetChnAttr success\\n");
VENC_RECV_PIC_PARAM_S RecvParam;
RecvParam.s32RecvPicNum = -1;
s32Ret = HI_MPI_VENC_StartRecvFrame(myVencChn[0],&RecvParam);
printf("HI_MPI_VENC_StartRecvFrame s32Ret=:0x%lx\\n",s32Ret);
if (HI_SUCCESS != s32Ret)
SAMPLE_PRT("HI_MPI_VENC_StartRecvFrame failed s32Ret:0x%lx!\\n",s32Ret);
return;
else
printf("HI_MPI_VENC_StartRecvFrame success\\n");
开始出图后,通过调用这个函数要设置偏移与宽高都正常。如果后面调节HI_MPI_VENC_SetChnAttr
设置venc的宽高,那最终venc会将图像缩放到原始大小.
参考
链接: https://www.ebaina.com/resources/240000026785
链接: http://bbs.ebaina.com/thread-18088-1-7.html
以上是关于Hi3519 设置crop动态调节输出分辨率的主要内容,如果未能解决你的问题,请参考以下文章