Regular gaps in calcOpticalFlowFarneback output

asked 2015-12-20 17:06:55 -0500

pkiv gravatar image

Hi,

I am using the code from the calcOpticalFlowFarneback sample modified to use images rather than video. I am using the same code render the vector field. I am noticing regular gaps in the vector field which would be debilitating for my application.

Attached is an image demonstrating the issue. Ignore any resolution issues due to uploading, the problem I'm asking about are the regular vertical and horizontal bands in the vector field.

The calculation code as well as the code to call the unmodified drawOptFlowMap is given below.

Assistance would be enormously appreciated.

    cvtColor(globals.images[current_image_index].cv, globals.gray, COLOR_BGR2GRAY);

if (!globals.prevgray.empty())
{
    calcOpticalFlowFarneback(globals.prevgray, globals.gray, globals.uflow, 
        /* scale */ 0.5, 
        /* levels */ 3, 
        /* winsize */ 50, 
        /* iterations */ 3, 
        /* polynsize */ 7, 
        /* polysigman */ 1.5, 
        /* flags */ 0);

    cvtColor(globals.prevgray, globals.cflow, COLOR_GRAY2BGR);
    globals.uflow.copyTo(globals.flow);
    drawOptFlowMap(globals.flow, globals.cflow, 4, 1.5, Scalar(0, 255, 0));
    imshow("flow", globals.cflow);
}

image description

edit retag flag offensive close merge delete