C# Класс Emgu.CV.CameraCalibration

Camera calibration functions
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CalibrateCamera ( MCvPoint3D32f objectPoints, PointF imagePoints, Size imageSize, Emgu.CV.IntrinsicCameraParameters intrinsicParam, CvEnum flags, Emgu.CV.ExtrinsicCameraParameters &extrinsicParams ) : double

Estimates intrinsic camera parameters and extrinsic parameters for each of the views

DrawChessboardCorners ( Byte>.Image image, Size patternSize, PointF corners ) : void

Draws the individual chessboard corners detected (as red circles) in case if the board was not found (patternWasFound== false) or the colored corners connected with lines when the board was found (patternWasFound == true).

EstimateRigidTransform ( PointF src, PointF dest, bool fullAffine ) : RotationMatrix2D

Estimate rigid transformation between 2 point sets.

FindChessboardCorners ( Byte>.Image image, Size patternSize, CvEnum flags ) : System.Drawing.PointF[]

Attempts to determine whether the input image is a view of the chessboard pattern and locate internal chessboard corners

FindExtrinsicCameraParams2 ( MCvPoint3D32f objectPoints, PointF imagePoints, Emgu.CV.IntrinsicCameraParameters intrin ) : Emgu.CV.ExtrinsicCameraParameters

Estimates extrinsic camera parameters using known intrinsic parameters and extrinsic parameters for each view. The coordinates of 3D object points and their correspondent 2D projections must be specified. This function also minimizes back-projection error.

FindHomography ( Matrix srcPoints, Matrix dstPoints, CvEnum method, double ransacReprojThreshold ) : HomographyMatrix

Use the specific method to find perspective transformation H=||h_ij|| between the source and the destination planes

FindHomography ( PointF srcPoints, PointF dstPoints, CvEnum method, double ransacReprojThreshold ) : HomographyMatrix

Finds perspective transformation H=||h_ij|| between the source and the destination planes

GetAffineTransform ( PointF src, PointF dest ) : RotationMatrix2D

Calculates the matrix of an affine transform such that: (x'_i,y'_i)^T=map_matrix (x_i,y_i,1)^T where dst(i)=(x'_i,y'_i), src(i)=(x_i,y_i), i=0..2.

GetPerspectiveTransform ( PointF src, PointF dest ) : HomographyMatrix

calculates matrix of perspective transform such that: (t_i x'_i,t_i y'_i,t_i)^T=map_matrix (x_i,y_i,1)^T where dst(i)=(x'_i,y'_i), src(i)=(x_i,y_i), i=0..3.

ProjectPoints ( MCvPoint3D32f objectPoints, Emgu.CV.ExtrinsicCameraParameters extrin, Emgu.CV.IntrinsicCameraParameters intrin ) : System.Drawing.PointF[]

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 as functions of all the input parameters w.r.t. the particular parameters, intrinsic and/or extrinsic. The jacobians are used during the global optimization in cvCalibrateCamera2 and cvFindExtrinsicCameraParams2. The function itself is also used to compute back-projection error for with current intrinsic and extrinsic parameters.

Note, that with intrinsic and/or extrinsic parameters set to special values, the function can be used to compute just extrinsic transformation or just intrinsic transformation (i.e. distortion of a sparse set of points)

StereoCalibrate ( MCvPoint3D32f objectPoints, PointF imagePoints1, PointF imagePoints2, Emgu.CV.IntrinsicCameraParameters intrinsicParam1, Emgu.CV.IntrinsicCameraParameters intrinsicParam2, Size imageSize, CvEnum flags, MCvTermCriteria termCrit, Emgu.CV.ExtrinsicCameraParameters &extrinsicParams, Matrix &foundamentalMatrix, Matrix &essentialMatrix ) : void

Estimates transformation between the 2 cameras making a stereo pair. If we have a stereo camera, where the relative position and orientatation of the 2 cameras is fixed, and if we computed poses of an object relative to the fist camera and to the second camera, (R1, T1) and (R2, T2), respectively (that can be done with cvFindExtrinsicCameraParams2), obviously, those poses will relate to each other, i.e. given (R1, T1) it should be possible to compute (R2, T2) - we only need to know the position and orientation of the 2nd camera relative to the 1st camera. That's what the described function does. It computes (R, T) such that: R2=R*R1, T2=R*T1 + T

Приватные методы

Метод Описание
ToMatrix ( MCvPoint3D32f data ) : Matrix
ToMatrix ( PointF data ) : Matrix

Описание методов

CalibrateCamera() публичный статический Метод

