Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

List of Supported Functions with Usage Notes

The following table lists the Image Processing Toolbox™ functions that have been enabled for code generation. You must have the MATLAB® Coder™ software installed to generate C code from MATLAB for these functions.

Image Processing Toolbox provides three types of code generation support:

  • Functions that generate C code.

  • Functions that generate C code that depends on a platform-specific shared library (.dll, .so, or .dylib). Use of a shared library preserves performance optimizations in these functions, but this limits the target platforms for which you can generate code. For more information, see Code Generation for Image Processing.

  • Functions that generate C code or C code that depends on a shared library, depending on which target platform you specify in MATLAB Coder. If you specify the generic MATLAB Host Computer target platform, these functions generate C code that depends on a shared library. If you specify any other target platform, these functions generate C code.

In generated code, each supported toolbox function has the same name, arguments, and functionality as its Image Processing Toolbox counterpart. However, some functions have limitations. The following table includes information about code generation limitations that might exist for each function. In the following table, all the functions generate C code. The table identifies those functions that generate C code that depends on a shared library, and those functions that can do both, depending on which target platform you choose.

FunctionRemarks/Limitations
adaptthresh

The ForegroundPolarity and Statistic arguments must be compile-time constants.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The NeighborhoodSize argument must be a compile-time constant.

affine2d

When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

boundarymask

The conn argument must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bwareaopen

BW must be a 2-D binary image. N-D arrays are not supported. conn can only be one of the two-dimensional connectivities (4 or 8) or a 3-by-3 matrix. The 3-D connectivities (6, 18, and 26) are not supported. Matrices of size 3-by-3-by-...-by-3 are not supported. conn must be a compile-time constant.

MATLAB Function Block support: No.

bwboundaries

The conn and options arguments must be compile-time constants and the return value A can only be a full matrix, not a sparse matrix.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

bwconncomp

The input image must be 2-D.

The conn argument must be a compile-time constant and the only connectivities supported are 4 or 8. You can specify connectivity as a 3-by-3 matrix, but it can only be [0 1 0;1 1 1;0 1 0] or ones(3).

The CC struct return value does not include the PixelIdxList field.

MATLAB Function Block support: No.

bwdist

The method argument must be a compile-time constant. Input images must have fewer than 232 pixels.

Generated code for this function uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bweuler

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bwlabel

When generating code, the parameter n must be a compile-time constant.

MATLAB Function Block support: No.

bwlookup

For best results, specify an input image of class logical.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bwmorph

The character vector specifying the operation must be a constant and, for best results, specify an input image of class logical.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

bwpack

Generated code for this function uses a precompiled platform-specific shared library.

MATLAB Function Block support: Yes.

bwperim

Supports only 2-D images. Does not support any no-output-argument syntaxes. The connectivity matrix input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bwselect

Supports only the 3 and 4 input argument syntaxes: BW2 = bwselect(BW,c,r) and BW2 = bwselect(BW,c,r,n). The optional fourth input argument, n, must be a compile-time constant. In addition, with code generation, bwselect only supports only the 1 and 2 output argument  syntaxes: BW2 = bwselect(___) or [BW2, idx] = bwselect(___).

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

bwtraceboundary

The dir, fstep, and conn arguments must be compile-time constants.

MATLAB Function Block support: No.

bwunpack

Generated code for this function uses a precompiled platform-specific shared library.

MATLAB Function Block support: Yes. The input argument M must be a compile-time constant.

conndef

Input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

demosaic

The sensorAlignment argument must be a compile-time constant.

MATLAB Function Block support: Yes.

edge

The method, direction, and sigma arguments must be a compile-time constants. In addition, nonprogrammatic syntaxes are not supported. For example, the syntax edge(im), where edge does not return a value but displays an image instead, is not supported.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input arguments thresh and sigma must be compile-time constants.

fitgeotrans

The transformtype argument must be a compile-time constant. The function supports the following transformation types: 'nonreflectivesimilarity', 'similarity', 'affine', or 'projective'.

MATLAB Function Block support: Yes.

fspecial

Inputs must be compile-time constants. Expressions or variables are allowed if their values do not change.

MATLAB Function Block support: Yes. The input arguments hsize, radius, len, and theta must be compile-time constants.

