Class PerspectiveOps
- java.lang.Object
-
- boofcv.alg.geo.PerspectiveOps
-
public class PerspectiveOps extends java.lang.ObjectFunctions related to perspective geometry and intrinsic camera calibration.
-
-
Constructor Summary
Constructors Constructor and Description PerspectiveOps()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static IntrinsicParametersadjustIntrinsic(IntrinsicParameters parameters, org.ejml.data.DenseMatrix64F adjustMatrix, IntrinsicParameters adjustedParam)Recomputes theIntrinsicParametersgiven an adjustment matrix.static org.ejml.data.DenseMatrix64FcalibrationMatrix(double fx, double fy, double skew, double xc, double yc)Given the intrinsic parameters create a calibration matrixstatic org.ejml.data.DenseMatrix64FcalibrationMatrix(IntrinsicParameters param, org.ejml.data.DenseMatrix64F K)Given the intrinsic parameters create a calibration matrixstatic Point2D_F64convertNormToPixel(org.ejml.data.DenseMatrix64F K, Point2D_F64 norm, Point2D_F64 pixel)Convenient function for converting from normalized image coordinates to the original image pixel coordinate.static Point2D_F64convertNormToPixel(IntrinsicParameters param, double x, double y, Point2D_F64 pixel)Convenient function for converting from normalized image coordinates to the original image pixel coordinate.static Point2D_F32convertNormToPixel(IntrinsicParameters param, float x, float y, Point2D_F32 pixel)Convenient function for converting from normalized image coordinates to the original image pixel coordinate.static Point2D_F64convertNormToPixel(IntrinsicParameters param, Point2D_F64 norm, Point2D_F64 pixel)Convenient function for converting from normalized image coordinates to the original image pixel coordinate.static Point2D_F64convertPixelToNorm(org.ejml.data.DenseMatrix64F K, Point2D_F64 pixel, Point2D_F64 norm)Convenient function for converting from original image pixel coordinate to normalized< image coordinates.static Point2D_F32convertPixelToNorm(IntrinsicParameters param, Point2D_F32 pixel, Point2D_F32 norm)Convenient function for converting from original image pixel coordinate to normalized< image coordinates.static Point2D_F64convertPixelToNorm(IntrinsicParameters param, Point2D_F64 pixel, Point2D_F64 norm)Convenient function for converting from original image pixel coordinate to normalized< image coordinates.static org.ejml.data.DenseMatrix64FcreateCameraMatrix(org.ejml.data.DenseMatrix64F R, Vector3D_F64 T, org.ejml.data.DenseMatrix64F K, org.ejml.data.DenseMatrix64F ret)Create a 3x4 camera matrix.static IntrinsicParameterscreateIntrinsic(int width, int height, double hfov)Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics.static IntrinsicParameterscreateIntrinsic(int width, int height, double hfov, double vfov)Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristicsstatic WorldToCameraToPixelcreateWorldToPixel(IntrinsicParameters intrinsic, Se3_F64 worldToCamera)Creates a transform from world coordinates into pixel coordinates.static IntrinsicParametersmatrixToParam(org.ejml.data.DenseMatrix64F K, int width, int height, IntrinsicParameters param)Converts a calibration matrix into intrinsic parametersstatic Point2D_F64renderPixel(org.ejml.data.DenseMatrix64F worldToCamera, Point3D_F64 X)Computes the image coordinate of a point given its 3D location and the camera matrix.static Point2D_F64renderPixel(IntrinsicParameters intrinsic, Point3D_F64 X)Renders a point in camera coordinates into the image plane in pixels.static Point2D_F64renderPixel(Se3_F64 worldToCamera, org.ejml.data.DenseMatrix64F K, Point3D_F64 X)Renders a point in world coordinates into the image plane in pixels or normalized image coordinates.static voidscaleIntrinsic(IntrinsicParameters param, double scale)Multiplies each element of the intrinsic parameters by the provided scale factor.static voidsplitAssociated(java.util.List<AssociatedPair> pairs, java.util.List<Point2D_F64> view1, java.util.List<Point2D_F64> view2)Takes a list ofAssociatedPairas input and breaks it up into two lists for each view.static voidsplitAssociated(java.util.List<AssociatedTriple> pairs, java.util.List<Point2D_F64> view1, java.util.List<Point2D_F64> view2, java.util.List<Point2D_F64> view3)Takes a list ofAssociatedTripleas input and breaks it up into three lists for each view.
-
-
-
Method Detail
-
createIntrinsic
public static IntrinsicParameters createIntrinsic(int width, int height, double hfov, double vfov)
Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics- Parameters:
width- Image widthheight- Image heighthfov- Horizontal FOV in degreesvfov- Vertical FOV in degrees- Returns:
- guess camera parameters
-
createIntrinsic
public static IntrinsicParameters createIntrinsic(int width, int height, double hfov)
Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics. The focal length is assumed to be the same for x and y.- Parameters:
width- Image widthheight- Image heighthfov- Horizontal FOV in degrees- Returns:
- guess camera parameters
-
scaleIntrinsic
public static void scaleIntrinsic(IntrinsicParameters param, double scale)
Multiplies each element of the intrinsic parameters by the provided scale factor. Useful if the image has been rescaled.- Parameters:
param- Intrinsic parametersscale- Scale factor that input image is being scaled by.
-
adjustIntrinsic
public static IntrinsicParameters adjustIntrinsic(IntrinsicParameters parameters, org.ejml.data.DenseMatrix64F adjustMatrix, IntrinsicParameters adjustedParam)
Recomputes the
KA = A*KIntrinsicParametersgiven an adjustment matrix.
Where KA is the returned adjusted intrinsic matrix, A is the adjustment matrix and K is the original intrinsic calibration matrix.NOTE: Distortion parameters are ignored in the provided
IntrinsicParametersclass.- Parameters:
parameters- (Input) Original intrinsic parameters. Not modified.adjustMatrix- (Input) Adjustment matrix. Not modified.adjustedParam- (Output) Optional storage for adjusted intrinsic parameters. Can be null.- Returns:
- Adjusted intrinsic parameters.
-
calibrationMatrix
public static org.ejml.data.DenseMatrix64F calibrationMatrix(double fx, double fy, double skew, double xc, double yc)Given the intrinsic parameters create a calibration matrix- Parameters:
fx- Focal length x-axis in pixelsfy- Focal length y-axis in pixelsskew- skew in pixelsxc- camera center x-axis in pixelsyc- center center y-axis in pixels- Returns:
- Calibration matrix 3x3
-
calibrationMatrix
public static org.ejml.data.DenseMatrix64F calibrationMatrix(IntrinsicParameters param, org.ejml.data.DenseMatrix64F K)
Given the intrinsic parameters create a calibration matrix- Parameters:
param- Intrinsic parameters structure that is to be converted into a matrixK- Storage for calibration matrix, must be 3x3. If null then a new matrix is declared- Returns:
- Calibration matrix 3x3
-
matrixToParam
public static IntrinsicParameters matrixToParam(org.ejml.data.DenseMatrix64F K, int width, int height, IntrinsicParameters param)
Converts a calibration matrix into intrinsic parameters- Parameters:
K- Camera calibration matrix.width- Image width in pixelsheight- Image height in pixelsparam- Where the intrinsic parameter are written to. If null then a new instance is declared.- Returns:
- IntrinsicParameters structure.
-
convertNormToPixel
public static Point2D_F64 convertNormToPixel(IntrinsicParameters param, double x, double y, Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then
NormalizedToPixel_F64should be used instead.- Parameters:
param- Intrinsic camera parametersx- X-coordinate of normalized.y- Y-coordinate of normalized.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static Point2D_F32 convertNormToPixel(IntrinsicParameters param, float x, float y, Point2D_F32 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then
NormalizedToPixel_F32should be used instead.- Parameters:
param- Intrinsic camera parametersx- X-coordinate of normalized.y- Y-coordinate of normalized.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static Point2D_F64 convertNormToPixel(IntrinsicParameters param, Point2D_F64 norm, Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then
NOTE: norm and pixel can be the same instance.NormalizedToPixel_F64should be used instead.- Parameters:
param- Intrinsic camera parametersnorm- Normalized image coordinate.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static Point2D_F64 convertNormToPixel(org.ejml.data.DenseMatrix64F K, Point2D_F64 norm, Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then
NOTE: norm and pixel can be the same instance.NormalizedToPixel_F64should be used instead.- Parameters:
K- Intrinsic camera calibration matrixnorm- Normalized image coordinate.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertPixelToNorm
public static Point2D_F64 convertPixelToNorm(IntrinsicParameters param, Point2D_F64 pixel, Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PixelToNormalized_F64should be used instead.- Parameters:
param- Intrinsic camera parameterspixel- Pixel coordinatenorm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static Point2D_F32 convertPixelToNorm(IntrinsicParameters param, Point2D_F32 pixel, Point2D_F32 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PixelToNormalized_F32should be used instead.- Parameters:
param- Intrinsic camera parameterspixel- Pixel coordinatenorm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static Point2D_F64 convertPixelToNorm(org.ejml.data.DenseMatrix64F K, Point2D_F64 pixel, Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PixelToNormalized_F64should be used instead.- Parameters:
K- Intrinsic camera calibration matrixpixel- Pixel coordinate.norm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
renderPixel
public static Point2D_F64 renderPixel(Se3_F64 worldToCamera, org.ejml.data.DenseMatrix64F K, Point3D_F64 X)
Renders a point in world coordinates into the image plane in pixels or normalized image coordinates.- Parameters:
worldToCamera- Transform from world to camera frameK- Optional. Intrinsic camera calibration matrix. If null then normalized image coordinates are returned.X- 3D Point in world reference frame..- Returns:
- 2D Render point on image plane or null if it's behind the camera
-
renderPixel
public static Point2D_F64 renderPixel(IntrinsicParameters intrinsic, Point3D_F64 X)
Renders a point in camera coordinates into the image plane in pixels.- Parameters:
intrinsic- Intrinsic camera parameters.X- 3D Point in world reference frame..- Returns:
- 2D Render point on image plane or null if it's behind the camera
-
renderPixel
public static Point2D_F64 renderPixel(org.ejml.data.DenseMatrix64F worldToCamera, Point3D_F64 X)
Computes the image coordinate of a point given its 3D location and the camera matrix.- Parameters:
worldToCamera- 3x4 camera matrix for transforming a 3D point from world to image coordinates.X- 3D Point in world reference frame..- Returns:
- 2D Render point on image plane.
-
splitAssociated
public static void splitAssociated(java.util.List<AssociatedPair> pairs, java.util.List<Point2D_F64> view1, java.util.List<Point2D_F64> view2)
Takes a list ofAssociatedPairas input and breaks it up into two lists for each view.- Parameters:
pairs- Input: List of associated pairs.view1- Output: List of observations from view 1view2- Output: List of observations from view 2
-
splitAssociated
public static void splitAssociated(java.util.List<AssociatedTriple> pairs, java.util.List<Point2D_F64> view1, java.util.List<Point2D_F64> view2, java.util.List<Point2D_F64> view3)
Takes a list ofAssociatedTripleas input and breaks it up into three lists for each view.- Parameters:
pairs- Input: List of associated triples.view1- Output: List of observations from view 1view2- Output: List of observations from view 2view3- Output: List of observations from view 3
-
createCameraMatrix
public static org.ejml.data.DenseMatrix64F createCameraMatrix(org.ejml.data.DenseMatrix64F R, Vector3D_F64 T, org.ejml.data.DenseMatrix64F K, org.ejml.data.DenseMatrix64F ret)Create a 3x4 camera matrix. For calibrated camera P = [R|T]. For uncalibrated camera it is P = K*[R|T].- Parameters:
R- Rotation matrix. 3x3T- Translation vector.K- Optional camera calibration matrix 3x3.ret- Storage for camera calibration matrix. If null a new instance will be created.- Returns:
- Camera calibration matrix.
-
createWorldToPixel
public static WorldToCameraToPixel createWorldToPixel(IntrinsicParameters intrinsic, Se3_F64 worldToCamera)
Creates a transform from world coordinates into pixel coordinates. can handle lens distortion
-
-
DataMelt 3.0 © DataMelt by jWork.ORG