Table of Contents

Class Fisheye

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

Fisheye Camera model

public static class Fisheye
Inheritance
Fisheye
Inherited Members

Methods

Calibrate(IInputArray, IInputArray, Size, IInputOutputArray, IInputOutputArray, IOutputArray, IOutputArray, CalibrationFlag, MCvTermCriteria)

Performs camera calibration.

public static double Calibrate(IInputArray objectPoints, IInputArray imagePoints, Size imageSize, IInputOutputArray K, IInputOutputArray D, IOutputArray rvecs, IOutputArray tvecs, Fisheye.CalibrationFlag flags, MCvTermCriteria criteria)

Parameters

objectPoints IInputArray

vector of vectors of calibration pattern points in the calibration pattern coordinate space.

imagePoints IInputArray

vector of vectors of the projections of calibration pattern points. imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to objectPoints[i].size() for each i.

imageSize Size

Size of the image used only to initialize the intrinsic camera matrix.

K IInputOutputArray

Output 3x3 floating-point camera matrix. If UseIntrisicGuess is specified, some or all of fx, fy, cx, cy must be initialized before calling the function.

D IInputOutputArray

Output vector of distortion coefficients (k1,k2,k3,k4).

rvecs IOutputArray

Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. M -1).

tvecs IOutputArray

Output vector of translation vectors estimated for each pattern view.

flags Fisheye.CalibrationFlag

Different flags

criteria MCvTermCriteria

Termination criteria for the iterative optimization algorithm.

Returns

double

The calibration error

DistortPoints(IInputArray, IOutputArray, IInputArray, IInputArray, double)

Distorts 2D points using fisheye model.

public static void DistortPoints(IInputArray undistored, IOutputArray distorted, IInputArray K, IInputArray D, double alpha = 0)

Parameters

undistored IInputArray

Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is the number of points in the view.

distorted IOutputArray

Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

alpha double

The skew coefficient.

EstimateNewCameraMatrixForUndistortRectify(IInputArray, IInputArray, Size, IInputArray, IOutputArray, double, Size, double)

Estimates new camera matrix for undistortion or rectification.

public static void EstimateNewCameraMatrixForUndistortRectify(IInputArray K, IInputArray D, Size imageSize, IInputArray R, IOutputArray P, double balance = 0, Size newSize = default, double fovScale = 1)

Parameters

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

imageSize Size

Size of the image

R IInputArray

Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel

P IOutputArray

New camera matrix (3x3) or new projection matrix (3x4)

balance double

Sets the new focal length in range between the min focal length and the max focal length. Balance is in range of [0, 1]

newSize Size

the new size

fovScale double

Divisor for new focal length.

InitUndistortRectifyMap(IInputArray, IInputArray, IInputArray, IInputArray, Size, DepthType, int, IOutputArray, IOutputArray)

Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero distortion is used, if R or P is empty identity matrixes are used.

public static void InitUndistortRectifyMap(IInputArray K, IInputArray D, IInputArray R, IInputArray P, Size size, DepthType depthType, int channels, IOutputArray map1, IOutputArray map2)

Parameters

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

R IInputArray

Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel

P IInputArray

New camera matrix (3x3) or new projection matrix (3x4)

size Size

Undistorted image size.

depthType DepthType

Depth type of the first output map. (The combination with channels can be one of CV_32FC1 or CV_16SC2)

channels int

Number of channels of the first output map. (The combination with depthType can be one of CV_32FC1 or CV_16SC2)

map1 IOutputArray

The first output map.

map2 IOutputArray

The second output map.

ProjectPoints(IInputArray, IOutputArray, IInputArray, IInputArray, IInputArray, IInputArray, double, IOutputArray)

Projects points using fisheye model. The function computes projections of 3D points to the image plane given intrinsic and extrinsic camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of image points coordinates (as functions of all the input parameters) with respect to the particular parameters, intrinsic and/or extrinsic.

public static void ProjectPoints(IInputArray objectPoints, IOutputArray imagePoints, IInputArray rvec, IInputArray tvec, IInputArray K, IInputArray D, double alpha = 0, IOutputArray jacobian = null)

Parameters

objectPoints IInputArray

Array of object points, 1xN/Nx1 3-channel (or vector<Point3f> ), where N is the number of points in the view.

imagePoints IOutputArray

Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or vector<Point2f>.

rvec IInputArray

rotation vector

tvec IInputArray

translation vector

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

alpha double

The skew coefficient.

jacobian IOutputArray

Optional output 2Nx15 jacobian matrix of derivatives of image points with respect to components of the focal lengths, coordinates of the principal point, distortion coefficients, rotation vector, translation vector, and the skew. In the old interface different components of the jacobian are returned via different output parameters.

StereoCalibrate(IInputArray, IInputArray, IInputArray, IInputOutputArray, IInputOutputArray, IInputOutputArray, IInputOutputArray, Size, IOutputArray, IOutputArray, CalibrationFlag, MCvTermCriteria)

