Presentation is loading. Please wait.

Presentation is loading. Please wait.

M ATLAB L ECTURE 1 Basic Concepts of Digital Image Processing.

Similar presentations


Presentation on theme: "M ATLAB L ECTURE 1 Basic Concepts of Digital Image Processing."— Presentation transcript:

1 M ATLAB L ECTURE 1 Basic Concepts of Digital Image Processing

2 I MAGE PROCESSING B ASIC C ONCEPT IP Basic Concepts In this lecture we will introduce some basic image processing concepts, including reading and showing image, performing some image enhancement operations on images, and getting information about an image. Step 1: Read and Display an Image Step 2: Check How the Image Appears in the Workspace Step 3: Image Sampling (Resizing Image) Step 4: Image Quantization (Gray Level Reduction) Step 5: Converting RGB image into grayscale intensity image.

3 S TEP 1: R EAD AND D ISPLAY AN I MAGE To Clear Matlab workspace, variables, and figure windows. >> close all To read an image, use the imread command. In the example below reads one of the sample images included with IPT, pout.tif, and stores it in an array named I. Example : >> I = imread('pout.tif'); To display the image, Use the imshow command >> imshow(I)

4 S TEP 2: C HECK H OW THE I MAGE A PPEARS IN THE W ORKSPACE The Workspace browser displays information about all the variables you create during a MATLAB session. The imread function returned the image data in the variable I, which is a 291- by-240 element array of uint8 data. MATLAB can store images as uint8, uint16, or double arrays. You can also get information about variables in the workspace by calling the whos command. >>whos Name Size Bytes Class I 291x240 69840 uint8 array

5 S TEP 3: I MAGE S AMPLING M ATLAB : IMRESIZE Resize an image To change the size of an image, use the imresize function. Using imresize, you can specify the size of the output image, specify the interpolation method used, and specify the filter to use to prevent aliasing. Resize Syntax: B = imresize(A,m) B = imresize(A,m,method) B = imresize(A,[mrows ncols],method) B = imresize(...,method,n) B = imresize(...,method,h)

6 D ESCRIPTION OF IMRESIZE B = imresize(A,m) returns an image B that is m times the size of A, using nearest-neighbor interpolation. B = imresize(A,m,method) returns an image that is m times the size of A using the interpolation method specified by method. B = imresize(A,[mrows ncols],method) returns an image of the size specified by [mrows ncols]. When the specified output size is smaller than the size of the input image, and method is 'bilinear' or 'bicubic', applies lowpass aliasing.

7 E XAMPLE : S AMPLING ( EXAMPLE OF RESIZE )

8 S TEP 4: I MAGE Q UANTIZATION (G RAY L EVEL R EDUCTION ) The quantization used to reduce the number of gray levels. Reducing the number of gray levels using the floor function. Floor function is used in the following sytax: X = floor(y/2)*2; It is used to reduce the gray levels in an image. You can divide many times according to the given gray level to see how the image is resulting from reducing the gray levels as in the following figure:

9 I MAGE Q UANTIZATION EXAMPLE

10 C ONVERTING I MAGE T YPES

11 S TEP 5: C ONVERTING RGB IMAGE INTO GRAYSCALE INTENSITY IMAGE. rgb2gray Converts RGB image to grayscale. Syntax I = rgb2gray(RGB) Description I = rgb2gray(RGB) converts the truecolor image RGB to the grayscale intensity image I.


Download ppt "M ATLAB L ECTURE 1 Basic Concepts of Digital Image Processing."

Similar presentations


Ads by Google