Introduction to Digital Image Processing Using MATLAB

Click here to load reader

download Introduction to Digital Image Processing Using MATLAB

of 35

description

A complete guide to image procesing

Transcript of Introduction to Digital Image Processing Using MATLAB

Introduction to Image processing Using MATLAB

By :- Pratik GohelIntroduction to Digital Image Processing Using MATLABOverview What is image processing?ApplicationsWhat is an image?Introduction to image processing techniquesBasic MATLAB commands for image processing

What is Image Processing? Image processing is the collective name for techniques used to extract information from digital images or to manipulate them to render variations of the input image.

Photo stitchingColor boostVehicle detection and tracking

Popular technologies which make use of the camera as a sensor

The Wii Remote uses an IR camera to sense its location relative to the Wii Sensor Bar.

The Kinect uses image processing techniques on depth images to detect and track locations of multiple persons in the field of view.ApplicationsMedicineDefenseMeteorologyEnvironmental scienceManufactureSurveillanceCrime investigation

Applications: Medicine

CT(computed Tomography)PET(Positron Emission TomographyPET/CTArrows indicating metastatic lesionsApplications: Meteorology

Applications: Environmental Science

Applications: Manufacture

Applications: Crime Investigation

Fingerprint enhancementPixelsPixel

A pixel (abbr. for picture element) is the smallest unit of an image.Therefore, a 640x480 image is a matrix of 640 columns and 480 rows, each element of this matrix is called an image pixel.MATLAB Image CoordinatesMATLAB stores images as matrices.In MATLAB, image pixels are referenced using (row, col) values.Origin of the coordinate system (1,1) is the top left corner of the imageThus, img(4,3) refers to the pixel at the 4th row and 3rd column.img(1,1)Sampling & Quantization

Sampling & Quantization

RGB and GrayscaleIn RGB format, each Pixel has 3 color components: Red, Green, and Blue.Other color representations, e.g. HSV, YUV, CMYK, are also used. Transformations from RGB to these color spaces and back are defined in MATLAB. If only intensity (bright/dark) variations are considered, the resultant image is called a grayscale image. Each pixel has only 1 component: intensity

Basic Image Processing techniquesBackground SubtractionIntensity Thresholding Morphological OperationsColor-based ProcessingShape-based Processing

A combination of the above methods is usually used in basic image processing applications. There is no perfect solution, so keep discussing (and trying) what suits your project best.

Spatial & Gray level resolutionZooming & Shrinking of Digital ImagesSampling decides the spatial resolution of an image.Spatial resolution is the smallest discernible detail in an image.M x N is the resolution of an image.What is the effect of changing the resolution of an image on its appearance?Smallest discernible change in gray level.It depends on hardware.Zooming

ShrinkingIts done with two processesCreate new pixel locationsAssign gray levels to these new locations

EnhancementTo make greater (in value , desirability, or attractiveness) Image enhancement is to make the visual interpretation of the image easier and to make the image more suitable to the subsequent image analysis.

Original ImageAfter EnhancementImage processing operationPoint ProcessingObtain Negative imageObtain Flip imageThreshold operation (Thresholding)image arithmetic operationsAdditionSubtractionMultiplicationimage logical operationsFiltering ProcessFilter mask is moved from point to point in an image. At each point (x,y), the response of filter is calculated using predefined relationship

Spatial FiltersSmoothing Spatial FiltersSmoothing Linear FiltersAverage FilterWeighted Average Filter

Order-Statistics FiltersMedian FilterMinimum FilterMaximum Filter

Sharpening Spatial FiltersFirst derivative Second Derivative

Box filter and Weighted Average Filter

Sharpening Image

Image ClassesClass for an image is data type used to store & represent an image.All MATLAB data types are designed to function as classes in object-oriented programming.

MATLAB Basic Functions for Image processingA = imread(filename, fmt) , It reads a grayscale or color image from the file specified by the string filenameA=imread('cameraman.tif'); imwrite(A,filename,fmt) It writes the image to filename, inferring the format to use from the filename's extensionIM2 = imcomplement(IM) B = imrotate(A,angle) F = imresize(A,[r,c]); G = im2bw(A); H=rgb2gray(RGB);

If we read given color image using imread() function, we get 3-D matrix. To separate out R,G and B planes, we can read each plane separately as follows:myImage=imread(RGBBar.bmp);RED=myImage(:,:,1);GREEN=myImage(:,:,2);BLUE=myImage(:,:,3);If we have three R,G and B planes separately and if we want to create color image from it, we can use concatenate function:Example:newImage=cat(3,RED,BLUE,GREEN)

[rows,cols] = size(imagedata);[namefile,pathname]=uigetfile({'*.bmp;*.tif;*.jpg;*.gif','IMAGE Files (*.bmp,*.tif,*.jpg,*.gif)'},'Choose GrayScale Image');img=imread(strcat(pathname,namefile));if(size(img,3)==3)img=rgb2gray(img);endB = zeros(m,n) Create array of all zerosxorimage= xor(myimageA,myimageB);| OR operation& and operationB = imnoise(A,'salt & pepper', 0.02); Add the Solt & Pepper noise in image.K = medfilt2(B);L = wiener2(B,[5 5]);Define spatial filter masksL1=[1 1 1;1 1 1;1 1 1];filt_image= conv2(double(myimage),double(L1))Perform 2- D convolutionfiltimg = imfilter(myimage,gaussmask);