NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Namespaces | Functions
mitkCameraCalibrationFacade.h File Reference
Include dependency graph for mitkCameraCalibrationFacade.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mitk
 

Functions

void mitk::LoadImages (const std::vector< std::string > &files, std::vector< IplImage * > &images, std::vector< std::string > &fileNames)
 Uses OpenCV to load images. More...
 
void mitk::LoadImagesFromDirectory (const std::string &fullDirectoryName, std::vector< IplImage * > &images, std::vector< std::string > &fileNames)
 Scans a directory for all filenames, and uses OpenCV to load images. More...
 
bool mitk::CheckAndAppendPairOfFileNames (const std::string &leftFileName, const std::string &rightFileName, const int &numberCornersX, const int &numberCornersY, const double &sizeSquareMillimeters, const mitk::Point2D &pixelScaleFactor, std::vector< std::string > &successfulLeftFiles, std::vector< std::string > &successfulRightFiles)
 Utility method to check and load stereo pairs of chessboards. More...
 
void mitk::CheckConstImageSize (const std::vector< IplImage * > &images, int &width, int &height)
 Iterates through the list of images, checking that the width and height are consistent. More...
 
void mitk::ExtractChessBoardPoints (const std::vector< IplImage * > &images, const std::vector< std::string > &fileNames, const int &numberCornersWidth, const int &numberCornersHeight, const bool &drawCorners, const double &squareSizeInMillimetres, const mitk::Point2D &pixelScaleFactor, std::vector< IplImage * > &outputImages, std::vector< std::string > &outputFileNames, CvMat *&outputImagePoints, CvMat *&outputObjectPoints, CvMat *&outputPointCounts)
 Extracts the chess board points, using OpenCV routines. More...
 
bool mitk::ExtractChessBoardPoints (const cv::Mat &image, const int &numberCornersWidth, const int &numberCornersHeight, const bool &drawCorners, const double &squareSizeInMillimetres, const mitk::Point2D &pixelScaleFactor, std::vector< cv::Point2d > &outputImagePoints, std::vector< cv::Point3d > &outputObjectPoints)
 Extracts the chess board points, using OpenCV routines. More...
 
double mitk::CalibrateSingleCameraParameters (const CvMat &objectPoints, const CvMat &imagePoints, const CvMat &pointCounts, const CvSize &imageSize, CvMat &outputIntrinsicMatrix, CvMat &outputDistortionCoefficients, CvMat *outputRotationVectors, CvMat *outputTranslationVectors, const int &flags=0)
 Calibrate a single camera's intrinsic parameters, by directly calling cvCalibrationCamera2. More...
 
double mitk::CalibrateSingleCameraUsingMultiplePasses (const CvMat &objectPoints, const CvMat &imagePoints, const CvMat &pointCounts, const CvSize &imageSize, CvMat &outputIntrinsicMatrix, CvMat &outputDistortionCoefficients, CvMat &outputRotationVectors, CvMat &outputTranslationVectors)
 Calibrate a single camera's intrinsic parameters by using 3 passes, firstly with fixed principal point and fixed aspect ratio, then with fixed principal point, then with nothing fixed. More...
 
void mitk::CalibrateSingleCameraExtrinsics (const CvMat &objectPoints, const CvMat &imagePoints, const CvMat &pointCounts, const CvMat &intrinsicMatrix, const CvMat &distortionCoefficients, const bool &useExtrinsicGuess, CvMat &outputRotationVectors, CvMat &outputTranslationVectors)
 Calculates JUST the extrinsic parameters for a whole bunch of calibrations. More...
 
void mitk::ExtractExtrinsicMatrixFromRotationAndTranslationVectors (const CvMat &rotationVectors, const CvMat &translationVectors, const int &viewNumber, CvMat &outputExtrinsicMatrix)
 The above method CalibrateSingleCameraParameters outputs a whole load of rotation and translation vectors, so this utility method reconstructs a single extrinsic parameter matrix, for a given viewNumber. More...
 
