Top Banner

Click here to load reader

Image Processing

Nov 24, 2014




Image Processing is any form of signal processing for which our input is an image, such as photographs or frames of video and our output can be either an image or a set of characteristics or parameters related to the image.

Image Processing generally refers to processing of two dimensional picture and by two dimensional picture we implies a digital image. A digital image is an array of real or complex numbers represented by a finite number of bits. But now in these days optical and analog image processing is also possible.

Face detection Feature detection Non-photorealistic rendering Medical image processing Microscope image processing Morphological image processing Remote sensing Automated Sieving Procedures Finger print recognization

Image processing can be done using various softwares and languages such as:Software Matlab Adobe photoshop Irfan view Language VHDL C/C++

The name MATLAB stands for matrix laboratory . It is a high-performance language for technical computing. It is an interactive system whose basic data element is an array which does not require any dimensioning. This allows us to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time.

MATLAB features a family of add-on applicationspecific solutions called toolboxes. These toolboxes are comprehensive collections of matlab functions (M-files) that extend the matlab environment to solve particular classes of problems. Areas in which toolboxes are available include image processing, signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many others..

The Image Processing Toolbox is a collection of functions that extend the capability of the Matlab numeric computing environment. These functions are written on M-files and further we can extend the capabilities of the Image Processing Toolbox by writing our own M-files. This toolbox supports a wide range of image processing operations such as..

Color corrections such as brightness and contrast adjustments, quantization, or color translation to a different color space. Image registration, the alignment of two or more images. Image segmentation.

Neighborhood and block operations. Linear filtering and filter design. Transforms. High dynamic range imaging by combining multiple images. Deblurring.

The following image formats are supported by Matlab: BMP HDF JPEG PCX TIFF XWB

Intensity image This is the equivalent to a "gray scale image . It represents an image as a matrix where every element has a value corresponding to how bright/dark (each element represent intensities). Binary image This image format also stores an image as a matrix but can only color a pixel black or white (and nothing in between). It assigns a 0 for black and a 1 for white.

Indexed image This is a practical way of representing color images. An indexed image stores an image as two matrices. The first matrix has the same size as the image and one number for each pixel. The second matrix is called the color map and its size may be different from the image. The numbers in the first matrix is an instruction of what number to use in the color map matrix.

RGB image It represents an image with three matrices of sizes matching the image format. Each matrix corresponds to one of the colors red, green or blue and gives an instruction of how much of each of these colors a certain pixel should use. A pixel whose color components are (255,255,255) is displayed as White. And whose color components are (0,0,0) is displayed as Black.

Histeq( ): This command is used to improve the contrast in the image. This function spreads the intensity values over the full range of the image, and this process is known as histogram equalization. Syntax histeq( Image_name.format );



Imadjust( ): This command is used to adjust the contrast of the image. Imadjust increases the contrast of the image by saturating 1% of the data at both low and high intensities of Image and by stretching the intensity. Syntax Imadjust( image_name.format )

Examples of imadjust

Adapthisteq( ): This command is used to perform contrast-limited adaptive histogram equalization (CLAHE). It is an alternative to function histeq, While histeq works on the entire image, adapthisteq operates on small regions in the image, called tiles. Syntax adapthisteq( Image_name.format );



Imread( ): This command is used to read that image onwhich the operation has to be done. Imread returns the image data in the array. If the file contains a grayscale image, then it will return a two-dimensional (M-by-N) array and if the file contains a color image, it will return a three-dimensional (M-by-N-by-3) array. The class of the returned array depends on the data type used by the file format. Syntax Imread( image_name.format )

Imview( ): This command is used to view the image on the screen. And this command is always used with the imread and imwrite command, because, it views only that image which is under process. Syntax Imview( image_name.format )

Result of above explained commands.

Imwrite( , ): This command is used to change the format of read file. By using this command we can change the file formats from one to another. SyntaxImwrite( image_name.format2 , image_name.format1 )

Imfinfo( ): This command is used to obtain the information about the image under process. It is used to obtain information such as size, position of pixels, number of rows and columns etc. SyntaxIminfo( image_name.format )

Imsubtract( , ): This command is used to create a more uniform background, by subtracting the background image from the original image. To estimate the background image, we use following command:background=imopen( Image_name.format ,strel('disk',15))

To see the estimated background image, type:imview(background)

Now subtract the background image from the original image, type:imsubtract( image_name.format ,background);

Result of the above used commands

Imresize( , ): This command is used to resize the processed image. To enlarge an image, specify a magnification factor greater than 1 in the command. To reduce an image, specify a magnification factor between 0 and 1 in the command. Syntax imresize( Image_name.format , value);

Image Rotation( , ): This command is used to rotate the given image. This command accepts two primary arguments, one is the image to be rotated and other one is rotation angle. We have to specify the rotation angle in degrees. If a positive value is specified then imrotate rotates the image counterclockwise and if a negative value then imrotate rotates the image clockwise. Syntax imrotate( Image_name.format , angle_in_degree);

Result of the above used commands

Imcrop( , ); This command is used to crop the particular image. It accepts two primary arguments: The image to be cropped. The coordinates of a rectangle that defines the crop area. If we call imcrop without specifying the crop rectangle, we can specify the crop rectangle interactively. In this case, the cursor changes to crosshairs when it is over the image. Position the crosshairs over a corner of the crop region and press and hold the left mouse button. When we drag the crosshairs over the image we specify the rectangular crop region. imcrop draws a rectangle around the area we are selecting. When we release the mouse button, imcrop creates a new image from the selected region.

Syntax Imcrop( image_name.format );



If we call imcrop with specifying the crop rectangle, imcrop operates on the image in the current axes. Syntax Imcrop( Image_name.format , [rect]);

Imerode( , ): This command is used to erode the image. This function accepts two primary arguments: The input image to be processed (grayscale, binary image), A structuring element object, returned by the strel function, or a binary matrix defining the neighborhood of a structuring element. Syntax Imerode( binary_image.format , strel);



Im2bw = This command is used to convert the given image in to binary image. This command is mainly followed by one another command i.e. level=graythresh(image_name.format). SyntaxLevel=graythresh( image_name.format ) Bw=im2bw( image_name.format , level)



Duller = This command is used to fade the image, so that, other image on which it is overlapped can be easily viewed. 0.5 Syntax Duller= * image_name.formatThis is the amount by which the fading is done.

Combine = This command is used to combine or overlap the two images. This is the command on which over all project stands. SyntaxCombine= image1 +image2.

We can convert images in any of formats/types described above using the following commands. Intensity format to Indexed format. gray2ind( )



indexed format to intensity format. ind2gray()



RGB format to intensity format. rgb2gray( )



RGB format to indexed format. rgb2ind( )



Image analysis return information about the structure of an image. This section describes toolbox functions that we can use for these image analysis techniques which includes: Edge Detection Boundary Tracing Quadtree Decomposition

We can use the edge function to detect edges, which are those places in an image that correspond to object boundaries. To find edges, this function looks for places in the image where the intensity changes rapidly. Edge takes an intensity image I as its input, and returns a binary image BW of the same size as I, with 1's where the function finds edges in I and 0's elsewhere.

Canny M