Common image processing functions

Source: Internet
Author: User

I. General functions:

 

 

 

 

 

Color Bar Display

 

 

 

Syntax: colorbar \ colorbar ('vert') \ colorbar ('horiz ') \ colorbar (h) \ h = colorbar (...) \ colorbar (..., 'peer ', axes_handle)

Getimage obtains image data from the coordinate axis

Syntax: A = getimage (h) \ [x, y, A] = getimage (h )\[..., a, flag] = getimage (h) \ [...] = getimage

Imshow display image

Syntax: imshow (I, n) \ imshow (I, [low high]) \ imshow (BW) \ imshow (X, map) \ imshow (RGB) \ imshow (..., display_option) \ imshow (x, y, ,...) \ imshow filename \ h = imshow (...)

Multiple images are displayed in the rectangle frame at the same time

Syntax: age (I) \ age (BW) \ age (X, map) \ age (RGB) \ h = age (...)

Create a multi-frame index graph movie animation using immovie

Syntax: mov = immovie (X, map) \ mov = immovie (RGB)

Subimage displays multiple images in one image

Syntax: subimage (X, map) \ subimage (I) \ subimage (BW) \ subimage (RGB) \ subimage (x, y ,...) \ subimage (...)

Truesize: adjust the image display size

Syntax: truesize (fig, [mrows mcols]) \ truesize (fig)

Warp displays the image on the texture ing surface

Syntax: warp (X, map) \ warp (I, n) \ warp (z ,...) warp (x, y, z ,...) \ h = warp (...)

Zoom image

Syntax: zoom on \ zoom off \ zoom out \ zoom reset \ zoom xon \ zoom yon \ zoom (factor) \ zoom (fig, option)

II. Image file I/O function commands

Imfinfo returns image file information

Syntax: info = imfinfo (filename, fmt) \ info = imfinfo (filename)

Imread reads (loads) images from image files

Syntax: A = imread (filename, fmt) \ [X, map] = imread (filename, fmt) \ [...] = imread (filename) \ [...] = imread (URL ,...) \ [...] = imread (..., idx) (CUR, ICO, and TIFF only) \ [...] = imread (..., 'frames ', idx) (GIF only) \ [...] = imread (..., ref) (HDF only) \ [...] = imread (..., 'backgroundcolor', BG) (PNG only) \ [A, map, alpha] = imread (...) (ICO, CUR, PNG only)

Imwrite writes (save) an image file

Syntax: imwrite (A, filename, fmt) \ imwrite (X, map, filename, fmt) \ imwrite (..., filename) \ imwite (..., param1, Val1, Param2, Val2 ...)

Imcdrop cut Image

Syntax: I2 = imcdrop (I) \ X2 = imcdrop (X, map) \ RGB2 = imcdrop (RGB) \ I2 = imcdrop (I, rect) \ X2 = imcdrop (RGB, rect) \ [...] = imcdrop (x, y ,...) \ [A, rect] = imcrop (...) \ [x, y, A, rect] = imcdrop (...)

Imresize changes Image size

Syntax: B = imresize (A, m, method)

Imrotate rotating image

Syntax: B = imrotate (A, angle, method) \ B = imrotate (A, angle, method, 'crop ')

3. Pixel and statistical processing functions

Corr2 calculates the two-dimensional correlation coefficient of two rectangles.

Syntax: r = corr2 (A, B)

Imcontour

Syntax: imcontour (I, n) \ imcontour (I, v) \ imcontour (x, y ,...) \ imcontour (..., lineSpec) \ [C, h] = imcontour (...)

Use imfeature to calculate the feature size of the image area

Syntax: stats = imfeature (L, measurements) \ stats = imfeature (L, measurements, n)

Imbist displays the column chart of image data

Impixel determines the pixel color value

Syntax: P = impixel (I) \ P = impixel (X, map) \ P = impixel (RGB) \ P = impixel (I, c, r) \ P = impixel (X, map, c, r) \ P = impixel (RGB, c, r) \ [c, r, P] = impixel (...) \ P = impixel (x, y, I, xi, yi) \ P = impixel (x, y, RGB, xi, yi) \ P = impixel (x, y, y, x, map, xi, yi )\

[Xi, yi, P] = impixel (x, y ,...)
Calculate the pixel value of the profile along the improfile line

Syntax: c = improfile \ c = improfile (n) \ c = improfile (I, xi, yi) \ c = improfile (I, xi, yi, n) \ [cx, cy, c] = improfile (...) \ [cx, cy, c, xi, yi] = improfile (...) \ [...] = improfile (x, y, I, xi, yi) \ [...] = improfile (x, y, I, xi, yi, n) \ [...] = improfile (..., method)

