Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
Ryan Livingston
Ryan Livingston el 9 de Ag. de 2014
Editada: Ryan Livingston el 9 de Ag. de 2014
Hi Christopher,
I tried this snippet in the pre-release and couldn't see the error either. Is it possible that some of the code after the posted snippet is having an effect?
Could you please run:
coder -tocode < name >.prj -script build_imfilter.m
where < name > is the name of your project and post build_imfilter.m? That will help us reproduce more easily.
Vignesh
Vignesh el 11 de Ag. de 2014
If you are still having trouble, consider contacting MathWorks technical support http://www.mathworks.com/support/contact_us/

Iniciar sesión para comentar.

Respuestas (2)

Anand
Anand el 6 de Ag. de 2014
Could you say which release and platform you are working with? I'm not able to see this.

Image Analyst
Image Analyst el 11 de Ag. de 2014
Perhaps try conv2() instead of imfilter().

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by