Skip to Content
Learning OpenCV 4 Computer Vision with Python 3 - Third Edition
book

Learning OpenCV 4 Computer Vision with Python 3 - Third Edition

by Joseph Howse, Joe Minichino
February 2020
Intermediate to advanced
372 pages
9h 26m
English
Packt Publishing
Content preview from Learning OpenCV 4 Computer Vision with Python 3 - Third Edition

Modifying the application

Now that we have high-level functions and classes for several filters, it is trivial to apply any of them to the captured frames in Cameo. Let's edit cameo.py and add the lines that appear in bold in the following excerpts. First, we need to add our filters module to our list of imports, as follows:

import cv2import filtersfrom managers import WindowManager, CaptureManager

Now, we need to initialize any filter objects we will use. An example of this can be seen in the following modified __init__ method:

class Cameo(object):        def __init__(self):        self._windowManager = WindowManager('Cameo',                                             self.onKeypress)        self._captureManager = CaptureManager(            cv2.VideoCapture(0), self._windowManager, True) self._curveFilter = filters.BGRPortraCurveFilter() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Computer Vision Projects with OpenCV 4 and C++

Building Computer Vision Projects with OpenCV 4 and C++

David Millan Escriva, Prateek Joshi, Vinicius G. Mendonca, Roy Shilkrot

Publisher Resources

ISBN: 9781789531619Supplemental Content