Mean2 calculates the average value of matrix elements

Syntax: B = mean2 ()

Pixval: displays the pixel information of an image.

Syntax: pixval on

Std2 calculates the standard offset of matrix elements

Syntax: B = std2 ()

IV. Image analysis functions:

Edge Image edge detection

Syntax: BW = edge (I, 'job') \ BW = edge (I, 'job', thresh) \ BW = edge (I, 'job', thresh, direction) \ [BW, thresh] = edge (I, 'sobel ',...) \ BW = edge (I, 'prewitht') \ BW = edge (I, 'prewitht', thresh) \ BW = edge (I, 'prewitht', thresh, direction )\

[BW, thresh] = edge (I, 'prewitt ',...) \ BW = edge (I, 'ots') \ BW = edge (I, 'ots', thresh) \ [BW, thresh] = edge (I, 'ots ',...) \ BW = edge (I, 'log') \ BW = edge (I, 'log', thresh) \ BW = edge (I, 'log', thresh, sigma) \ [BW, threshold] = edge (I, 'log ',...) \ BW = edge (I, 'zeroscross ', thresh, h) \ [BW, thresh] = edge (I, 'zeroscross ',...) \

BW = edge (I, 'hangzhou') \ BW = edge (I, 'hangzhou', thresh) \ BW = edge (I, 'hangzhou', thresh, sigma) \ [BW, threshold] = edge (I, 'ecoly ',...)

Qtgetblk gets the block value of the quad-tree decomposition.

Syntax: [vals, r, c] = qtgetblk (I, S, dim) \ [vals, idx] = qtgetblk (I, S, dim)

Qtsetblk

Syntax: J = qtsetblk (I, S, dim, vals)

V. Image enhancement functions

Enhanced Comparison of histeq histogram equalization

Syntax: J = histeq (I, hgram) \ J = histeq (I, n) \ [J, T] = histeq (I ,...) \ newmap = histeq (X, map, hgram) \ newmap = histeq (X, map)

Imadjust: adjust the gray scale or color image table of the image

Syntax: J = imadjust (I, [low_in, high_in]), [low_out, high_out], gamma) \ newmap = imadjust (map, [low_in, high_in]), [low_out, high_out], gamma) \ RGB2 = imadjust (RGB1 ,...)

Imnoise enhances image rendering

Syntax: J = imnoise (I, type) \ J = imnoise (I, type, parameters)

Medfilt2 performs two-dimensional median filtering

Syntax: B = medfilt2 (A, [m n]) \ B = medfilt2 (A) \ B = medfilt2 (A, 'indexed ',...)

Ordfilt2 performs two-dimensional statistical sequence filtering

Syntax: B = ordfilt2 (A, order, domain) \ B = ordfilt2 (A, order, domain, S) \ B = ordfilt2 (..., padopt)

Wiener2 for two-dimensional adaptive denoising filtering

Syntax: J = wiener2 (I, [m n], noise) \ [J, noise] = wiener2 (I, [m n])

VI. Linear filtering functions

Conv2 performs two-dimensional convolution

Syntax: C = conv2 (A, B) \ C = conv2 (hcol, hrow, A) \ C = conv2 (..., 'shape ')

Convmtx2 computing two-dimensional convolution matrix

Syntax: T = convmtx2 (H, m, n) \ T = convmtx2 (H, [m n])

Convn calculates n-dimensional convolution

Syntax: C = convn (A, B) \ C = convn (A, B, 'shape ')

Filter2 for two-dimensional linear filtering

Syntax: Y = filter2 (h, X) \ Y = filter2 (h, X, shape)

Fspecial create predefine filter

Syntax: h = fspecial (type) \ h = fspecial (type, parameters)

VII. Linear two-dimensional filtering design functions

Freqspace: determine the frequency space of two-dimensional frequency response

Syntax: [f1, f2] = freqspace (n) \ [f1, f2] = freqspace ([m n]) \ [x1, y1] = freqspace (..., 'meshgrid') \ f = freqspace (N, 'whole ')

Freqz2 calculates two-dimensional frequency response

Syntax: [H, f1, f2] = freqz2 (h, n1, n2) \ [H, fi, f2] = freqz2 (h, [n2, n1]) \ [H, fi, f2] = freqz2 (h, f1, f2]) \ [H, fi, f2] = freqz2 (h) \ [...] = freqz2 (h ,..., [dx dy]) \ [...] = freqz2 (h ,..., dx) \ freqz2 (...)

