October 2015
Intermediate to advanced
230 pages
5h 10m
English
Before we can make use of the designed image filter effects in an interactive way, we need to set up the main script and design a GUI application.
To run the application, we will turn to the chapter1.py. script, which we will start by importing all the necessary modules:
import numpy as np import wx import cv2
We will also have to import a generic GUI layout (from gui) and all the designed image effects (from filters):
from gui import BaseLayout from filters import PencilSketch, WarmingFilter, CoolingFilter, Cartoonizer
OpenCV provides a straightforward way to access a computer's webcam or camera device. The following code snippet opens the default camera ID (0) of a computer using cv2.VideoCapture:
def main(): ...