NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Classes | Functions
mitk Namespace Reference

Classes

class  AffineTransformViewActivator
 CTK Plugin Activator class for AffineTransformView. More...
 
class  BaseVideoProcessor
 
class  CameraCalibrationFromDirectory
 Does a camera calibration from a directory containing a set of image files. More...
 
class  CorrectImageDistortion
 
class  CorrectVideoFileDistortion
 
class  EvaluateIntrinsicParametersOnNumberOfFrames
 
class  FindAndTriangulateCrossHair
 
class  FootpedalHotkeyViewActivator
 
class  GoldStandardPoint
 
class  HandeyeCalibrate
 
class  HandeyeCalibrateFromDirectory
 
class  IGIVLEditorActivator
 Activator class for the IGIVLEditor. More...
 
class  Image2DToTexturePlaneMapper3D
 Vtk-based mapper for a 2D image, that displays a texture mapped plane in 3D space. More...
 
class  in_mask
 
class  InvariantPointCalibration
 Base class for Ultrasound Pin/Cross-Wire calibration and Video Hand-Eye calibration. More...
 
class  it_unito_cim_intensityprofile_Activator
 
class  MakeGridOf2DImages
 Tiles images together, e.g. Tiles Tags into a board of Tags. More...
 
class  MakeMaskImagesFromStereoVideo
 
class  Manager
 
class  MonoVideoProcessorTemplateMethod
 
class  NifTKIGIObjectFactory
 Object factory class to create and register stuff at startup. More...
 
class  NiftyRegPluginActivator
 
class  NiftySegPluginActivator
 
class  out_of_bounds
 
class  PickedObject
 
class  PickedPointList
 
class  PickPointsOnStereoVideo
 
class  PivotCalibration
 Does a pivot calibration from a vector of 4x4 matrices, such as might be used to calibrate an image guided surgery pointing device. More...
 
class  PivotCalibrationViewActivator
 
class  PointerCalibViewActivator
 
class  PointRegViewActivator
 
class  PointSetCropperEventInterface
 
class  PointSetCropperPluginActivator
 
class  ProjectedPointPair
 
class  ProjectedPointPairsWithTimingError
 
class  ProjectPointsOnStereoVideo
 
class  RMSErrorViewActivator
 
class  SnapshotViewActivator
 CTK Plugin Activator class for SnapshotView. More...
 
class  SplitVideo
 Takes an input video file (.avi or .264) together with the corresponding .framemap.log file, a start frame and an end frame. The file is split and the resulting file written out together a suitable .framemap.log file. More...
 
class  StereoCameraCalibration
 Does a stereo camera calibration from one/two directories, each containing a set of image files. More...
 
class  StereoDistortionCorrectionVideoProcessor
 
class  StereoOneTimePointVideoProcessorTemplateMethod
 
class  StereoPointProjectionIntoTwoImages
 Takes stereo calibration data, two input images and a bunch of 3D points, and projects them to two 2D images. More...
 
class  StereoTwoTimePointVideoProcessorTemplateMethod
 
class  StereoVideoProcessorTemplateMethod
 
class  SurfaceExtractorPluginActivator
 CTK Plugin Activator class for the Surface Extractor plugin. More...
 
class  SurfaceReconViewActivator
 
class  SurfaceRegViewActivator
 
class  SurfTester
 Just playing around with OpenCV SURF. More...
 
class  TestIGIDataSource
 
class  TimeStampsContainer
 Helper class that contains a vector of timestamps, that are assumed to be strictly increasing. More...
 
class  TrackedImage
 Command used to update the position of a tracked image. More...
 
class  TrackedImageViewActivator
 
class  TrackedPointer
 Command used to update the alignment of a tracked pointer. More...
 
class  TrackedPointerViewActivator
 
class  TrackerAnalysis
 A class to match video frames to tracking frames, when reading recorded tracking data. More...
 
class  TrackingAndTimeStampsContainer
 Contains a matched vector of timestamps, and 4x4 tracking Matrices. More...
 
class  TrackingMatrices
 
class  Triangulate2DPointPairsTo3D
 Takes an input file containing 4 numbers on each line corresponding to the x and y image coordinates for the left and then right image of a stereo video pair, and all the calibration data to enable a reconstruction of 3D points. More...
 
class  TwoTrackerAnalysis
 A class to match video frames to tracking frames, or two sets of tracking data when reading recorded tracking data. More...
 
class  TwoTrackerMatching
 A class to match two sets of time stamped data currently for reading recorded tracking data. More...
 
class  uk_ac_ucl_cmic_breastsegmentation_Activator
 
class  uk_ac_ucl_cmic_igiundistort_Activator
 
class  uk_ac_ucl_cmic_imagestatistics_Activator
 
class  uk_ac_ucl_cmic_mitksegmentation_Activator
 Class to launch/activate the MITKSegmentationView. More...
 
class  uk_ac_ucl_cmic_pointsetconverter_Activator
 
class  UltrasoundPinCalibration
 Does an Ultrasound Pin/Cross-Wire calibration. More...
 
class  UltrasoundPinCalibrationEvaluation
 Evaluates directories of points and tracking matrices against a known gold standard invariant point. More...
 
class  UltrasoundTransformAndImageMerger
 Merges a directory of images and tracking data into a .mhd file, according to PLUS meta-data specifications. More...
 
class  VideoFrame
 
class  VideoHandEyeCalibration
 Does an Ultrasound Pin/Cross-Wire calibration. More...
 
class  VideoToSurface
 
class  VideoTrackerMatching
 A class to match video frames to tracking frames, when reading recorded tracking data. More...
 
class  VLRendererPluginActivator
 
class  WorldPoint
 
class  WorldPointsWithTimingError
 
class  XnatPluginActivator
 

Functions

mitk::DataNode::Pointer CreateConeRepresentation (const char *label, mitk::Vector3D &centerPoint, mitk::Vector3D &direction)
 
mitk::DataNode::Pointer CreateConeRepresentation (const char *label, mitk::Vector3D &direction)
 Calls CreateConeRepresentation, centering the cone at (0,0,7.5). More...
 
NIFTKIGI_EXPORT
mitk::DataNode::Pointer 
CreateConeRepresentation (const char *label, const mitk::Vector3D &centerPoint, const mitk::Vector3D &direction)
 Creates a cone, radius 7.5mm, height 15.0mm, centred at centrePoint, facing the given direction. More...
 
void LoadImages (const std::vector< std::string > &files, std::vector< IplImage * > &images, std::vector< std::string > &fileNames)
 Uses OpenCV to load images. More...
 
void 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 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 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...
 
bool 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...
 
void 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...
 
double 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 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 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 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 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...
 
double CalculateRPE (const CvMat &projectedPoints, const CvMat &goldStandardPoints)
 Calculates the RMS projection error. More...
 