Design of two-dimensional FIR filter using frequency sampling method in fsamp2

Syntax: h = fsamp2 (Hd) \ h = fsamp2 (f1, f2, Hd, [m n])

Ftrans2 designs two-dimensional FIR filter based on frequency conversion

Syntax: h = ftrans2 (B, t) \ h = ftrans2 (B)

Design of two-dimensional FIR filter using one-dimensional window method in fwind1

Syntax: h = fwind1 (Hd, win) \ h = fwind1 (Hd, win1, win2) \ h = fwind1 (f1, f2, Hd ,...)

Design of two-dimensional FIR filter using two-dimensional window method in fwind2

Syntax: h = fwind2 (Hd, win) \ h = fwind2 (f1, f2, Hd, win)

8. Image transformation functions

Dct2 implements two-dimensional discrete cosine transformation (idct2 for inverse cosine transformation)

Syntax: B = dct2 (A) \ B = dct2 (A, m. n) \ B = dct2 (A, [m n])

Calculation of discrete cosine Fourier transformation using dctctx

Syntax: D = dctctx (n)

Fft2 performs two-dimensional fast Fourier transformation (ifft2 is used for inverse transformation)

Syntax: Y = fft2 (X) \ Y = fft2 (X, m, n)

Fftn performs n-dimensional fast Fourier transformation (ifftn for inverse transformation)

Syntax: Y = ffn (X) \ Y = fftn (X, siz)

The DC component of fftshift fast Fourier transformation is moved to the spectral center.

Syntax: Y = fftshift (X) \ Y = fftshift (X, dim)

Iradon for anti-Euclidean transformation

Syntax: I = iradon (P, theta) \ I = iradon (P, theta, interp, filter, d, n) \ [I, h] = iradon (...)

Phantom generates a phantom image of the head

Syntax: P = phantom (def, n) \ P = phantom (E, n) \ [P, E] = phantom (...)

Calculation of the euclidean transform using the Euclidean algorithm

Syntax: R = registers (I, theta) \ [R, xp] = records (...)

9. Edge and block processing functions

Bestblk determines the block size for block operations

Syntax: siz = bestblk ([m n], k) \ [mb, nb] = bestblk ([m n], k)

Blkproc implements Image Display block operations

Syntax: B = blkproc (A, [m n]), fun) \ B = blkproc (A, [m n], fun, P1, P2 ,...) \ B = blkproc (A, [m n], [mborder nborder], fun ,...)

Col2im re-organizes columns in the matrix into blocks.

Syntax: A = col2im (B, [m n], [mm nn], block_type) \ A = col2im (B, [m n], [mm nn])

Colfilt uses column-related functions for edge operations

Syntax: B = colfilt (A, [m n], block_type, fun) \ B = colfilt (A, [m n], block_type, fun, P1, p2 ,...) \ B = colfilt (A, [m n], [mblock nblock],...) \ B = colfilt (A, 'indexed ',...)

Im2col re-tune the image block as a column

Syntax: B = im2col (A, [m n], block_type) \ B = im2col (A, [m n]) \ B = im2col (, 'indexed ',...)

Edge operation by nlfilter

Syntax: B = nlfilter (A, [m n], fun) \ B = nlfilter (A, [m n], fun, P1, P2 ,...) \ B = nlfilter (A, 'indexed ',...)

10. Binary image operation functions

Use the lookup table in the binary image to perform row edge operations.

Syntax: A = applylut (BW, LUT)

Bwarea calculates the area of the binary image object

Syntax: total = bwarea (BW)

Bwe calculates the number of operating records of binary images.

Syntax: eul = bwe.pdf (BW)

Bwfill fills in the background color of the binary image

Syntax: BW2 = bwfill (BW1, c, r, n) \ BW2 = bwfill (BW1, n) \ [BW2, idx] = bwfill (...) \ BW2 = bwfill (x, y, BW1, xi, yi, n) \ [x, y, BW2, idx, xi, yi] = bwfill (...) \ [BW2, idx] = bwfill (BW1, 'holes ', n)

Bwlabel indicates the connected part of the binary image

Syntax: L = bwlabel (BW, n) \ [L, num] = bwlabel (BW, n)

Bwmorph extract the contour of binary images

Syntax: BW2 = bwmorph (BW1, operation) \ BW2 = bwmorph (BW1, operation, n)

Bwperim calculates the perimeter of an object in a binary image

