Unable to import camera parameters or intrinsics to Simulink simulation

3 Ansichten (letzte 30 Tage)
Dylan
Dylan am 30 Mai 2024
Beantwortet: Milan Bansal am 30 Mai 2024
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'

Antworten (1)

Milan Bansal
Milan Bansal am 30 Mai 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!

Kategorien

Mehr zu MATLAB Support Package for USB Webcams finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by