void mitk::ComputeRightToLeftTransformations (const CvMat &rotationVectorsLeft, const CvMat &translationVectorsLeft, const CvMat &rotationVectorsRight, const CvMat &translationVectorsRight, CvMat &rotationVectorsRightToLeft, CvMat &translationVectorsRightToLeft)
 Method to take a set of rotation and translation vectors for left and right cameras, and compute transformations from right to left. More...
 
void mitk::ProjectAllPoints (const int &numberSuccessfulViews, const int &pointCount, const CvMat &objectPoints, const CvMat &intrinsicMatrix, const CvMat &distortionCoeffictions, const CvMat &rotationVectors, const CvMat &translationVectors, CvMat &outputImagePoints)
 Bulk method to project all points for all calibrations back to 2D, useful for validating calibration. More...
 
double mitk::CalculateRPE (const CvMat &projectedPoints, const CvMat &goldStandardPoints)
 Calculates the RMS projection error. More...
 
double mitk::CalibrateStereoCameraParameters (const CvMat &objectPointsLeft, const CvMat &imagePointsLeft, const CvMat &pointCountsLeft, const CvSize &imageSize, const CvMat &objectPointsRight, const CvMat &imagePointsRight, const CvMat &pointCountsRight, CvMat &outputIntrinsicMatrixLeft, CvMat &outputDistortionCoefficientsLeft, CvMat &outputRotationVectorsLeft, CvMat &outputTranslationVectorsLeft, CvMat &outputIntrinsicMatrixRight, CvMat &outputDistortionCoefficientsRight, CvMat &outputRotationVectorsRight, CvMat &outputTranslationVectorsRight, CvMat &outputRightToLeftRotation, CvMat &outputRightToLeftTranslation, CvMat &outputEssentialMatrix, CvMat &outputFundamentalMatrix, const bool &fixedIntrinsics=false, const bool &fixedRightToLeft=false)
 Performs a stereo calibration, including all intrinsic, extrinsic, distortion co-efficients, and also outputs the rotation and translation vector between the two cameras. Now we also have an option to fix the intrinsics, and an option to fix the right to left calculation. More...
 
std::vector< double > mitk::OutputCalibrationData (std::ostream &outputStream, const std::string &outputDirectoryName, const std::string &intrinsicFlatFileName, const CvMat &objectPoints, const CvMat &imagePoints, const CvMat &pointCounts, const CvMat &intrinsicMatrix, const CvMat &distortionCoefficients, const CvMat &rotationVectors, const CvMat &translationVectors, const double &projectionError, const int &sizeX, const int &sizeY, const int &cornersX, const int &cornersY, std::vector< std::string > &fileNames)
 Utility method to dump output to a stream. More...
 
void mitk::CorrectDistortionInImageFile (const std::string &inputImageFileName, const std::string &inputIntrinsicsFileName, const std::string &inputDistortionCoefficientsFileName, const std::string &outputImageFileName)
 Loads an image and parameters and writes the distortion corrected image to the output. Assumes that both the intrinsic camera params and distortion coefficients are in OpenCV's xml format. More...
 
void mitk::CorrectDistortionInImageFile (const std::string &inputFileName, const CvMat &intrinsicParams, const CvMat &distortionCoefficients, const std::string &outputFileName)
 Method that reads a single image (eg. png, jpg or anything that OpenCV recognises) and corrects it using the intrinsic params and distortion co-efficients, and writes it to the output file. More...
 
void mitk::CorrectDistortionInSingleImage (const CvMat &intrinsicParams, const CvMat &distortionCoefficients, IplImage &image)
 Assuming image is pre-allocated, will take the intrinsic and distortion parameters and calculate a pixel-wise undistortion map, and apply it to image. More...
 
void mitk::UndistortImageUsingDistortionMap (const IplImage &mapX, const IplImage &mapY, IplImage &image)
 Assumes all image buffers are pre-allocated and the same size, and applies mapX and mapY to image. More...
 
void mitk::ApplyDistortionCorrectionMap (const IplImage &mapX, const IplImage &mapY, const IplImage &inputImage, IplImage &outputImage)
 Assumes all image buffers are pre-allocated and the same size, and applies mapX and mapY to the inputImage, and writes to outputImage. More...
 
