public class CameraIntrinsics extends Object
Modifier and Type | Field and Description |
---|---|
Jama.Matrix |
calibrationMatrix
The camera calibration matrix
|
int |
height
The image height of the camera in pixels
|
double |
k1
First radial distortion term
|
double |
k2
Second radial distortion term
|
double |
k3
Third radial distortion term
|
double |
p1
First tangential distortion term
|
double |
p2
Second tangential distortion term
|
int |
width
The image width of the camera in pixels
|
Constructor and Description |
---|
CameraIntrinsics(Jama.Matrix m,
int width,
int height)
Construct with the given matrix.
|
Modifier and Type | Method and Description |
---|---|
Point2d |
applyDistortion(Point2d p)
Apply the radial and tangential distortion of this camera to the given
projected point (presumably computed by projecting a world point through
the homography defined by the extrinsic parameters of a camera).
|
FImage[] |
buildRectifiedUndistortionMap(int width,
int height,
CameraIntrinsics target,
Jama.Matrix R)
Build the rectified distortion map, which for every un-distorted point in
the given size image contains the x and y ordinates of the corresponding
rectifed distorted point.
|
RemapProcessor |
buildRectifiedUndistortionProcessor(int width,
int height,
CameraIntrinsics target,
Jama.Matrix R)
Build a
RemapProcessor capable of correcting the radial and
tangential distortion of this camera. |
FImage[] |
buildUndistortionMap(int width,
int height)
Build the distortion map, which for every un-distorted point in the given
size image contains the x and y ordinates of the corresponding distorted
point.
|
FImage[] |
buildUndistortionMap(int width,
int height,
CameraIntrinsics target)
Build the distortion map, which for every un-distorted point in the given
size image contains the x and y ordinates of the corresponding distorted
point.
|
RemapProcessor |
buildUndistortionProcessor()
Build a
RemapProcessor capable of correcting the radial and
tangential distortion of this camera. |
RemapProcessor |
buildUndistortionProcessor(int width,
int height)
Build a
RemapProcessor capable of correcting the radial and
tangential distortion of this camera. |
RemapProcessor |
buildUndistortionProcessor(int width,
int height,
CameraIntrinsics target)
Build a
RemapProcessor capable of correcting the radial and
tangential distortion of this camera. |
double |
getFocalLengthX()
Get the focal length in the x direction (in pixels)
|
double |
getFocalLengthY()
Get the focal length in the y direction (in pixels)
|
double |
getPrincipalPointX()
Get the x-ordinate of the principal point (in pixels).
|
double |
getPrincipalPointY()
Get the y-ordinate of the principal point (in pixels).
|
CameraIntrinsics |
getScaledIntrinsics(int newWidth,
int newHeight)
Compute a scaled set of intrinsic parameters based on the given image
size.
|
double |
getSkewFactor()
Get the skew factor.
|
void |
setFocalLengthX(double fy)
Set the focal length in the x direction (in pixels)
|
void |
setFocalLengthY(double fy)
Set the focal length in the y direction (in pixels)
|
void |
setPrincipalPointX(double cx)
Set the x-ordinate of the principal point (in pixels).
|
void |
setPrincipalPointY(double cy)
Set the y-ordinate of the principal point (in pixels).
|
void |
setSkewFactor(double skew)
Set the skew factor.
|
String |
toString() |
<I extends Image<?,I> & SinglebandImageProcessor.Processable<Float,FImage,I>> |
undistort(I image)
Undistort the given image by removing the radial and tangential
distortions of this camera.
|
public Jama.Matrix calibrationMatrix
public double k1
public double k2
public double k3
public double p1
public double p2
public int width
public int height
public CameraIntrinsics(Jama.Matrix m, int width, int height)
m
- the matrixwidth
- the image width of the camera in pixelsheight
- the image height of the camera in pixelspublic double getFocalLengthX()
public double getFocalLengthY()
public double getPrincipalPointX()
public double getPrincipalPointY()
public void setFocalLengthX(double fy)
fy
- the focal length in the x directionpublic void setFocalLengthY(double fy)
fy
- the focal length in the y directionpublic void setPrincipalPointX(double cx)
cx
- the y-ordinate of the principal pointpublic void setPrincipalPointY(double cy)
cy
- the y-ordinate of the principal pointpublic void setSkewFactor(double skew)
skew
- the skew.public double getSkewFactor()
public Point2d applyDistortion(Point2d p)
p
- the projected pointpublic CameraIntrinsics getScaledIntrinsics(int newWidth, int newHeight)
newWidth
- the target image sizenewHeight
- the target image widthpublic RemapProcessor buildUndistortionProcessor()
RemapProcessor
capable of correcting the radial and
tangential distortion of this camera.
Note: Skew is currently assumed to be zero
public RemapProcessor buildUndistortionProcessor(int width, int height)
RemapProcessor
capable of correcting the radial and
tangential distortion of this camera.
Note: Skew is currently assumed to be zero
width
- the target width of images produced by the processorheight
- the target height of images produced by the processorpublic RemapProcessor buildUndistortionProcessor(int width, int height, CameraIntrinsics target)
RemapProcessor
capable of correcting the radial and
tangential distortion of this camera. The distortion map is computed such
that the warped image will appear as if it were viewed through the
undistorted target
camera, rather than this one.
Note: Skew is currently assumed to be zero
width
- the target width of images produced by the processorheight
- the target height of images produced by the processortarget
- the target camerapublic RemapProcessor buildRectifiedUndistortionProcessor(int width, int height, CameraIntrinsics target, Jama.Matrix R)
RemapProcessor
capable of correcting the radial and
tangential distortion of this camera. The distortion map is computed such
that the warped image will appear as if it were viewed through the
undistorted target
camera rather than this one, and the
3x3matrix R
controls the rectification (i.e. the relative
change in position of the camera in world space).
Note: Skew is currently assumed to be zero
width
- the target width of images produced by the processorheight
- the target height of images produced by the processortarget
- the target cameraR
- the rectification matrixpublic FImage[] buildUndistortionMap(int width, int height)
RemapProcessor
to
undistort imaaes.
Note: Skew is currently assumed to be zero
width
- the desired width; typically the same as the image width used
to calibrate the cameraheight
- the desired height; typically the same as the image height
used to calibrate the camerapublic FImage[] buildUndistortionMap(int width, int height, CameraIntrinsics target)
RemapProcessor
to
undistort imaaes. The distortion map is computed such that the warped
image will appear as if it were viewed through the undistorted
target
camera, rather than this one.
Note: Skew is currently assumed to be zero
width
- the desired width; typically the same as the image width used
to calibrate the cameraheight
- the desired height; typically the same as the image height
used to calibrate the cameratarget
- the target camera intrinsicspublic FImage[] buildRectifiedUndistortionMap(int width, int height, CameraIntrinsics target, Jama.Matrix R)
RemapProcessor
to undistort imaaes. The distortion map is
computed such that the warped image will appear as if it were viewed
through the undistorted target
camera rather than this one,
and the 3x3matrix R
controls the rectification (i.e. the
relative change in position of the camera in world space).
Note: Skew is currently assumed to be zero
width
- the desired width; typically the same as the image width used
to calibrate the cameraheight
- the desired height; typically the same as the image height
used to calibrate the cameratarget
- the target camera intrinsicsR
- the rectification matrixpublic <I extends Image<?,I> & SinglebandImageProcessor.Processable<Float,FImage,I>> I undistort(I image)
CameraIntrinsics
.
This method is inefficient if you need to process many images as the
distortion map is computed each time. For more efficient operation, use
buildUndistortionProcessor()
to make a reusable
RemapProcessor
capable of efficiently undistorting multiple
images.
image
- the image to undistort