I am interested in obtaining & interpreting the output cost (confidence) of the flow vectors that have been calculated via the Optical Flow SDK example application AppOfCuda. I have successfully modified the example to output the cost by:
- Setting the enableOutputCost flag in initialisation parameters
- Generating cost buffers via a call to nvOpticalFlow->CreateBuffers(NV_OF_BUFFER_USAGE_COST, NUM_COST_BUFFERS)
- Executing NvOFBatchExecute whilst suppying the cost buffers which are then passed onto NvOF::Execute and m_NvOFAPI->GetAPI()->nvOFExecute(...)
- Downloading the cost buffer data by calling costBuffers[i]->DownloadData(pCost.get()), which is then saved to an image
I am running the Optical Flow with NV_OF_MODE_OPTICALFLOW and the “slow” preset. I am interpreting the values as 32-bit unsigned integers. I’ve tried to split values to 16-bit unsigned ints and save out as separate images in case the x & y costs were interleaved but the high-order bytes seemed to always evaluate to 0.
When it comes to interpreting the result, I’m lost as the output cost looks a lot like one of the input images with some pixelated artefacts, except that the resulting image is at about a 1/16th of the full size (expected, as the motion vectors are 4x4).
The programming guide has the following piece of information:
Enable output cost: This flag enabled in case client desires to obtain the cost associated
with the generated flow vectors. <…> Higher cost value implies the flow vector to be less accurate and vice-versa.
But I found it insufficient.
Could you please give me an example of what an output cost map should look like or information on how the metric is supposed to be interpreted?