getrangefromclass

MATLAB Function Block support: Yes.

grayconnectedIf you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

histeq

All the syntaxes that include indexed images are not supported. This includes all syntaxes that accept map as input and return newmap.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument N must be a compile-time constant.

hough

The optional parameter names 'Theta' and 'RhoResolution' must be compile-time character vector constants. The optional Theta vector must have a bounded size.

MATLAB Function Block support: Yes. The input argument BW must be fixed size, the RhoResolution parameter must be a compile-time constant, and the Theta vector must have a bounded size.

houghlines

The optional parameter names 'FillGap' and 'MinLength' must be compile-time character vector constants. Their associated values need not be compile-time constants.

MATLAB Function Block support: No.

houghpeaks

The optional parameter names 'Threshold' and 'NHoodSize' must be compile-time character vector constants. Their associated values need not be compile-time constants.

MATLAB Function Block support: Yes.

im2int16

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

im2uint8

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

im2uint16If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

im2single

MATLAB Function Block support: Yes.

im2double

MATLAB Function Block support: Yes.

imabsdiff

MATLAB Function Block support: Yes.

imadjust

Does not support syntaxes that include indexed images. This includes all syntaxes that accept map as input and return newmap.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imbinarize

Character vector input arguments must be compile-time constants.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imbothat

The input image IM must be either 2-D or 3-D image. The structuring element input argument SE must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imboxfilt

MATLAB Function Block support: Yes.

imclearborder

The optional second input argument, conn, must be a compile-time constant. Supports only up to 3-D inputs.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imclose

The input image IM must be either 2-D or 3-D image. The structuring element input argument SE must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imcomplement

Does not support int64 and uint64 data types.

MATLAB Function Block support: Yes.

imcropThe interactive syntaxes, such as I2 = imcrop, are not supported. Indexed images are not supported, including the noninteractive syntax X2 = imcrop(X,map,rect);.

MATLAB Function Block support: Yes.

imdilate

The input image IM must be either 2-D or 3-D image. The SE, PACKOPT, and SHAPE input arguments must be a compile-time constant. The structuring element argument SE must be a single element—arrays of structuring elements are not supported. To obtain the same result as that obtained using an array of structuring elements, call the function sequentially.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imerode

The input image IM must be either 2-D or 3-D image. The SE, PACKOPT, and SHAPE input arguments must be a compile-time constant. The structuring element argument SE must be a single element—arrays of structuring elements are not supported. To obtain the same result as that obtained using an array of structuring elements, call the function sequentially.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imextendedmax

The optional third input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imextendedmin

The optional third input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imfill

The optional input connectivity, conn and the character vector 'holes' must be compile-time constants.

Supports only up to 3-D inputs.

The interactive mode to select points, imfill(BW,0,CONN) is not supported in code generation.

locations can be a P-by-1 vector, in which case it contains the linear indices of the starting locations. locations can also be a P-by-ndims(I) matrix, in which case each row contains the array indices of one of the starting locations. Once you select a format at compile-time, you cannot change it at run time. However, the number of points in locations can be varied at run time.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imfilter

The input image can be either 2-D or 3-D. The value of the input argument, options, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imfindcircles

All character vector input arguments and values must be compile-time constants.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

imgaborfilt

The wavelength, orientation, SpatialFrequencyBandwidth, and SpatialAspectRatio must be compile-time constants.

The filter bank syntax is not supported.

MATLAB Function Block support: Yes.

imgaussfilt

Character vector input arguments must be compile-time constants.

When FilterDomain is 'spatial', if you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imgradient3

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

imgradientxyz

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

imhist

The optional second input argument, n, must be a compile-time constant. In addition, nonprogrammatic syntaxes are not supported. For example, the syntaxes where imhist displays the histogram are not supported.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument N must be a compile-time constant.

imhmax

The optional third input argument, conn, must be a compile-time constant

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imhmin

The optional third input argument, conn, must be a compile-time constant

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imlincomb

The output_class argument must be a compile-time constant. You can specify up to four input image arguments.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

immse

MATLAB Function Block support: Yes.

imopen

The input image IM must be either 2-D or 3-D image. The structuring element input argument SE must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imoverlay

If you specify the 'color' argument as a character vector, it must be a compile-time constant.