void 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 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 > 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 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 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 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 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 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 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< intProjectVisible3DWorldPointsToStereo2D (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 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 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 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...
 
cv::Point3d 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...
 
std::vector< std::pair
< cv::Point3d, double > > 
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 > 
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...
 
void 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< cv::Point3d > 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...
 
std::vector< mitk::WorldPointTriangulate (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::Mat_< double > 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 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 LoadResult (const std::string &Filename, cv::Mat &result, std::vector< double > &residuals)
 loads a result file into a residual vector and matrix More...
 
void 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...
 
cv::Point3d LeftLensToWorld (cv::Point3d PointInLensCS, cv::Mat &Handeye, cv::Mat &Tracker)
 
cv::Point3d WorldToLeftLens (cv::Point3d PointInWorldCS, cv::Mat &Handeye, cv::Mat &Tracker)
 
cv::Point3d 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...
 
void 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...
 
NIFTKOPENCV_EXPORT cv::Point3f 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 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...
 
double ComparePointsWithGoldStandard (const std::string &goldStandardFileName, const CvMat *points, IplImage *outputImage)
 
bool CheckIfDirectoryContainsTrackingMatrices (const std::string &directory)
 Iterates through a directory to see if it contains any files that have a timestamp as a name, and end in .txt. More...
 
std::vector< std::stringFindTrackingMatrixDirectories (const std::string &directory)
 Recursively hunts for all directories that look like they contain tracking matrices, <timestamp>.txt. More...
 
mitk::TimeStampsContainer FindTrackingTimeStamps (std::string directory)
 Returns an mitk::TimeStampsContainer containing all the timestamps of tracking matrices. More...
 
std::vector< std::stringFindVideoFrameMapFiles (const std::string directory)
 Recursively hunts for all files that look like they are a video frame map file, (.+)(framemap.log). More...
 
bool ReadTrackerMatrix (const std::string &filename, cv::Mat &outputMatrix)
 Extracted from mitkVideoTrackerMatching, reads a 4x4 matrix into a cv::Mat, and if the matrix can't be read, will return a new matrix thats initialised according to the default OpenCV macros (i.e. unitinitialised). More...
 
bool ReadTrackerMatrix (const std::string &filename, cv::Matx44d &outputMatrix)
 
bool SaveTrackerMatrix (const std::string &filename, cv::Mat &outputMatrix)
 Saves a 4x4 matrix;. More...
 
bool SaveTrackerMatrix (const std::string &filename, cv::Matx44d &outputMatrix)
 See SaveTrackerMatrix(const std::string& filename, cv::Mat& outputMatrix);. More...
 
cv::VideoCapture * InitialiseVideoCapture (std::string filename, bool ignoreErrors=false)
 Attempts to open a video capture and checks for errors. see trac 3718. This attempts to avoid problems caused by the subtle decoding errors. More...
 
std::vector< std::pair
< unsigned long long,
cv::Point3d > > 
LoadTimeStampedPoints (const std::string &directory)
 Loads points from a directory, where each point is in a separate file, and the filename is a timestamp. More...
 
void LoadTimeStampedPoints (std::vector< std::pair< unsigned long long, cv::Point3d > > &points, std::vector< mitk::ProjectedPointPair > &screenPoints, const std::string &fileName)
 Loads points from a flat text file with each line having the timestamp, the triangulated point, then the left and right screen points. More...
 
void LoadTimeStampedPoints (std::vector< std::pair< unsigned long long, cv::Point2d > > &points, const std::string &fileName)
 Loads points from a flat text file with each line having the time stamp, followed by the on screen points. More...
 
void SaveTimeStampedPoints (const std::vector< std::pair< unsigned long long, cv::Point3d > > &points, const std::string &fileName)
 Saves points to a flat text file. More...
 
void SavePickedObjects (const std::vector< mitk::PickedObject > &points, std::ostream &os)
 Saves a vector of picked objects. More...
 
void LoadPickedObjects (std::vector< mitk::PickedObject > &points, std::istream &is)
 Loads a vector of picked objects. More...
 
std::vector< cv::Mat > LoadMatricesFromDirectory (const std::string &fullDirectoryName)
 Read a set of matrices, stored as plain text, 4x4 matrices from a directory and put them in a vector of 4x4 cvMats. More...
 
std::vector< cv::Mat > LoadOpenCVMatricesFromDirectory (const std::string &fullDirectoryName)
 Read a set of matrices, stored in openCV xml matrix format from a directory and put them in a vector of 4x4 cvMats. More...
 
std::vector< cv::Mat > LoadMatricesFromExtrinsicFile (const std::string &fullFileName)
 Load a set of matrices from a file describing the extrinsic parameters of a standard camera calibration. More...
 
void LoadStereoCameraParametersFromDirectory (const std::string &directory, cv::Mat *leftCameraIntrinsic, cv::Mat *leftCameraDistortion, cv::Mat *rightCameraIntrinsic, cv::Mat *rightCameraDisortion, cv::Mat *rightToLeftRotationMatrix, cv::Mat *rightToLeftTranslationVector, cv::Mat *leftCameraToTracker)
 Load stereo camera parameters from a directory. More...
 
void LoadCameraIntrinsicsFromPlainText (const std::string &filename, cv::Mat *cameraIntrinsic, cv::Mat *cameraDistortion)
 Load camera intrinsics from a plain text file and return results as cv::Mat. More...
 
void LoadStereoTransformsFromPlainText (const std::string &filename, cv::Mat *rightToLeftRotationMatrix, cv::Mat *rightToLeftTranslationVector)
 Load stereo camera parameters from a plain text file cv::Mat. More...
 
void LoadHandeyeFromPlainText (const std::string &filename, cv::Mat *leftCameraToTracker)
 Load the handeye matrix from a plain text file cv::Mat. More...
 
mitk::PickedPointList::Pointer LoadPickedPointListFromDirectory (const std::string &directoryName, unsigned int frameNumber=0, unsigned long long timestamp=0, std::string channel="world", cv::Scalar scalar=cv::Scalar(255, 255, 255))
 Create an mitk::PickedPointList object from a directory of mitk point files directory contains files line_00.mps .. line_nn.mps and points.mps. Point ID's are stored in the file, while line ID's are stored in the file name framenumber etc are settable by parameters. More...
 
cv::Point2d FindCrosshairCentre (const cv::Mat &image, const int &cannyLowThreshold, const int &cannyHighThreshold, const int &cannyKernel, const double &houghRho, const double &houghTheta, const int &houghThreshold, const int &houghLineLength, const int &houghLineGap, cv::vector< cv::Vec4i > &lines)
 finds the intersection of two lines in an image More...
 
unsigned int ApplyMask (std::vector< std::pair< cv::Point2d, cv::Point2d > > &pointPairs, const cv::Mat &maskImage, const unsigned int &maskValue, const bool &maskUsingFirst)
 Applies binary mask to a vector of point pairs. More...
 
std::vector< cv::Point3d > SubtractPointFromPoints (const std::vector< cv::Point3d > listOfPoints, const cv::Point3d &point)
 Subtracts a point (e.g. the centroid) from a list of points. More...
 
std::vector< cv::Point3d > PointSetToVector (const mitk::PointSet::Pointer &pointSet)
 Converts mitk::PointSet to vector of cv::Point3d, but you lose the point ID contained within the mitk::PointSet. More...
 
void MakeIdentity (cv::Matx44d &outputMatrix)
 Haven't found a direct method to do this yet. More...
 
cv::Matx33d CalculateCrossCovarianceH (const std::vector< cv::Point3d > &q, const std::vector< cv::Point3d > &qPrime)
 Calculates 1/N Sum (q_i * qPrime_i^t) where q_i and qPrime_i are column vectors, so the product is a 3x3 matrix. More...
 
bool DoSVDPointBasedRegistration (const std::vector< cv::Point3d > &fixedPoints, const std::vector< cv::Point3d > &movingPoints, cv::Matx33d &H, cv::Point3d &p, cv::Point3d &pPrime, cv::Matx44d &outputMatrix, double &fiducialRegistrationError)
 Helper method to do the main SVD bit of the point based registration, and handle the degenerate conditions mentioned in Aruns paper. More...
 
double CalculateFiducialRegistrationError (const std::vector< cv::Point3d > &fixedPoints, const std::vector< cv::Point3d > &movingPoints, const cv::Matx44d &matrix)
 Calculates Fiducial Registration Error by multiplying the movingPoints by the matrix, and comparing with fixedPoints. More...
 
double CalculateFiducialRegistrationError (const mitk::PointSet::Pointer &fixedPointSet, const mitk::PointSet::Pointer &movingPointSet, vtkMatrix4x4 &vtkMatrix)
 Converts format of input to call the other CalculateFiducialRegistrationError method. More...
 
void ConstructAffineMatrix (const cv::Matx31d &translation, const cv::Matx33d &rotation, cv::Matx44d &matrix)
 Simply copies the translation vector and rotation matrix into the 4x4 matrix. More...
 
void CopyToVTK4x4Matrix (const cv::Matx44d &matrix, vtkMatrix4x4 &vtkMatrix)
 Copies matrix to vtkMatrix. More...
 
void CopyToOpenCVMatrix (const vtkMatrix4x4 &matrix, cv::Matx44d &openCVMatrix)
 Copies matrix to openCVMatrix. More...
 
void CopyToVTK4x4Matrix (const cv::Mat &input, vtkMatrix4x4 &output)
 Copies to VTK matrix, throwing exceptions if input is not 4x4. More...
 
void CopyToOpenCVMatrix (const vtkMatrix4x4 &input, cv::Mat &output)
 Copies to OpenCV matrix, throwing exceptions if output is not 4x4. More...
 
void CopyToOpenCVMatrix (const cv::Matx44d &matrix, cv::Mat &output)
 Copies to OpenCV matrix, throwing exceptions if output is not 4x4. More...
 
std::vector< mitk::WorldPointoperator* (const cv::Mat &M, const std::vector< mitk::WorldPoint > &p)
 multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix More...
 
std::vector< mitk::WorldPointoperator* (const cv::Matx44d &M, const std::vector< mitk::WorldPoint > &p)
 multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix More...
 
mitk::WorldPoint operator* (const cv::Mat &M, const mitk::WorldPoint &p)
 multiplies a point and corresponding scalar value by a 4x4 transformation matrix More...
 
mitk::WorldPoint operator* (const cv::Matx44d &M, const mitk::WorldPoint &p)
 multiplies a point and corresponding scalar value by a 4x4 transformation matrix More...
 
std::vector< cv::Point3d > operator* (const cv::Mat &M, const std::vector< cv::Point3d > &p)
 multiplies a set of points by a 4x4 transformation matrix More...
 
std::vector< cv::Point3d > operator* (const cv::Matx44d &M, const std::vector< cv::Point3d > &p)
 multiplies a set of points by a 4x4 transformation matrix More...
 
cv::Point3d operator* (const cv::Mat &M, const cv::Point3d &p)
 multiplies a point by a 4x4 transformation matrix More...
 
cv::Point3d operator* (const cv::Matx44d &M, const cv::Point3d &p)
 multiplies a point by a 4x4 transformation matrix More...
 
std::pair< cv::Point3d,
cv::Point3d > 
TransformPointPair (const cv::Matx44d &M, const std::pair< cv::Point3d, cv::Point3d > &p)
 multiplies a point pair by a 4x4 transformation matrix More...
 
bool NearlyEqual (const cv::Point2d &p1, const cv::Point2d &p2, const double &tolerance)
 Tests equality of 2 2d points. The openCV == operator struggles on floating points,. More...
 
bool NearlyEqual (const cv::Point3d &p1, const cv::Point3d &p2, const double &tolerance)
 Tests equality of 2 3d points. The openCV == operator struggles on floating points,. More...
 
bool ImageHeadersEqual (const cv::Mat &m1, const cv::Mat &m2)
 Tests whether two cv::Mat have the same header info (dimension and data type),. More...
 
bool ImageDataEqual (const cv::Mat &m1, const cv::Mat &m2, const double &tolerance)
 Tests whether two cv::Mat have the same data. More...
 
cv::Point2d operator/ (const cv::Point2d &p, const int &n)
 Divides a 2d point by an integer (x=x1/n, y=y1/2) More...
 
cv::Point2d operator* (const cv::Point2d &p1, const cv::Point2d &p2)
 Multiplies the components of a 2d point by an integer (x=x1*x2, y=y1*y2) More...
 
cv::Point2d FindIntersect (const cv::Vec4i &line1, const cv::Vec4i &line2)
 
bool PointInInterval (const cv::Point2d &point, const cv::Vec4i &interval)
 
bool CheckIfLinesArePerpendicular (cv::Vec4i line1, cv::Vec4i line2, double tolerance)
 
double AngleBetweenLines (cv::Vec4i line1, cv::Vec4i line2)
 
std::vector< cv::Point2d > FindIntersects (const std::vector< cv::Vec4i > &lines, const bool &rejectIfPointNotOnBothLines, const bool &rejectIfNotPerpendicular, const double &angleTolerance)
 
cv::Point2d GetCentroid (const std::vector< cv::Point2d > &points, bool RefineForOutliers=false, cv::Point2d *StandardDeviation=NULL)
 Calculates the centroid of a vector of points. More...
 
cv::Point3d GetCentroid (const std::vector< cv::Point3d > &points, bool RefineForOutliers=false, cv::Point3d *StandardDeviation=NULL)
 Calculates the centroid of a vector of points. More...
 
cv::Matx33d ConstructEulerRxMatrix (const double &rx)
 Generates a rotation about X-axis, given a Euler angle in radians. More...
 
cv::Matx33d ConstructEulerRyMatrix (const double &ry)
 Generates a rotation about Y-axis, given a Euler angle in radians. More...
 
cv::Matx33d ConstructEulerRzMatrix (const double &rz)
 Generates a rotation about Z-axis, given a Euler angle in radians. More...
 
cv::Matx33d ConstructEulerRotationMatrix (const double &rx, const double &ry, const double &rz)
 Generates a rotation matrix, given Euler angles in radians. More...
 
cv::Matx13d ConvertEulerToRodrigues (const double &rx, const double &ry, const double &rz)
 Converts Euler angles in radians to the Rodrigues rotation vector (axis-angle convention) mentioned in OpenCV. More...
 
cv::Matx44d ConstructRigidTransformationMatrix (const double &rx, const double &ry, const double &rz, const double &tx, const double &ty, const double &tz)
 From rotations in radians and translations in millimetres, constructs a 4x4 transformation matrix. More...
 
cv::Matx44d ConstructRodriguesTransformationMatrix (const double &r1, const double &r2, const double &r3, const double &tx, const double &ty, const double &tz)
 From Rodrigues rotation parameters and translations in millimetres, constructs a 4x4 transformation matrix. More...
 
cv::Matx44d ConstructScalingTransformation (const double &sx, const double &sy, const double &sz=1)
 Constructs a scaling matrix from sx, sy, sz where the scale factors simply appear on the diagonal. More...
 
cv::Matx44d ConstructSimilarityTransformationMatrix (const double &rx, const double &ry, const double &rz, const double &tx, const double &ty, const double &tz, const double &sx, const double &sy, const double &sz)
 Constructs an affine transformation, without skew using the specified parameters, where rotations are in degrees. More...
 
cv::Point3d FindMinimumValues (std::vector< cv::Point3d > inputValues, cv::Point3i *indexes=NULL)
 Takes a point vector and finds the minimum value in each dimension. Returns the minimum values. Optionally returns the indexes of the minium values. More...
 
std::pair< double, double > RMSError (std::vector< mitk::ProjectedPointPairsWithTimingError > measured, std::vector< mitk::ProjectedPointPairsWithTimingError > actual, int index=-1, cv::Point2d outlierSD=cv::Point2d(2.0, 2.0), long long allowableTimingError=30e6, bool duplicateLines=true)
 Returns the RMS error between two projected point vectors. More...
 
mitk::ProjectedPointPair MeanError (std::vector< mitk::ProjectedPointPairsWithTimingError > measured, std::vector< mitk::ProjectedPointPairsWithTimingError > actual, mitk::ProjectedPointPair *StandardDeviations=NULL, int index=-1, long long allowableTimingError=30e6, bool duplicateLines=true)
 Returns the mean pixel errors for the right and left sets of projected points. More...
 
cv::Mat PerturbTransform (const cv::Mat transformIn, const double tx, const double ty, const double tz, const double rx, const double ry, const double rz)
 perturbs a 4x4 matrix with a 6 dof rigid transform. The transform is defined by three translations and 3 rotations, in Degrees More...
 
cv::Point2d FindNearestPoint (const cv::Point2d &point, const std::vector< cv::Point2d > &matchingPonints, double *minRatio=NULL, unsigned int *index=NULL)
 Searches through vector of 2D points to find the one closest (by distance) to the passed point, and returns the index of that point. More...
 
mitk::PickedObject FindNearestPickedObject (const mitk::PickedObject &point, const std::vector< mitk::PickedObject > &matchingPoints, double *minRatio=NULL)
 Searches through vector of 3D points and lines to find the one closest (by distance) to the passed point. Returns an empty PickedPoint if no point found. More...
 
bool DistanceCompare (const cv::Point2d &p1, const cv::Point2d &p2)
 Compare two cv point based on their distance from 0,0. More...
 
cv::Mat Tracker2ToTracker1Rotation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, double &Residual)
 works out the rigid rotation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat Tracker2ToTracker1Translation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, double &Residual, const cv::Mat &rcg)
 works out the rigid translation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat Tracker2ToTracker1RotationAndTranslation (const std::vector< cv::Mat > &Tracker1ToWorld1, const std::vector< cv::Mat > &World2ToTracker2, std::vector< double > &Residuals, cv::Mat *World2ToWorld1=NULL)
 works out the rigid rotation and translation correspondence between two sets of corresponding rigid body transforms More...
 
