Getting Started With The MATLAB Image Processing Toolbox

Similar documents
Image processing in MATLAB. Linguaggio Programmazione Matlab-Simulink (2017/2018)

MATLAB Image Processing Toolbox

Digital Imaging and Image Editing

Images and Graphics. 4. Images and Graphics - Copyright Denis Hamelin - Ryerson University

5.1 Image Files and Formats

Computer Vision & Digital Image Processing

INTRODUCTION TO COMPUTER GRAPHICS

Digital Image processing Lab

Brief Introduction to Vision and Images

Photoshop 01. Introduction to Computer Graphics UIC / AA/ AD / AD 205 / F05/ Sauter.../documents/photoshop_01.pdf

A PROPOSED ALGORITHM FOR DIGITAL WATERMARKING

Digital Imaging & Photoshop

Digital Imaging - Photoshop

DSP First Lab 06: Digital Images: A/D and D/A

Multimedia. Graphics and Image Data Representations (Part 2)

LECTURE 02 IMAGE AND GRAPHICS

Chapter 3 Graphics and Image Data Representations

1 Li & Drew c Prentice Hall Li & Drew c Prentice Hall 2003

CS 262 Lecture 01: Digital Images and Video. John Magee Some material copyright Jones and Bartlett

Understanding Image Formats And When to Use Them

Dr. Shahanawaj Ahamad. Dr. S.Ahamad, SWE-423, Unit-06

L2. Image processing in MATLAB

Computers & Philately Overview

Using Adobe Photoshop

Digital Images. Digital Images. Digital Images fall into two main categories

LECTURE 03 BITMAP IMAGE FORMATS

Bitmap Image Formats

CS101 Lecture 19: Digital Images. John Magee 18 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Creating Digital Artwork

Fundamentals of Multimedia

Indexed Color. A browser may support only a certain number of specific colors, creating a palette from which to choose

4 Images and Graphics

Detection of Image Forgery was Created from Bitmap and JPEG Images using Quantization Table

Matlab for CS6320 Beginners

Welcome Back to Fundamentals of Multimedia (MR412) Fall, 2012 Chapter 3. ZHU Yongxin, Winson

EELE 5110 Digital Image Processing Lab 02: Image Processing with MATLAB

Raster (Bitmap) Graphic File Formats & Standards

Factors to Consider When Choosing a File Type

Computer Art Semester Exam

A raster image uses a grid of individual pixels where each pixel can be a different color or shade. Raster images are composed of pixels.

Starting a Digitization Project: Basic Requirements

Digital Image Processing 3/e

Applying mathematics to digital image processing using a spreadsheet

PCCLUB.ORG.UK Tuesday, 3 rd May 2005 Stuart Crump. Picture Editing, Printing & Publishing Tutorial 1 of 2

Lab P-8: Digital Images: A/D and D/A

Image Compression Using SVD ON Labview With Vision Module

The BIOS in many personal computers stores the date and time in BCD. M-Mushtaq Hussain

Image Perception & 2D Images

in the list below are available in the Pro version of Scan2CAD

How to Avoid Landmines: Managing your Motion Graphics Projects

Lecture - 3. by Shahid Farid

UNIT 7C Data Representation: Images and Sound

Introduction to Color Theory

6.098/6.882 Computational Photography 1. Problem Set 1. Assigned: Feb 9, 2006 Due: Feb 23, 2006

3.1 Graphics/Image age Data Types. 3.2 Popular File Formats

Digital imaging or digital image acquisition is the creation of digital images, typically from a physical scene. The term is often assumed to imply

Photoshop CS6 First Edition

15110 Principles of Computing, Carnegie Mellon University

*Which code? Images, Sound, Video. Computer Graphics Vocabulary

Guide to Computer Forensics and Investigations Third Edition. Chapter 10 Chapter 10 Recovering Graphics Files

Adobe Photoshop CS2 Workshop

Commercial Art 1 Photoshop Study Guide. 8) How is on-screen image resolution measured? PPI - Pixels Per Inch

Digital Photographs and Matrices

Computers and Imaging

HTTP transaction with Graphics HTML file + two graphics files

Digital Image Object Extraction

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

B.Digital graphics. Color Models. Image Data. RGB (the additive color model) CYMK (the subtractive color model)

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101

CMPSC 390 Visual Computing Spring 2014 Bob Roos Review Notes Introduction and PixelMath

CS101 Lecture 12: Digital Images. What You ll Learn Today

all editorial writing.

CHAPTER 3 I M A G E S

raw format format for capturing maximum continuous-tone color information. It preserves all information when photograph was taken.

Photoshop (Image Processing)

Convert images and non-vector PDFs

Computer Programming

Specific structure or arrangement of data code stored as a computer file.

COURSE ECE-411 IMAGE PROCESSING. Er. DEEPAK SHARMA Asstt. Prof., ECE department. MMEC, MM University, Mullana.

