Obstacle detection method using optical flow of images