Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Mastering OpenCV 4 - Third Edition

Mastering OpenCV 4 - Third Edition

This is the code repository for Mastering OpenCV 4 - Third Edition, published by Packt.

A comprehensive guide to building computer vision and image processing applications with C++

What is this book about?

Mastering OpenCV, now in its third edition, targets computer vision engineers taking their first steps toward mastering OpenCV. Keeping the mathematical formulations to a solid but bare minimum, the book delivers complete projects from ideation to running code, targeting current hot topics in computer vision such as face recognition, landmark detection and pose estimation, and number recognition with deep convolutional networks.

This book covers the following exciting features:

  • Build real-world computer vision problems with working OpenCV code samples
  • Uncover best practices in engineering and maintaining OpenCV projects
  • Explore algorithmic design approaches for complex computer vision tasks
  • Work with OpenCV’s most updated API (v4.0.0)through projects
  • Understand 3D scene reconstruction and Structure from Motion (SfM)
  • Study camera calibration and overlay AR using the ArUco Module

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

Mat bigImg; 
resize(smallImg, bigImg, size, 0,0, INTER_LINEAR); 
bigImg.copyTo(dst, mask);

Following is what you need for this book: This book is for those who have a basic knowledge of OpenCV and are competent C++ programmers. You need to have an understanding of some of the more theoretical/mathematical concepts, as we move quite quickly throughout the book.

With the following software and hardware list you can run all code files present in the book (Chapter 1-10).

Software and Hardware List

Each chapter folder contains individual instruction on building and running the code. Chapter 10: Avoiding Common Pitfalls in OpenCV, is without code.

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Related products

  • Learn OpenCV 4 By Building Projects - Second Edition [Packt] [Amazon]

  • Hands-On GPU-Accelerated Computer Vision with OpenCV and CUDA [Packt] [Amazon]

Get to Know the Authors

Roy Shilkrot is an assistant professor of computer science at Stony Brook University, where he leads the Human Interaction group. Dr. Shilkrot's research is in computer vision, human-computer interfaces, and the cross-over between these two domains, funded by US federal, New York State, and industry grants. Dr. Shilkrot graduated from the Massachusetts Institute of Technology (MIT) with a PhD, and has authored more than 25 peer-reviewed papers published at premier computer science conferences, such as CHI and SIGGRAPH, as well as in leading academic journals such as ACM Transaction on Graphics (TOG) and ACM Transactions on Computer-Human Interaction (ToCHI). Dr. Shilkrot is also a co-inventor of several patented technologies, a co-author of a number of books, serves on the scientific advisory board of numerous start-up companies, and has over 10 years of experience as an engineer and an entrepreneur.

David Millan Escriva was eight years old when he wrote his first program on an 8086 PC in Basic, which enabled the 2D plotting of basic equations. In 2005, he finished his studies in IT through the Universitat Politécnica de Valenci with honors in human-computer interaction supported by computer vision with OpenCV (v0.96). He had a final project based on this subject and published it on HCI Spanish congress. He has worked with Blender, an open source, 3D software project, and worked on his first commercial movie, Plumiferos - Aventuras voladoras, as a computer graphics software developer. David now has more than 10 years of experience in IT, with experience in computer vision, computer graphics, and pattern recognition, working with different projects and start-ups, applying his knowledge of computer vision, optical character recognition, and augmented reality. He is the author of the DamilesBlog blog, where he publishes research articles and tutorials about OpenCV, computer vision in general, and optical character recognition algorithms.

Other books by the authors

Mastering OpenCV 3 - Second Edition

Mastering OpenCV with Practical Computer Vision Projects

Suggestions and Feedback

Click here if you have any feedback or suggestions.


Mastering OpenCV 4, Third Edition, published by Packt publishing







No releases published


No packages published

Contributors 4