First time here? Check out the FAQ!
the code seems right could u provide the video on which u applied optical flow