cv::Mat AverageMatrices (const std::vector< cv::Mat > &matrices)
 find the average of a vector of 4x4 matrices More...
 
std::vector< cv::Mat > FlipMatrices (const std::vector< cv::Mat > matrices)
 Flips the matrices in the vector from left handed coordinate system to right handed and vice versa. More...
 
std::vector< intSortMatricesByDistance (const std::vector< cv::Mat > matrices)
 Sorts the matrices based on the translations , and returns the order. More...
 
std::vector< intSortMatricesByAngle (const std::vector< cv::Mat > matrices)
 Sorts the matrices based on the rotations, and returns the order. More...
 
double AngleBetweenMatrices (cv::Mat Mat1, cv::Mat Mat2)
 Returns the angular distance between two rotation matrices. More...
 
double DistanceBetweenMatrices (cv::Mat Mat1, cv::Mat Mat2)
 Returns the distance between two 4x4 matrices. More...
 
cv::Mat DirectionCosineToQuaternion (cv::Mat dc_Matrix)
 Converts a 3x3 rotation matrix to a quaternion. More...
 
void InvertRigid4x4Matrix (const CvMat &input, CvMat &output)
 Specific method that inverts a matrix without SVD or decomposition, because the input is known to be orthonormal. More...
 
void InvertRigid4x4Matrix (const cv::Mat &input, cv::Mat &output)
 Overloaded invert method that calls the C-looking one. More...
 
void InvertRigid4x4Matrix (const cv::Matx44d &input, cv::Matx44d &output)
 Overloaded invert method that calls the C-looking one. More...
 
void InterpolateTransformationMatrix (const cv::Mat &before, const cv::Mat &after, const double &proportion, cv::Mat &output)
 Interpolates between two matrices. More...
 
void InterpolateTransformationMatrix (const cv::Matx44d &before, const cv::Matx44d &after, const double &proportion, cv::Matx44d &output)
 
std::string MatrixType (const cv::Mat &matrix)
 returns the matrix type as a string More...
 
bool IsNaN (const cv::Point2d &)
 check if point has a NaN value More...
 
bool IsNaN (const cv::Point3d &)
 check if point has a NaN value More...
 
bool IsNotNaNorInf (const cv::Point2d &)
 check if 2D point has a NaN or inf value More...
 
bool IsNotNaNorInf (const cv::Point3d &)
 check if 3D point has a NaN or inf value More...
 
double DistanceToLine (const std::pair< cv::Point3d, cv::Point3d > &line, const cv::Point3d &point)
 calculates the distance between a line and a point More...
 
double DistanceBetweenTwoPoints (const cv::Point3d &p1, const cv::Point3d &p2, cv::Point3d *delta=NULL)
 calculates the distance between two points More...
 
double DistanceBetweenTwoSplines (const std::vector< cv::Point3d > &s0, const std::vector< cv::Point3d > &s1, unsigned int splineOrder, cv::Point3d *delta=NULL)
 calculates the average shortest distance between two splines. More...
 
double DistanceToLineSegment (const std::pair< cv::Point3d, cv::Point3d > &line, const cv::Point3d &point, cv::Point3d *delta=NULL)
 calculates the distance between a line segment and a point More...
 
double DistanceBetweenLines (const cv::Point3d &P0, const cv::Point3d &u, const cv::Point3d &Q0, const cv::Point3d &v, cv::Point3d &midpoint)
 calculates the shortest distance between two lines More...
 
double DistanceBetweenLineAndSegment (const cv::Point3d &P0, const cv::Point3d &u, const cv::Point3d &x0, const cv::Point3d &x1, cv::Point3d &closestPointOnSecondLine)
 calculates the shortest distance between a line and a segment the point must lie on the segment More...
 
std::pair< cv::Point3d,
cv::Point3d > 
TwoPointsToPLambda (const std::pair< cv::Point3d, cv::Point3d > &twoPointLine)
 converts a line defined by two points on the line to the same line defined by a single point and it's unit vector More...
 
cv::Point3d CrossProduct (const cv::Point3d &p1, const cv::Point3d &p2)
 Calculates the cross product of two vectors (cv::Point3D) More...
 
double DotProduct (const cv::Point3d &p1, const cv::Point3d &p2)
 Calculates the dot product of two vectors (cv::Point3D) More...
 
double Norm (const cv::Point3d &p1)
 Calculates the norm product of a vectors (cv::Point3D) More...
 
unsigned int RemoveOutliers (std::vector< cv::Point3d > &points, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &zLow, const double &zHigh)
 Removes points outside the passed limits. More...
 
unsigned int RemoveOutliers (std::vector< std::pair< cv::Point3d, double > > &points, const double &xLow, const double &xHigh, const double &yLow, const double &yHigh, const double &zLow, const double &zHigh)
 Removes points outside the passed limits. More...
 
void ExtractRigidBodyParameters (const vtkMatrix4x4 &matrix, mitk::Point3D &outputRodriguesRotationParameters, mitk::Point3D &outputTranslationParameters)
 Decomposes a rigid body matrix into Rodrigues Rotations and Translations. More...
 
std::istream & operator>> (std::istream &is, GoldStandardPoint &GSP)
 
bool operator< (const GoldStandardPoint &GSP1, const GoldStandardPoint &GSP2)
 
bool operator< (const PickedObject &po1, const PickedObject &po2)
 
void PointPickingCallBackFunc (int, int, int, int, void *)
 a call back function for dealing with PickedPointLists More...
 
cv::Point2i Point3dToPoint2i (const cv::Point3d &point)
 a function to cast a point3d to a point2i, checks that z is zero, throws an error is not More...
 
NIFTKOPENCVUTILS_EXPORT
std::istream & 
operator>> (std::istream &is, const GoldStandardPoint &gsp)
 
std::istream & operator>> (std::istream &is, PickedObject &po)
 
std::ostream & operator<< (std::ostream &os, const PickedObject &po)
 

