Usage notes and limitations:
imfilter
supports the generation of C
code (requires MATLAB®
Coder™). Note that if you choose the generic MATLAB Host Computer
target platform, imfilter
generates code that uses a precompiled,
platform-specific shared library. Use of a shared library preserves performance optimizations
but limits the target platforms for which code can be generated. For more information, see Code Generation Using a Shared Library.
When generating code, the input image, A
,
must be 2-D or 3-D. The value of the input argument, options
,
must be a compile-time constant.
If you specify a large kernel h
, a kernel that contains large
values, or specify an image containing large values, you can see different results
between MATLAB and generated code using codegen for floating point data types. This
happens because of accumulation errors due to different algorithm
implementations.
Usage notes and limitations:
When generating code, the input image, A
, must be 2-D or 3-D.
The value of the input argument, options
, must be a compile-time
constant.
If you specify a large kernel h
, a kernel that contains large
values, or specify an image containing large values, you can see different results
between MATLAB and generated code using codegen for floating point data types. This
happens because of accumulation errors due to different algorithm
implementations.
With CUDA® toolkit v9.0, a bug in the NVIDIA® optimization causes numerical mismatch between the results from the
generated code and MATLAB. As a workaround, turn off the optimization by passing the following
flags to the configuration object (cfg
) before generating the
code.
cfg.GpuConfig.CompilerFlags = ‘-Xptxas -O0’
NVIDIA is expected to fix this bug in CUDA toolkit v9.1.
Usage notes and limitations:
The filtering kernel h
must be a vector or 2-D matrix of data
type double
.
If the image is filtered using a GPU, then imfilter
computes the
value of each output pixel using either single- or double-precision floating point,
depending on the data type of A
. If A
contains
double-precision or uint32
values, then imfilter
uses double-precision values. For all other data types, imfilter
uses
single-precision. If A
is an integer or logical array, then
imfilter
truncates output elements that exceed the range of the
given type, and rounds fractional values.
For more information, see Image Processing on a GPU.