Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATLAB® Image Processing Toolbox

Similar presentations


Presentation on theme: "MATLAB® Image Processing Toolbox"— Presentation transcript:

1 MATLAB® Image Processing Toolbox
Rahman Tashakkori, Appalachian Sue Lea, UNCG "A Consortium to Promote Computational Science and High Performance Computing" Workshop – July 26-28, 2004

2 Image Processing Toolbox
The Image Processing Toolbox is a collection of functions that support a wide range of image processing operations, including: Spatial image transformations Morphological operations Neighborhood and block operations Linear filtering and filter design Transforms Image analysis and enhancement Image registration Deblurring Region of interest operations

3 Reading and displaying images
The MATLAB imread allows reading images in several different formats: I = imread(‘filename.ext'); Where the “.ext” refers to the extension for possible formats. Here is the list: bmp, cur, gif, hdf, ico, jpg, jpeg, pbm, pcx, pgm, png, pnm, ppm, ras, tif, tiff, and xwd To display an image we will use imshow(I) The imview function displays an image in a separate Java-based window called the Image Viewer, which provides access to additional tools that aid in navigating around an image, especially large images, and enable the inspection of pixels in an image. More information on supported formats:

4 Image Types The Image Processing Toolbox supports four basic types of images: Indexed images Intensity images Binary images RGB images Reading and Writing Image Data         Reading a Graphics Image         Writing a Graphics Image         Querying a Graphics File         Converting Image Storage Classes         Converting Graphics File Formats         Reading and Writing DICOM Files

5 Example: I = imread('pout.tif'); Imshow(I); Produces:

6 Reading and displaying images
You can also get information about variables in the workspace by calling the whos command. whos Name Size Bytes Class I 291x uint8 array Grand total is elements using bytes To write an image to a disk file, use the imwrite function. If you include the filename extension '.png', the imwrite function writes the image to a file in Portable Network Graphics (PNG) format, but you can specify other formats. imwrite (I2, 'pout2.png'); imwrite(A,filename,fmt) imwrite(X,map,filename,fmt) imwrite(...,filename) imwrite(...,Param1,Val1,Param2,Val2...)

7 Coordinate Systems         Pixel Coordinates         Spatial Coordinates

8 Storage Classes By default, MATLAB stores most data in arrays of class double. The data in these arrays is stored as double-precision (64-bit) floating-point numbers. All MATLAB functions work with these arrays. For image processing, however, this data representation is not always ideal. The number of pixels in an image can be very large; for example, a 1000-by-1000 image has a million pixels. Since each pixel is represented by at least one array element, this image would require about 8 megabytes of memory. To reduce memory requirements, MATLAB supports storing image data in arrays as 8-bit or 16-bit unsigned integers, class uint8 and uint16. These arrays require one eighth or one fourth as much memory as double arrays.

9 Histogram Equalization
As you can see, pout.tif is a somewhat low contrast image. To see the distribution of intensities in pout.tif, we can create a histogram by calling the imhist function imadjdemo

10 Create a Binary Version of the Image
Create a binary version of the image by using thresholding. The function graythresh automatically computes an appropriate threshold to use to convert the intensity image to binary. The im2bw function performs the conversion. level = graythresh(I); bw = im2bw(I,level); imshow(bw)

11 Determine the Number of Objects in the Image
After converting the image to a binary image, we can use the bwlabel function to determine the number of objects in the image. The bwlabel function labels all the components in the binary image bw and returns the number of components it finds in the image in the output value, numObjects. [labeled,numObjects] = bwlabel(bw,4); numObjects ans = 101 The accuracy of the results depends on a number of factors, including The size of the objects Whether or not any objects are touching (in which case they might be labeled as one object) The accuracy of the approximated background The connectivity selected. The parameter 4, passed to the bwlabel function, means that pixels must touch along an edge to be considered connected. In our case: [labeled,numObjects] = bwlabel(bw,4); produces 48

12 % Image Processing Toolbox --- demos and sample images
% dctdemo D DCT image compression demo. % edgedemo Edge detection demo. % firdemo D FIR filtering and filter design demo. % imadjdemo - Intensity adjustment and histogram equalization demo. % landsatdemo - Landsat color composite demo. % nrfiltdemo - Noise reduction filtering demo. % qtdemo Quadtree decomposition demo. % roidemo Region-of-interest processing demo. % Extended-examples. % ipexindex Index of extended examples. % ipexsegmicro Segmentation to detect microstructures. % ipexsegcell Segmentation to detect cells. % ipexsegwatershed - Watershed segmentation. % ipexgranulometry - Granulometry of stars. % ipexdeconvwnr - Wiener deblurring. % ipexdeconvreg - Regularized deblurring. % ipexdeconvlucy - Lucy-Richardson deblurring. % ipexdeconvblind - Blind deblurring. % ipextform Image transform gallery. % ipexshear Image padding and shearing. % ipexmri D MRI slices. % ipexconformal - Conformal mapping. % ipexnormxcorr2 - Normalized cross-correlation. % ipexrotate Rotation and scale recovery. % ipexregaerial - Aerial photo registration.

13 % Image Processing Toolbox --- demos and sample images
% Extended-example helper M-files. % ipex Used by image padding and shearing example. % ipex Used by image padding and shearing example. % ipex Used by MRI slicing example. % ipex Used by conformal mapping example. % ipex Used by conformal mapping example. % ipex Used by conformal mapping example.

14 Terminology Interpolation Interpolation Methods Image Types
Spatial Transformations     Terminology     Interpolation         Interpolation Methods         Image Types

15 Other Spatial Transformations
   Image Resizing         Specifying the Size of the Output Image         Specifying the Interpolation Method         Using Filters to Prevent Aliasing     Image Rotation         Specifying the Interpolation Method         Specifying the Size of the Output Image     Image Cropping     Performing General Spatial Transformations         Specifying the Transformation Type         Performing the Transformation         Advanced Spatial Transformation Techniques

16 Image Registration     Terminology     Registering an Image         Point Mapping         Example: Registering to a Digital Orthophoto     Types of Supported Transformations     Selecting Control Points         Using the Control Point Selection Tool         Starting the Control Point Selection Tool         Viewing the Images         Specifying Matching Control Point Pairs         Saving Control Points

17 Linear Filtering and Filter Design
   Terminology     Linear Filtering         Convolution         Correlation         Filtering Using imfilter         Using Predefined Filter Types     Filter Design         FIR Filters         Frequency Transformation Method         Frequency Sampling Method         Windowing Method         Creating the Desired Frequency Response Matrix         Computing the Frequency Response of a Filter

18 Transforms     Terminology     Fourier Transform         Definition of Fourier Transform         Discrete Fourier Transform         Applications of the Fourier Transform     Discrete Cosine Transform         The DCT Transform Matrix         DCT and Image Compression     Radon Transform         Plotting the Radon Transform         Viewing the Radon Transform as an Image         Using the Radon Transform to Detect Lines         Inverse Radon Transform         Example: Reconstructing an Image from Parallel Projection Data     Fan-Beam Projection Data         Computing Fan-Beam Projection Data         Reconstructing an Image from Fan-Beam Projection Data         Working with Fan-Beam Projection Data

19 Morphological Operations
   Terminology     Dilation and Erosion         Understanding Dilation and Erosion         Structuring Elements         Dilating an Image         Eroding an Image         Combining Dilation and Erosion         Dilation- and Erosion-Based Functions     Morphological Reconstruction         Marker and Mask         Pixel Connectivity         Flood-Fill Operations         Finding Peaks and Valleys     Distance Transform     Objects, Regions, and Feature Measurement         Connected-Component Labeling         Selecting Objects in a Binary Image         Finding the Area of the Foreground of a Binary Image         Finding the Euler Number of a Binary Image     Lookup Table Operations

20 Analyzing and Enhancing Images
    Terminology     Pixel Values and Statistics         Pixel Selection         Intensity Profile         Image Contours         Image Histogram         Summary Statistics         Region Property Measurement     Image Analysis         Edge Detection         Boundary Tracing         Quadtree Decomposition     Intensity Adjustment         Adjusting Intensity Values to a Specified Range         Histogram Equalization         Contrast-Limited Adaptive Histogram Equalization         Decorrelation Stretching     Noise Removal         Using Linear Filtering         Using Median Filtering         Using Adaptive Filtering

21 Region-Based Processing
    Terminology     Specifying a Region of Interest         Selecting a Polygon         Other Selection Methods     Filtering a Region         Example: Filtering a Region in an Image         Specifying the Filtering Operation     Filling a Region

22 Image Debluring     Terminology     Understanding Deblurring         Causes of Blurring         Deblurring Model     Using the Deblurring Functions         Deblurring with the Wiener Filter         Deblurring with a Regularized Filter         Deblurring with the Lucy-Richardson Algorithm         Deblurring with the Blind Deconvolution Algorithm         Creating Your Own Deblurring Functions     Avoiding Ringing in Deblurred Images

23 Color     Terminology     Working with Different Screen Bit Depths         Determining Screen Bit Depth         Choosing a Screen Bit Depth     Reducing the Number of Colors in an Image         Using rgb2ind         Reducing Colors in an Indexed Image         Dithering     Converting Color Data Between Color Spaces         Converting Between Device-Independent Color Spaces         Performing Profile-Based Conversions         Converting Between Device-Dependent Color Spaces

24 Wavelet Analysis – Wavelet Toolbox
Wavelet analysis has become very popular in image processing. The main idea is to break an image into sub-bands in different frequency and time domain. MATLAB provides an excellent toolbox for performing wavelet analysis on both one- and two-dimensional data. Demo:

25 .m files – Example Hotelling Transform
Allows us to create a .m file that contains all the commands we wish to run at once. Then by typing the file name, we can run those commands. Let’s look at one example. C:\course\ImgProcessing\hotelling


Download ppt "MATLAB® Image Processing Toolbox"

Similar presentations


Ads by Google