OFA Gridsize and NumOfLevels

Hello,
when i try to calculate the dense optical flow in cpp with vpi it is only possible to do so with a gridsize of 2 and numoflevels of 4. When i change the grid size to 4 i receive VPI_ERROR_INVALID_ARGUMENT from the function vpiCreateOpticalFlowDense(). Can somebody explain me why?

Hi,

Could you share the input image size with us?
The output flow need to bigger than 4x4.

Thanks.

The input image is a 8bit grayscale image with 640 times 480 pixel.

Hi,

Based on your image size, the pyramid sizes are:
640x480 - 160x120 - 40x30 - 10x7

Which is too small, the pyramid size also needs to be larger than 32 to get a flow.

Thanks.

Thank you. Can you also tell me how i can split the output of the dense optical flow in the VPIImage with the format VPI_IMAGE_FORMAT_2S16_BL to two seperate VPIImages with the format VPI_IMAGE_FORMAT_S16?

Hi,

You can do this with OpenCV.
The example can be found in the /opt/nvidia/vpi2/samples/13-optflow_dense.

VPIImageData mvData;
CHECK_STATUS(vpiImageLockData(mvImg, VPI_LOCK_READ, VPI_IMAGE_BUFFER_HOST_PITCH_LINEAR, &mvData));

...
cv::Mat magnitude, angle;
{
    cv::Mat flowChannels[2];
    split(flow, flowChannels);

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.