Images 6 11/21/2016. Describe the capabilities and limitations of bitmap images. Describe the capabilities and limitations of vector images.

Elements of Design. Basic Concepts

CD: (compact disc) A 4 3/4" disc used to store audio or visual images in digital form. This format is usually associated with audio information.

GUIDELINES & INFORMATION

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Chapter 3 Graphics and Image Data Representations

Bangla Optical Digits Recognition using Edge Detection Method

The Classification of Gun s Type Using Image Recognition Theory

Image Optimization for Print and Web

Graphics for Web. Desain Web Sistem Informasi PTIIK UB

IMAGE SIZING AND RESOLUTION. MyGraphicsLab: Adobe Photoshop CS6 ACA Certification Preparation for Visual Communication

15110 Principles of Computing, Carnegie Mellon University

EP375 Computational Physics

ENEE408G Multimedia Signal Processing

The next table shows the suitability of each format to particular applications.

Photoshop Domain 2: Identifying Design Elements When Preparing Images

PB Works e-portfolio Optimizing Photographs using Paintshop Pro 9

March 31, Welcome to the Family Tree Maker Users Group!

Portfolio Primer University of Minnesota School of Architecture College of Design

WordPress Users Group Manchester, NH July 13, Preparing Images for the Web. Daryl Johnson SvenGrafik

UNIT 7C Data Representation: Images and Sound Principles of Computing, Carnegie Mellon University CORTINA/GUNA

Transcription:

Session III A 5 Getting Started With The MATLAB Image Processing Toolbox James E. Cross, Wanda McFarland Electrical Engineering Department Southern University Baton Rouge, Louisiana 70813 Phone: (225) 775-4153 Fax: (225) 775-3710 Email: cross4153@aol.com I. Abstract The MATLAB Image Processing Toolbox was designed to make the processing of images relatively simple. It is user friendly and gives the programmer full control of the image files. Traditional signal processing techniques can be applied to images by writing the algorithms to process data in two dimensions. The MATLAB Image Processing Toolbox is a powerful software package. This paper presents some fundamental concepts of images and image processing, and provides a short tutorial on the MATLAB Image Processing Toolbox. II. Introduction Digital imaging has become very popular since computer speeds are now fast enough to process images in a very short time. This popularity in digital imaging is for both military and civilian applications. Digital cameras have become common place and tele-marketers are constantly sending out messages saying how easy it is to share pictures of your children with your in-laws. Image Processing is becoming an intricate part of the Digital Signal Processing discipline. This is especially true for digital radar processing and for similar military applications. A picture of a battlefield can be taken and imaging software used to search for targets of a particular interest. Digital imaging software can be used to determine the best color to be used for military uniforms for camouflaging in a given environment. As a result, Digital Imaging has become a fertile research field and several engineering departments with large graduate programs have created Digital Image Processing Centers with much of its activity being funded by the Department of Defense. A number of software packages are now available for image processing. This paper will give a brief presentation on the computer BIOS functions available to place picture elements on the screen, followed by a brief discussion of MATLAB imaging fundamentals. A short tutorial on using the MATLAB Imaging Processing Toolbox with examples will be presented followed by some comments on other commercially available imaging software. The letters MATLAB stands for matrix laboratory. A digital image is stored as a matrix of numbers representing intensity and/or colors. The MATLAB Imaging Processing Toolbox is a powerful software

package for image processing in that it is a technical computing environment for highperformance numerical computation and visualization, specifically designed for matrix computations. III. A Brief Examination of the Pixel and Screen Handling The effective use of any software package can often be enhanced when one understands the fundamental concepts used by the program. Considering this, we will give a brief presentation on some fundamental concepts of how a picture is composed and how it is displayed on the monitor. Pictures are composed of small dots known as picture elements or pixels for short. For a given size picture, the more elements used, the higher the resolution or clarity of the picture, that is, the more details that are displayed. The complete image or picture is composed of a matrix of pixels. As examples, an image composed of a 320 x 200 (320 rows and 200 columns) matrix of pixels gives a relatively low resolution picture whereas an image composed of a 640 x 480 matrix of pixels gives a relatively high resolution. Assume that a byte of memory is needed to store each pixel. Then, for the first case only 64,000 bytes are needed where as for the second case, 307,200 bytes are needed. The screen handling facility for IBM compatible computers is found in the Basic Input-Output System (BIOS) memory, which is contained in the read-only memory (ROM) supplied with the computer. This is at a lower level than the Disk Operating System (DOS). The BIOS functions are accessed through the use of interrupts. Although this can be done through the C language, assembly language is the most efficient method of directly assessing the system's underlying resources. Interrupt 10h provides Video Services for different video display adapters. Advanced assembly language and MS DOS Advanced Programming books [1][2] explain the use of this set of services. The service number for the function to be performed is placed in the AH register when invoking the interrupt. As an elementary example, a pixel is written to the screen when interrupt 10h is invoked with the value OCh placed in the AH and the color code for the pixel in the AL register. Screen handling has two general modes, alphanumeric and graphics. Graphics has several video modes, which determine the resolution and color option. The video mode is set in the AL register. As an example, when the INT 10 interrupt is invoked with a Video Graphics Adapter, for the value 0 set in the AH register and the value 13h set in the AL register, the display is set for 640 x 480 rows and columns of pixels with 256 colors. The primary colors are red, green and blue. Some mixture of these colors generates all other colors and intensity levels. The number of colors available, how they are obtained, and the intensity level depends on the type of type of graphics adapter (CGA, EGA, VGA, etc.). As an example, one can select from a color palette of 64 colors with the Enhanced Graphics Adapter (EGA). On the other hand, a choice of 256K colors is provided with VGA. The VGA is an analog display using a Digital to Analog Converter (DAC). The DAC has 256 registers having color values going from 0 to 255, thereby providing the 256K different colors. This concept can provide insight when we examine MATLAB imaging.

