Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

OpenCV 3.0 Computer Vision with Java
OpenCV 3.0 Computer Vision with Java
OpenCV 3.0 Computer Vision with Java
Ebook295 pages1 hour

OpenCV 3.0 Computer Vision with Java

Rating: 0 out of 5 stars

()

Read preview

About this ebook

OpenCV 3.0 Computer Vision with Java is a practical tutorial guide that explains fundamental tasks from computer vision while focusing on Java development. This book will teach you how to set up OpenCV for Java and handle matrices using the basic operations of image processing such as filtering and image transforms. It will also help you learn how to use Haar cascades for tracking faces and to detect foreground and background regions with the help of a Kinect device. It will even give you insights into server-side OpenCV. Each chapter is presented with several projects that are ready to use. The functionality of these projects is found in many classes that allow developers to understand computer vision principles and rapidly extend or customize the projects for their needs.
LanguageEnglish
Release dateJul 30, 2015
ISBN9781783283989
OpenCV 3.0 Computer Vision with Java
Author

Daniel Lélis Baggio

Daniel Lelis Baggio started his work in computer vision through medical image processing at InCor (Instituto do Coracao - Heart Institute) in Sao Paulo, where he worked with intra-vascular ultrasound image segmentation. Since then, he has focused on GPGPU and ported the segmentation algorithm to work with NVIDIA's CUDA. He has also dived into six degrees of freedom head tracking with a natural user interface group through a project called ehci (http://code.google.com/p/ehci/). He now works for the Brazilian Air Force

Read more from Daniel Lélis Baggio

Related to OpenCV 3.0 Computer Vision with Java

Related ebooks

Computers For You

View More

Related articles

Reviews for OpenCV 3.0 Computer Vision with Java

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    OpenCV 3.0 Computer Vision with Java - Daniel Lélis Baggio

    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


    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

    Credits

    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

    About the Author

    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.

    Acknowledgment

    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.

    About the Reviewers

    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).

    I would like to thank Professor Yuichi Ohta, Professor Yoshinari Kameda, and Professor Kitahara Itaru at the University of Tsukuba. They taught me a lot about computer vision.

    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 prestigious IIT Kharagpur and has continued working with OpenCV on Linux machines ever since. Currently, he successfully manages a blog on OpenCV for beginners, which you can find at http://opencvuser.blogspot.in/.

    I would like to thank Packt Publishing for giving me the opportunity to review this book and Judie for bearing the delays in the completion of my reviews.

    Domenico Luciani is a passionate 22-year-old programmer. He currently works as a software engineer for some companies and is studying computer science at the University of Palermo, Italy.

    He is a computer vision enthusiast and loves security and often pentests too; he also takes part in bounty programs for many companies. He has worked with many technologies in the past, such as MongoDB, Node.js, PHP, PostgreSQL, and C. He makes many Node.js modules that he successfully publishes on the NPM website. He collaborated as a reviewer on a published BDD test using a JavaScript book. He studies the Go language (golang) just for fun.

    He owns a Raspberry Pi. He loves writing code using vim and manages it with Git. He also writes tests and collaborates with various open source projects on the Web.

    In his free time, he likes running and playing Parkour. You can find out more about him at http://dlion.it.

    Sebastian Montabone is a computer engineer with a master's of science degree in computer vision. He has worked in areas, such as intelligent IP cameras for automated surveillance, data mining, 3D sensors, game development, and embedded devices.

    He is the author of Beginning Digital Image Processing: Using Free Tools for Photographers, Apress. He has also written scientific articles and a computer vision video course OpenCV Computer Vision Application Programming, Packt Publishing.

    You can visit his blog at www.samontab.com, where he shares his current projects with the world.

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    For support files and downloads related to your book, please visit www.PacktPub.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.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.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.

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    Free access for Packt account holders

    If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

    To all the readers, without whom this book would not have a reason for existing

    Preface

    Living in times when self-driving vehicles are becoming a reality might trigger curious minds as to how could computers' incipient vision works. Having a face recognized for access control, getting our pictures automatically organized by a subject or person, and having characters automatically recognized from paper scans are tasks that have become common in our lives. All these aforementioned actions have been enlisted in the so-called study area of computer vision.

    As a scientific discipline, the theory behind systems that can extract information from images can be described as computer vision, and it has been adopted to extract valuable measurements from medical images, as well as to help humans delineate the boundaries of important image areas in the so-called semi-automatic procedures.

    In the context of providing a simple-to-use computer vision infrastructure to help people rapidly build sophisticated vision applications, an open source library was created: OpenCV. It was designed for real-time applications and is written in C++, containing several hundred computer vision algorithms.

    Although OpenCV had its debut alpha release back in January 1999, it was only in February 2013 that it officially supported desktop Java through bindings. As this is one of the most popular introductory teaching languages adopted in computer science departments as well as K-12 computer-related courses, it is important to have a good reference for how to build vision apps in a Java environment.

    This book covers the basic OpenCV computer vision algorithms and their integration with Java. As the Swing GUI widget toolkit is widely adopted to build GUIs in Java, in this book, you will benefit from the chapters that deal with this topic as well as come to know how to set up your development environment that deals with native code bindings. Besides, operations such as stretching, shrinking, warping, and rotating, as well as finding edges, lines, and circles are all covered through interesting and practical sample projects in this book.

    As the Kinect device has become a great tool for background segmentation, we have covered

    Enjoying the preview?
    Page 1 of 1