rv1106支持移动侦测(Motion Detect)么?支持的话,具体怎么用?

  • pan_nexus wrote: 2024-06-21 5:45 我看到ivs_md.h当中有MD相关的接口,不知道能不能用,没有看到有MD相关的sample code,不知道怎么用。
    MPI文档也没有介绍MD相关的功能。
    有知道rv1106是否支持MD功能,以及具体用法的帅锅,请帮忙指点,感谢!
    网盘镜像中开机自启的rkipc是有移动检测功能的,具体使用请参照源码(<SDK>/project/app/rkipc) 和相关手册
    PixPin_2024-06-22_10-11-52.jpg
    Downloaded 228 times
  • Crocodile wrote: 2024-06-22 2:14
    pan_nexus wrote: 2024-06-21 5:45 我看到ivs_md.h当中有MD相关的接口,不知道能不能用,没有看到有MD相关的sample code,不知道怎么用。
    MPI文档也没有介绍MD相关的功能。
    有知道rv1106是否支持MD功能,以及具体用法的帅锅,请帮忙指点,感谢!
    网盘镜像中开机自启的rkipc是有移动检测功能的,具体使用请参照源码(<SDK>/project/app/rkipc) 和相关手册
    PixPin_2024-06-22_10-11-52.jpg
    Rockchip_Developer_Guide_Linux_RKIPC_CN.pdf
    I'm trying to record video or images if motion is detected. It appears that the demo software detects motion and prints out some info to the terminal. How can I modify the software so that video or image files are stored on the SD card for example when motion is detected?

    I'm also aware of the standard linux motion software which I included in my built image but I'm having trouble setting up the video source. I'm getting "V4L2 device failed to open"

    Thanks!
  • Hello, your needs need to modify the source code, get the frame data of the VI when triggering Motion Detect and save it, the default rkipc application supports the jpeg capture function, the attachment is the development instructions of the rkipc application, you can save the jpeg by calling the rk_take_photo function
    Attachments
    Downloaded 32 times
  • Crocodile wrote: 2025-04-26 2:43 Hello, your needs need to modify the source code, get the frame data of the VI when triggering Motion Detect and save it, the default rkipc application supports the jpeg capture function, the attachment is the development instructions of the rkipc application, you can save the jpeg by calling the rk_take_photo function
    The solution was surprisingly easy! I simply switched on cycle snapshot when motion was detected and switched it off if there was no motion. This is the modified function in video.c:

    Code: Select all

    static void *rkipc_ivs_get_results(void *arg) {
    	LOG_DEBUG("#Start %s thread, arg:%p\n", __func__, arg);
    	prctl(PR_SET_NAME, "RkipcGetIVS", 0, 0, 0);
    	int ret, i;
    	IVS_RESULT_INFO_S stResults;
    	int resultscount = 0;
    	int count = 0;
    	int md = rk_param_get_int("ivs:md", 0);
    	int od = rk_param_get_int("ivs:od", 0);
    	int width = rk_param_get_int("video.2:width", 960);
    	int height = rk_param_get_int("video.2:height", 540);
    	int md_area_threshold = width * height * 0.3;
    
    	while (g_video_run_) {
    		ret = RK_MPI_IVS_GetResults(0, &stResults, 1000);
    		if (ret >= 0) {
    			resultscount++;
    			if (md == 1) {
    				if (stResults.pstResults->stMdInfo.u32Square > md_area_threshold) {
    					LOG_INFO("MD: md_area is %d, md_area_threshold is %d\n",
    					         stResults.pstResults->stMdInfo.u32Square, md_area_threshold);
    					if (cycle_snapshot_flag == 0){
    						rk_video_set_enable_cycle_snapshot(1);
    						LOG_INFO("Cycle snapshot enabled!\n");
    					}
    				}
    				else if (cycle_snapshot_flag == 1){
    					rk_video_set_enable_cycle_snapshot(0);
    					LOG_INFO("Cycle snapshot disabled!\n");
    				}
    			}
    			if (od == 1) {
    				if (stResults.s32ResultNum > 0) {
    					if (stResults.pstResults->stOdInfo.u32Flag)
    						LOG_INFO("OD flag:%d\n", stResults.pstResults->stOdInfo.u32Flag);
    				}
    			}
    			RK_MPI_IVS_ReleaseResults(0, &stResults);
    		} else {
    			LOG_ERROR("get chn %d fail %d\n", 0, ret);
    			usleep(50000llu);
    		}
    	}
    	return NULL;
    }