IV. MATLAB Imaging Fundamentals It can be seen that the fundamental imaging concepts discussed above applies equally well to MATLAB imaging. As mentioned above, an image consists of a matrix of pixels or picture elements. An image to be displayed on the screen is characterized by a mixture of the primary colors (red, green and blue), the intensity, and the x and y coordinates for the pixel. There are three types of image data matrices, indexed images, truecolor (or RGB) images, and intensity images. [3][4] An indexed image uses a colormap. A colormap provides a number of colors used to represent pixels. A mixture of the three primary colors, red, green and blue forms each color. Each of the three numbers is in the range 0 to 1. For example, [1, 0, 0] is red, [0,.5, 0] is dark green and [0.67, 0, 1] is violet. The colormap is composed of n rows of these three-column color combinations. Although a colormap does not have to consist of any set number of rows, the number of rows is 64 by default, thereby providing a 64-by-3 data image array. Each pixel in the image is then characterized by a set of three numbers. The first two numbers give the x and y coordinate. The third number is an index into the 64-by-three array. As an example, assume that the color is yellow. Since yellow is represented by [1, 0, 1], if this combination is the 12th row in the array, the third number will be 12. A truecolor image uses an m-by-n-by-3 data array. The first two parameters give the coordinates of the pixel followed by three more numbers that give the color. The default format is double or a double-precision floating-point number. However, the 8-bit unsigned integer type unit8 format can also be used. In this case, colors are represented by values 0 to 255 rather than from 0 to 1. A conversion can be made between the unit8 format and the double format by scaling the numbers by 255. An intensity image is used for gray scale or one of the other monochromatic colormaps and scales the image data over a range of intensities. Image files can be saved and/or loaded using the MATLAB "save" and/or "load" command. Industry standard image file types supported by MATLAB are BMP (MS Windows Bitmap Format), HDF (Hierarchical Data Format), JPEG (Joint Photographic Experts Group Format), PCX (PC Paintbrush Format), TIFF (Tagged Image File Format) and XWD (X Windows Dump Format). V. Using the MATLAB Image Processing Toolbox MATLAB has a wide variety of functions that make problem solving and plotting easy. In addition to the elementary math functions found in Fortran and C, MATLAB contains a rich set of matrix, logical, plotting and other functions. They perform such operations as finding the determinant, the inverse, the transpose, and eigenvalues of matrices. MATLAB has several "Toolboxes" which are collections of functions built on MATLAB's numeric computing environment. These are families of application-specific solutions employing a comprehensive collection of MATLAB functions known as M-files. Among these is the Image Processing Toolbox. The functions provided in this Toolbox make it possible to have access to the ASCII data file of an image and to manipulate it in any way one chooses. Or, if one wishes, an image can be created by simply forming a matrix for a data file of pixels. This can be fun. Some examples will be given.

A. Example 1: Our Picture Below is a picture taken with a Sony Digital Mavica camera that uses diskettes. The picture has a JPG format. It was stored in the computer and then opened using the MATLAB Import Wizard that automatically converted it to an indexed image data file, the name of the file being Mvc_002s. The image was displayed using the command: Image (Mvc_002s). Using the command, "whos", it was seen that the image data file was a 480 x 640 x 3 unit8 array. The value of the individual pixels can be examined. For example, by entering Mvc_002s(480,640, :) we can note the three values for the colors of the last pixel as 90, 71, 73. Thus 90 gives the intensity for the color red, 71 gives the intensity of the color green and 73 gives the intensity for the color blue, with possible values ranging from 0 to 255. Any part of the image can be selected and manipulated by creating a submatrix from the file. As an example, Mrs. Cross was isolated and the image displaced using the following commands: Fig. 1 Fig. 2 subpic1=mvc_200s(1:480,320:640,:); image(subpic1) This selects an image consisting of pixels for all the rows (1 through 480) with only the columns from 320 to 640, the right half side of the image. The image is show as Fig. 2. MATLAB has the "crop" function and we could have selected the above sub-image using that function. The above selection method was used to demonstrate that since the image is in the form of an ASCII data matrix, the user has complete control of the image and can perform the various operations available in various commercial imaging packages. In addition, the user is free to design filtering, pattern recognition and similar type algorithms of military interest and use them for locating and identifying targets. An example using a military target will be given next. Example 2: A Scud Missile Launcher