Performs stereo calibration.

public static double StereoCalibrate(IInputArray objectPoints, IInputArray imagePoints1, IInputArray imagePoints2, IInputOutputArray K1, IInputOutputArray D1, IInputOutputArray K2, IInputOutputArray D2, Size imageSize, IOutputArray R, IOutputArray T, Fisheye.CalibrationFlag flags, MCvTermCriteria criteria)

Parameters

objectPoints IInputArray

Vector of vectors of the calibration pattern points.

imagePoints1 IInputArray

Vector of vectors of the projections of the calibration pattern points, observed by the first camera.

imagePoints2 IInputArray

Vector of vectors of the projections of the calibration pattern points, observed by the second camera.

K1 IInputOutputArray

Input/output first camera matrix.If FixIntrinsic is specified, some or all of the matrix components must be initialized.

D1 IInputOutputArray

Input/output vector of distortion coefficients (k1,k2,k3,k4) of 4 elements.

K2 IInputOutputArray

Input/output second camera matrix. The parameter is similar to K1

D2 IInputOutputArray

Input/output lens distortion coefficients for the second camera. The parameter is similar to D1

imageSize Size

Size of the image used only to initialize intrinsic camera matrix.

R IOutputArray

Output rotation matrix between the 1st and the 2nd camera coordinate systems.

T IOutputArray

Output translation vector between the coordinate systems of the cameras.

flags Fisheye.CalibrationFlag

Fish eye calibration flags

criteria MCvTermCriteria

Termination criteria for the iterative optimization algorithm.

Returns

double

The calibration error

StereoRectify(IInputArray, IInputArray, IInputArray, IInputArray, Size, IInputArray, IInputArray, IOutputArray, IOutputArray, IOutputArray, IOutputArray, IOutputArray, int, Size, double, double)

Stereo rectification for fisheye camera model.

public static void StereoRectify(IInputArray K1, IInputArray D1, IInputArray K2, IInputArray D2, Size imageSize, IInputArray R, IInputArray tvec, IOutputArray R1, IOutputArray R2, IOutputArray P1, IOutputArray P2, IOutputArray Q, int flags, Size newImageSize = default, double balance = 0, double fovScale = 1)

Parameters

K1 IInputArray

First camera matrix.

D1 IInputArray

First camera distortion parameters.

K2 IInputArray

Second camera matrix.

D2 IInputArray

Second camera distortion parameters.

imageSize Size

Size of the image used for stereo calibration.

R IInputArray

Rotation matrix between the coordinate systems of the first and the second cameras.

tvec IInputArray

Translation vector between coordinate systems of the cameras.

R1 IOutputArray

Output 3x3 rectification transform (rotation matrix) for the first camera.

R2 IOutputArray

Output 3x3 rectification transform (rotation matrix) for the second camera.

P1 IOutputArray

Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.

P2 IOutputArray

Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.

Q IOutputArray

Output 4×4 disparity-to-depth mapping matrix (see reprojectImageTo3D ).

flags int

Operation flags that may be zero or ZeroDisparity . If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the useful image area.

newImageSize Size

New image resolution after rectification. The same size should be passed to initUndistortRectifyMap. When (0,0) is passed (default), it is set to the original imageSize . Setting it to larger value can help you preserve details in the original image, especially when there is a big radial distortion.

balance double

Sets the new focal length in range between the min focal length and the max focal length. Balance is in range of [0, 1].

fovScale double

Divisor for new focal length.

UndistortImage(IInputArray, IOutputArray, IInputArray, IInputArray, IInputArray, Size)

Transforms an image to compensate for fisheye lens distortion. The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap (with bilinear interpolation).

public static void UndistortImage(IInputArray distorted, IOutputArray undistored, IInputArray K, IInputArray D, IInputArray Knew = null, Size newSize = default)

Parameters

distorted IInputArray

Image with fisheye lens distortion.

undistored IOutputArray

Output image with compensated fisheye lens distortion.

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

Knew IInputArray

Camera matrix of the distorted image. By default, it is the identity matrix but you may additionally scale and shift the result by using a different matrix.

newSize Size

The function transforms an image to compensate radial and tangential lens distortion.

UndistortPoints(IInputArray, IOutputArray, IInputArray, IInputArray, IInputArray, IInputArray)

Transforms an image to compensate for fisheye lens distortion.

public static void UndistortPoints(IInputArray distorted, IOutputArray undistorted, IInputArray K, IInputArray D, IInputArray R = null, IInputArray P = null)

Parameters

distorted IInputArray

Array of object points, 1xN/Nx1 2-channel (or vector<Point2f> ), where N is the number of points in the view.

undistorted IOutputArray

Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f>.

K IInputArray

Camera matrix

D IInputArray

Input vector of distortion coefficients (k1,k2,k3,k4).

R IInputArray

Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel

P IInputArray

New camera matrix (3x3) or new projection matrix (3x4)