MATLAB Function Block support: Yes.

impyramid

The direction argument must be a compile-time constant.

MATLAB Function Block support: Yes. The input argument direction must be a compile-time constant.

imquantize

MATLAB Function Block support: Yes.

imread

Supports reading of 8-bit JPEG images only. The file name input argument must be a valid absolute path or relative path.

This function generates code that uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The file name input argument must be a compile-time constant.

imreconstruct

The optional third input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imref2d

The XWorldLimits, YWorldLimits and ImageSize properties can be set only during object construction. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

imref3d

The XWorldLimits, YWorldLimits, ZWorldLimits and ImageSize properties can be set only during object construction. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

imregionalmax

The optional second input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imregionalmin

The optional second input argument, conn, must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imresize

Does not support indexed images or custom interpolation kernels. All parameter-value pair input arguments must be compile-time constants.

MATLAB Function Block support: Yes. The input arguments Scale and method must be compile-time constants, and the values of the OutputSize parameter, numrows and numcols, must be compile-time constants.

imrotate

The method and bbox input argument values must be compile-time constants.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument angle must be a compile-time constant.

imtophat

The input image IM must be either 2-D or 3-D image. The structuring element input argument SE must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

imtranslate

The supports only 2-D translation vectors. 3-D translations are not supported

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument translation must be a compile-time constant.

imwarp

The geometric transformation object input, tform, must be either affine2d or projective2d. Additionally, the interpolation method and optional parameter names must be character vector constants.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument tform must be a compile-time constant.

integralBoxFilter

The 'NormalizationFactor' parameter must be a compile-time constant.

MATLAB Function Block support: Yes. The input argument filtersize must be a compile-time constant.

intlut

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

iptcheckconn

Input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

iptcheckmap

MATLAB Function Block support: Yes.

lab2rgb

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

label2idx

MATLAB Function Block support: No.

label2rgb

Referring to the standard syntax:

RGB = label2rgb(L, map, zerocolor, order)
  • Submit at least two input arguments: the label matrix, L, and the colormap matrix, map.

  • map must be an n-by-3, double, colormap matrix. You cannot use a character vector containing the name of a MATLAB colormap function or a function handle of a colormap function.

  • If you set the boundary color zerocolor to the same color as one of the regions, label2rgb will not issue a warning.

  • If you supply a value for order, it must be 'noshuffle'.

MATLAB Function Block support: Yes.

mean2

MATLAB Function Block support: Yes.

medfilt2

The padopt argument must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The neighborhood size input argument must be a compile-time constant.

multithresh

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes. The input argument N must be compile-time constant.

offsetstrel

The 'ball' input argument and all other input arguments must be compile-time constants. None of the methods are supported for code generation. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

ordfilt2

The padopt argument must be a compile-time constant.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

otsuthresh

MATLAB Function Block support: Yes.

padarray

Support only up to 3-D inputs.

Input arguments, padval and direction are expected to be compile-time constants.

MATLAB Function Block support: Yes. The input argument padsize must be a compile-time constant.

projective2d

When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

psnr

MATLAB Function Block support: Yes.

regionprops

Supports only 2-D images. Does not support the table output type. Does not accept cell arrays as input—use a comma-separated list instead. Does not support the properties ConvexArea, ConvexHull, ConvexImage, Solidity, and SubarrayIdx.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

rgb2gray

MATLAB Function Block support: Yes.

rgb2lab

Character vector input arguments must be compile-time constants.

MATLAB Function Block support: Yes.

rgb2ycbcr

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

strel

All of the input arguments must be compile-time constants. None of the methods are supported for code generation. When generating code, you can only specify single objects—arrays of objects are not supported.

MATLAB Function Block support: Yes.

stretchlim

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

superpixels

Character vector input arguments must be compile-time constants. The value of 'IsInputLab' (true or false) must be a compile-time constant.

MATLAB Function Block support: No.

watershed

Supports only 2-D images. Supports only 4- or 8-connectivity. Supports only up to 65,535 regions. The output type is always uint16.

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: No.

ycbcr2rgb

If you choose the generic MATLAB Host Computer target platform, generated code uses a precompiled, platform-specific shared library.

MATLAB Function Block support: Yes.

More About

Was this topic helpful?