Constant value for System object constructor problem

3 views (last 30 days)
I'm trying to use the hough transform, local maxima and hough lines algorithms in the computer vision toolbox of MATLAB so as to be able to then generate C code from a MATLAB function. I'm essentially initializing the object multiple times through a for loop to apply hough algorithms on multiple segments of an image.
However in trying to generate code with codegen, I get this error message
'Cannot compute constant value for argument for this System object constructor. All arguments to the constructor of this System object must be constants for code generation...'
since I'm trying to use different input properties for different segments of an image. I've now put all these different values for each iteration into an array in the function encapsulating the Hough algorithms and tried to address a different row each time i call the function. It still doesn't work of course.
Is the issue here that a system object constructor cannot be called multiple times or that I must find a way of making my input parameters for the system object constructor constant. In the case of the latter, how do I go about doing it? I've read about coder.const but they seem to only take a function as an argument but I just merely need to select the corresponding row from a fixed array.
  2 Comments
Denis Gurchenkov
Denis Gurchenkov on 26 Sep 2014
Hi Jonathan, can you please post the example that you have? I think your problem can be resolved by using coder.unroll() on the loop and re-creating the object afresh inside each loop iteration. If you post the example, it'd be much easier for us suggest a fix.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!