Function Documentation

NIFTKOPENCVUTILS_EXPORT double mitk::AngleBetweenLines ( cv::Vec4i  ,
cv::Vec4i   
)

\ brief Finds the angle, in radians between two line segments

NIFTKOPENCVUTILS_EXPORT double mitk::AngleBetweenMatrices ( cv::Mat  Mat1,
cv::Mat  Mat2 
)

Returns the angular distance between two rotation matrices.

NIFTKOPENCV_EXPORT 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.

NIFTKOPENCVUTILS_EXPORT unsigned int mitk::ApplyMask ( std::vector< std::pair< cv::Point2d, cv::Point2d > > &  pointPairs,
const cv::Mat &  mask,
const unsigned int blankValue,
const bool &  maskUsingFirst 
)

Applies binary mask to a vector of point pairs.

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::AverageMatrices ( const std::vector< cv::Mat > &  Matrices)

find the average of a vector of 4x4 matrices

NIFTKOPENCVUTILS_EXPORT cv::Matx33d mitk::CalculateCrossCovarianceH ( const std::vector< cv::Point3d > &  q,
const std::vector< cv::Point3d > &  qPrime 
)

Calculates 1/N Sum (q_i * qPrime_i^t) where q_i and qPrime_i are column vectors, so the product is a 3x3 matrix.

See also
Least-Squares Fitting of two, 3-D Point Sets, Arun, 1987, DOI=10.1109/TPAMI.1987.4767965, where this calculates matrix H.
NIFTKOPENCVUTILS_EXPORT double mitk::CalculateFiducialRegistrationError ( const std::vector< cv::Point3d > &  fixedPoints,
const std::vector< cv::Point3d > &  movingPoints,
const cv::Matx44d &  matrix 
)

Calculates Fiducial Registration Error by multiplying the movingPoints by the matrix, and comparing with fixedPoints.

NIFTKOPENCVUTILS_EXPORT double mitk::CalculateFiducialRegistrationError ( const mitk::PointSet::Pointer &  fixedPointSet,
const mitk::PointSet::Pointer &  movingPointSet,
vtkMatrix4x4 &  vtkMatrix 
)

Converts format of input to call the other CalculateFiducialRegistrationError method.

NIFTKOPENCV_EXPORT double mitk::CalculateRPE ( const CvMat &  projectedPoints,
const CvMat &  goldStandardPoints 
)

Calculates the RMS projection error.

Parameters
projectedPoints[Nx2] list of 2D points, measured in pixels.
goldStandardPoints[Nx2] list of 2D points, measured in pixels.
NIFTKOPENCV_EXPORT 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.

NIFTKOPENCV_EXPORT 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.

Parameters
objectPoints[(MxN)x3] list of 3D points generated by ExtractChessBoardPoints, in the objects natural coordinate system.
imagePoints[(MxN)x2] list of 2D image points generated by ExtractChessBoardPoints.
pointCounts[(MxN)x1] array containing the number of points, where this array should be the same length as objectPoints and imagePoints, and each entry contain the number of points.
outputIntrinsicMatrix[3x3] matrix.
outputDistortionCoefficients[4x1] matrix of [k1, k2, p1, p2].
flagsA bit-wise OR, of zero, CV_CALIB_USE_INTRINSIC_GUESS, CV_CALIB_FIX_PRINCIPAL_POINT, CV_CALIB_FIX_ASPECT_RATIO, CV_CALIB_FIX_FOCAL_LENGTH, CV_CALIB_FIXK1, CV_CALIB_FIXK2, CV_CALIB_FIXK3 and CV_CALIB_ZERO_TANGENT_DIST.
NIFTKOPENCV_EXPORT 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.

Parameters
In]objectPoints
See also
CalibrateSingleCameraIntrinsicParameters
Parameters
In]imagePoints
See also
CalibrateSingleCameraIntrinsicParameters
Parameters
In]pointCounts
See also
CalibrateSingleCameraIntrinsicParameters
Parameters
In]imageSize
See also
CalibrateSingleCameraIntrinsicParameters
Parameters
outputIntrinsicMatrix
See also
CalibrateSingleCameraIntrinsicParameters
Parameters
outputDistortionCoefficients
See also
CalibrateSingleCameraIntrinsicParameters
NIFTKOPENCV_EXPORT 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,
const bool &  fixedRightToLeft 
)

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.

NIFTKOPENCV_EXPORT 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.

Parameters
leftFileName
rightFileName
numberCornersX
numberCornersY
sizeSquareMillimeters
pixelScaleFactor
successfulLeftFiles
successfulRightFiles
Returns
true if the pair was loaded.
NIFTKOPENCV_EXPORT 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.

Exceptions
Throwsexception if any images are of different size to the first, or the list is empty.
Parameters
widthoutput parameter containing the image width for all the images.
heightoutput parameter containing the image height for all the images.
NIFTKOPENCVUTILS_EXPORT bool mitk::CheckIfDirectoryContainsTrackingMatrices ( const std::string directory)

Iterates through a directory to see if it contains any files that have a timestamp as a name, and end in .txt.

NIFTKOPENCVUTILS_EXPORT bool mitk::CheckIfLinesArePerpendicular ( cv::Vec4i  ,
cv::Vec4i  ,
double  toleranceInDegrees 
)

\ brief Checks if two line segments are perpendicular, within a tolerance set in degrees

double mitk::ComparePointsWithGoldStandard ( const std::string goldStandardFileName,
const CvMat *  points,
IplImage *  outputImage 
)
NIFTKOPENCV_EXPORT 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.

This means that a given a point P_r in the coordinate frame of the right hand camera, then when this point is multiplied by the rotationVectorsRightToLeft and translationVectorsRightToLeft, the point will be converted to a point P_l that is in the coordinate frame of the left hand camera.

Parameters
In]rotationVectorsLeft [Mx3] matrix of row vectors representing rotations in the left hand coordinate frame, in Rodrigues format.
In]translationVectorsLeft [Mx3] matrix of row vectors representing translations in the left hand coordinate frame.
In]rotationVectorsRight [Mx3] matrix of row vectors representing rotations in the right hand coordinate frame, in Rodrigues format.
In]translationVectorsRight [Mx3] matrix of row vectors representing translations in the right hand coordinate frame.
Out]rotationVectorsRightToLeft [Mx3] rotations right to left
Out]translationVectorsRightToLeft [Mx3] translations right to left
NIFTKOPENCVUTILS_EXPORT void mitk::ConstructAffineMatrix ( const cv::Matx31d &  translation,
const cv::Matx33d &  rotation,
cv::Matx44d &  matrix 
)

Simply copies the translation vector and rotation matrix into the 4x4 matrix.

NIFTKOPENCVUTILS_EXPORT cv::Matx33d mitk::ConstructEulerRotationMatrix ( const double &  rx,
const double &  ry,
const double &  rz 
)

Generates a rotation matrix, given Euler angles in radians.

Parameters
rxangle in radians
ryangle in radians
rzangle in radians
Returns
a new [3x3] rotation matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx33d mitk::ConstructEulerRxMatrix ( const double &  rx)

Generates a rotation about X-axis, given a Euler angle in radians.

Parameters
rxangle in radians
Returns
a new [3x3] rotation matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx33d mitk::ConstructEulerRyMatrix ( const double &  ry)

Generates a rotation about Y-axis, given a Euler angle in radians.

Parameters
ryangle in radians
Returns
a new [3x3] rotation matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx33d mitk::ConstructEulerRzMatrix ( const double &  rz)

Generates a rotation about Z-axis, given a Euler angle in radians.

Parameters
rzangle in radians
Returns
a new [3x3] rotation matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx44d mitk::ConstructRigidTransformationMatrix ( const double &  rx,
const double &  ry,
const double &  rz,
const double &  tx,
const double &  ty,
const double &  tz 
)

From rotations in radians and translations in millimetres, constructs a 4x4 transformation matrix.

Parameters
rxEuler rotation about x-axis in radians
ryEuler rotation about y-axis in radians
rzEuler rotation about z-axis in radians
txtranslation in millimetres along x-axis
tytranslation in millimetres along y-axis
tztranslation in millimetres along z-axis
Returns
a new [4x4] matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx44d mitk::ConstructRodriguesTransformationMatrix ( const double &  r1,
const double &  r2,
const double &  r3,
const double &  tx,
const double &  ty,
const double &  tz 
)

From Rodrigues rotation parameters and translations in millimetres, constructs a 4x4 transformation matrix.

Parameters
r1Rodrigues rotation
r2Rodrigues rotation
r3Rodrigues rotation
txtranslation in millimetres along x-axis
tytranslation in millimetres along y-axis
tztranslation in millimetres along z-axis
Returns
a new [4x4] matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx44d mitk::ConstructScalingTransformation ( const double &  sx,
const double &  sy,
const double &  sz = 1 
)

Constructs a scaling matrix from sx, sy, sz where the scale factors simply appear on the diagonal.

Parameters
sxscale factor in x direction
syscale factor in y direction
szscale factor in z direction
Returns
a new [4x4] matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx44d mitk::ConstructSimilarityTransformationMatrix ( const double &  rx,
const double &  ry,
const double &  rz,
const double &  tx,
const double &  ty,
const double &  tz,
const double &  sx,
const double &  sy,
const double &  sz 
)

Constructs an affine transformation, without skew using the specified parameters, where rotations are in degrees.

Parameters
rxEuler rotation about x-axis in radians
ryEuler rotation about y-axis in radians
rzEuler rotation about z-axis in radians
txtranslation in millimetres along x-axis
tytranslation in millimetres along y-axis
tztranslation in millimetres along z-axis
sxscale factor in x direction
syscale factor in y direction
szscale factor in z direction
Returns
a new [4x4] matrix
NIFTKOPENCVUTILS_EXPORT cv::Matx13d mitk::ConvertEulerToRodrigues ( const double &  rx,
const double &  ry,
const double &  rz 
)

Converts Euler angles in radians to the Rodrigues rotation vector (axis-angle convention) mentioned in OpenCV.

