This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM368 IPNC如何开启和使用移动侦测motion detect?



目前正在添加移动侦测功能,因为DM368 RDK内没有移动侦测的文档,对这部分功能有点迷茫。

通过跟踪代码,大概流程是AVSERVER init调用VIDEO_motionCreate()-->VIDEO_motionTskMain()-->VIDEO_motionTskRun();

可是我将motion的motionenable和motioncenable都打开赋值为1,可是程序依然无法进入motionTskRun,无响应的打印信息;

跟踪代码,程序跑到OSA_bufGetFull()红色部分就返回了。

求教:1、是否有DM368 Motion detect的相应文档;2、motion detect由OSA_bufGetFull()出错返回,可能原因为何?

int VIDEO_motionTskRun()
{
int status, motionVal, inBufId;
OSA_BufInfo *pMotionBufInfo;
ALG_MotionDetectRunPrm tMotionDetectPrm;
ALG_MotionDetectRunStatus tMotionDetectStatus;
static int motionDetectCnt = 0;

status = OSA_bufGetFull(&gVIDEO_ctrl.motionStream.bufMotionIn, &inBufId, OSA_TIMEOUT_FOREVER);
if(status!=OSA_SOK) {
OSA_ERROR("OSA_bufGetFull()\n");
return status;
}

#ifdef AVSERVER_DEBUG_VIDEO_MOTION_THR
OSA_printf(" MOTION: Get Buf %d \n", inBufId);
#endif

pMotionBufInfo = OSA_bufGetBufInfo(&gVIDEO_ctrl.motionStream.bufMotionIn, inBufId);
#ifdef AVSERVER_DEBUG_VIDEO_MOTION_THR
OSA_printf(" MOTION: pMotionBufInfo->width = %d \n", pMotionBufInfo->width);
OSA_printf(" MOTION: pMotionBufInfo->height = %d \n", pMotionBufInfo->height);
#endif

/*Do detect and alarm here */
AVSERVER_lock();

tMotionDetectPrm.mbMvInfo = pMotionBufInfo->virtAddr;
tMotionDetectPrm.ImageWidth = pMotionBufInfo->width;
tMotionDetectPrm.ImageHeight = pMotionBufInfo->height;
tMotionDetectPrm.isKeyFrame = pMotionBufInfo->isKeyFrame;
tMotionDetectPrm.codecType = pMotionBufInfo->codecType;
tMotionDetectPrm.isDateTimeDraw = 0;
tMotionDetectPrm.motionenable = gVIDEO_ctrl.motionStream.motionEnable;
tMotionDetectPrm.motioncenable = gVIDEO_ctrl.motionStream.motionCEnable;
tMotionDetectPrm.motioncvalue = gVIDEO_ctrl.motionStream.motionCValue;
tMotionDetectPrm.motionlevel = gVIDEO_ctrl.motionStream.motionLevel;
tMotionDetectPrm.motionsens = gVIDEO_ctrl.motionStream.motionCValue;
tMotionDetectPrm.windowWidth = (tMotionDetectPrm.ImageWidth / ALG_MOTION_DETECT_HORZ_REGIONS);
tMotionDetectPrm.windowHeight = (tMotionDetectPrm.ImageHeight / ALG_MOTION_DETECT_VERT_REGIONS);
tMotionDetectPrm.blockNum = gVIDEO_ctrl.motionStream.motionBlock;

AVSERVER_unlock();
//tMotionDetectStatus structure will have the status for motion detected for each selected window.

if(tMotionDetectPrm.motionenable == 1)
{
OSA_prfBegin(&gAVSERVER_ctrl.motionPrf);

motionVal = ALG_motionDetectRun(gVIDEO_ctrl.motionStream.algMotionHndl, &tMotionDetectPrm,&tMotionDetectStatus);

OSA_prfEnd(&gAVSERVER_ctrl.motionPrf, 1);

if(motionVal == ALG_MOTION_S_DETECT)
{
#ifdef AVSERVER_DEBUG_VIDEO_MOTION_THR
OSA_printf(" MOTION: DETECTED \n");
#endif
/* send motion dectect once in 5 frames to avoid too many messages */
if(motionDetectCnt>5)
motionDetectCnt=0;
if((gAVSERVER_config.alarmEnable)&&(motionDetectCnt==0)) {
// SendAlarmMotionrDetect(VIDEO_streamGetJPGSerialNum());
}
motionDetectCnt++;
}
else
{
#ifdef AVSERVER_DEBUG_VIDEO_MOTION_THR
OSA_printf(" MOTION: NOT DETECTED \n");
#endif
motionDetectCnt=0;
}
}

OSA_bufPutEmpty(&gVIDEO_ctrl.motionStream.bufMotionIn, inBufId);

#ifdef AVSERVER_DEBUG_VIDEO_MOTION_THR
OSA_printf(" MOTION: Put Buf %d \n", inBufId);
#endif

return status;
}

  • 你好,

    请问你是否有划定做运动检测的区域? VIDEO_motionTskRun是要有新数据才能运行的。

          case AVSERVER_CMD_NEW_DATA:
            OSA_tskAckOrFreeMsg(pMsg, OSA_SOK);
            VIDEO_motionTskRun();
            break;

     

  • IPNC_RDK里面自带的网页有Montion Detect检测区域的设置。但我们的www将这些功能都去除了。

    不通过网页,如何设置检测区域?

    目前我设置了如下参数:

    motionenable = 1;

    motioncenable = 1;

    motionblock = 010;

    encodeconfig.motionVectorOutputEnable = TRUE;

  • 你好,

    请问h264enc是否在运行?这个MD是基于h264enc输出的MV/SAD数据的。

  • H264 encode有在运行。可以通过网页或RTSP收到264码流。
  • 你好,

    你能否打印一下MvBufInfo.siz的值是否不为0?

    av_capture/application/ipnc/av_server/src/video/videoEncoderThr.c

            /* check if motion enable and run only for first stream */

      if( ALG_vidEncGetMVdataStatus(gVIDEO_ctrl.encodeStream[encodeId].algEncHndl) )
      {
       MvBufInfo.size    = ALG_vidEncGetMVdataSize(gVIDEO_ctrl.encodeStream[encodeId].algEncHndl);
       MvBufInfo.virtAddr   = ALG_vidEncGetMVdataAddr(gVIDEO_ctrl.encodeStream[encodeId].algEncHndl);
       MvBufInfo.width   = gAVSERVER_config.encodeConfig[encodeId].cropWidth;
       MvBufInfo.height   = gAVSERVER_config.encodeConfig[encodeId].cropHeight;
       MvBufInfo.isKeyFrame = encStatus.isKeyFrame;
       MvBufInfo.temporalId = encStatus.temporalId;
       MvBufInfo.codecType  = gAVSERVER_config.encodeConfig[encodeId].codecType;
       if( MvBufInfo.size ) {
        VIDEO_motionCopyRun(&MvBufInfo);
       }

  • 通过消息大印 MVBufInfo.size = 0xFF00

    而且发现,只有在重启AVSERVER的时候,这条信息才会大印出来;