35 views

Uploaded by tartcradle

- senhas.docx
- En Wikipedia Org
- Graphic Latex
- Acquiring Image and Skeletal Data Using the Kinect
- Computer Graphics MCQ'S
- Resume Deepak
- vision computer
- QRCodeFontware
- Multime.pdf
- Schematic Model for Analyzing Mobility and Detection of Multiple
- Mimic Creator Tut
- Exercise Week 3
- Sticky Notes 1
- a2d raster article aapg explorer valusek
- Pelco Endura Maping Spec
- Iris Final Documentation
- game graphics report
- Pinnboard Tutorial by Kuschelirmel
- COMPUTER GRAPHICS AND ANIMATION 1.docx
- UV Tutorial

You are on page 1of 6

8 TITLE:

/ / / /5 /5 /

GRADE

PROFESSOR

page 1 of

SIGNLAB Signals, Spectra and SignalProcessing Experiment Title Module MATLAB IMAGE PROCESSING

Objectives: By the end of the session the students should be: y familiar with image processing, image representation, reading and writing images in matlab environment. y Some basic operations, linear filters, nonlinear filters Introduction: I. Image representation. There are five types of images in MATLAB: 1. Grayscale. A grayscale image M pixels tall and N pixels wide is represented as a matrix of double datatype of size MN. Element values (e.g., MyImage(m,n)) denote the pixel grayscale intensities in [0,1] with 0=black and 1=white. 2. Truecolor RGB. A truecolor red-green-blue (RGB) image is represented as a three-dimensional MN3 double matrix. Each pixel has red, green, blue components along the third dimension with values in [0,1], for example, the color components of pixel (m,n) are MyImage(m,n,1) = red, MyImage(m,n,2) = green, MyImage(m,n,3) = blue. 3. Indexed. Indexed (paletted) images are represented with an index matrix of size MN and a colormap matrix of size K3. The colormap holds all colors used in the image and the index matrix represents the pixels by referring to colors in the colormap. For example, if the 22nd color is magenta MyColormap(22,:) = [1,0,1], then MyImage(m,n) = 22 is a magenta-colored pixel. 4. Binary. A binary image is represented by an MN logical matrix where pixel values are 1 (true) or 0 (false). 5. uint8. This type uses less memory and some operations compute faster than with double types. For simplicity, this tutorial does not discuss uint8 further. Note: Grayscale is usually the preferred format for image processing. In cases requiring color, an RGB color image can be decomposed and handled as three separate grayscale images. Indexed images must be converted to grayscale or RGB for most operations. II. Reading and writing image files MATLAB can read and write images with the imread and imwrite commands. Matlab supports several image formats and to check the list type imformats on the command window. >> imformats

EXT ISA INFO READ WRITE ALPHA DESCRIPTION -------------------------------------------------------------------------------------bmp isbmp imbmpinfo readbmp writebmp 0 Windows Bitmap (BMP) gif isgif imgifinfo readgif writegif 0 Graphics Interchange Format (GIF) jpg jpeg isjpg imjpginfo readjpg writejpg 0 Joint Photographic Experts Group (JPEG) pbm ispbm impnminfo readpnm writepnm 0 Portable Bitmap (PBM) pcx ispcx impcxinfo readpcx writepcx 0 Windows Paintbrush (PCX) pgm ispgm impnminfo readpnm writepnm 0 Portable Graymap (PGM) png ispng impnginfo readpng writepng 1 Portable Network Graphics (PNG) pnm ispnm impnminfo readpnm writepnm 0 Portable Any Map (PNM) ppm isppm impnminfo readpnm writepnm 0 Portable Pixmap (PPM)

ECE DEPARTMENT 9 FEU EAST ASIA COLLEGE Version 1.0. 2009 Module 8 Matlab Image Processing Prepared by Engr. AU Cabatit page 2 of

...

When reading images, an unfortunate problem is that imread returns the image data in uint8 datatype, which must be converted to double and rescaled before use. Instead of calling imread directly, create the following Mfile function to read and convert images:

function Img = getimage(Filename) %GETIMAGE % % % Read an image given a filename The image is V = GETIMAGE(FILENAME) where FILENAME is an image file.

returned either as an MxN double matrix for a grayscale image or as an MxNx3 double matrix for a color image, with elements in [0,1].

Linear filters Linear filtering is the cornerstone technique of signal processing. To briefly introduce, a linear filter is an operation where at every pixel xm,n of an image, a linear function is evaluated on the pixel and its neighbors to compute a new pixel value ym,n.

j k

hj,k xm

j,n k

