In order to test my algorithms I’ve developed in matlab / blender a set of functions that allows me to generate 3D multicam sequence fully calibrated (where all camera parameters are exactly known).
The main idea of this is to check the accuracy of different parts of FVV algorithm. For example I can check the precision of pose recovery block because I know exactly the extrinsics matrix of the camera. Or I can check the likeness of FVV interpolated image because I can generate that real image using blender.
The sequence to generate a ground truth sequence is:
1- Calculate the camera positions given the camera setup (sphere or cylinder set up) using one of these matlab functions (see figure 1 and figure 2):
[Twoc] = GetCameraPosFromSphereSetup(vPi,dr, nN, nM, dThetaL, dThetaR, dPhiT, dPhiD)
[Twoc] = GetCameraPosFromCylinderSetup(vPi,dr, nN, nM, dThetaL, dThetaR, dPhiT, dPhiD)
Camera setup input parameters are:
- vPi = Point of interest. Is the point where all cameras have to look at.
- dr = Distance from Pi to the optical center of the cameras (radius of the sphere)
- nN = Number of cameras per row
- nM = Number of cameras per Col
- dthetaL = Delimitation left angle in horizontal plane
- dthetaR = Delimitation right angle in horizontal plane
- dPhiT = Delimitation top angle in vertical plane
- dPhiD = Delimitation top angle in vertical plane
The output parameters are:
- Twoc = Camera position vector respect world axis [X Y Z] (row per cam)
2- Calculate the camera transformation matrix using this matlab function:
[Rw2oc] = GetCameraRFromLookAt(Twoc, Pi, Up, nCamOriginZFw)
- Twoc= Camera position vector respect world axis [X Y Z] (row per cam)
- Pi = Point of interest, the central point of camera view [X Y Z]
- Up = Camera UP vector [X Y Z] ([0 0 1] -> Up is +Z axis)
- optional nCamOriginZFw = Indicates where the original camera is pointing. Allowed values: 1 = +Z, -1 = -Z (Default = -1)
- Rw2oc: Camera rotation matrices [3x3xnum of cams]
3- Generate a Collada format file that define the camera setup with this matlab function:
Input parameters are:
- strFileName: File name (including path) of the Collada file (.dae)
- Rw2oc = Rotation matrix [mat 3x3xnCams]
- Twoc = Translation vector (camera position) [X Y Z] [mat nCamsx3] (row based)
- I : Camera information matrix. One camera per row.
- Optional strUnits = Specify the magnitude of Longitude units in collada file. The allowed values are: ‘Centimeter’, ‘Meter’, ‘Milimeter’. (Default: ‘Centimeter’)
- Optional strAxisUP = Specify what is the UP axis in collada file. The allowed values are: ‘Z’, ‘Y’, ‘X’. (Default: ‘Z’)
4- Using the following matlab function, From Twoc and RW2oc matrices and camera parameters we can calculate the projection matrices (P) of each camera:
[P Kin Kext] = GetCameraP(Rw2oc, Twoc, dCamXFOV, dDAR, nCamPixelsX, nCamPixelsY, dSkewAngle, nCamOriginZFw, nImInv)
Input parameters are:
Camera position data:
- Rw2oc = Rotation matrix [mat 3x3xnCams] (row based)
- Twoc = Camera translation vector respect world axis (camera position) [X Y Z] [mat nCamsx3] (row based)
- dCamXFOV= X Field of view of the camera ) [degree]
- dDAR = Display aspect ratio (Most common: 4/3, 16/9)
- nCamPixelsX = CCD pixels per row
- nCamPixelsY = CCD pixels per col
- dSkewAngle = Angle between CCD rows and cols [degree]
- nCamOriginZFw = Indicates where the original camera is pointing. Allowed values: 1 = +Z, -1 = -Z
- nImInv = Indicates if the camera gives the inverted image. Allowed values: 0 = Non inverted, 1 = Inverted
- P = Camera projection matrix [mat 4×3xnCams]
- Kin = Calibration intrinsics matrix [mat 3x3xnCams]
- Kext = Calibration extrinsics matrix [mat 4x4xnCams]
5- Load Collada generated file in blender (append with existing 3D composition) and generate the M*N (num of cams) video sequences (see figure 3 and figure 4)
6- And now we have a fully calibrated 3D scene. We know exactly the camera positions, and using projection matrices (P) we can calculate the correspondence pixel of each point of the 3D scene over each camera.
We can use this to check how exactly are our Free View Video (FVV) algorithms, for example:
- Generate a 3 cameras fully calibrate 3D scene.
- Send to our FVV algorithm the images from camera 1 and camera 3 and generate the virtual image of camera 2 position.
- Use any likeness comparing method to check the similarity between the real camera 2 image, and the virtual camera 2 image (FVV).