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 Center および File ExchangeMATLAB 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