Unable to import camera parameters or intrinsics to Simulink simulation

조회 수: 7 (최근 30일)
Dylan
Dylan 2024년 5월 30일
답변: Milan Bansal 2024년 5월 30일
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'

답변 (1개)

Milan Bansal
Milan Bansal 2024년 5월 30일
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!

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by