Skip to content

Camera position

David Cardinal edited this page Jan 28, 2022 · 29 revisions

Relevant tutorials

Overview of Manipulating the Camera

Reading in a lens, adjusting the focal length, pointing the camera, and moving the camera are basic manipulations that are illustrated in these tutorial scripts.

Each camera has a position ('from') and looks at a position ('to'). Further, there is a direction that points up ('up'). These three parameters are stored in the lookAt slot of the recipe.

Camera position and direction

To adjust the position of the camera or the direction that it is looking towards, we vary the lookAt variable. This type of code can be used to create a stereo pair.

%%  Make an image with a camera positioned adjacent to the original
% This is the original
lookAt = thisR.get('lookAt');

% We reset the camera position using the 'from' variable
thisR.set('from',lookAt.from + [1 0 0]);

Camera motion

t_cameraMotion. The camera can be assigned a translation or rotation during the simulated 'exposure' opening. This script shows how to set up the camera translation and rotation parameters.

The three ISETCam camera motion scenes, without the labels, that will appear in the sceneWindow are:

Example: Stereo

You can adjust the camera position. This code fragment illustrates how to generate a stereo pair.

thisR = piRecipeDefault('scene name','SimpleScene');

% Low resolution rendering poarameters
thisR.set('film resolution',[200 150]);
thisR.set('rays per pixel',64);
thisR.set('fov',45);
thisR.set('nbounces',5);

% Let's put in a camera lens
lensname = 'dgauss.22deg.12.5mm.json';
c = piCameraCreate('omni','lens file',lensname);
thisR.set('camera',c);
thisR.set('fov',35);

%% Look at the blue stick figure
blueStick = thisR.get('asset','figure_3m_B','world position');
to   = thisR.set('to',blueStick);

oi = piWRS(thisR);
oiWindow(oi);
oiSet(oi,'render flag','hdr');

% Move the camera to the left
thisR = piCameraTranslate(thisR, 'xshift',0.2,'fromto','both');
oi = piWRS(thisR);
oiWindow(oi);

Camera lens

Clone this wiki locally