Matlab Image Processing
Matlab Image Processing
This series of images illustrates the use of the multidimensional watershed transform to segment or separate touching three-dimensional objects. From left to right: simulated image of two
touching spherical objects; several isosurfaces of the multidimensional Euclidean distance transform; different colors highlight the segmentation of the touching objects.
colorbar Display colorbar imcrop Crop image histeq Enhance contrast using his-
immovie Make movie from imresize Resize image togram equalization
multiframe image imrotate Rotate image imadjust Adjust image intensity values
imshow Display image imtransformApply spatial transformation or colormap
montage Display multiple image to image imnoise Add noise to an image
frames as rectangular tformarray Apply spatial transformation medfilt2 Perform 2-D median filtering
montage to multidimensional array ordfilt2 Perform 2-D order-statistic
movie Play recorded movie frames filtering
subimage Display multiple images in Image Registration stretchlim Find limits to contrast stretch
single figure an image
For selecting control points and aligning
warp Display image as texture- wiener2 Perform 2-D adaptive noise-
mapped surface two images. removal filtering
cp2tform Infer geometric transforma-
Image File I/O tion from control point pairs Linear Filtering
For loading, saving, and retrieving informa- cpcorr Tune control point locations For applying arbitrary as well as predefined
tion about images. (Supported file formats using cross-correlation filters to images and multidimensional
include: AVI, BMP, CDF, DICOM, FITS, HDF, cpselect Control point selection tool datasets.
HDF-EOS, JPEG, PCX, PNG, TIFF, XWD) normxcorr2 Normalized two-dimensional
cross-correlation fspecial Create predefined filters
dicominfo Read metadata from a imfilter Filter 2-D and multidimen-
DICOM message Pixel Values and Statistics sional images
dicomread Read a DICOM image For extracting grayscale statistics and other
imfinfo Return information about information about pixel values in images.
Linear 2-D Filter Design
image file For designing 2-D FIR filters to meet given
imread Read image file corr2 Compute 2-D correlation frequency-domain specifications.
imwrite Write image file coefficient
imcontour Create contour plot of freqspace Determine 2-D frequency
Image Arithmetic image data response spacing
For performing integer and floating-point imhist Display histogram of freqz2 Compute 2-D frequency
image data response
arithmetic operations on images.
improfile Compute pixel-value cross- fsamp2 Design 2-D FIR filter using
imabsdiff Compute absolute difference sections along line segments frequency sampling
of two images regionprops Measure properties of ftrans2 Design 2-D FIR filter using
imadd Add two images, or add image regions frequency transformation
constant to image fwind1 Design 2-D FIR filter using
imcomplement Image Analysis 1-D window method
Complement image For analyzing images to extract information fwind2 Design 2-D FIR filter using
imdivide Divide two images, or 2-D window method
about their structure.
divide image by constant
imlincomb Compute linear edge Find edges in intensity image Image Deblurring
combination of images qtdecomp Perform quadtree decomposi- For deblurring images using different
immultiply Multiply two images, or tion algorithms.
multiply image by constant qtgetblk Get block values in quadtree
imsubtract Subtract two images, or sub- decomposition deconvlucy Deblur image using
tract constant from image qtsetblk Set block values in quadtree Lucy-Richardson method
decomposition deconvreg Deblur image using a
regularized filter
deconvwnr Deblur image using
Wiener method
Note: The Signal Processing Toolbox is recommended for 2-D FIR continued
filter design to generate the inputs (1-D windows and 1-D filter proto-
types) to the 2-D FIR design functions.
Original image of rice grains with Extraction of nonuniform background Result of subtraction of Histogram plot of resultant image
nonuniform background intensity intensity using morphological opening nonuniformity from original with automatic thresholding
A typical interactive session using MATLAB and the Image Processing Toolbox to perform connected components analysis — also known as blob analysis — on an image with nonuniform
background intensity. Note that it took only nine functions to perform the analysis.
Sample Functions continued idct2 2-D inverse discrete cosine imdilate Dilate image
transform imerode Erode image
edgetaper Taper edges using point- ifft2 2-D inverse fast Fourier imextendedmax
spread function transform Extended-maxima transform
otf2psf Convert optical transfer func- ifftn Multidimensional inverse imextendedmin
tion to point-spread function fast Fourier transform Extended-minima transform
psf2otf Convert point-spread function iradon Compute inverse Radon imfill Fill image regions and holes
to optical transfer function transform imhmax H-maxima transform
radon Compute Radon transform imhmin H-minima transform
Image Transforms imimposemin Impose minima
Morphological Operations imopen Open image
For alternative mathematical representations
of images for advanced analysis. For extracting information about shapes imreconstruct
from grayscale and binary images. Morphological reconstruction
dct2 2-D discrete cosine transform imregionalmax
dctmtx Discrete cosine transform conndef Default connectivity Regional maxima
matrix imbothat Perform bottom-hat filtering imregionalmin
fft2 2-D fast Fourier transform imclearborder Regional minima
fftn multidimensional fast Fourier Suppress light structures imtophat Perform tophat filtering
transform connected to image border watershed Watershed transform
imclose Close image
continued
Sample Functions continued Colormap Manipulation im2mis Convert image to Java
MemoryImageSource
For manipulating colormaps and approxi- ind2rgb Convert indexed image
Morphological Operations (binary images) mating indexed images with fewer colors to RGB image
For extracting information about shapes or with alternate colormaps. rgb2gray Convert RGB image or
from binary images. colormap to grayscale
brighten Brighten or darken colormap rgb2ind Convert RGB image to
applylut Perform neighborhood oper- cmpermute Rearrange colors in colormap indexed image
ations using lookup tables cmunique Find unique colormap colors
bwarea Compute area of objects in and corresponding image Documentation and Examples
binary image colormap Set or get color lookup table The Image Processing Toolbox User’s Guide
bwareaopen Binary area open (remove imapprox Approximate indexed image
describes toolbox functionality in a tutorial
small objects) by one with fewer colors
and reference format. It includes many
bwdist Compute distance transform
of binary image Color Space Conversions examples that take you step-by-step through
bweuler Compute Euler number of the solution of an image processing problem
For converting images from one color space
binary image in MATLAB. In addition, GUI-driven
to another.
bwhitmiss Binary hit-miss operation demonstrations introduce major features
bwlabel Label connected components hsv2rgb Convert HSV values to RGB of the product in an easy-to-use format. ■
in 2-D binary image color space
bwlabeln Label connected components ntsc2rgb Convert NTSC values to
in multidimensional binary RGB color space
image rgb2hsv Convert RGB values to HSV
bwmorph Perform morphological color space
operations on binary image rgb2ntsc Convert RGB values
bwpack Pack binary image to NTSC color space
bwperim Determine perimeter of rgb2ycbcr Convert RGB values
objects in binary image to YCBCR color space
bwselect Select objects in binary ycbcr2rgb Convert YCBCR values
image For demos, application examples,
to RGB color space tutorials, user stories, and pricing:
bwulterode Ultimate erosion
• Visit www.mathworks.com
bwunpack Unpack binary image Image Types and Type Conversions
makelut Construct lookup table for • Contact The MathWorks directly
use with applylut For converting images from one type US & Canada 508-647-7000
to another. Benelux +31 (0)182 53 76 44
Region-based Processing France +33 (0)1 41 14 67 14
dither Convert image using Germany +49 (0)89 995901 0
For performing image processing and dithering Spain +34 93 362 13 00
analysis operations on arbitrary regions gray2ind Convert intensity image Switzerland +41 (0)31 954 20 20
to indexed image UK +44 (0)1223 423 200
of images.
grayslice Create indexed image Visit www.mathworks.com to obtain
roicolor Select region of interest, from intensity image contact information for authorized
MathWorks representatives in countries
based on color by thresholding
throughout Asia Pacific, Latin America,
roifill Smoothly interpolate graythresh Compute global image the Middle East, Africa, and the rest
within arbitrary region threshold using Otsu’s of Europe.
roifilt2 Filter a region of interest method
roipoly Select polygonal region im2bw Convert image to binary
of interest image by thresholding
ind2gray Convert indexed image
to intensity image
© 2001 by The MathWorks, Inc. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders.