- Python Multimedia
- Ninad Sathaye
- 1049字
- 2021-08-03 15:27:37
Multimedia processing
We discussed some of the application domains where multimedia is extensively used. The focus of this book will be on multimedia processing, using which various multimedia applications will be developed.
Image processing
After taking a snap with a digital camera, we often tweak the original digital image for various reasons. One of the most common reasons is to remove blemishes from the image, such as removing 'red-eye' or increasing the brightness level if the picture was taken in insufficient light, and so on. Another reason for doing so is to add special effects that give a pleasing appearance to the image. For example, making a family picture black and white and digitally adding a frame around the picture gives it a nostalgic effect. The next illustration shows an image before and after the enhancement. Sometimes, the original image is modified just to make you understand important information presented by the image. Suppose the picture represents a complicated assembly of components. One can add special effects to the image so that only edges in the picture are shown as highlighted. This information can then be used to detect, for instance, interference between the components. Thus, we digitally process the image further until we get the desired output image.
An example where a border is added around an image to change its appearance is as follows:

Digital image processing can be viewed as an application of various algorithms/filters on the image data. One of the examples is an image smoothing filter. Image smoothing means reducing the noise from the image. The random changes in brightness and color levels within the image data are typically referred to as image noise. The smoothing algorithms modify the input image data so that this noise is reduced in the resultant image.
Another commonly performed image processing operation is blending. As the name suggests, blending means mixing two compatible images to create a new image. Typically, the data of the two input images is interpolated using a constant value of alpha to produce a final image. The next illustration shows the two input images and the resultant image after blending. In the coming chapters we will learn several of such digital image processing techniques.
The pictures of the bridge and the flying birds are taken at different locations. Using image processing techniques these two images can be blended together so that they appear as a single picture:

Audio and video processing
When you are listening to music on your computer, your music player is doing several things in the background. It processes the digital media data so that it can be transformed into a playable format that an output media device, such as an audio speaker, requires. The media data flows through a number of interconnected media handling components, before it reaches a media output device or a media file to which it is written. This is shown in the next illustration.
The following image shows a media data processing pipeline:

Audio and video processing encompasses a number of things. Some of them are briefly discussed in this section. In this book, we will learn various audio-video processing techniques using Python bindings of the GStreamer multimedia framework.
Compression
If you record footage on your camcorder and then transfer it to your computer, it will take up a lot of space. In order to save those moments on a VCD or a DVD, you almost always have to compress the audio-video data so that it occupies less space. There are two types of audio and video compression; lossy and lossless. The lossy compression is very common. Here, some data is assumed unnecessary and is not retained in the compressed media. For example, in a lossy video compression, even if some of the original data is lost, it has much less impact on the overall quality of the video. On the other hand, in lossless compression, the data of a compressed audio or video perfectly matches the original data. The compression ratio, however, is very low. As we go along, we will write audio-video data conversion utilities to compress the media data.
Mixing
Mixing is a way to create composite media using more than one media source. In case of audio mixing, the audio data from different sources is combined into one or more audio channels. For example, it can be used to add audio effect, in order to synchronize separate music and lyrics tracks. In the coming chapters, we will learn more about the media mixing techniques used with Python.
Editing
Media mixing can be viewed as a type of media editing. Media editing can be broadly divided into linear editing and non-linear editing. In linear editing, the programmer doesn't control the way media is presented. Whereas in non-linear editing, editing is done interactively. This book will cover the basics of media editing. For example, we will learn how to create a new audio track by combining portions of different audio files.
Animations
An animation can be viewed as an optical illusion of motion created by displaying a sequence of image frames one after the other. Each of these image frames is slightly different from the previously displayed one. The next illustration shows animation frames of a 'grandfather's clock':

As you can see, there are four image frames in a clock animation. These frames are quickly displayed one after the other to achieve the desired animation effect. Each of these images will be shown for 0.25 seconds. Therefore, it simulates the pendulum oscillation of one second.
Cartoon animation is a classic example of animation. Since its debut in the early twentieth century, animation has become a prominent entertainment industry. Our focus in this book will be on 2D cartoon animations built using Python. In Chapter 4, we will learn some techniques to build such animations. Creating a cartoon character and bringing it to 'life' is a laborious job. Until the late 70s, most of the animations and effects were created without the use of computers. In today's age, much of the image creation work is produced digitally. The state-of-the-art technology makes this process much faster. For example, one can apply image transformations to display or move a portion of an image, thereby avoiding the need to create the whole cartoon image for the next frame.
- Moodle 2.0 E/Learning Course Development
- IBM Rational ClearCase 7.0: Master the Tools That Monitor, Analyze, and Manage Software Configurations
- Visio圖形設計從新手到高手(兼容版·第2版)
- 中文版After Effects 2021入門教程
- 中文版Maya 2012實用教程(第2版)
- Photoshop CS6從入門到精通
- 剪映短視頻剪輯與運營全攻略:視頻剪輯+音頻處理+后期特效+運營管理
- Vue 企業開發實戰
- Photoshop 2024從入門到精通
- After Effects 2022從入門到精通
- Photoshop CC完全自學教程:從入門到實踐(全新版)
- 音樂制作7天速成:Cubase編曲教程
- UG NX 12.0中文版從入門到精通
- Excel 2013公式·函數與數據分析
- AutoCAD 2022中文版從入門到精通(標準版)