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
affine2d

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

bwdistThe 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.

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.

bwmorph

The text string 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.

bwpack

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

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(___).

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

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

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

conndef

Input arguments must be compile-time constants.

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.

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

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

fspecial

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

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

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

im2uint8

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

im2uint16

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

im2int16

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

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

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

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.

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

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

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.

imcomplement

Does not support int64 and uint64 data types.

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.

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.

imextendedmax

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

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

imextendedmin

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

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

imfill

The optional input connectivity, conn and the string '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.

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

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.

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.

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

imhmax

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

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

imhmin

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

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

imlincombThe output_class argument must be a compile-time constant.

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

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.

imquantize

imreconstruct

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

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

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.

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.

imregionalmax

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

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

imregionalmin

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

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

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.

imwarp

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

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

intlut

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

iptcheckconn

Input arguments must be compile-time constants.

iptcheckmap

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 string 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'.

mean2
medfilt2The padopt argument must be a compile-time constant.

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

multithresh
ordfilt2The padopt argument must be a compile-time constant.

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

padarray

Support only up to 3-D inputs.

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

projective2d

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

rgb2ycbcr
strelInput arguments must be compile-time constants. The following methods are not supported for code generation: getsequence, reflect, translate, disp, display, loadobj. When generating code, you can only specify single objects—arrays of objects are not supported.
stretchlim

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

ycbcr2rgb

More About

Was this topic helpful?