Skip to content

registerCameras

Calibration and geometryfunctionOpenCV 5.0.0
import { registerCameras } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSobjectPoints1, objectPoints2, imagePoints1, imagePoints2
FUNCTIONregisterCameras
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calibrates a camera pair set up. This function finds the extrinsic parameters between the two cameras.

See: calibrateCamera, stereoCalibrate

registerCameras(objectPoints1: MatVector, objectPoints2: MatVector, imagePoints1: MatVector, imagePoints2: MatVector, cameraMatrix1: Mat, distCoeffs1: Mat, cameraModel1: number, cameraMatrix2: Mat, distCoeffs2: Mat, cameraModel2: number, R: Mat, T: Mat, E: Mat, F: Mat, perViewErrors: Mat, flags: number, criteria: TermCriteria): number;
3 available overloads
registerCameras(objectPoints1: MatVector, objectPoints2: MatVector, imagePoints1: MatVector, imagePoints2: MatVector, cameraMatrix1: Mat, distCoeffs1: Mat, cameraModel1: number, cameraMatrix2: Mat, distCoeffs2: Mat, cameraModel2: number, R: Mat, T: Mat, E: Mat, F: Mat, perViewErrors: Mat): number;
registerCameras(objectPoints1: MatVector, objectPoints2: MatVector, imagePoints1: MatVector, imagePoints2: MatVector, cameraMatrix1: Mat, distCoeffs1: Mat, cameraModel1: number, cameraMatrix2: Mat, distCoeffs2: Mat, cameraModel2: number, R: Mat, T: Mat, E: Mat, F: Mat, perViewErrors: Mat, flags: number): number;
registerCameras(objectPoints1: MatVector, objectPoints2: MatVector, imagePoints1: MatVector, imagePoints2: MatVector, cameraMatrix1: Mat, distCoeffs1: Mat, cameraModel1: number, cameraMatrix2: Mat, distCoeffs2: Mat, cameraModel2: number, R: Mat, T: Mat, E: Mat, F: Mat, perViewErrors: Mat, flags: number, criteria: TermCriteria): number;
objectPoints1

Vector of vectors of the calibration pattern points for camera 1. A similar structure as objectPoints in calibrateCamera and for each pattern view, both cameras do not need to see the same object points. objectPoints1.size(), imagePoints1.size() nees to be equal,as well as objectPoints1[i].size(), imagePoints1[i].size() need to be equal for each i.

objectPoints2

Vector of vectors of the calibration pattern points for camera 2. A similar structure as objectPoints1. objectPoints2.size(), and imagePoints2.size() nees to be equal, as well as objectPoints2[i].size(), imagePoints2[i].size() need to be equal for each i. However, objectPoints1[i].size() and objectPoints2[i].size() are not required to be equal.

imagePoints1

Vector of vectors of the projections of the calibration pattern points, observed by the first camera. The same structure as in calibrateCamera.

imagePoints2

Vector of vectors of the projections of the calibration pattern points, observed by the second camera. The same structure as in calibrateCamera.

cameraMatrix1

Input/output camera intrinsic matrix for the first camera, the same as in calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.

distCoeffs1

Input/output vector of distortion coefficients, the same as in calibrateCamera.

cameraModel1

Flag reflecting the type of model for camera 1 (pinhole / fisheye):

  • CALIB_MODEL_PINHOLE pinhole camera model
  • CALIB_MODEL_FISHEYE fisheye camera model
cameraMatrix2

Input/output second camera intrinsic matrix for the second camera. See description for cameraMatrix1.

distCoeffs2

Input/output lens distortion coefficients for the second camera. See description for distCoeffs1.

cameraModel2

Flag reflecting the type of model for camera 2 (pinhole / fisheye). See description for cameraModel1.

R

Input/output value, modified by the native operation. Output rotation matrix. Together with the translation vector T, this matrix brings points given in the first camera's coordinate system to points in the second camera's coordinate system. In more technical terms, the tuple of R and T performs a change of basis from the first camera's coordinate system to the second camera's coordinate system. Due to its duality, this tuple is equivalent to the position of the first camera with respect to the second camera coordinate system.

T

Input/output value, modified by the native operation. Output translation vector, see description above.

E

Output destination, filled by the native operation. Output essential matrix.

F

Output destination, filled by the native operation. Output fundamental matrix.

perViewErrors

Output destination, filled by the native operation. Output vector of the RMS re-projection error estimated for each pattern view.

flags

Different flags that may be zero or a combination of the following values:

  • CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
criteria

Termination criteria for the iterative optimization algorithm.

The function estimates the transformation between two cameras similar to stereo pair calibration. The principle follows closely to stereoCalibrate. To understand the problem of estimating the relative pose between a camera pair, please refer to the description there. The difference for this function is that, camera intrinsics are not optimized and two cameras are not required to have overlapping fields of view as long as they are observing the same calibration target and the absolute positions of each object point are known. The above illustration shows an example where such a case may become relevant. Additionally, it supports a camera pair with the mixed model (pinhole / fisheye). Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the points in all the available views from both cameras.

Returns

the final value of the re-projection error.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.