Estimates intrinsic camera parameters and extrinsic parameters for each of the views
public static CalibrateCamera ( MCvPoint3D32f objectPoints, PointF imagePoints, Size imageSize, Emgu.CV.IntrinsicCameraParameters intrinsicParam, CvEnum flags, Emgu.CV.ExtrinsicCameraParameters &extrinsicParams ) : double
objectPoints MCvPoint3D32f The 3D location of the object points. The first index is the index of image, second index is the index of the point
imagePoints System.Drawing.PointF The 2D image location of the points. The first index is the index of the image, second index is the index of the point
imageSize System.Drawing.Size The size of the image, used only to initialize intrinsic camera matrix
intrinsicParam Emgu.CV.IntrinsicCameraParameters The intrisinc parameters, might contains some initial values. The values will be modified by this function.
flags CvEnum Flags
extrinsicParams Emgu.CV.ExtrinsicCameraParameters The output array of extrinsic parameters.
Результат double

DrawChessboardCorners() публичный статический Метод

Draws the individual chessboard corners detected (as red circles) in case if the board was not found (patternWasFound== false) or the colored corners connected with lines when the board was found (patternWasFound == true).
public static DrawChessboardCorners ( Byte>.Image image, Size patternSize, PointF corners ) : void
image Byte>.Image The destination image
patternSize System.Drawing.Size The number of inner corners per chessboard row and column
corners System.Drawing.PointF The array of corners detected. Can be null if no corners were found
Результат void

EstimateRigidTransform() публичный статический Метод

Estimate rigid transformation between 2 point sets.
public static EstimateRigidTransform ( PointF src, PointF dest, bool fullAffine ) : RotationMatrix2D
src System.Drawing.PointF The points from the source image
dest System.Drawing.PointF The corresponding points from the destination image
fullAffine bool Indicates if full affine should be performed
Результат RotationMatrix2D

FindChessboardCorners() публичный статический Метод

Attempts to determine whether the input image is a view of the chessboard pattern and locate internal chessboard corners
public static FindChessboardCorners ( Byte>.Image image, Size patternSize, CvEnum flags ) : System.Drawing.PointF[]
image Byte>.Image Source chessboard view
patternSize System.Drawing.Size The number of inner corners per chessboard row and column
flags CvEnum Various operation flags
Результат System.Drawing.PointF[]

FindExtrinsicCameraParams2() публичный статический Метод

Estimates extrinsic camera parameters using known intrinsic parameters and extrinsic parameters for each view. The coordinates of 3D object points and their correspondent 2D projections must be specified. This function also minimizes back-projection error.
public static FindExtrinsicCameraParams2 ( MCvPoint3D32f objectPoints, PointF imagePoints, Emgu.CV.IntrinsicCameraParameters intrin ) : Emgu.CV.ExtrinsicCameraParameters
objectPoints MCvPoint3D32f The array of object points
imagePoints System.Drawing.PointF The array of corresponding image points
intrin Emgu.CV.IntrinsicCameraParameters The intrinsic parameters
Результат Emgu.CV.ExtrinsicCameraParameters

FindHomography() публичный статический Метод

Use the specific method to find perspective transformation H=||h_ij|| between the source and the destination planes
public static FindHomography ( Matrix srcPoints, Matrix dstPoints, CvEnum method, double ransacReprojThreshold ) : HomographyMatrix
srcPoints Matrix Point coordinates in the original plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates), where N is the number of points
dstPoints Matrix Point coordinates in the destination plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates)
method CvEnum FindHomography method
ransacReprojThreshold double The maximum allowed reprojection error to treat a point pair as an inlier. The parameter is only used in RANSAC-based homography estimation. E.g. if dst_points coordinates are measured in pixels with pixel-accurate precision, it makes sense to set this parameter somewhere in the range ~1..3
Результат HomographyMatrix

FindHomography() публичный статический Метод

Finds perspective transformation H=||h_ij|| between the source and the destination planes
public static FindHomography ( PointF srcPoints, PointF dstPoints, CvEnum method, double ransacReprojThreshold ) : HomographyMatrix
srcPoints System.Drawing.PointF Point coordinates in the original plane
dstPoints System.Drawing.PointF Point coordinates in the destination plane
method CvEnum FindHomography method
ransacReprojThreshold double /// The maximum allowed reprojection error to treat a point pair as an inlier. /// The parameter is only used in RANSAC-based homography estimation. /// E.g. if dst_points coordinates are measured in pixels with pixel-accurate precision, it makes sense to set this parameter somewhere in the range ~1..3 ///
Результат HomographyMatrix

GetAffineTransform() публичный статический Метод

