Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenCV 3 Computer Vision Application Programming Cookbook

You're reading from   OpenCV 3 Computer Vision Application Programming Cookbook Recipes to make your applications see

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher
ISBN-13 9781786469717
Length 474 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Robert Laganiere Robert Laganiere
Author Profile Icon Robert Laganiere
Robert Laganiere
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Playing with Images FREE CHAPTER 2. Manipulating Pixels 3. Processing the Colors of an Image 4. Counting the Pixels with Histograms 5. Transforming Images with Morphological Operations 6. Filtering the Images 7. Extracting Lines, Contours, and Components 8. Detecting Interest Points 9. Describing and Matching Interest Points 10. Estimating Projective Relations in Images 11. Reconstructing 3D Scenes 12. Processing Video Sequences 13. Tracking Visual Motion 14. Learning from Examples

Applying morphological operators on gray-level images


More advanced morphological operators can be composited by combining the different basic morphological filters introduced in this chapter. This recipe will present two morphological operators that, when applied to gray-level images, can lead to the detection of interesting image features.

How to do it...

One interesting morphological operator is the morphological gradient that allows extracting the edges of an image. This one can be accessed through the cv::morphologyEx function as follows:

    // Get the gradient image using a 3x3 structuring element 
    cv::Mat result; 
    cv::morphologyEx(image, result,
                     cv::MORPH_GRADIENT, cv::Mat()); 

The following result shows the extracted contours of the image's elements (the resulting image has been inverted for better viewing):

Another useful morphological operator is the top-hat transform. This operator can be used to extract local small foreground objects...

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 €18.99/month. Cancel anytime