Below is an image of a scud missile launcher found on the Internet. Fig. 2 This image is represented by a 486 x 720 x 3 unit8 array, thus occupying about 1M bytes of memory. This file was down-loaded and stored with the name scud_launcher.bmp. It was then loaded under MATLAB using the command to read images: imread('scud_launcher.bmp') Example 3: Tank Images Algorithms to find the edge of an image have been found to be very useful. Some such well know algorithms are those based on the Sobel Operator, the Roberts Operator and the Prewitt Operator. [5] These algorithms are supplied with the MATLAB Imaging Toolbox. The below program was used to extract the edge of a tank. The tank image below is an intensity image and Fig. 4

the edge algorithms will not operate on an intensity image. It must be converted to a gray image. The MATLAB function rgb2gray was used to do this as follows: % Program, edge_tank1, to find the edge for file Mvc-015s.jpg I1 = imread('mvc-015s.jpg'); % Since the Matlab edge function does not work on rgb images, convert it to gray. I1g = rgb2gray (I1); % Now find the edge of the image I1g using the Sobel method. edgei = edge(i1g, 'Sobel'); imshow (edgei). Below is the image that was produced. Fig. 5 As a final demonstration of the ability to process images with MATLAB, we will use the following program to invert the tank image: % Program "tank_180degrees" using the picture Mvc-015s. The tank % is to be rotated 180 degrees. A = imread('mvc-015s.jpg'); % The matrix A is 480 X 640 x 3. Rotate it 180 degrees using: for i = 1:480 B(480-i+1,:,:) = A(i,:,:); end % Now show the new image, B. imshow (B) The results are as shown below.

Fig. 6 VI. Other Imaging Software Packages A variety of other imaging software packages exist. Most such software is designed for the average "home user". Other software packages have the capability of converting between formats and of producing ASCII matrix files similar to that of MATLAB. Such software was designed for the professional user and for research. Examples of the first type of software is Adobe's Photoshop, Kodak Photo CD, Paint Shop Pro, Microsoft's Picture It, and Corel Photo Paint 9. An example of the second type is Image Alchemy, produced by Handmade Software, Inc. Alchemy is an image conversion and compression utility. It supports a wide variety of raster formats, reading and writing scanned and digitized images. It supports every color space and compression type. Information on a variety of software packages can be found at the web site: http://www.sphoto.com/techinfo/wdtech.html. VII. Conclusions The MATLAB Image Processing Toolbox was designed to make the processing of images relatively simple. It is user friendly and gives the programmer full control of the image files. Traditional signal processing techniques can be applied to images by writing the algorithms to process data in two dimensions. The MATLAB Image Processing Toolbox is a powerful software package. VIII. References [1] M.Young, S DOS Advanced Programming, SYBEX Inc., San Francisco, 1989. [2] S. H. Holzner & P. Norton, Advanced Assembly Language, Brady, 1991.

[3] D. Hanselman and B. Littlefield, Mastering MATLAB 5, Prentice Hall, Upper Saddle River, NJ, 1998. [4] The Math Works, Inc., Using MATLAB Graphics, The Math Works, Inc., Natick, MA, 1996. [5] M. A. Sid-Ahmed, Image Processing, McGraw-Hill, Inc., New York, 1995. Biographical Information James E. Cross Cross is an associate professor of Electrical Engineering at Southern University in Baton Rouge, LA where he has been a member of the faculty since 1962. Cross earned the BES degree in Electrical Engineering from Johns Hopkins University in 1960, the MS degree in Electrical Engineering from LSU 1967 and did further study in Electrical Engineering at LSU and the University of Florida. Cross has also earned the Bachelor s, Masters and Doctor of Theology degrees from Christian Bible College. He has worked on several Digital Signal Processing research projects for the Department of Defense and on other research and curriculum improvement projects. Wanda McFarland McFarland has served as a member of the Southern Univ. Electrical Engineering. Faculty since 1993 and presently holds the rank of Assist. Prof. She is an EE Ph.D student Texas A & M University College Station, Texas. She has performed research in the area of Digital Signal Processing for radar. McFarland has served in the United States Peace Corps in Bukavu, Zaire and Libreville, Gabon Africa.