Parameters
rxEuler angle rotation about x-axis in radians
ryEuler angle rotation about y-axis in radians
rzEuler angle rotation about z-axis in radians
Returns
A new [1x3] matrix
NIFTKOPENCVUTILS_EXPORT void mitk::CopyToOpenCVMatrix ( const vtkMatrix4x4 &  matrix,
cv::Matx44d &  openCVMatrix 
)

Copies matrix to openCVMatrix.

NIFTKOPENCVUTILS_EXPORT void mitk::CopyToOpenCVMatrix ( const vtkMatrix4x4 &  input,
cv::Mat &  output 
)

Copies to OpenCV matrix, throwing exceptions if output is not 4x4.

NIFTKOPENCVUTILS_EXPORT void mitk::CopyToOpenCVMatrix ( const cv::Matx44d &  input,
cv::Mat &  output 
)

Copies to OpenCV matrix, throwing exceptions if output is not 4x4.

NIFTKOPENCVUTILS_EXPORT void mitk::CopyToVTK4x4Matrix ( const cv::Matx44d &  matrix,
vtkMatrix4x4 &  vtkMatrix 
)

Copies matrix to vtkMatrix.

NIFTKOPENCVUTILS_EXPORT void mitk::CopyToVTK4x4Matrix ( const cv::Mat &  input,
vtkMatrix4x4 &  output 
)

Copies to VTK matrix, throwing exceptions if input is not 4x4.

NIFTKOPENCV_EXPORT 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.

NIFTKOPENCV_EXPORT 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.

NIFTKOPENCV_EXPORT 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.

mitk::DataNode::Pointer mitk::CreateConeRepresentation ( const char *  label,
mitk::Vector3D &  centerPoint,
mitk::Vector3D &  direction 
)
NIFTKIGI_EXPORT mitk::DataNode::Pointer mitk::CreateConeRepresentation ( const char *  label,
const mitk::Vector3D &  centerPoint,
const mitk::Vector3D &  direction 
)

Creates a cone, radius 7.5mm, height 15.0mm, centred at centrePoint, facing the given direction.

Parameters
labelthe name as it appears in DataStorage
centerPointthe centre of the cone (in VTK terms, see SetCenter).
directionthe directionof the cone (in VTK terms, see SetDirection).
NIFTKIGI_EXPORT mitk::DataNode::Pointer mitk::CreateConeRepresentation ( const char *  label,
mitk::Vector3D &  direction 
)

Calls CreateConeRepresentation, centering the cone at (0,0,7.5).

Parameters
labelthe name as it appears in DataStorage
directionthe directionof the cone (in VTK terms, see SetDirection).
NIFTKOPENCV_EXPORT void mitk::CropToScreen ( const std::vector< cv::Point2d > &  src,
std::vector< cv::Point2d > &  dst,
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.

NIFTKOPENCVUTILS_EXPORT cv::Point3d mitk::CrossProduct ( const cv::Point3d &  p1,
const cv::Point3d &  p2 
)

Calculates the cross product of two vectors (cv::Point3D)

Parameters
thevectors as points
NIFTKOPENCV_EXPORT 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.

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::DirectionCosineToQuaternion ( cv::Mat  dc_Matrix)

Converts a 3x3 rotation matrix to a quaternion.

NIFTKOPENCVUTILS_EXPORT double mitk::DistanceBetweenLineAndSegment ( const cv::Point3d &  P0,
const cv::Point3d &  u,
const cv::Point3d &  x0,
const cv::Point3d &  x1,
cv::Point3d &  closestPointOnSecondLine 
)

calculates the shortest distance between a line and a segment the point must lie on the segment

Parameters
line1 define as x = P0 + lambda u
line2 defined as the start and end points x0, x1
holderfor the closest point on the second line
NIFTKOPENCVUTILS_EXPORT double mitk::DistanceBetweenLines ( const cv::Point3d &  P0,
const cv::Point3d &  u,
const cv::Point3d &  Q0,
const cv::Point3d &  v,
cv::Point3d &  midpoint 
)

calculates the shortest distance between two lines

Parameters
line1 define as x = P0 + lambda u
line2 defined as x = Q0 + lambda v
holderto return the midpoint
optionallyreturn the closest point on the second line
NIFTKOPENCVUTILS_EXPORT double mitk::DistanceBetweenMatrices ( cv::Mat  Mat1,
cv::Mat  Mat2 
)

Returns the distance between two 4x4 matrices.

NIFTKOPENCVUTILS_EXPORT double mitk::DistanceBetweenTwoPoints ( const cv::Point3d &  p1,
const cv::Point3d &  p2,
cv::Point3d *  delta = NULL 
)

calculates the distance between two points

Parameters
point1
point2
optionalthe signed distance vector between the two points
NIFTKOPENCVUTILS_EXPORT double mitk::DistanceBetweenTwoSplines ( const std::vector< cv::Point3d > &  s0,
const std::vector< cv::Point3d > &  s1,
unsigned int  splineOrder,
cv::Point3d *  delta = NULL 
)

calculates the average shortest distance between two splines.

Parameters
controlpoints for spline 1, each of which is used for a measurement
controlpoints for spline 2, which form the line segments for the measurement
orderthe polynomial order of the spline (only 1 is implemented)
optionalthe mean signed distance vector between the two points
NIFTKOPENCVUTILS_EXPORT bool mitk::DistanceCompare ( const cv::Point2d &  p1,
const cv::Point2d &  p2 
)

Compare two cv point based on their distance from 0,0.

NIFTKOPENCVUTILS_EXPORT double mitk::DistanceToLine ( const std::pair< cv::Point3d, cv::Point3d > &  line,
const cv::Point3d &  point 
)

calculates the distance between a line and a point

Parameters
theline defined by two points on the line
thepoint
NIFTKOPENCVUTILS_EXPORT double mitk::DistanceToLineSegment ( const std::pair< cv::Point3d, cv::Point3d > &  line,
const cv::Point3d &  point,
cv::Point3d *  delta = NULL 
)

calculates the distance between a line segment and a point

Parameters
theline defined by the two end points of the line segment
thepoint
optionalthe signed distance vector between the two points
NIFTKOPENCVUTILS_EXPORT bool mitk::DoSVDPointBasedRegistration ( const std::vector< cv::Point3d > &  fixedPoints,
const std::vector< cv::Point3d > &  movingPoints,
cv::Matx33d &  H,
cv::Point3d &  p,
cv::Point3d &  pPrime,
cv::Matx44d &  outputMatrix,
double &  fiducialRegistrationError 
)

Helper method to do the main SVD bit of the point based registration, and handle the degenerate conditions mentioned in Aruns paper.

NIFTKOPENCVUTILS_EXPORT double mitk::DotProduct ( const cv::Point3d &  p1,
const cv::Point3d &  p2 
)

Calculates the dot product of two vectors (cv::Point3D)

Parameters
thevectors as points
NIFTKOPENCV_EXPORT 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.

Parameters
In]image is a single image.
In]numberCornersWidth the number of internal corners along the width axis (X).
In]numberCornersHeight the number of internal corners along the height axis (Y).
In]drawCorners if true will dump images in the same directory as the input images, to indicate which points were found (usefull for debugging).
In]squareSizeInMillimetres The size of the chessboard squares in millimetres, needed to make sure that the units of the output camera model are millimetres rather than multiples of the chessboard square size.
In]pixelScaleFactor The caller can specify a multiplier for the number of pixels in each direction to scale up/down the image.
Out]outputImagePoints if successful will contain (numberCornersWidth*numberCornersHeight) 2D image points, if unsuccessful, vector is untouched.
Out]outputObjectPoints if successful will contain (numberCornersWidth*numberCornersHeight) 3D object points, if unsuccessful, vector is untouched.
NIFTKOPENCV_EXPORT 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.

Parameters
In]images vector of pointers to images, where each image must be of the same size.
In]fileNames the corresponding file names, and this vector must be the same length as the vector of images.
In]numberCornersWidth the number of internal corners along the width axis (X).
In]numberCornersHeight the number of internal corners along the height axis (Y).
In]drawCorners if true will dump images in the same directory as the input images, to indicate which points were found (usefull for debugging).
In]squareSizeInMillimetres The size of the chessboard squares in millimetres, needed to make sure that the units of the output camera model are millimetres rather than multiples of the chessboard square size.
In]pixelScaleFactor The caller can specify a multiplier for the number of pixels in each direction to scale up/down the image.
Out]outputImages list of successfully processed images, which are just pointers back to the same images as in the first parameter vector, i.e. they are not copied, so don't de-allocate the images twice.
Out]outputFileNames corresponding list of successfully processed image filenames,
Out]outputImagePoints output image points, array size = (number of successes (M) * numberOfCorners (N)) x 2, and caller must de-allocate.
Out]outputObjectPoints output object points, array size = (number of successes (M) * numberOfCorners (N)) x 3, and caller must de-allocate.
Out]outputPointCounts output point counts, array size = number of successes (M) x 1, and caller must de-allocate. In this case, a "successful" result is one in which the extraction process retrieved all N points for that chessboard. So, by definition, this array, is M x 1, with each entry containing the number N.
NIFTKOPENCV_EXPORT 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.

Parameters
In]rotationVectors [Mx3] matrix of rotation vectors, where M is the number of views of the chess board.
In]translationVectors [Mx3] matrix of translation vectors, where M is the number of views of the chess board.
In]viewNumber which view to extract, where 0 <= viewNumber < M, and viewNumber is unvalidated (unchecked).
Out]outputExtrinsicMatrix the output matrix, which should be a pre-allocated 4x4 matrix
NIFTKOPENCVUTILS_EXPORT void mitk::ExtractRigidBodyParameters ( const vtkMatrix4x4 &  matrix,
mitk::Point3D &  outputRodriguesRotationParameters,
mitk::Point3D &  outputTranslationParameters 
)

Decomposes a rigid body matrix into Rodrigues Rotations and Translations.

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::FindCrosshairCentre ( const cv::Mat &  image,
const int cannyLowThreshold,
const int cannyHighThreshold,
const int cannyKernel,
const double &  houghRho,
const double &  houghTheta,
const int houghThreshold,
const int houghLineLength,
const int houghLineGap,
cv::vector< cv::Vec4i > &  lines 
)

finds the intersection of two lines in an image

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::FindIntersect ( const cv::Vec4i &  line1,
const cv::Vec4i &  line2 
)