where x is the input, y is the output, and h is the filter impulse response. Different choices of h lead to filters that smooth, sharpen, and detect edges, to name a few applications. The right-hand side of the above equation is denoted concisely as h x and is called the convolution of h and x. Exercises: % To convert or lead an image to matrix that matlab can read

ECE DEPARTMENT 9 FEU EAST ASIA COLLEGE Version 1.0. 2009 Module 8 Matlab Image Processing Prepared by Engr. AU Cabatit page 3 of

% variable = Img( filename.ext ); % always place a semicolon less matlab will display all matrix elements % or use variable = imread( filename.ext ) A=imread( Tree.jpg ); % To view image in matlab: or Imshow(variable) % image(variable) image(A); % or use Imshow(A); % determines the size of the matrix row and column [row, column] = size(A); % shows all the variables used and its dimensions whos % extracts red (1), green (2), or blue (3) from an rgb image syntax (color = variablename (:,:,n)) Red = A(:,:,1) ; image(Red); Green=A(:,:,2); image(Green); Blue=A(:,:,3); image(Blue); % combine all rgb and convert to gray scale B = (A(:,:,1) + A(:,:,2) +A(:,:,3))/3; Imshow(B); % To resize an image A1=imsize(A,0.2); A2=imsize(A1,5); % downsample to 1/5th of the size % upsample back to original size

% Histogram is a measure of the distribution of density within pixels. figure();imhist(A); % Tresholding changing the contrast of an image A3=max(A,100); %removes all values below 100 imshow(A3); A4=min(A,100); %removes all values above 100 Imshow(A4); % A light smoothing filter h = [0 1 0; 1 4 1; 0 1 0]; h = h/sum(h(:)); % Normalize the filter uSmooth = conv2padded(u,h); % A sharpening filter h = [0 -1 0; -1 8 -1; 0 -1 0]; h = h/sum(h(:)); % Normalize the filter uSharp = conv2padded(u,h); % Sobel edge detection hx = [1 0 -1; 2 0 -2; 1 0 -1]; hy = rot90(hx,-1); u_x = conv2padded(u,hx); u_y = conv2padded(u,hy); EdgeStrength = sqrt(u_x.^2 + u_y.^2); % Moving average

ECE DEPARTMENT 9 FEU EAST ASIA COLLEGE Version 1.0. 2009 Module 8 Matlab Image Processing Prepared by Engr. AU Cabatit page 4 of

WindowSize = 5; h1 = ones(WindowSize,1)/WindowSize; uSmooth = conv2padded(h1,h1,u); % Gaussian filtering sigma = 3.5; FilterRadius = ceil(4*sigma); % Truncate the Gaussian at 4*sigma h1 = exp(-(-FilterRadius:FilterRadius).^2/(2*sigma^2)); h1 = h1/sum(h1); % Normalize the filter uSmooth = conv2padded(h1,h1,u); Maximum of 6 images per page Machine Problem: Write a program that will accept different elements for a 3 by 3 filter kernel and perform image convolution using the same filter kernel.

