Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
OpenCV 3.0 Computer Vision with Java

You're reading from  OpenCV 3.0 Computer Vision with Java

Product type Book
Published in Jul 2015
Publisher
ISBN-13 9781783283972
Pages 174 pages
Edition 1st Edition
Languages
Author (1):
Daniel Lelis Baggio Daniel Lelis Baggio
Profile icon Daniel Lelis Baggio

Table of Contents (15) Chapters

OpenCV 3.0 Computer Vision with Java
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Setting Up OpenCV for Java Handling Matrices, Files, Cameras, and GUIs Image Filters and Morphological Operators Image Transforms Object Detection Using Ada Boost and Haar Cascades Detecting Foreground and Background Regions and Depth with a Kinect Device OpenCV on the Server Side Index

Video playback


Another important I/O task in computer vision is being able to open and process a video file. Fortunately, OpenCV can easily deal with videos through the VideoCapture class. Instead of constructing it with a device number, as was done previously, we need to create it with the file path. We can also use the empty constructor and make the open(String filename) method responsible for pointing to the file.

The videoplayback project available in the chapter's source code has the same structure as the swing-imageshow project, explained previously. It only differs when you initialize the VideoCapture instance:

VideoCapture capture = new VideoCapture("src/main/resources/videos/tree.avi");

We have also put a 50ms delay between each frame so that the whole video doesn't play too fast. There is also code that you can use to manipulate InterruptedException. Note that the video files won't play with the same velocity as seen in a video player device. This is because the capture.read(webcamMatImage...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}