Camera Matrix Correction Using the Free Scaling Parameter
Source:R/calib3d.R
getOptimalNewCameraMatrix.Rd
getOptimalNewCameraMatrix
computes and returns an optimal
new camera intrinsic matrix based on the free scaling parameter alpha
.
By varying this parameter, you may retrieve only sensible pixels
alpha = 0
, keep all the original image pixels if there is valuable
information in the corners alpha = 1
, or get something in between.
When alpha > 0
, the undistorted result is likely to have some black
pixels corresponding to "virtual" pixels outside of the captured distorted
image.
Usage
getOptimalNewCameraMatrix(
camera_matrix,
dist_coefs,
nrow,
ncol,
alpha = 0,
center_principal_point = FALSE
)
Arguments
- camera_matrix
A 3x3 camera intrinsic matrix as returned by
calibrateCamera
.- dist_coefs
A single row matrix with 4, 5, 8, 12 or 14 elements as returned by
calibrateCamera
.- nrow, ncol
The number of rows and columns of the image to undistort.
- alpha
A numeric value corresponding to the free scaling parameter between 0 (only valid pixels in the the source image are retained in the undistorted image; the default) and 1 (all the source image pixels are retained in the undistorted image).
- center_principal_point
A boolean that indicates whether in the new camera intrinsic matrix the principal point should be at the image center or not (the default). The principal point is chosen to best fit a subset of the source image (determined by alpha) to the corrected image.
Value
A list:
camera_matrix
:the new 3x3 camera intrinsic matrix.
roi:
a 4-element list defining a rectangle that outlines the all-valid-pixels region in the undistorted image.
Author
Simon Garnier, garnier@njit.edu
Examples
# See the help vignette:
if (FALSE) { # \dontrun{
vignette("z8_calib", package = "Rvision")
} # }