\ brief Finds the intersection point of two 2D lines defined as cv::Vec4i x0,y1 = line1[0], line1[1], x1,y1 = line1[2],line1[3] x0,y1 = line2[0], line2[1], x1,y1 = line2[2],line2[3]

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Point2d > mitk::FindIntersects ( const std::vector< cv::Vec4i > &  ,
const bool &  RejectIfNotOnBothLines = false,
const bool &  RejectIfNotPerpendicular = false,
const double &  angleTolerance = 45.0 
)

\ brief Finds all the intersection points of a vector of 2D lines defined as cv::Vec4i \ param reject any points that don't fall on both lines \ param reject any points formed by non perpendicular lines \ param the tolerance to use for perpendicularity test

NIFTKOPENCVUTILS_EXPORT cv::Point3d mitk::FindMinimumValues ( std::vector< cv::Point3d >  inputValues,
cv::Point3i *  indexes 
)

Takes a point vector and finds the minimum value in each dimension. Returns the minimum values. Optionally returns the indexes of the minium values.

NIFTKOPENCVUTILS_EXPORT mitk::PickedObject mitk::FindNearestPickedObject ( const mitk::PickedObject point,
const std::vector< mitk::PickedObject > &  matchingPoints,
double *  minRatio 
)

Searches through vector of 3D points and lines to find the one closest (by distance) to the passed point. Returns an empty PickedPoint if no point found.

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::FindNearestPoint ( const cv::Point2d &  point,
const std::vector< cv::Point2d > &  matchingPoints,
double *  minRatio,
unsigned int Index 
)

Searches through vector of 2D points to find the one closest (by distance) to the passed point, and returns the index of that point.

NIFTKOPENCVUTILS_EXPORT std::vector< std::string > mitk::FindTrackingMatrixDirectories ( const std::string directory)

Recursively hunts for all directories that look like they contain tracking matrices, <timestamp>.txt.

NIFTKOPENCVUTILS_EXPORT mitk::TimeStampsContainer mitk::FindTrackingTimeStamps ( std::string  directory)

Returns an mitk::TimeStampsContainer containing all the timestamps of tracking matrices.

NIFTKOPENCVUTILS_EXPORT std::vector< std::string > mitk::FindVideoFrameMapFiles ( const std::string  directory)

Recursively hunts for all files that look like they are a video frame map file, (.+)(framemap.log).

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Mat > mitk::FlipMatrices ( const std::vector< cv::Mat >  Matrices)

Flips the matrices in the vector from left handed coordinate system to right handed and vice versa.

NIFTKOPENCV_EXPORT 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

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::GetCentroid ( const std::vector< cv::Point2d > &  points,
bool  RefineForOutliers,
cv::Point2d *  StandardDeviation 
)

Calculates the centroid of a vector of points.

NIFTKOPENCVUTILS_EXPORT cv::Point3d mitk::GetCentroid ( const std::vector< cv::Point3d > &  points,
bool  RefineForOutliers,
cv::Point3d *  StandardDeviation 
)

Calculates the centroid of a vector of points.

NIFTKOPENCV_EXPORT 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.

Returns
a point pair defining P0 and P1 lying on the ray. ray length can be set.
NIFTKOPENCVUTILS_EXPORT bool mitk::ImageDataEqual ( const cv::Mat &  m1,
const cv::Mat &  m2,
const double &  tolerance 
)

Tests whether two cv::Mat have the same data.

NIFTKOPENCVUTILS_EXPORT bool mitk::ImageHeadersEqual ( const cv::Mat &  m1,
const cv::Mat &  m2 
)

Tests whether two cv::Mat have the same header info (dimension and data type),.

NIFTKOPENCVUTILS_EXPORT cv::VideoCapture * mitk::InitialiseVideoCapture ( std::string  filename,
bool  ignoreErrors = false 
)

Attempts to open a video capture and checks for errors. see trac 3718. This attempts to avoid problems caused by the subtle decoding errors.

Parameters
thefilename
ignoreerrors, false by default
Returns
the video capture object
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.

Parameters
P1left camera matrix, meaning a full perspective projection, including extrinsic and intrinsic.
P2right camera matrix, meaning a full perspective projection, including extrinsic and intrinsic.
u1normalised left camera image coordinate in pixels.
u2normalised right camera image coordinate in pixels.
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.

Parameters
P1left camera matrix, meaning a full perspective projection, including extrinsic and intrinsic.
P2right camera matrix, meaning a full perspective projection, including extrinsic and intrinsic.
u1normalised left camera image coordinate in pixels.
u2normalised right camera image coordinate in pixels.
NIFTKOPENCVUTILS_EXPORT void mitk::InterpolateTransformationMatrix ( const cv::Mat &  before,
const cv::Mat &  after,
const double &  proportion,
cv::Mat &  output 
)

Interpolates between two matrices.

Parameters
proportionis defined as between [0 and 1], where 0 gives exactly the before matrix, 1 gives exactly the after matrix, and the proportion is a linear proportion between them over which to interpolate.
NIFTKOPENCVUTILS_EXPORT void mitk::InterpolateTransformationMatrix ( const cv::Matx44d &  before,
const cv::Matx44d &  after,
const double &  proportion,
cv::Matx44d &  output 
)
NIFTKOPENCVUTILS_EXPORT void mitk::InvertRigid4x4Matrix ( const CvMat &  input,
CvMat &  output 
)

Specific method that inverts a matrix without SVD or decomposition, because the input is known to be orthonormal.

NIFTKOPENCVUTILS_EXPORT void mitk::InvertRigid4x4Matrix ( const cv::Mat &  input,
cv::Mat &  output 
)

Overloaded invert method that calls the C-looking one.

NIFTKOPENCVUTILS_EXPORT void mitk::InvertRigid4x4Matrix ( const cv::Matx44d &  input,
cv::Matx44d &  output 
)

Overloaded invert method that calls the C-looking one.

NIFTKOPENCVUTILS_EXPORT bool mitk::IsNaN ( const cv::Point2d &  point)

check if point has a NaN value

NIFTKOPENCVUTILS_EXPORT bool mitk::IsNaN ( const cv::Point3d &  point)

check if point has a NaN value

NIFTKOPENCVUTILS_EXPORT bool mitk::IsNotNaNorInf ( const cv::Point2d &  point)

check if 2D point has a NaN or inf value

NIFTKOPENCVUTILS_EXPORT bool mitk::IsNotNaNorInf ( const cv::Point3d &  point)

check if 3D point has a NaN or inf value

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.

cv::Point3d mitk::LeftLensToWorld ( cv::Point3d  PointInLensCS,
cv::Mat &  Handeye,
cv::Mat &  Tracker 
)
NIFTKOPENCVUTILS_EXPORT void mitk::LoadCameraIntrinsicsFromPlainText ( const std::string filename,
cv::Mat *  cameraIntrinsic,
cv::Mat *  cameraDistortion 
)

Load camera intrinsics from a plain text file and return results as cv::Mat.

Parameters
cameraIntrinsic3x3 matrix (double!)
cameraDistortionis optional, number of components needs to match the file! (double!)
Exceptions
exceptionif parsing fails for any reason.
NIFTKOPENCVUTILS_EXPORT void mitk::LoadHandeyeFromPlainText ( const std::string filename,
cv::Mat *  leftCameraToTracker 
)

Load the handeye matrix from a plain text file cv::Mat.

NIFTKOPENCV_EXPORT void mitk::LoadImages ( const std::vector< std::string > &  files,
std::vector< IplImage * > &  images,
std::vector< std::string > &  fileNames 
)

Uses OpenCV to load images.

Exceptions
Throwsexception if files is empty, or no images found.
Parameters
In]files list of files
Out]images which the caller must take responsibility for and de-allocate appropriately.
Out]fileNames list of filenames
NIFTKOPENCV_EXPORT 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.

Parameters
In]fullDirectoryName full directory name
Out]images which the caller must take responsibility for and de-allocate appropriately.
Out]fileNames list of filenames
NIFTKOPENCVUTILS_EXPORT std::vector< cv::Mat > mitk::LoadMatricesFromDirectory ( const std::string fullDirectoryName)

Read a set of matrices, stored as plain text, 4x4 matrices from a directory and put them in a vector of 4x4 cvMats.

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Mat > mitk::LoadMatricesFromExtrinsicFile ( const std::string fullFileName)

Load a set of matrices from a file describing the extrinsic parameters of a standard camera calibration.

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Mat > mitk::LoadOpenCVMatricesFromDirectory ( const std::string fullDirectoryName)

Read a set of matrices, stored in openCV xml matrix format from a directory and put them in a vector of 4x4 cvMats.

NIFTKOPENCVUTILS_EXPORT void mitk::LoadPickedObjects ( std::vector< mitk::PickedObject > &  points,
std::istream &  is 
)

Loads a vector of picked objects.

NIFTKOPENCVUTILS_EXPORT mitk::PickedPointList::Pointer mitk::LoadPickedPointListFromDirectory ( const std::string directory,
unsigned int  frameNumber,
unsigned long long  timestamp,
std::string  channel,
cv::Scalar  scalar 
)

Create an mitk::PickedPointList object from a directory of mitk point files directory contains files line_00.mps .. line_nn.mps and points.mps. Point ID's are stored in the file, while line ID's are stored in the file name framenumber etc are settable by parameters.

NIFTKOPENCV_EXPORT void mitk::LoadResult ( const std::string FileName,
cv::Mat &  result,
std::vector< double > &  residuals 
)

loads a result file into a residual vector and matrix

NIFTKOPENCVUTILS_EXPORT void mitk::LoadStereoCameraParametersFromDirectory ( const std::string directory,
cv::Mat *  leftCameraIntrinsic,
cv::Mat *  leftCameraDistortion,
cv::Mat *  rightCameraIntrinsic,
cv::Mat *  rightCameraDistortion,
cv::Mat *  rightToLeftRotationMatrix,
cv::Mat *  rightToLeftTranslationVector,
cv::Mat *  leftCameraToTracker 
)

Load stereo camera parameters from a directory.

NIFTKOPENCVUTILS_EXPORT void mitk::LoadStereoTransformsFromPlainText ( const std::string filename,
cv::Mat *  rightToLeftRotationMatrix,
cv::Mat *  rightToLeftTranslationVector 
)

