Book Image

Learning ROS for Robotics Programming Second Edition

Book Image

Learning ROS for Robotics Programming Second Edition

Overview of this book

Table of Contents (27 chapters)
Learning ROS for Robotics Programming Second Edition
Credits
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Author
Acknowledgments
About the Reviewer
About the Reviewer
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Computing the homography of two images


The homography matrix is a 3 x 3 matrix that provides transformation up to scale from a given image and a new one, which must be coplanar. In src/homography.cpp, there is an extensive example that takes the first image acquired by the camera and then computes the homography for every new frame with respect to the first image. In order to run the example, take something planar, such as a book cover, and run the following command:

$ roslaunch chapter5_tutorials homography.launch

This runs the camera driver that should grab frames from your camera (webcam), detect features (SURF by default), extract descriptors for each of them, and match them with the ones extracted for the first image using a Flann-based matching with a cross-check filter. Once the program has the matches, the homography matrix H is computed. With H, we can warp the new frame to obtain the original one, as shown in the next screenshot (matches on the top, warped image using H, which...