Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA
Effective techniques for processing complex image data in real time using GPUs
Bhaumik Vaidya
BIRMINGHAM - MUMBAI
Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Acquisition Editor: Alok Dhuri
Content Development Editor: Pooja Parvatkar
Technical Editor: Divya Vadhyar
Copy Editor: Safis Editing
Project Coordinator: Ulhas Kambali
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Tom Scaria
Production Coordinator: Deepika Naik
First published: September 2018
Production reference: 1240918
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78934-829-3
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Bhaumik Vaidya is an experienced computer vision engineer and mentor. He has worked extensively on OpenCV Library in solving computer vision problems. He is a University gold medalist in masters and is now doing a PhD in the acceleration of computer vision algorithms built using OpenCV and deep learning libraries on GPUs. He has a background in teaching and has guided many projects in computer vision and VLSI( Very-large-scale integration) . He has worked in the VLSI domain previously as an ASIC verification engineer, so he has very good knowledge of hardware architectures also. He has published many research papers in reputable journals to his credit. He, along with his PhD mentor, has also received an NVIDIA Jetson TX1 embedded development platform as a research grant from NVIDIA.
"I would like to thank my parents and family for their immense support. I would especially like to thank Parth Vaghasiya, who has stood like a pillar with me, for his continuous love and support. I really appreciate and thank Umang Shah and Ayush Vyas for their help in the development of content for this book. I would like to thank my friends Nihit, Arpit, Chirag, Vyom, Anupam, Bhavin, and Karan for their constant motivation and encouragement. I would like to thank Jay, Rangat, Manan, Rutvik, Smit, Ankit, Yash, Prayag, Jenish, Darshan , Parantap, Saif, Sarth, Shrenik, Sanjeet, and Jeevraj, who have been very special to me for their love, motivation, and support. I would like to thank Dr. Chirag Paunwala, Prof. Vandana Shah, Ms. Jagruti Desai and Prof. Mustafa Surti for their continuous guidance and support.
I gratefully acknowledge the support of NVIDIA Corporation and their donation of the Jetson TX1 GPU used for this book. I am incredibly grateful to Pooja Parvatkar, Alok Dhuri, and all the amazing people of Packt Publishing for taking their valuable time out to review this book in so much detail and for helping me during the development of the book.
To the memory of my grandmother, Urmilaben Vaidya, and to my family members, Vidyut Vaidya, Sandhya Vaidya, Bhartiben Joshi, Hardik Vaidya, and Parth Vaghasiya for their sacrifices, love, support, and inspiration."
About the reviewer
Vandana Shah gained her bachelor's degree in electronics in the year 2001. She has also gained an MBA in Human Resource management an a master's in Electronics Engineering specifically in the VLSI domain. She has also submitted her thesis for a PhD in electronics, specifically concerning the domain of image processing and deep learning for brain tumor detection, and is awaiting her award. Her area of interest is image processing with deep learning and embedded systems. She has more than 13 years of experience in research, as well as in teaching and guiding undergraduate and postgraduate students of electronics and communications. She has published many papers in renowned journals, such as IEEE, Springer, and Inderscience. She is also receiving a government grant for her upcoming research in the MRI image-processing domain. She has dedicated her life to mentoring students and researchers. She is also able to train students and faculty members in soft-skill development. Besides her prowess in technical fields, she also has a strong command of Kathak, an Indian dance.
"I thank my family members for their full support."
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Table of Contents
Preface
Computer vision is revolutionizing a wide range of industries and OpenCV is the most widely chosen tool for computer vision with the ability to work in multiple programming languages. Nowadays, there is a need to process large images in real time in computer vision which is difficult to handle for OpenCV on its own. In this Graphics Processing Unit (GPU) and CUDA can help. So this book provides a detailed overview on integrating OpenCV with CUDA for practical applications. It starts with explaining the programming of GPU with CUDA which is essential for computer vision developers who have never worked with GPU. Then it explains OpenCV acceleration with GPU and CUDA by taking some practical examples. When computer vision applications are to be used in real life scenarios then it needs to deployed on embedded development boards. This book covers the deployment of OpenCV applications on NVIDIA Jetson Tx1 which is very popular for computer vision and deep learning applications. The last part of the book covers the concept of PyCUDA which can be used by Computer vision developers who are using OpenCV with Python. PyCUDA is a python library which leverages the power of CUDA and GPU for accelerations. This book provides a complete guide for developers using OpenCV in C++ or Python in accelerating their computer vision applications by taking a hands on approach.