int myEmboss(void *inData, unsigned int inRowBytes, void *outData, unsigned int outRowBytes, unsigned int height, unsigned int width, void *kernel, unsigned int kernel_height, unsigned int kernel_width, int divisor , vImage_Flags flags ) { uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; // 1 vImage_Buffer src = { inData, height, width, inRowBytes }; // 2 vImage_Buffer dest = { outData, height, width, outRowBytes }; // 3 unsigned char bgColor[4] = { 0, 0, 0, 0 }; // 4

ECE DEPARTMENT 9 FEU EAST ASIA COLLEGE Version 1.0. 2009 Module 8 Matlab Image Processing Prepared by Engr. AU Cabatit page 5 of

vImage_Error err; // 5 err = vImageConvolve_ARGB8888( *dest, NULL, 0, //unsigned int srcOffsetToROI_X, 0, srcOffsetToROI_Y, kernel, *kernel, kernel_height, //unsigned int kernel_width, //unsigned int divisor, //int bgColor, flags | kvImageBackgroundColorFill //vImage_Flags flags ); return err; } //const signed int //unsigned int &src, &dest, //const vImage_Buffer *src //const vImage_Buffer

Histogram is a graphical representation showing a visual impression of the distribution of data. It is an estimate of the probability distribution of a continuous variable

Q2. Describe image convolution?

convolution is a mathematical operation on two functions f and g, producing a third function that is typically viewed as a modified version of one of the original functions. Convolution is similar to cross-correlation. It has applications that include probability, statistics, computer vision, image and signal processing, electrical engineering, and differential equations.

Q3. Describe the process of image convolution? Discussion:

Matlab has applications that include probability, statistics, computer vision, image and signal processing, electrical engineering, and differential equations.

. Conclusion:

Convolution is a mathematical operation on two functions f and g, producing a third function that is typically viewed as a modified version of one of the original functions. Convolution is similar to cross-correlation. It has applications that include probability, statistics, computer vision, image and signal processing, electrical engineering, and differential equations.

page 6 of

- senhas.docxUploaded byWellington Nasario
- En Wikipedia OrgUploaded byjignesh
- Graphic LatexUploaded byAnushree Anil
- Acquiring Image and Skeletal Data Using the KinectUploaded byjajprabu
- Computer Graphics MCQ'SUploaded byGuruKPO
- Resume DeepakUploaded bydeepak1998
- vision computerUploaded bypedro_cordoba027069
- QRCodeFontwareUploaded bySherwood Hu
- Multime.pdfUploaded byGagan Bansal
- Schematic Model for Analyzing Mobility and Detection of MultipleUploaded byIAEME Publication
- Mimic Creator TutUploaded byaleksandarpmau
- Exercise Week 3Uploaded byAufa Adlia
- Sticky Notes 1Uploaded byCristian Sergiu Georgescu
- a2d raster article aapg explorer valusekUploaded byapi-205999899
- Pelco Endura Maping SpecUploaded byngayit
- Iris Final DocumentationUploaded byNadikatla Chandrasekhar
- game graphics reportUploaded byapi-333091344
- Pinnboard Tutorial by KuschelirmelUploaded byAbhay Aryan
- COMPUTER GRAPHICS AND ANIMATION 1.docxUploaded byLycelleRamos
- UV TutorialUploaded byOlban Javier Calero Martinez
- Canning Poster RubricUploaded byabernola
- rubric making a diagramUploaded byapi-418881909
- popplet rubricUploaded byapi-450398727
- Transactions Journals (13)Uploaded byinbox9999
- Advanced Computer GraphicsUploaded byArtyLake
- p53-grossUploaded byRocking Ridz
- lecturafacildecomprensionlectorahigienepdfUploaded byPedagogía Uandes
- cg01Uploaded byhi_am_balaji
- artistic style treatmentUploaded byapi-302170302
- Graphic Express 11-5 Mb MaxUploaded byRodolfo Enrique Suarez

- Ra 9710 Magna Carta for Women With Implementing Rules (Irr)Uploaded byalm27ph
- Van Dorn vs RomilloUploaded bycaramelsundae
- 7610Uploaded bytartcradle
- CIV2-3Uploaded bytartcradle
- 2010 Civil Mock Bar AnswersUploaded bydmad_shayne
- 2010 BAR EXAMINATIONSUploaded bytartcradle
- 45177293-Tax-2-TagufaUploaded byMC NPaminiano

- 27832 VoIP FinalUploaded byPrasanga Wdz
- ISMS_Manual.pdfUploaded byWill Ariseoluwa Macdanielle
- Bug RateUploaded byThanh Hương
- Manual OXXUploaded byhalleck203
- Ch14_Test (1)Uploaded byUsama EL Alaoui
- e Film 30 User GuideUploaded byboogie_man2010
- Srs of Linked InUploaded byadarsh raj
- Labor Distribution User GuideUploaded byoneeb350
- 02whynetconfandyang 150213141218 Conversion Gate02Uploaded byHugo Cesar Flores Ortiz
- DS QlikView for Recruitment EnUploaded byMadhavi Kurra
- Display space used by tableUploaded byIris Pleasent
- Aspnet Aspnet LatestUploaded bysepulinho
- 35607686-hacking-Module-11Uploaded byChye Heng
- Manual Orbit 5 InstalacionUploaded byLeo Raw
- IRJET-Survey on Emotion Recognition using Facial Expression from Video SequenceUploaded byIRJET Journal
- TraverseXL_V1_0Uploaded byDeni Saddam
- Manual Cardiofax 1150 - PDF Free Download.pdfUploaded byTường Nguyễn Bá
- 2012-07-10procurementsigNAUploaded bySoorav Mlic
- Kulkarni Presentation CISCUploaded byuttammande
- 001 Handouts for Section-5 PresentationUploaded byNavneetMishra
- rfc2326Uploaded byFrancesco Saviano
- Solman 7.1 installation guide using Linux and MaxDBUploaded byMập Xấu Tính
- Ccnp t ShootUploaded byTanzim Taj
- Data SetUploaded byPartho Bora
- Intrebari_oracle.pdfUploaded byBianca Grigoras
- Introduction Vb .NetUploaded bydonakomeah
- Systems i Software Iws PDF WebServicesServer NewUploaded byAnalistaProgramador
- The Core Components of Entrust/PKI v5Uploaded byLuke O'Connor
- Manual del 705itUploaded byAngel Rosales
- Level II CHARTS 999901.docxUploaded byManjeet Singh