Load stereo camera parameters from a plain text file cv::Mat.

Exceptions
exceptionif parsing fails for any reason.
NIFTKOPENCVUTILS_EXPORT std::vector< std::pair< unsigned long long, cv::Point3d > > mitk::LoadTimeStampedPoints ( const std::string directory)

Loads points from a directory, where each point is in a separate file, and the filename is a timestamp.

NIFTKOPENCVUTILS_EXPORT void mitk::LoadTimeStampedPoints ( std::vector< std::pair< unsigned long long, cv::Point3d > > &  points,
std::vector< mitk::ProjectedPointPair > &  screenPoints,
const std::string fileName 
)

Loads points from a flat text file with each line having the timestamp, the triangulated point, then the left and right screen points.

NIFTKOPENCVUTILS_EXPORT void mitk::LoadTimeStampedPoints ( std::vector< std::pair< unsigned long long, cv::Point2d > > &  points,
const std::string fileName 
)

Loads points from a flat text file with each line having the time stamp, followed by the on screen points.

NIFTKOPENCVUTILS_EXPORT void mitk::MakeIdentity ( cv::Matx44d &  outputMatrix)

Haven't found a direct method to do this yet.

NIFTKOPENCVUTILS_EXPORT std::string mitk::MatrixType ( const cv::Mat &  matrix)

returns the matrix type as a string

NIFTKOPENCVUTILS_EXPORT mitk::ProjectedPointPair mitk::MeanError ( std::vector< mitk::ProjectedPointPairsWithTimingError measured,
std::vector< mitk::ProjectedPointPairsWithTimingError actual,
mitk::ProjectedPointPair StandardDeviations = NULL,
int  index = -1,
long long  allowableTimingError = 30e6,
bool  duplicateLines = true 
)

Returns the mean pixel errors for the right and left sets of projected points.

Parameters
themeasured projected points
theactual projected points
optionalpointer to return standard deviations
optionallyconstrain calculation for only one projected point pair in each vector, if -1 all projected point pairs are used
discardpoint pairs with timing errors in excess of allowableTimingError
ifduplicateLines true, only every second entry in measured and actual is used, this is useful when running from stereo video and tracking data.
NIFTKOPENCVUTILS_EXPORT bool mitk::NearlyEqual ( const cv::Point2d &  p1,
const cv::Point2d &  p2,
const double &  tolerance 
)

Tests equality of 2 2d points. The openCV == operator struggles on floating points,.

NIFTKOPENCVUTILS_EXPORT bool mitk::NearlyEqual ( const cv::Point3d &  p1,
const cv::Point3d &  p2,
const double &  tolerance 
)

Tests equality of 2 3d points. The openCV == operator struggles on floating points,.

NIFTKOPENCVUTILS_EXPORT double mitk::Norm ( const cv::Point3d &  p1)

Calculates the norm product of a vectors (cv::Point3D)

Parameters
thevector as cv::Point3D
NIFTKOPENCVUTILS_EXPORT std::vector< mitk::WorldPoint > mitk::operator* ( const cv::Mat &  M,
const std::vector< mitk::WorldPoint > &  p 
)

multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT std::vector< mitk::WorldPoint > mitk::operator* ( const cv::Matx44d &  M,
const std::vector< mitk::WorldPoint > &  p 
)

multiplies a set of points and corresponding scalar values by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT mitk::WorldPoint mitk::operator* ( const cv::Mat &  M,
const mitk::WorldPoint p 
)

multiplies a point and corresponding scalar value by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT mitk::WorldPoint mitk::operator* ( const cv::Matx44d &  M,
const mitk::WorldPoint p 
)

multiplies a point and corresponding scalar value by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Point3d > mitk::operator* ( const cv::Mat &  M,
const std::vector< cv::Point3d > &  p 
)

multiplies a set of points by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Point3d > mitk::operator* ( const cv::Matx44d &  M,
const std::vector< cv::Point3d > &  p 
)

multiplies a set of points by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT cv::Point3d mitk::operator* ( const cv::Mat &  M,
const cv::Point3d &  p 
)

multiplies a point by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT cv::Point3d mitk::operator* ( const cv::Matx44d &  M,
const cv::Point3d &  p 
)

multiplies a point by a 4x4 transformation matrix

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::operator* ( const cv::Point2d &  p1,
const cv::Point2d &  p2 
)

Multiplies the components of a 2d point by an integer (x=x1*x2, y=y1*y2)

NIFTKOPENCVUTILS_EXPORT cv::Point2d mitk::operator/ ( const cv::Point2d &  p1,
const int n 
)

Divides a 2d point by an integer (x=x1/n, y=y1/2)

NIFTKOPENCVUTILS_EXPORT bool mitk::operator< ( const GoldStandardPoint &  GSP1,
const GoldStandardPoint &  GSP2 
)
NIFTKOPENCVUTILS_EXPORT bool mitk::operator< ( const PickedObject &  po1,
const PickedObject &  po2 
)
std::ostream& mitk::operator<< ( std::ostream &  os,
const PickedObject &  po 
)
NIFTKOPENCVUTILS_EXPORT std::istream& mitk::operator>> ( std::istream &  is,
const GoldStandardPoint &  gsp 
)
std::istream& mitk::operator>> ( std::istream &  is,
GoldStandardPoint &  GSP 
)
std::istream& mitk::operator>> ( std::istream &  is,
PickedObject &  po 
)
NIFTKOPENCV_EXPORT 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.

Returns
RMS projection error, as projected to one camera, for each image in order.

i.e. this method is called seperately for both left and right camera.

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::PerturbTransform ( const cv::Mat  transformIn,
const double  tx,
const double  ty,
const double  tz,
const double  rx,
const double  ry,
const double  rz 
)

perturbs a 4x4 matrix with a 6 dof rigid transform. The transform is defined by three translations and 3 rotations, in Degrees

cv::Point2i NIFTKOPENCVUTILS_EXPORT mitk::Point3dToPoint2i ( const cv::Point3d &  point)

a function to cast a point3d to a point2i, checks that z is zero, throws an error is not

NIFTKOPENCVUTILS_EXPORT bool mitk::PointInInterval ( const cv::Point2d &  point,
const cv::Vec4i &  interval 
)

\ brief Returns true if the passed point falls within the limits defined by the passed interval x0,y0 = interval[0], interval[1], x1,y1 = interval[2], interval[3]

NIFTKOPENCVUTILS_EXPORT void mitk::PointPickingCallBackFunc ( int  event,
int  x,
int  y,
int  flags,
void userdata 
)

a call back function for dealing with PickedPointLists

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Point3d > mitk::PointSetToVector ( const mitk::PointSet::Pointer &  pointSet)

Converts mitk::PointSet to vector of cv::Point3d, but you lose the point ID contained within the mitk::PointSet.

NIFTKOPENCV_EXPORT 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.

Parameters
modelPointsIn3D[Nx3] matrix containing points in model coordinates.
leftCameraIntrinsic[3x3] matrix of intrinsic parameters, as output from these and OpenCV routines.
leftCameraDistortion[4x1] matrix of distortion co-efficients, as output from these and OpenCV routines.
leftCameraRotationVector[1x3] vector representing rotations (see cvRodrigues2 in OpenCV).
leftCameraTranslationVector[1x3] translation vector, along with leftCameraRotationVector represents the so-called camera extrinsic parameters.
rightCameraIntrinsicas per left
rightCameraDistortionas per left
rightToLeftRotationMatrix[3x3] rotation matrix.
rightToLeftTranslationVector[1x3] translation vector, which along with rightToLeftRotationMatrix represents the transformation of the right camera to coordinate system of the left camera.
output2DPointsLeft[Nx3] matrix of the 2D pixel location in left camera
output2DPointsRight[Nx3] matrix of the 2D pixel location in right camera
NIFTKOPENCV_EXPORT 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.

Parameters
numberSuccessfulViewsthe number of successful views from ExtractChessBoardPoints, in this documentation called 'M'.
pointCountthe number of detected points in each view, in this documentation, called 'N'.
objectPoints[(MxN)x3] list of 3D object points generated as output from ExtractChessBoardPoints.
intrinsicMatrix[3x3] matrix of pre-initialised intrinsic parameters.
distortionCoefficients[4x1] matrix of [k1, k2, p1, p2], pre-initialised.
rotationVectorsan [Mx3] matrix of rotation vectors, see also cvRodrigues2 to convert from a rotation vector to a rotation matrix.
translationVectorsan [Mx3] matrix of translation vectors.
outputImagePoints[(MxN)x2] list of 2D image points generated by calling cvProjectPoints2.
NIFTKOPENCV_EXPORT std::vector< int > mitk::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.

Returns
point IDs of the valid points
Parameters
leftCameraWorldPointsIn3D[Nx3] matrix of 3D world points
leftCameraWorldNormalsIn3D[Nx3] matrix of 3D world unit vector normals, corresponding to points in leftCameraWorldPointsIn3D
leftCameraPositionToFocalPointUnitVector[1x3] unit vector pointing from camera position to focal point (i.e. forwards).
leftCameraIntrinsic[3x3] matrix of intrinsic parameters, as output from these and OpenCV routines.
leftCameraDistortion[4x1] matrix of distortion co-efficients, as output from these and OpenCV routines.
rightCameraIntrinsicas per left
rightCameraDistortionas per left
rightToLeftRotationMatrix[3x3] rotation matrix.
rightToLeftTranslationVector[1x3] translation vector, which along with rightToLeftRotationMatrix represents the transformation of the right camera to coordinate system of the left camera.
outputLeftCameraWorldPointsIn3D[nx3] newly created matrix, that the user must de-allocate, of 3D points that were actually visible.
outputLeftCameraWorldNormalsIn3D[nx3] newly created matrix, that the user must de-allocate, of 3D unit normals that were actually visible.
output2DPointsLeft[nx3] newly created matrix, that the user must de-allocate of the 2D pixel location in left camera
output2DPointsRight[nx3] newly created matrix, that the user must de-allocate of the 2D pixel location in right camera
cropPointsToScreenoptionally you can crop the output points to only use points that fit with set limits. This is useful if it possible to pass very large valued input points as in this situation the underlying cv::undistortPoints will return the image principal point. With this parameter set the cropValue will be returned instead.
NIFTKOPENCVUTILS_EXPORT bool mitk::ReadTrackerMatrix ( const std::string filename,
cv::Mat &  outputMatrix 
)

