How can I get intrinsic parameters of virtual cameras in MATLAB views?

16 views (last 30 days)
I'm writing a simulated computer vision experiment, using virtual cameras to observe a scene instead of real ones.
I set up the camera that I'm interested in below:
campos([0,0,0]);
camtarget([1,0,0]);
camup([0,0,1]);
camproj('perspective');
camview(60);
For a "physical" camera, I'd use the Camera Calibrator app to get the focal length, intrinsics matrix, etc.
How can I do this for a virtual camera? I tried using the "patch" command to make virtual checkerboards in front of the camera and saving the figure windows as .png files. The Camera Calibrator app detected them fine but the intrinsics I got were completely inaccurate.
Thanks for your help!

Answers (1)

Aishwarya
Aishwarya on 14 Nov 2023
Hi,
As per my understanding you wish to know how to calibrate and get intrinsic parameters of a virtual camera created using the provided code.
After reviewing the code, I would like to point out that the functions used in this code like “camtarget”,camup”,camproj” are functions used to adjust the properties of an existing camera object in current MATLAB figure.
In order to create a virtual camera, I would suggest creating a camera object using “cameraParameters” function. For this function, you can define the required focal length, principal point (optical center of camera) and image size produced by the camera.
Below is an example implementation to create camera parameter object:
% Define camera parameters
focalLength = [1000, 1000]; % in pixels
principalPoint = [320, 240]; % in pixels
imageSize = [480, 640]; % in pixels
intrinsics = cameraIntrinsics(focalLength, principalPoint, imageSize);
% Create camera parameters object
params = cameraParameters('IntrinsicMatrix', intrinsics.IntrinsicMatrix);
I hope this helps!

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!