Syntax: BW2 = bwperim (BW1) \ BW2 = bwperim (BW1, CONN)

Bwselect select an object in a binary image

Syntax: BW2 = bwselect (BW1, c, r, n) \ BW2 = bwselect (BW1, n) \ [BW2, idx] = bwselect (...) \ BW2 = bwselect (x, y, BW1, xi, yi, n) \ [x, y, BW2, idx, xi, yi] = bwselect (...)

Dilate to enlarge the binary image

Syntax: BW2 = dilate (BW1, SE) \ BW2 = dilate (BW1, SE, alg) \ BW2 = dilate (BW1, SE,..., n)

Erode weakens the boundaries of binary images

Syntax: BW2 = erode (BW1, SE) \ BW2 = erode (BW1, SE, alg) \ BW2 = erode (BW1, SE,..., n)

Makelut creates a lookup table for the applylut function.

Syntax: lut = makelut (fun, n) \ lut = makelut (fun, n, P1, P2 ,...)

11. Regional processing functions

Roicolor select the color area of interest

Syntax: BW = roicolor (A, low, high) \ BW = rocicolor (A, v)

Roabaqus performs smooth interpolation in any area of the image

Syntax: J = roabaqus (I, c, r) \ J = roabaqus (I, BW) \ [J, BW] = roabaqus (...) \ J = roabaqus (x, y, I, xi, yi) \ [x, y, J, BW, xi, yi] = roabaqus (...)

Roifilt2 filter sensitive areas

Syntax: J = roifilt2 (h, I, BW) \ J = roifilt2 (I, BW, fun) \ J = roifilt2 (I, BW, fun, P1, p2 ,...)

Roipoly selects a sensitive polygon area

Syntax: BW = roipoly (I, c, r) \ BW = roipoly (I) \ BW = roipoly (x, y, I, xi, yi) \ [BW, xi, yi] = roipoly (...) \ [x, y, BW, xi, yi] = roipoly (...)

12. Color image processing functions

Brighten increase or decrease the brightness of the color image table

Syntax: brighten (beta) \ brighten (h, beta) \ newmap = brighten (cmap, beta)

Cmpermute: adjust the color in the color image table

Syntax: [Y, newmap] = cmpermute (X, map) \ [Y, newmap] = cmpermute (X, map, index)

Cmunigue searches for specific colors and corresponding images in the color image table.

Syntax: [Y, newmap] = cmunigue (X, map) \ [Y, newmap] = cmunigue (RGB) \ [Y, newmap] = cmunique (I)

Imapprox performs approximate processing on indexed images

Syntax: [Y, newmap] = imapprox (X, map, n) \ [Y, newmap] = imapprox (X, map, tol) \ Y = imapprox (X, map, newmap) \ [...] = imapprox (..., dither_option)

Rgbplot division color image table

Syntax: rgbplot (cmap)

13. Color space conversion function

HSV 2rgb converted to RGB color space: M = HSV 2rgb (H)

Ntsc2rgb conversion NTSC value is RGB color space: rgbmap = ntsc2rgb (yiqmap) \ RGB = ntsc2rgb (YIQ)

Rgb2hsv converts RGB values to HSV color space: cmap = rgb2hsv (M)

The RGB value of rgb2ntsc is NTSC color space: yiqmap = rgb2ntsc (rgbmap) \ YIQ = rgb2ntsc (RGB)

Rgb2ycbcr converts RGB values to YCbCr color space: ycbcrmap = rgb2ycbcr (rgbmap) \ YCBCR = rgb2ycbcr (RGB)

Ycbcr2rgb convert YCbCr value to RGB color space: rgbmap = ycbcr2rgb (ycbcrmap) \ RGB = ycbcr2rgb (YCBCR)

IV. Image types and type conversion functions

Dither uses jitter to increase the appearance color resolution to convert the image

Syntax: X = dither (RGB, map) \ BW = dither (I)

Gray2ind converts grayscale images to indexed images

Syntax: [X, map] = gray2ind (I, n) \ [X, map] = gray2ind (BW, n)

Grayslice uses grayscale images as index images

Syntax: X = grayslice (I, n) \ X = grayslice (I, v)

Convert im2bw image to binary image

Syntax: BW = im2bw (I, level) \ BW = im2bw (X, map, level) \ BW = im2bw (RGB, level)

Im2double conversion Image matrix is double precision type

Syntax: I2 = im2double (I1) \ RGB2 = im2double (RGB1) \ I = im2double (BW) \ X2 = im2double (X1, 'indexed ')