Extracted from mitkVideoTrackerMatching, reads a 4x4 matrix into a cv::Mat, and if the matrix can't be read, will return a new matrix thats initialised according to the default OpenCV macros (i.e. unitinitialised).

Returns
true if successful and false otherwise
NIFTKOPENCVUTILS_EXPORT bool mitk::ReadTrackerMatrix ( const std::string filename,
cv::Matx44d &  outputMatrix 
)
NIFTKOPENCVUTILS_EXPORT unsigned int mitk::RemoveOutliers ( std::vector< cv::Point3d > &  points,
const double &  xLow,
const double &  xHigh,
const double &  yLow,
const double &  yHigh,
const double &  zLow,
const double &  zHigh 
)

Removes points outside the passed limits.

NIFTKOPENCVUTILS_EXPORT unsigned int mitk::RemoveOutliers ( std::vector< std::pair< cv::Point3d, double > > &  points,
const double &  xLow,
const double &  xHigh,
const double &  yLow,
const double &  yHigh,
const double &  zLow,
const double &  zHigh 
)

Removes points outside the passed limits.

NIFTKOPENCV_EXPORT cv::Point3d mitk::ReProjectPoint ( const cv::Point2d &  point,
const cv::Mat &  IntrinsicMatrix 
)

Reprojects undistorted screen points to normalised points (x/z, y/z, 1.0) in lens coordinates.

NIFTKOPENCVUTILS_EXPORT std::pair< double, double > mitk::RMSError ( std::vector< mitk::ProjectedPointPairsWithTimingError measured,
std::vector< mitk::ProjectedPointPairsWithTimingError actual,
int  index = -1,
cv::Point2d  outlierSD = cv::Point2d(2.0, 2.0),
long long  allowableTimingError = 30e6,
bool  duplicateLines = true 
)

Returns the RMS error between two projected point vectors.

Parameters
themeasured projected points
theactual projected points
optionallyconstrain calculation for only one projected point pair in each vector, if -1 all projected point pairs are used
discardpoint pairs where the error is above the mean error +/- n standard deviations.
discardpoint pairs with timing errors in excess of allowableTimingError
ifduplicateLines true, only every second entry in measured and actual is used, this is useful when running from stereo video and tracking data.
NIFTKOPENCVUTILS_EXPORT void mitk::SavePickedObjects ( const std::vector< mitk::PickedObject > &  points,
std::ostream &  os 
)

Saves a vector of picked objects.

NIFTKOPENCVUTILS_EXPORT void mitk::SaveTimeStampedPoints ( const std::vector< std::pair< unsigned long long, cv::Point3d > > &  points,
const std::string fileName 
)

Saves points to a flat text file.

NIFTKOPENCVUTILS_EXPORT bool mitk::SaveTrackerMatrix ( const std::string filename,
cv::Mat &  outputMatrix 
)

Saves a 4x4 matrix;.

Returns
true if successful and false otherwise
NIFTKOPENCVUTILS_EXPORT bool mitk::SaveTrackerMatrix ( const std::string filename,
cv::Matx44d &  outputMatrix 
)
NIFTKOPENCVUTILS_EXPORT std::vector< int > mitk::SortMatricesByAngle ( const std::vector< cv::Mat >  Matrices)

Sorts the matrices based on the rotations, and returns the order.

NIFTKOPENCVUTILS_EXPORT std::vector< int > mitk::SortMatricesByDistance ( const std::vector< cv::Mat >  Matrices)

Sorts the matrices based on the translations , and returns the order.

NIFTKOPENCVUTILS_EXPORT std::vector< cv::Point3d > mitk::SubtractPointFromPoints ( const std::vector< cv::Point3d >  listOfPoints,
const cv::Point3d &  centroid 
)

Subtracts a point (e.g. the centroid) from a list of points.

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::Tracker2ToTracker1Rotation ( const std::vector< cv::Mat > &  Tracker1ToWorld1,
const std::vector< cv::Mat > &  World2ToTracker2,
double &  Residual 
)

works out the rigid rotation correspondence between two sets of corresponding rigid body transforms

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::Tracker2ToTracker1RotationAndTranslation ( const std::vector< cv::Mat > &  Tracker1ToWorld1,
const std::vector< cv::Mat > &  World2ToTracker2,
std::vector< double > &  Residuals,
cv::Mat *  World2ToWorld1 
)

works out the rigid rotation and translation correspondence between two sets of corresponding rigid body transforms

NIFTKOPENCVUTILS_EXPORT cv::Mat mitk::Tracker2ToTracker1Translation ( const std::vector< cv::Mat > &  Tracker1ToWorld1,
const std::vector< cv::Mat > &  World2ToTracker2,
double &  Residual,
const cv::Mat &  rcg 
)

works out the rigid translation correspondence between two sets of corresponding rigid body transforms

NIFTKOPENCVUTILS_EXPORT std::pair< cv::Point3d, cv::Point3d > mitk::TransformPointPair ( const cv::Matx44d &  M,
const std::pair< cv::Point3d, cv::Point3d > &  p 
)

multiplies a point pair by a 4x4 transformation matrix

NIFTKOPENCV_EXPORT std::vector< mitk::WorldPoint > mitk::Triangulate ( const std::vector< mitk::ProjectedPointPair > &  onScreenPointPairs,
const cv::Mat &  leftIntrinsicMatrix,
const cv::Mat &  leftDistortionVector,
const cv::Mat &  rightIntrinsicMatrix,
const cv::Mat &  rightDistortionVector,
const cv::Mat &  rightToLeftRotationMatrix,
const cv::Mat &  rightToLeftTranslationVector,
const bool &  cropPointsToScreen,
const double &  xLow,
const double &  xHigh,
const double &  yLow,
const double &  yHigh,
const double &  cropValue 
)

Wrapper to triangulate vector of mitk::ProjectedPointPair to vector of mitk::WorldPoint.

NIFTKOPENCV_EXPORT 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.

Returns
the points and their triangulation error as a paired vector

Taken from: http://geomalgorithms.com/a07-_distance.html

Parameters
rightToLeftRotationMatrix[3x3] matrix representing the rotation between camera axes
rightToLeftTranslationVector[1x3] translation between camera origins
toleranceif the distance between the midpoint of the two intersected rays, and a ray is greater than the tolerance, the point is rejected.
preserveVectorSizeif true will fill any output points outside tolerance with NaN, to preserve correspondance between input and output vectors
NIFTKOPENCV_EXPORT 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.

NOTE: This is only valid up to an indeterminant scale factor.

From "Triangulation", Hartley, R.I. and Sturm, P., Computer vision and image understanding, 1997. and here. and Price 2012, Computer Vision: Models, Learning and Inference.

Parameters
leftCameraIntrinsicParams[3x3] matrix for left camera, as output by OpenCV and routines in this file.
leftCameraRotationVector[1x3] matrix for the extrinsic parameters rotation vector.
leftCameraTranslationVector[1x3] matrix for the extrinsic parameters translation vector.
rightCameraIntrinsicParams[3x3] matrix for right camera, as output by OpenCV and routines in this file.
rightCameraRotationVector[1x3] matrix for the extrinsic parameters rotation vector.
rightCameraTranslationVector[1x3] matrix for the extrinsic parameters translation vector.
outputPointsreconstructed 3D points, but only reconstructed up to a an indeterminant scale factor.
NIFTKOPENCV_EXPORT 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().

Parameters
rightToLeftRotation<Matrix[3x3] vector representing the rotation between camera axes
rightToLeftTranslationVector[1x3] translation between camera origins
NIFTKOPENCVUTILS_EXPORT std::pair< cv::Point3d, cv::Point3d > mitk::TwoPointsToPLambda ( const std::pair< cv::Point3d, cv::Point3d > &  twoPointLine)

converts a line defined by two points on the line to the same line defined by a single point and it's unit vector

Parameters
line1 define as x1 x2
Returns
lin defined as x = Q0 + lambda v
NIFTKOPENCV_EXPORT 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.

NIFTKOPENCV_EXPORT 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.

Parameters
inputObservedPointsvector of (x,y) points, as observed in a distorted image
cameraIntrinsics3x3[3x3] matrix of camera intrisic parameters.
cameraDistortionParams5x1[5x1] camera distortion params.
outputIdealPointsvector of (x,y) points, as ideal locations in an undistorted image
cropPointsToScreenoptionally you can crop the output points to only use points that fit with set limits. This is useful if it possible to pass very large valued input points as in this situation the underlying cv::undistortPoints will return the image principal point. With this parameter set the cropValue will be returned instead.
NIFTKOPENCV_EXPORT 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.

Parameters
inputObservedPointsNx2[Nx2] matrix of (x,y) points, as observed in a distorted image.
cameraIntrinsics3x3[3x3] matrix of camera intrisic parameters.
cameraDistortionParams5x1[5x1] camera distortion params.
outputIdealPointsNx2[Nx2] matrix of (x,y) points, as ideal locations in an undistorted image.
cropPointsToScreenoptionally you can crop the output points to only use points that fit with set limits. This is useful if it possible to pass very large valued input points as in this situation the underlying cv::undistortPoints will return the image principal point. With this parameter set the cropValue will be returned instead.
NIFTKOPENCV_EXPORT 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.

Parameters
inputObservedPointsvector of (x,y) points, as observed in a distorted image
cameraIntrinsics3x3[3x3] matrix of camera intrisic parameters.
cameraDistortionParams4x1[4x1] camera distortion params.
outputIdealPointsvector of (x,y) points, as ideal locations in an undistorted image
cropPointsToScreenoptionally you can crop the output points to only use points that fit with set limits. This is useful if it possible to pass very large valued input points as in this situation the underlying cv::undistortPoints will return the image principal point. With this parameter set the cropValue will be returned instead.
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.

cv::Point3d mitk::WorldToLeftLens ( cv::Point3d  PointInWorldCS,
cv::Mat &  Handeye,
cv::Mat &  Tracker 
)