从 nvidia Visionworks 运动估计器示例中提取运动场
Extract motion fields from the nvidia Visionworks Motion estimator example
我正在尝试从 visionworks example. i saw the post in the nvidia forum here 中提取运动场,但我仍然不明白如何获得运动场。
文档说运动场是 vx_image 类型 NVX_DF_IMAGE2F32,这意味着有两个通道。
有人知道每个频道的意思吗?我什至意识到图像的大小是用于检测运动的输入图像的一半。
在nvidia post版主说“值(x, y)是点(x, y)的运动”,但我不明白这是什么意思
我理解解释的概念“更准确地说,对于第N帧中字段值为(mx, my)的点(x, y)。第N-1帧中的匹配点是(x+mx, y+我的)。
但我无法用这些参数匹配我在 vx_image 中得到的结果。
经过一番研究,我找到了意思。我写的解决方案以防对其他人有用:
这里我的理解是使用cv::Mat可以很方便的绘制出结果
// get the motion in vx_image format
vx_image MotionImage = ime.getMotionField();
//convert to cv::Mat (or GpuMat as you like...)
nvx_cv::VXImageToCVMatMapper map(MotionImage);
//cv::cuda::GpuMat MotionImageGpuMat = map.getGpuMat();
cv::Mat MotionImageMatMap = map.getMat();
//resize the motion map as it is the half of the original image used to compute the motion
cv::Mat MotionImageMat;
cv::resize(MotionImageMatMap,MotionImageMat,cv::Size(),2.0,2.0,cv::INTER_NEAREST);
//split in two channels
cv::Mat MotionImageMat_split[2];
cv::split(MotionImageMat, MotionImageMat_split);
//MotionImageMat_split[0](x,y) -> contains the increment for the pixel (x,y) in width (columns) direction between the current and previous frame.
// Example: if MotionImageMat_split[0] at pixel (x,y) is 5 means that the difference between the current and previous frame in the width (columns) direction is 5
//MotionImageMat_split[1](x,y) -> contains the increment for the pixel (x,y) in height (rows) direction between the current and previous frame.
// Example: if MotionImageMat_split[0] at pixel (x,y) is 5 means that the difference between the current and previous frame in the height (rows) direction is 5
我正在尝试从 visionworks example. i saw the post in the nvidia forum here 中提取运动场,但我仍然不明白如何获得运动场。
文档说运动场是 vx_image 类型 NVX_DF_IMAGE2F32,这意味着有两个通道。
有人知道每个频道的意思吗?我什至意识到图像的大小是用于检测运动的输入图像的一半。
在nvidia post版主说“值(x, y)是点(x, y)的运动”,但我不明白这是什么意思
我理解解释的概念“更准确地说,对于第N帧中字段值为(mx, my)的点(x, y)。第N-1帧中的匹配点是(x+mx, y+我的)。
但我无法用这些参数匹配我在 vx_image 中得到的结果。
经过一番研究,我找到了意思。我写的解决方案以防对其他人有用:
这里我的理解是使用cv::Mat可以很方便的绘制出结果
// get the motion in vx_image format
vx_image MotionImage = ime.getMotionField();
//convert to cv::Mat (or GpuMat as you like...)
nvx_cv::VXImageToCVMatMapper map(MotionImage);
//cv::cuda::GpuMat MotionImageGpuMat = map.getGpuMat();
cv::Mat MotionImageMatMap = map.getMat();
//resize the motion map as it is the half of the original image used to compute the motion
cv::Mat MotionImageMat;
cv::resize(MotionImageMatMap,MotionImageMat,cv::Size(),2.0,2.0,cv::INTER_NEAREST);
//split in two channels
cv::Mat MotionImageMat_split[2];
cv::split(MotionImageMat, MotionImageMat_split);
//MotionImageMat_split[0](x,y) -> contains the increment for the pixel (x,y) in width (columns) direction between the current and previous frame.
// Example: if MotionImageMat_split[0] at pixel (x,y) is 5 means that the difference between the current and previous frame in the width (columns) direction is 5
//MotionImageMat_split[1](x,y) -> contains the increment for the pixel (x,y) in height (rows) direction between the current and previous frame.
// Example: if MotionImageMat_split[0] at pixel (x,y) is 5 means that the difference between the current and previous frame in the height (rows) direction is 5