void mitk::Project3DModelPositionsToStereo2D (const CvMat &modelPointsIn3D, const CvMat &leftCameraIntrinsic, const CvMat &leftCameraDistortion, const CvMat &leftCameraRotationVector, const CvMat &leftCameraTranslationVector, const CvMat &rightCameraIntrinsic, const CvMat &rightCameraDistortion, const CvMat &rightToLeftRotationMatrix, const CvMat &rightToLeftTranslationVector, CvMat &output2DPointsLeft, CvMat &output2DPointsRight, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Used to project 3D points into 2D locations for a stereo pair. Here, 3D model points means that the 3D coordinates are with respect to the model's natural coordinate system, but are in millimetres. So, you multiply the grid position by the number of millimetres per pixel to get model coordinates. More...
 
std::vector< intmitk::ProjectVisible3DWorldPointsToStereo2D (const CvMat &leftCameraWorldPointsIn3D, const CvMat &leftCameraWorldNormalsIn3D, const CvMat &leftCameraPositionToFocalPointUnitVector, const CvMat &leftCameraIntrinsic, const CvMat &leftCameraDistortion, const CvMat &rightCameraIntrinsic, const CvMat &rightCameraDistortion, const CvMat &rightToLeftRotationMatrix, const CvMat &rightToLeftTranslationVector, CvMat *&outputLeftCameraWorldPointsIn3D, CvMat *&outputLeftCameraWorldNormalsIn3D, CvMat *&output2DPointsLeft, CvMat *&output2DPointsRight, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Takes 3D world points, and normals, and if the normal is pointing towards camera, will project the point to both left and right 2D position using ProjectLeftCamera3DPositionToStereo2D. Here, in this method, the 3D points are assumed to be in true 3D world (mm) coordinates relative to the left camera. So, the left camera extrinsic parameters are not needed. More...
 
void mitk::UndistortPoints (const cv::Mat &inputObservedPointsNx2, const cv::Mat &cameraIntrinsics3x3, const cv::Mat &cameraDistortionParams5x1, cv::Mat &outputIdealPointsNx2, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Takes image points, and undistorts them to ideal locations. More...
 
void mitk::UndistortPoints (const std::vector< cv::Point2d > &inputObservedPoints, const cv::Mat &cameraIntrinsics3x3, const cv::Mat &cameraDistortionParams5x1, std::vector< cv::Point2d > &outputIdealPoints, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Takes image points, and undistorts them to ideal locations, which is a C++ wrapper for the above method. More...
 
void mitk::UndistortPoint (const cv::Point2d &inputObservedPoint, const cv::Mat &cameraIntrinsics3x3, const cv::Mat &cameraDistortionParams, cv::Point2d &outputIdealPoint, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Takes an image point, and undistorts it to ideal locations, which is a C++ wrapper for the above method. More...
 
std::vector< std::pair
< cv::Point3d, double > > 
mitk::TriangulatePointPairsUsingGeometry (const std::vector< std::pair< cv::Point2d, cv::Point2d > > &inputUndistortedPoints, const cv::Mat &leftCameraIntrinsicParams, const cv::Mat &rightCameraIntrinsicParams, const cv::Mat &rightToLeftRotationMatrix, const cv::Mat &rightToLeftTranslationVector, const double &tolerance, const bool &preserveVectorSize=false)
 Triangulates a vector of un-distorted (i.e. already correction for distortion) 2D point pairs back into 3D. More...
 
std::pair< cv::Point3d,
cv::Point3d > 
mitk::GetRay (const cv::Point2d &inputUndistortedPoint, const cv::Mat &cameraIntrinsicParams, const double &rayLength=1000)
 Projects a ray from un-distorted (i.e. already correction for distortion) 2D point. More...
 
cv::Point3d mitk::TriangulatePointPairUsingGeometry (const std::pair< cv::Point2d, cv::Point2d > &inputUndistortedPoints, const cv::Mat &leftCameraIntrinsicParams, const cv::Mat &rightCameraIntrinsicParams, const cv::Mat &rightToLeftRotationMatrix, const cv::Mat &rightToLeftTranslationVector)
 Triangulates a single point from two 2D points by calling TriangulatePointPairsUsingGeometry(). More...
 
void mitk::CStyleTriangulatePointPairsUsingSVD (const CvMat &leftCameraUndistortedImagePoints, const CvMat &rightCameraUndistortedImagePoints, const CvMat &leftCameraIntrinsicParams, const CvMat &leftCameraRotationVector, const CvMat &leftCameraTranslationVector, const CvMat &rightCameraIntrinsicParams, const CvMat &rightCameraRotationVector, const CvMat &rightCameraTranslationVector, CvMat &output3DPoints)
 C Wrapper for the other TriangulatePointPairsUsingSVD. More...
 
std::vector< mitk::WorldPointmitk::Triangulate (const std::vector< mitk::ProjectedPointPair > &onScreenPoints, const cv::Mat &leftIntrinsicMatrix, const cv::Mat &leftDistortionVector, const cv::Mat &rightIntrinsicMatrix, const cv::Mat &rightDistorionVector, const cv::Mat &rightToLeftRotationMatrix, const cv::Mat &rightToLeftTranslationVector, const bool &cropPointsToScreen=false, const double &xLow=0.0, const double &xHigh=0.0, const double &yLow=0.0, const double &yHigh=0.0, const double &cropValue=0.0)
 Wrapper to triangulate vector of mitk::ProjectedPointPair to vector of mitk::WorldPoint. More...
 
cv::Point3d mitk::ReProjectPoint (const cv::Point2d &inputUndistortedPoint, const cv::Mat &CameraIntrinsicParams)
 Reprojects undistorted screen points to normalised points (x/z, y/z, 1.0) in lens coordinates. More...
 
std::vector< cv::Point3d > mitk::TriangulatePointPairsUsingSVD (const std::vector< std::pair< cv::Point2d, cv::Point2d > > &inputUndistortedPoints, const cv::Mat &leftCameraIntrinsicParams, const cv::Mat &leftCameraRotationVector, const cv::Mat &leftCameraTranslationVector, const cv::Mat &rightCameraIntrinsicParams, const cv::Mat &rightCameraRotationVector, const cv::Mat &rightCameraTranslationVector)
 Triangulates a vector of un-distorted (i.e. already correction for distortion) 2D point pairs back into 3D. More...
 
cv::Mat_< double > mitk::InternalTriangulatePointUsingSVD (const cv::Matx34d &P1, const cv::Matx34d &P2, const cv::Point3d &u1, const cv::Point3d &u2, const double &w1, const double &w2)
 Don't call this: Triangulates a 3D point using SVD. More...
 
cv::Point3d mitk::InternalIterativeTriangulatePointUsingSVD (const cv::Matx34d &P1, const cv::Matx34d &P2, const cv::Point3d &u1, const cv::Point3d &u2)
 Don't call this: Triangulates a 3D point using SVD by calling TriangulatePointUsingSVD with different weighting factors. More...
 
void mitk::GenerateFullHandeyeMatrices (const std::string &directory)
 reads the handeye and r2l transforms and writes out a set of left, centre and right hand eye matrices, useful for generating geometry for the scope More...
 
void mitk::LoadResult (const std::string &Filename, cv::Mat &result, std::vector< double > &residuals)
 loads a result file into a residual vector and matrix More...
 
NIFTKOPENCV_EXPORT cv::Point3f mitk::LeftLensToWorld (cv::Point3f pointInLensCS, cv::Mat &handeye, cv::Mat &tracker)
 Transforms a point relative to the left camera lens to world coordinates using the handeye and tracking matrices. More...
 
NIFTKOPENCV_EXPORT cv::Point3f mitk::WorldToLeftLens (cv::Point3f pointInWorldCS, cv::Mat &handeye, cv::Mat &tracker)
 Transforms a point in world coordinates to a point relative to the left lens using world coordinates using the handeye and tracking matrices. More...
 
void mitk::CropToScreen (const std::vector< cv::Point2d > &srcPoints, std::vector< cv::Point2d > &dstPoints, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &cropValue)
 Iterates through a vector of points and checks whether they are within the bounds passed. If out of bounds the corresponding value in the destination vector is set to the passed value. More...