Join our book community on Discord
Installing OpenCV and running samples is fun, but at this stage, we want to try things out in our own way. This chapter introduces OpenCV's I/O functionality. We also discuss the concept of a project and the beginnings of an object-oriented design for this project, which we will flesh out in subsequent chapters.
By starting with a look at I/O capabilities and design patterns, we will build our project in the same way we would make a sandwich: from the outside in. Bread slices and spread, or endpoints and glue, come before fillings or algorithms. We choose this approach because computer vision is mostly extroverted, it contemplates the real world outside our computer, and we want to apply all of our subsequent algorithmic work to the real world through a common interface.
Specifically, in this chapter, our code samples and discussions will cover the following tasks:
- Reading images from image files, video files, camera devices, or raw bytes of data in memory
- Writing images to image files or video files
- Manipulating image data in NumPy arrays
- Converting between NumPy arrays and OpenCV’s
UMat
format, which supports OpenCL acceleration - Enabling hardware acceleration of video I/O
- Sending a video stream over a network
- Displaying images in windows
- Handling keyboard and mouse input
- Implementing an application with an object-oriented design