Distance Estimation from Stereo Vision: Review and Results
Total Page:16
File Type:pdf, Size:1020Kb
DISTANCE ESTIMATION FROM STEREO VISION: REVIEW AND RESULTS A Project Presented to the faculty of the Department of the Computer Engineering California State University, Sacramento Submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in Computer Engineering by Sarmad Khalooq Yaseen SPRING 2019 © 2019 Sarmad Khalooq Yaseen ALL RIGHTS RESERVED ii DISTANCE ESTIMATION FROM STEREO VISION: REVIEW AND RESULTS A Project by Sarmad Khalooq Yaseen Approved by: __________________________________, Committee Chair Dr. Fethi Belkhouche __________________________________, Second Reader Dr. Preetham B. Kumar ____________________________ Date iii Student: Sarmad Khalooq Yaseen I certify that this student has met the requirements for format contained in the University format manual, and that this project is suitable for shelving in the Library and credit is to be awarded for the project. __________________________, Graduate Coordinator ___________________ Dr. Behnam S. Arad Date Department of Computer Engineering iv Abstract of DISTANCE ESTIMATION FROM STEREO VISION: REVIEW AND RESULTS by Sarmad Khalooq Yaseen Stereo vision is the one of the major researched domains of computer vision, and it can be used for different applications, among them, extraction of the depth of a scene. This project provides a review of stereo vision and matching algorithms, used to solve the correspondence problem [22]. A stereo vision system consists of two cameras with parallel optical axes which are separated from each other by a small distance. The system is used to produce two stereoscopic pictures of a given object. Distance estimation between the object and the cameras depends on two factors, the distance between the positions of the object in the pictures and the focal lengths of the cameras [37]. In this project, the internal parameters of the cameras are calculated after taking several pictures from both left and right cameras. The correspondence problem between left and right images is solved using MATLAB. The disparity is then estimated based on the center of the image plane and finally, the distance of the object is calculated using the epipolar triangulation method. The results of this project showed that the distance estimated using stereo vision to ten different objects is relatively accurate. v Two tests are completed in this project. The first one is done for checking the error between manual and stereo vision results, where the error ranged from 0.09% to 1.4%, the second test is done for comparison between passive and active stereo vision methods, this project used the passive method and the average error was equal to 0.78% which is less than the other methods. _______________________, Committee Chair Dr. Fethi Belkhouche _______________________ Date vi ACKNOWLEDGEMENTS Firstly, I would like to extend my appreciation and love to my respective family for all their continuing support, care and consideration. I would like to express our sincere gratitude to Dr Fethi Belkhouche for accepting to be my project coordinator. We are grateful for the help and advice, for without which we would have not progressed that far. I would also like to extend my sincere thanks to Dr. Preetham B. Kumar, Dr. Behnam S. Arad and CPE department. vii TABLE OF CONTENTS Page Acknowledgements……………………………………………………………………. vii List of tables………………………………………………………………………….…xi List of figures …………………………………………………………………………. xii Chapter 1. INTRODUCTION. ……………………..………………………………………….. 1 1.1 Project Background.……………………………………………………..1 1.2 Stereoscopic Measurement Method……………………………………...1 1.3 Stereo Vision Disparity……………………………………….………..…3 1.4 Stereo Vision Corresponding Problem…………………………………..5 1.5 Objectives and Scope Of The Project.……………………………… . ….5 2. CAMERA PARAMETERS………………………………………………………..... 7 2.1 Camera Model and Parameters………………………………………….7 2.1.1 Intrinsic Parameters ……………….………………………7 2.1.2 Extrinsic Parameters.……………………………………..11 2.2 Camera Calibration………………………………………………...…. 13 2.3 Camera Calibration Techniques………………………………………..14 2.4 Lens Distortion …………………………………………………………15 2.5 Epipolar Geometry ……………………………………………………..15 2.6 Image Rectification.…………………………………………………….17 viii . STEREO VISION 3.1 Introduction …………………………………………………………….19 3.2 A Classification of Stereo Vision Algorithms.……………...…………20 3.3 Stereo Vision Flowchart………………………………………………...22 3.4 Depth Recovering and Disparity…………………………………………24 3.5 Stereo Matching Strategies…………………………………………….25 3.5.1 Local Dense Stereo Matching Methods……………….……..27 3.5.1.1 Matching Costs.…………………………………..….27 3.5.1.2 Aggregation Area.……………………………………28 3.5.2 Global Dense Stereo Matching Methods………………….......29 3.5.2.1 Horizontal Disparity Smoothness Assumption. ……30 3.5.2.2 Horizontal and Vertical Disparity Smoothness …….32 3.6 3D Reconstruction via Stereo Vision………………………………….32 4. CALCULATIONS AND RESULTS ………………………………………………..34 4.1 Introduction …………………………………………………………….34 4.2 Tools ……………………………………………………………………..35 4.3 Hardware Setup ………………………………………………………......36 4.4 Results ……………………………………………………………………38 4.4.1 Distance Measurement ……………………………………...…38 4.4.2 Comparison between Passive and Active Stereo Vision Camera…41 4.4.3 Result of Right Camera …………………………………………..43 4.4.4 Result of Left Camera ……………………………..…………..…44 ix 4.4.5 Result Of Both Camera ……………………………………...…..45 5. CONCLUSION AND FUTURE WORK……………………………………….…...47 References …………………………………………………………………………….49 x LIST OF TABLES Tables Page 1. Object in Left and Right Images with Disparity and Distances of The Object for Ten Tests………………………………………………………40 2. Comparison Between This Project and Past Projects ………….……..…42 xi LIST OF FIGURES Figures Page 1. Pinhole Camera Projection (A) Single Camera (B) Stereo Camera……………..2 2. Epipolar Geometry……………………….……………………………………...4 3. Illustration of A Pinhole Camera Example ………………………………………8 4. The Central-Projection Model ………………………………………………….9 5. Skew Effect ……………………………………………………………………11 6. Camera Coordinate System Vs Arbitrary Coordinate System ………………….12 7. The Calibration Patterns. (A) Left Images; (B) Right Images ………………...14 8. Epipolar Geometry Between A Pair Of Images ………..……………………….16 9. A Rectified Stereo Pair………………………………………………………..…18 10. Stereo Vision System Flow Chart ………………………………………………23 11. Stereo Triangulation And Geometry……………………………………………..25 12. Stereo Based on Dynamic Programming ……………………………….…….…31 13. Using Measurement Tools To Measure Dimensions For The Object ………..…35 14. Using iPhone Camera for Calibration…. ……………………………………...36 15. The Ten Objects Used in This Project ……………………………………….…37 16. Camera capture (a) left image camera (b) right image camera ……………….…38 17. (a) Relation between rp & xz (b) relation between cp & xz from right camera…43 18. (a) Relation between rp & xz (b) relation between cp & xz from left camera…..44 19. (a) Relation between rp & xz (b) relation between cp & xz from both camera ..45 xii 1 Chapter One Introduction 1.1 Project Background Different strategies are used to find the distance of an object using machine vision. Traditionally, laser domain finder and ultrasonic measurements are widely used. These methods are no longer viable in applications like industrial automation and navigation because they require continuous human monitoring even though they have excellent accuracy. We can evaluate the object distance and its geometry using stereo vision. This project starts by taking stereo images from different scenes. Experiments are conducted, and the outcomes based on the implementation of certain algorithms are discussed [1]. Stereo vision is suitable for many applications for numerous reasons. The most important one is the similarity to binocular vision in humans and animals. Stereo vision consists of two identical cameras, which allow to obtain pictures from two distinctive viewpoints. Depth is determined through finding the disparity in the images of the same 3D points [2]. 1.2 Stereoscopic Measurement Method Stereoscopy is an approach used to represent (3D) scenes from (2D) images. By using two images taken at slightly distinct locations, it can create a phantasm of depth. In 1838, stereoscopic images and viewing devices was invented by Charles Wheatstone. It is viewed as a passive technique if no additional source of light is applied on the scene. For 2 example, some applications require laser beam. There are many applications where passive stereo vision is used such as robotic navigation [3]. Figure 1.1 Pinhole Camera Projection (A) Single Camera (B) Stereo Camera [4] In figure 1.1(a), a single camera has the same image points for all the points in the same projection line. Two points (P and Q) project to the same image point (p ≡q). This is true for each point along the ray OP. By using triangulation and finding the corresponding (homologous) points from the two pictures, we can determine the depth as shown in figure 1.1(b) [4]. There are many challenges for using stereo vision to perform distance measurement. Processing tasks 3 need to be implemented twice, this led to duplicating the effort for stereo vision such as image enhancement and filtering tasks. To overcome this issue, parallel architectures can be used to increase the performance. Many techniques have been proposed to improve performance and power consumption [5]. 1.3 Stereo Vision Disparity The first step in the stereo vision process is to find the disparities between two pictures produced by using two cameras positioned at different locations. This problem is related to 3D reconstruction which will be discussed