Book Image

Visual Media Processing Using MATLAB Beginner's Guide

By : George Siogkas
Book Image

Visual Media Processing Using MATLAB Beginner's Guide

By: George Siogkas

Overview of this book

Whether you want to enhance your holiday photographs or make a professional banner image for your website, you need a software tool that offers you quick and easy ways to accomplish it. All-in-one tools tend to be rare, and Matlab is one of the best available.This book is a practical guide full of step-by-step examples and exercises that will enable you to use Matlab as a powerful, complete, and versatile alternative to traditional image and video processing software.You will start off by learning the very basics of grayscale image manipulation in Matlab to master how to analyze 3-dimensional images and videos using the same tool. The methods you learn here are explained and expanded upon so that you gradually reach a more advanced level in Matlab image and video processing. You will be guided through the steps of opening, transforming, and saving images, later to be mixed with advanced masking techniques both in grayscale and in color. More advanced examples of artistic image processing are also provided, like creating panoramic photographs or HDR images. The second part of the book covers video processing techniques and guides you through the processes of creating time-lapse videos from still images, and acquiring, filtering, and saving videos in Matlab. You will learn how to use many useful functions and tools that transform Matlab from a scientific software to a powerful and complete solution for your everyday image and video processing needs.
Table of Contents (18 chapters)
Visual Media Processing Using MATLAB Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – using imtool to extract useful information


Now that we know what the imtool can do, let's use it to get some more information about our image. Suppose that we want to know the color, depth, and size of our image, the values of the pixels around an area we want to inspect, and the distances (in pixels) of some pairs of points on the image, we will have to take the following steps:

  1. Click on the third icon from the left, , that displays information about the image. You will see that the new window that appears contains a lot of information about the image, including its width, height, and bit depth.
  2. To make your task easier, you should first zoom in using the magnifying glass with the plus symbol (). Let's zoom in on the area containing the moving track (top of the image).
  3. Then, click on and place the blue crosshair that appears on the image on the track. You will now be able to see the values of the pixels in the small area selected by your crosshair. If you enlarge the selected area by dragging its sides, the values will not be visible, but you will still be able to inspect details in the image.
  4. Now let's measure the dimensions of the track that we have zoomed in on. Zoom in as much as you like to see the details and then click on .
  5. To measure the length between two points, you should left-click on the first point and keeping the left mouse button clicked, move the cursor to the second point and release the mouse button. This will draw a line between the two points you selected and place a label on it, displaying its length in pixels. Let's repeat this process to measure the dimensions of the truck.

  6. Now that you have measured the distances you needed, you might want to save the resulting image with the overlaid distance measurements. Click on File and then Print to Figure, in order to display your processed image in a new window and then navigate to File | Save As to get a chance to select the name and type of the image you want to save.

What just happened?

The process described previously is generally useful for people who work with image enhancement and analysis. In image processing, you will often need to inspect an image in terms of color values or measured in terms of distance, and so on. The analysis of the image regions should be easily extractable so that the results can be passed on to others. These functionalities are covered by imtool. In our example, we used the image information icon, which gave us an idea on what values to expect (8 bit depth means values from 0 to 255) and what the image dimensions are. Then, we located and inspected the region of our choice using the zoom in/out and the pixel values inspection tools. When we decided on the actual part of the image we wanted to measure, we used the distance measurement tool to see the dimensions of the selected object on screen. Finally, we exported our enhanced results to a new image of our chosen format, using the Print to Figure functionality.