OpenCV 3.0 Computer Vision with Java
Table of Contents
OpenCV 3.0 Computer Vision with Java
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Setting Up OpenCV for Java
Getting OpenCV for Java development
Building OpenCV from the source code
The Java OpenCV project in Eclipse
The NetBeans configuration
A Java OpenCV simple application
Building your project with Ant
The Java OpenCV Maven configuration
Creating a Windows Java OpenCV Maven project pointing to the Packt repository
Creating a Java OpenCV Maven project pointing to a local repository
Summary
2. Handling Matrices, Files, Cameras, and GUIs
Basic matrix manipulation
Pixel manipulation
Loading and displaying images from files
Displaying an image with Swing
Capturing a video from a camera
Video playback
Swing GUI's integration with OpenCV
Summary
3. Image Filters and Morphological Operators
Smoothing
Averaging
Gaussian
Median filtering
Bilateral filtering
Morphological operators
Flood filling
Image pyramids
Thresholding
Summary
4. Image Transforms
The Gradient and Sobel derivatives
The Laplace and Canny transforms
The line and circle Hough transforms
Geometric transforms â stretch, shrink, warp, and rotate
Discrete Fourier Transform and Discrete Cosine Transform
Integral images
Distance transforms
Histogram equalization
References
Summary
5. Object Detection Using Ada Boost and Haar Cascades
The boosting theory
AdaBoost
Cascade classifier detection and training
Detection
Training
References
Summary
6. Detecting Foreground and Background Regions and Depth with a Kinect Device
Background subtraction
Frame differencing
Averaging a background method
The mixture of Gaussians method
Contour finding
Kinect depth maps
The Kinect setup
The driver setup
The OpenCV Kinect support
The Kinect depth application
Summary
7. OpenCV on the Server Side
Setting up an OpenCV web application
Creating a Maven-based web application
Adding OpenCV dependencies
Running the web application
Importing the project to Eclipse
Mixed reality web applications
Image upload
Image processing
The response image
Summary
Index
OpenCV 3.0 Computer Vision with Java
Copyright © 2015 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, and its dealers and distributors will be held liable for any damages caused or alleged to be 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.
First published: July 2015
Production reference: 1270715
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-397-2
www.packtpub.com
Author
Daniel LĂ©lis Baggio
Reviewers
Ngoc Dao
Dileep Kumar Kotha
Domenico Luciani
Sebastian Montabone
Commissioning Editor
Kunal Parikh
Acquisition Editor
Harsha Bharwani
Content Development Editor
Nikhil Potdukhe
Technical Editor
Parag Topre
Copy Editors
Sarang Chari
Sonia Mathur
Swati Priya
Neha Vyas
Project Coordinator
Judie Jose
Proofreader
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Disha Haria
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
Daniel Lélis Baggio started his work in computer vision through medical image processing at Instituto do Coração (InCor), which is a heart institute in São Paulo, Brazil, where he worked with intravascular ultrasound (IVUS) image segmentation. After this, he focused on GPGPU and ported that algorithm to work with NVIDIA's CUDA. He also dived into the topic of six degrees of freedom (6DoF), head tracking through a project called EHCI (http://code.google.com/p/ehci/) with the Natural User Interface group.
He is also the author of Mastering OpenCV with Practical Computer Vision Projects, Packt Publishing.
I'd first like to thank God for all the opportunities He has given me as well as for giving me our happy family.
I'd certainly like to thank Professor Sergio Furuie for introducing me to this wonderful world of computer vision. I'd also like to thank Professor Carlos Henrique Forster for his courses on the subject.
A big thanks goes to all the reviewers of this book, who took their time to put constructive and interesting corrections to its contents.
I would also like to thank the people from Packt Publishingâespecially Parag Topre, Nikhil Potdukhe, Sriram Neelakantan, Harsha Bharwani, Sageer Parkar, and Nadeem Bagbanâwithout whom, this book would never have been finished. I would also like to thank them for their patience.
I would like to thank my parents, who brought me into this world and educated me. I also thank my brother for always being there for me.
I dedicate this book to my children, who will always be part of my heart.
I'd also like to thank my wife for supporting me day and night in our life's journey.
Ngoc Dao studied computer vision at the Computer Vision and Image Media Lab of the University of Tsukuba, Japan. He has created several high-speed and scalable image matching server systems using Scala, Akka, and MongoDB with OpenCV's Java binding. These systems can scale multiple machines and have successfully been used with many iOS and Android apps.
Other than computer vision, Ngoc is also interested in real-time distributed systems and web frameworks. He is the main author of Xitrum, which is an open source async and clustered web framework for Scala (http://xitrum-framework.github.io). He presented this framework at the Scala Matsuri 2014 conference in Tokyo (http://scalamatsuri.org/en/program/index.html).
Dileep Kumar Kotha currently works as a senior software engineer at a telecom firm in Bangalore, India. He is an undergraduate in computer science from the National Institute of Technology, Rourkela, 2012 batch. He started working on image processing during his summer internship at the presti...