rewrite opticalFlow