• No results found

Color Specification

(iii) Grayscale Image

5.1.6 Color Specification

There are 3 ways by which one can specify color in a MATLAB graphics. They are:

(i) RGB Triple (ii) Short name (iii) Long name

There are eight predefined colors in MATLAB. The RGB (red-green-blue) triple is a three-element row vector whose elements specify the intensities of the red, green and blue components of the color. The intensities lie in the range of 0 to 1.

RGB Value Short Name Long Name

[1 1 0] y yellow

[1 0 1] m magenta

[0 1 1] c cyan

[1 0 0] r red

[0 1 0] g green

[0 0 1] b blue

[1 1 1] w white

[0 0 0] k black

The details of few image formats supported by MATLAB are:

BMP BMP stands for a bitmap image file. It is also known as device independent bitmap (DIB) or bitmap. It is capable of storing 2D images of any dimension and resolution. A bitmap image file can color or monochromatic

HDF Hierarchical Data Format or HDF is the name given to the set of file formats and libraries designed to store and organize large amounts of data. It was originally developed at the National Center for Supercomputing Applications and is presently supported by the non-profit HDF Group.

JPEG JPEG stands for the Joint Photographic Expert Group. JPEG can give upto 10:1 compression with any perceptible loss in the image quality. The extension for this format of digital images is .jpg

PCX PCX stands for Personal Computer Exchange. It is an image file format. It was initially the native file format for PC Paintbrush and had become one of the first widely accepted imaging standards in the DOS operating system. Files in the PCX format are commonly stored palette-indexed images which range from 2 or 4 colors to 16 and 256 colors. This format is also extended for true color or 24-bit image.

TIFF TIFF or the tagged image file format is a format for storing raster graphics images. This is one of the most popular formats among artists and publishers. Armature as well as professional photographers use this format very commonly.

The format was developed by a company called Aldus for use in desktop publishing. Since 2009 this format is under the control of Adobe Systems.

A number of other sophisticated image formats have been developed such as GIF, JPEG and PNG.

MATLAB is capable of reading and writing images using the imread and imwrite commands. It can display the images using the image and imshow commands. MATLAB supports a large number of file formats. imformats command can be used to see the list of image formats that are supported by the version of MATLAB installed in the computer.

>> imformats

5.1.7 Pixel

A digital image is composed of pixels which can be considered small dots. A digital image is a data set which gives the instruction of how to colour each pixel or dot. A digital image could have a size of 512 by 512 pixels. Usually, the number pixels is in the form 2n. An image of size m × n pixel is composed of m pixels in the vertical direction and n pixels in the horizontal direction. A 512 × 512 image has a total number of 262144 pixels. This is a very large number and in order to store this information a very large memory size is required. As a result we need to compress this image and reduce the size of the data. This can be done using techniques like Fourier analysis and Wavelet Analysis.

The word pixel was first used in 1965 by Frederic C Billingsley of JPL, Jet Propulsion Laboratory. He published two papers in 1965 where he used the term pixel. He used the term pixel to describe elements of video images from space probes to moon and mars.

Frederic C Billingsley spent most of his career working on digital image processing. Pixel is the short form of picture element. In a digital image a pixel or pel as it is sometimes known is the smallest element in a digital image display device. A display monitor displays a digital image by dividing the screen into thousands and millions of pixels. The pixels are arranged in rows and columns. Each pixel has its unique address which is determined by its physical coordinates. It is hard to distinguish individual pixels in the monitor as they are very close to each other. The number of bits used to represent each pixel determines how many colours or shades of gray can be displayed. A 8 bits color mode in a color monitor uses 8 bits for each pixel so it is possible to display 28 = 256 different colors or shades of gray. On color monitors each pixel is composed of a red, blue and green dots, all converging at a point. The quality of a display depends on the number of pixels it can display and the bits used to represent each pixel. A true color system uses 24 bits per pixel and this makes it possible to display more than 16 million different

colours.

A digital image has all its information in the form of digits stored in an array. Everything in this digital image is discrete. A digital image is a large array of dots. Each dot has a number associated with it. The numbers, usually integers, have the information relating to the brightness of the dots. All the dots make up the entire image. Each dot is called a pixel.

A pixel neigbourhood is determined by the array size we select around a pixel.

In paint when the pencil is used to color single pixels and then the pixels are zoomed to several hundred time we can notice that the pixels are square in dimension and it is these tiny squares that make a complete image.

The actual pixels in paint. The paint images have been resized.

If we observe carefully we can easily see the square shaped pixels in the image when magnified 800 times.

5.1.8 Megapixel

The term megapixel is used to denote the size of a digital image. Megapixel stands for one million pixels (106 pixels). As pixels are usually square and form a grid, a 1-megapixel camera will produce an image about 1200 pixels wide by 900 pixels long. Digital images with more megapixels are larger in size and so can a lot of space for their storage. The resolution of digital cameras is often measured in terms of megapixels.

5.2 image (c)

image (C) displays matrix C as an image. Each element of the matrix C specifies the color of a pixel in the image. The different ways to read an image and display it in a figure window is shown below.

>> a=imread (‘flower.jpg’,’jpg’);

>> image (a)

>> a=imread (‘01.bmp’,’bmp’);

>> image (a)

>> axis square

Related documents