Convert double to double

Syntax: double (X)

Unit8 and unit16 convert data to 8-bit and 16-bit unsigned integer: I = unit8 (x) \ I = unit16 (x)

Im2unit8 converts an image array to an 8-bit unsigned integer

Syntax: I2 = im2unit8 (I1) \ RGB2 = im2unit8 (RGB1) \ I = im2unit8 (BW) \ X2 = im2unit8 (X1, 'indexed ')

Im2unit16 converts the image array to a 16-bit unsigned integer

Syntax: I2 = im2unit16 (I1) \ RGB2 = im2unit16 (RGB1) \ I = im2unit16 (BW) \ X2 = im2unit16 (X1, 'indexed ')

Ind2gray converts the retrieved image to a grayscale image

Syntax: I = ind2gray (X, map)

Ind2rgb convert index image to RGB true color image

Syntax: RGB = ind2rgb (X, map)

Isbw determines whether the image is a binary image

Syntax: flag = isbw ()

Isgray determines whether a gray image is used

Syntax: flag = isgray ()

Isind determines whether the image is indexed

Syntax: flag = isind ()

Isrgb determines if it is an RGB true color image

Syntax: flag = isrgb ()

The mat2gray conversion matrix is a grayscale image.

Syntax: I = mat2gray (A, [amin amax]) \ I = mat2gray ()

Rgb2gray converts RGB images or color image tables to grayscale images

Syntax: I = rgb2gray (RGB) \ newmap = rgb2gray (map)

Rgb2ind converts RGB images to indexed images

Syntax: [X, map] = rgb2ind (RGB, tol) \ [X, map] = rgb2ind (RGB, n) \ X = rgb2ind (RGB, map) \ [...] = rgb2ind (..., dither_option)

15. Added the image processing toolbox function.

Adapthisteq restricted contrast histogram equalization: J = adapthisteq (I) \ J = adapthisteq (I, param1, val1, param2, val2 ...)

Applycform is used for color space transformation out = applyform (I, C)

Bwboundaries depicts binary image boundaries

Syntax: B = bwboundaries (BW) \ B = bwboundaries (BW, CONN) \ B = bwboundaries (BW, CONN, options) [BW, CONN, options] \ [BL] = bwboundaries (...) \ [BLNA] = bwboundaries ()

Bwtraceboundary describes objects in binary images

B = bwtraceboundary (BW, P, fstep) \ B = bwtraceboundary (BW, P, fstep, CONN) \ B = bwtraceboundary (... N, dir)

Demo-strech de-correlation processing for multi-channel images

Syntax: S = demo-stretch (I) \ S = demo-stretch (I, TOL)

Dicomdict: obtain or read DICOM files

Syntax: dicomdict ('set', dictionary) \ dictionary = dicomdict ('get ')

Getline select ployline with the mouse

 

Syntax: [x, y] = getline (fig) \ [x, y] = getline (ax) \ [x, y] = getline \ [x, y] = getline (..., 'closed ')

 

Getpts selects the pixel with the mouse

Syntax: [x, y] = getpts (fig) \ [x, y] = getpts (ax) \ [x, y] = getpts

Getrect select the matrix with the mouse

Syntax: rect = getrect (fig) \ rect = getrect (ax) \ rect = getrect (fig)

Iccread read ICC profile

Syntax: P = iccread (filename)

Im2java2d converts an image into a Java buffer image

Syntax: jimage = im2java2d (I) \ jimage = im2java2d (X, MAP)

Imview displays images in the image and blue flag

Syntax: imview (I) \ imview (RGB) \ imview (X, map) \ imview (I, range) \ imview (filename) \ imview (.... 'initialmagnification', initial_mag) \ h = imview (...) \ imview close all

Ippl check IPPL

Syntax: TF = ippl \ [tf B] = ippl

Index image in iptdemos Display Image Processing Toolbox

Lab2double, lab2unit16, and lab2unit8 convert L * a * B data into dual-precision, 16-bit data, and 8-bit data respectively.

Makecform creates a color conversion structure

Poly2mask converts a polygon area to a mask area.

Syntax: BW = poly2mask (x, y, m, n)

Unitlut

Syntax: B = unitlut (A, LUT)

Xyz2double and xyz2unit16 convert color data from XYZ to dual precision and hexadecimal.

 

 

 

 

 

 

 

 

Syntax: xyzd = xyz2double (XYZ) \ xyz16 = xyz2unit16 (xyz)

Common image processing functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.