3980
- 收藏
- 点赞
- 分享
- 举报
如何将移动侦测处理的背景图像输出?
本帖最后由 bemy1004 于 2018-6-5 16:55 编辑
刚接触Hi3519V101板子,想对移动侦测功能(Md)进行更多的学习。我想将背景图像输出,参考sample_ive_md.c的关系,我对输出stBaseFrmInfo重新赋值,如下:
[code]
IVE_DST_IMAGE_S Img_bg; // backgroung image.
s32Ret = SAMPLE_COMM_IVE_CreateImage(&Img_bg,IVE_IMAGE_TYPE_U8C1,720,576);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Create bg_image failed!\n");
SAMPLE_PRT("SAMPLE_COMM_IVE_CreateImage fail,Error(%#x)\n",s32Ret);
return NULL;
}
while (HI_FALSE == s_bStopSignal)
{
SAMPLE_PRT("start MD!\n");
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[1], &stExtFrmInfo, s32MilliSec);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[1], s32Ret);
continue;
}
/*
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[0], &stBaseFrmInfo, s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!=s32Ret, EXT_RELEASE,
"HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[0], s32Ret);
*/
if (HI_TRUE != bFirstFrm)
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
//printf("Not_First_Frame!!! %d \n",s32CurIdx);
}
else
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[1-s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
printf("First_Frame!!! %d \n",s32CurIdx);
bFirstFrm = HI_FALSE;
goto CHANGE_IDX;//first frame just init reference frame
}
s32Ret = HI_IVS_MD_Process(MdChn,&pstMd->astImg[s32CurIdx],&pstMd->astImg[1 - s32CurIdx],&Img_sad,&pstMd->stBlob);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_IVS_MD_Process fail,Error(%#x)\n",s32Ret);
s32Ret = HI_IVS_MD_GetBg(MdChn,&Img_bg);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_IVS_MD_GetBg failed\n");
continue;
}
//change the VO (img_bg to video_frame_info).
//s32Ret = SAMPLE_COMM_IVE_Image2Dma(&stBaseFrmInfo,&Img_bg,bInstant);
//SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, EXT_RELEASE,"SAMPLE_COMM_IVE_Image2Dma fail,Error(%#x)\n",s32Ret);
//direct transform.
stBaseFrmInfo.stVFrame.pVirAddr[0] = Img_bg.pu8VirAddr[0];
stBaseFrmInfo.stVFrame.u32PhyAddr[0] = Img_bg.u32PhyAddr[0];
stBaseFrmInfo.stVFrame.u32Width = (HI_U32)Img_bg.u16Width;
stBaseFrmInfo.stVFrame.u32Height = (HI_U32)Img_bg.u16Height;
stBaseFrmInfo.stVFrame.u32Stride[0] = (HI_U32)Img_bg.u16Stride[0];
/*
//Blob2Rect.
SAMPLE_COMM_IVE_BlobToRect((IVE_CCBLOB_S *)pstMd->stBlob.pu8VirAddr,&(pstMd->stRegion),50,8,
pstMdAttr->u16Width,pstMdAttr->u16Height,(HI_U16)stBaseFrmInfo.stVFrame.u32Width,(HI_U16)stBaseFrmInfo.stVFrame.u32Height);
//Draw rect.
s32Ret = SAMPLE_COMM_VGS_FillRect(&stBaseFrmInfo, &pstMd->stRegion, 0x00FF0000);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,"SAMPLE_COMM_VGS_FillRect fail,Error(%#x)\n",s32Ret);
*/
s32Ret = HI_MPI_VO_SendFrame(voLayer,voChn,&stBaseFrmInfo,s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_MPI_VO_SendFrame fail,Error(%#x)\n",s32Ret);
CHANGE_IDX:
//Change reference and current frame index
printf("haha %d \n",s32CurIdx);
s32CurIdx = 1 - s32CurIdx;
}[/code]
根据代码的意思:(1)输入的图像分两路:图像处理和输出(stBaseFrmInfo和stExtFrmInfo);
(2)将图像处理的结果(矩形坐标)叠加在输出图像上(stBaseFrmInfo);
(3)通过VO将stBaseFrmInfo赋值到输出通道。
我的想法是直接对输出图像用背景图像(img_bg)进行赋值,但是仍然报错。
请大神指导一下,感激!
刚接触Hi3519V101板子,想对移动侦测功能(Md)进行更多的学习。我想将背景图像输出,参考sample_ive_md.c的关系,我对输出stBaseFrmInfo重新赋值,如下:
[code]
IVE_DST_IMAGE_S Img_bg; // backgroung image.
s32Ret = SAMPLE_COMM_IVE_CreateImage(&Img_bg,IVE_IMAGE_TYPE_U8C1,720,576);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("Create bg_image failed!\n");
SAMPLE_PRT("SAMPLE_COMM_IVE_CreateImage fail,Error(%#x)\n",s32Ret);
return NULL;
}
while (HI_FALSE == s_bStopSignal)
{
SAMPLE_PRT("start MD!\n");
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[1], &stExtFrmInfo, s32MilliSec);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[1], s32Ret);
continue;
}
/*
s32Ret = HI_MPI_VPSS_GetChnFrame(s32VpssGrp, as32VpssChn[0], &stBaseFrmInfo, s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS!=s32Ret, EXT_RELEASE,
"HI_MPI_VPSS_GetChnFrame failed, VPSS_GRP(%d), VPSS_CHN(%d), Error(%#x)!\n",
s32VpssGrp, as32VpssChn[0], s32Ret);
*/
if (HI_TRUE != bFirstFrm)
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
//printf("Not_First_Frame!!! %d \n",s32CurIdx);
}
else
{
s32Ret = SAMPLE_COMM_IVE_DmaImage(&stExtFrmInfo,&pstMd->astImg[1-s32CurIdx],bInstant);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"SAMPLE_COMM_IVE_DmaImage fail,Error(%#x)\n",s32Ret);
printf("First_Frame!!! %d \n",s32CurIdx);
bFirstFrm = HI_FALSE;
goto CHANGE_IDX;//first frame just init reference frame
}
s32Ret = HI_IVS_MD_Process(MdChn,&pstMd->astImg[s32CurIdx],&pstMd->astImg[1 - s32CurIdx],&Img_sad,&pstMd->stBlob);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_IVS_MD_Process fail,Error(%#x)\n",s32Ret);
s32Ret = HI_IVS_MD_GetBg(MdChn,&Img_bg);
if(HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_IVS_MD_GetBg failed\n");
continue;
}
//change the VO (img_bg to video_frame_info).
//s32Ret = SAMPLE_COMM_IVE_Image2Dma(&stBaseFrmInfo,&Img_bg,bInstant);
//SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, EXT_RELEASE,"SAMPLE_COMM_IVE_Image2Dma fail,Error(%#x)\n",s32Ret);
//direct transform.
stBaseFrmInfo.stVFrame.pVirAddr[0] = Img_bg.pu8VirAddr[0];
stBaseFrmInfo.stVFrame.u32PhyAddr[0] = Img_bg.u32PhyAddr[0];
stBaseFrmInfo.stVFrame.u32Width = (HI_U32)Img_bg.u16Width;
stBaseFrmInfo.stVFrame.u32Height = (HI_U32)Img_bg.u16Height;
stBaseFrmInfo.stVFrame.u32Stride[0] = (HI_U32)Img_bg.u16Stride[0];
/*
//Blob2Rect.
SAMPLE_COMM_IVE_BlobToRect((IVE_CCBLOB_S *)pstMd->stBlob.pu8VirAddr,&(pstMd->stRegion),50,8,
pstMdAttr->u16Width,pstMdAttr->u16Height,(HI_U16)stBaseFrmInfo.stVFrame.u32Width,(HI_U16)stBaseFrmInfo.stVFrame.u32Height);
//Draw rect.
s32Ret = SAMPLE_COMM_VGS_FillRect(&stBaseFrmInfo, &pstMd->stRegion, 0x00FF0000);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,"SAMPLE_COMM_VGS_FillRect fail,Error(%#x)\n",s32Ret);
*/
s32Ret = HI_MPI_VO_SendFrame(voLayer,voChn,&stBaseFrmInfo,s32MilliSec);
SAMPLE_CHECK_EXPR_GOTO(HI_SUCCESS != s32Ret, BASE_RELEASE,
"HI_MPI_VO_SendFrame fail,Error(%#x)\n",s32Ret);
CHANGE_IDX:
//Change reference and current frame index
printf("haha %d \n",s32CurIdx);
s32CurIdx = 1 - s32CurIdx;
}[/code]
根据代码的意思:(1)输入的图像分两路:图像处理和输出(stBaseFrmInfo和stExtFrmInfo);
(2)将图像处理的结果(矩形坐标)叠加在输出图像上(stBaseFrmInfo);
(3)通过VO将stBaseFrmInfo赋值到输出通道。
我的想法是直接对输出图像用背景图像(img_bg)进行赋值,但是仍然报错。
请大神指导一下,感激!
我来回答
回答7个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2021-03-02 21:17:31
-
2015-11-26 14:42:12
-
2013-08-25 10:41:18
-
2013-07-14 10:35:10
-
02018-12-30 19:22:56
-
2022-09-27 16:26:38
-
32016-05-05 14:11:19
-
2018-12-28 13:48:02
-
2017-08-12 10:21:59
-
2015-10-13 23:31:54
-
2024-04-18 10:09:39
-
2020-10-12 16:24:57
-
2020-06-12 18:59:26
-
2019-05-22 09:47:35
-
102019-05-22 09:55:10
-
2017-06-28 23:14:18
-
2016-07-26 10:40:02
-
2014-12-26 22:08:26
-
2019-06-26 11:27:46
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认