Unable to import camera parameters or intrinsics to Simulink simulation

3 views (last 30 days)
Hi, I have a CameraParameters struct in my workspace, but I am unable to import it into Simulink to use with AprilTag identification and similar. I have tried using the constant block, or the "From Workspace" block but neither is able to compile if I set the value to CameraParams, or CameraParams.Intrinsics (CameraParams is just the variable I have defined). Any help would be hugely appreciated.
Thank you!
The error using a From Workspace block is this:
Unsupported input format for From Workspace block 'SimulinkEnv/From Workspace'. Input data must use a supported format such as timeseries or timetable and must not contain Inf or NaN values.
The error using a constant is this:
  • Invalid setting in 'SimulinkEnv/Constant3' for parameter 'Value'

Answers (1)

Milan Bansal
Milan Bansal on 30 May 2024
Hi Dylan
To import the CameraParameters structure into Simulink, you need to use a format that Simulink supports. The From Workspace block typically requires data to be in formats such as timeseries, timetable, or a numeric array, and it cannot handle complex structures directly. The Constant block also expects numeric data types or arrays.
Here’s how you can work around this limitation and import the necessary parameters into Simulink:
  • Extract Relevant Parameters: Extract the necessary numeric values from the CameraParameters struct.
  • Create Numeric Variables: Create separate variables for each parameter you need to use for AprilTag identification in Simulink.
focalLength = CameraParams.FocalLength;
principalPoint = CameraParams.PrincipalPoint;
radialDistortion = CameraParams.RadialDistortion;
tangentialDistortion = CameraParams.TangentialDistortion;
  • Use Multiple Blocks: Use multiple Constant blocks with the extracted numeric variables.
Please refer to the following documentation link to learn more about From Workspace block in Simulink.
Hope this helps!

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!