Motion detection and segmentation are used in many applications of computer vision. The goal of this segmentation is to extract moving object from its background. This segmentation would be more challengeable when the camera is moving itself. This paper considers the addressing of this problem using structure from motion (SFM) techniques. First, using the RANSAC algorithm the Epipolar geometry between two-view images is estimated to calculate the fundamental matrix. Second, the dense optical flow is used to find the corresponding point for all the pixels. Then the corresponding points which do not lie on their Epipolar lines are detected. These points will introduce the moving objects. The experiments show the performance of our algorithm in real scene.