Calculates the matrix of an affine transform such that: (x'_i,y'_i)^T=map_matrix (x_i,y_i,1)^T where dst(i)=(x'_i,y'_i), src(i)=(x_i,y_i), i=0..2.
public static GetAffineTransform ( PointF src, PointF dest ) : RotationMatrix2D
src System.Drawing.PointF Coordinates of 3 triangle vertices in the source image. If the array contains more than 3 points, only the first 3 will be used
dest System.Drawing.PointF Coordinates of the 3 corresponding triangle vertices in the destination image. If the array contains more than 3 points, only the first 3 will be used
Результат RotationMatrix2D

GetPerspectiveTransform() публичный статический Метод

calculates matrix of perspective transform such that: (t_i x'_i,t_i y'_i,t_i)^T=map_matrix (x_i,y_i,1)^T where dst(i)=(x'_i,y'_i), src(i)=(x_i,y_i), i=0..3.
public static GetPerspectiveTransform ( PointF src, PointF dest ) : HomographyMatrix
src System.Drawing.PointF Coordinates of 4 quadrangle vertices in the source image
dest System.Drawing.PointF Coordinates of the 4 corresponding quadrangle vertices in the destination image
Результат HomographyMatrix

ProjectPoints() публичный статический Метод

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 as functions of all the input parameters w.r.t. the particular parameters, intrinsic and/or extrinsic. The jacobians are used during the global optimization in cvCalibrateCamera2 and cvFindExtrinsicCameraParams2. The function itself is also used to compute back-projection error for with current intrinsic and extrinsic parameters.
Note, that with intrinsic and/or extrinsic parameters set to special values, the function can be used to compute just extrinsic transformation or just intrinsic transformation (i.e. distortion of a sparse set of points)
public static ProjectPoints ( MCvPoint3D32f objectPoints, Emgu.CV.ExtrinsicCameraParameters extrin, Emgu.CV.IntrinsicCameraParameters intrin ) : System.Drawing.PointF[]
objectPoints MCvPoint3D32f The array of object points.
extrin Emgu.CV.ExtrinsicCameraParameters Extrinsic parameters
intrin Emgu.CV.IntrinsicCameraParameters Intrinsic parameters
Результат System.Drawing.PointF[]

StereoCalibrate() публичный статический Метод

Estimates transformation between the 2 cameras making a stereo pair. If we have a stereo camera, where the relative position and orientatation of the 2 cameras is fixed, and if we computed poses of an object relative to the fist camera and to the second camera, (R1, T1) and (R2, T2), respectively (that can be done with cvFindExtrinsicCameraParams2), obviously, those poses will relate to each other, i.e. given (R1, T1) it should be possible to compute (R2, T2) - we only need to know the position and orientation of the 2nd camera relative to the 1st camera. That's what the described function does. It computes (R, T) such that: R2=R*R1, T2=R*T1 + T
public static StereoCalibrate ( MCvPoint3D32f objectPoints, PointF imagePoints1, PointF imagePoints2, Emgu.CV.IntrinsicCameraParameters intrinsicParam1, Emgu.CV.IntrinsicCameraParameters intrinsicParam2, Size imageSize, CvEnum flags, MCvTermCriteria termCrit, Emgu.CV.ExtrinsicCameraParameters &extrinsicParams, Matrix &foundamentalMatrix, Matrix &essentialMatrix ) : void
objectPoints MCvPoint3D32f The 3D location of the object points. The first index is the index of image, second index is the index of the point
imagePoints1 System.Drawing.PointF The 2D image location of the points for camera 1. The first index is the index of the image, second index is the index of the point
imagePoints2 System.Drawing.PointF The 2D image location of the points for camera 2. The first index is the index of the image, second index is the index of the point
intrinsicParam1 Emgu.CV.IntrinsicCameraParameters The intrisinc parameters for camera 1, might contains some initial values. The values will be modified by this function.
intrinsicParam2 Emgu.CV.IntrinsicCameraParameters The intrisinc parameters for camera 2, might contains some initial values. The values will be modified by this function.
imageSize System.Drawing.Size Size of the image, used only to initialize intrinsic camera matrix
flags CvEnum Different flags
termCrit Emgu.CV.Structure.MCvTermCriteria Termination criteria for the iterative optimiziation algorithm
extrinsicParams Emgu.CV.ExtrinsicCameraParameters The extrinsic parameters which contains: /// R - The rotation matrix between the 1st and the 2nd cameras' coordinate systems; /// T - The translation vector between the cameras' coordinate systems.
foundamentalMatrix Matrix The fundamental matrix
essentialMatrix Matrix The essential matrix
Результат void