"Non-constant or empty expression" error when generating code using imfilter

3 ビュー (過去 30 日間)
Christopher McNally
Christopher McNally 2014 年 8 月 6 日
回答済み: Image Analyst 2014 年 8 月 11 日
I'm trying to generate code from a function that uses imfilter like this:
function [output] = some_function(A)
%A is image data read in with imread
conv_kern = 15;
H = fspecial('disk', conv_kern);
A_filtered = imfilter(A, H, 'replicate');
...
When the function runs through Coder it generates this error:
??? Non-constant expression or empty matrix. This expression must be constant because its value determines the size or class of some expression.
Error in ==> padarray Line: 213 Column: 34
The Coder settings have A defined as a specific size and data type, and I thought the other arguments (H and 'replicate') would be considered constant, so I'm confused where the error is coming from.
  2 件のコメント
Vignesh
Vignesh 2014 年 8 月 11 日
If you are still having trouble, consider contacting MathWorks technical support http://www.mathworks.com/support/contact_us/

サインインしてコメントする。

回答 (2 件)

Anand
Anand 2014 年 8 月 6 日
Could you say which release and platform you are working with? I'm not able to see this.
  1 件のコメント
Christopher McNally
Christopher McNally 2014 年 8 月 6 日
I'm running the 2014b pre-release candidate on Linux.

サインインしてコメントする。


Image Analyst
Image Analyst 2014 年 8 月 11 日
Perhaps try conv2() instead of imfilter().

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by