32 ToFScalarType imageY_in_pX = imageY * (focalLengthX / focalLengthY);
35 ToFScalarType d_in_pX = sqrt(imageX*imageX + imageY_in_pX*imageY_in_pX + focalLengthX*focalLengthX);
37 cartesianCoordinates[0] = distance * imageX / d_in_pX;
38 cartesianCoordinates[1] = distance * imageY_in_pX / d_in_pX;
39 cartesianCoordinates[2] = distance * focalLengthX / d_in_pX;
41 return cartesianCoordinates;
50 cartesianCoordinates[0] = distance * (i - principalPointX) / focalLengthX;
51 cartesianCoordinates[1] = distance * (j - principalPointY) / focalLengthY;
52 cartesianCoordinates[2] = distance;
54 return cartesianCoordinates;
60 indexCoordinatesAndDistanceValue[0] = ((cartesianPointX*focalLengthX)/cartesianPointZ) + principalPointX;
61 indexCoordinatesAndDistanceValue[1] = ((cartesianPointY*focalLengthY)/cartesianPointZ) + principalPointY;
63 if (calculateDistance)
65 indexCoordinatesAndDistanceValue[2] = cartesianPointZ;
69 indexCoordinatesAndDistanceValue[2] = 0.0;
71 return indexCoordinatesAndDistanceValue;
81 ToFScalarType imageX = (( i - principalPointX ) * interPixelDistanceX);
82 ToFScalarType imageY = (( j - principalPointY ) * interPixelDistanceY);
85 ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
87 cartesianCoordinates[0] = (distance)*imageX / d;
88 cartesianCoordinates[1] = (distance)*imageY / d;
89 cartesianCoordinates[2] = ((distance*focalLength) / d);
91 return cartesianCoordinates;
102 ToFScalarType imageX = cartesianPointX*focalLengthX/cartesianPointZ;
103 ToFScalarType imageY = cartesianPointY*focalLengthY/cartesianPointZ;
105 indexCoordinatesAndDistanceValue[0] = imageX + principalPointX;
106 indexCoordinatesAndDistanceValue[1] = imageY + principalPointY;
112 ToFScalarType imageY_in_pX = imageY * focalLengthX/focalLengthY;
115 ToFScalarType d_in_pX = sqrt(imageX*imageX + imageY_in_pX*imageY_in_pX + focalLengthX*focalLengthX);
117 if (calculateDistance)
119 indexCoordinatesAndDistanceValue[2] = d_in_pX*(cartesianPointZ) / focalLengthX;
123 indexCoordinatesAndDistanceValue[2] = 0.0;
125 return indexCoordinatesAndDistanceValue;
134 ToFScalarType imageX = cartesianPointX*focalLength/cartesianPointZ;
135 ToFScalarType imageY = cartesianPointY*focalLength/cartesianPointZ;
137 indexCoordinatesAndDistanceValue[0] = imageX/interPixelDistanceX + principalPointX;
138 indexCoordinatesAndDistanceValue[1] = imageY/interPixelDistanceY + principalPointY;
140 ToFScalarType d = sqrt(imageX*imageX + imageY*imageY + focalLength*focalLength);
142 if (calculateDistance)
144 indexCoordinatesAndDistanceValue[2] = d*(cartesianPointZ) / focalLength;
148 indexCoordinatesAndDistanceValue[2] = 0.0;
150 return indexCoordinatesAndDistanceValue;
157 cartesianCoordinates[0] = distance * (continuousIndex[0] - principalPointX) / focalLengthX;
158 cartesianCoordinates[1] = distance * (continuousIndex[1] - principalPointY) / focalLengthY;
159 cartesianCoordinates[2] = distance;
161 return cartesianCoordinates;
166 ToFScalarType viewAngle = 180*(atan2(intrinsics->GetPrincipalPointX(),intrinsics->GetFocalLengthX()) + atan2((dimX-intrinsics->GetPrincipalPointX()),intrinsics->GetFocalLengthX()))/vnl_math::pi;
itk::SmartPointer< Self > Pointer
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY)
Convert index based distances to cartesian coordinates.
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY, ToFScalarType cartesianPointZ, ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.
static ToFProcessingCommon::ToFPoint3D ContinuousKinectIndexToCartesianCoordinates(mitk::Point2D continuousIndex, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY)
ContinuousKinectIndexToCartesianCoordinates This method is escpially meant for reconstructing a Kinec...
DataCollection - Class to facilitate loading/accessing structured data.
static ToFScalarType CalculateViewAngle(mitk::CameraIntrinsics::Pointer intrinsics, unsigned int dimX)
Calculates the horizontal view angle of the camera with the given intrinsics.
static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY, ToFScalarType cartesianPointZ, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true)
Convert cartesian coordinates to index based distances.
static ToFProcessingCommon::ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY)
KinectIndexToCartesianCoordinates Convert a pixel (i,j) with value d to a 3D world point...
itk::Point< ToFScalarType, 3 > ToFPoint3D
static ToFPoint3D CartesianToKinectIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY, ToFScalarType cartesianPointZ, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true)
CartesianCoordinatesToKinectIndexCoordinates Transform a 3D world point back to distance image pixel ...
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY)
Convert index based distances to cartesian coordinates.