Camera tracking: support refining radial K1, K2 only

This commits adds extra refirenment entry in the menu which is
"K1, K2" and which will apparently refine only this distortion
coefficients.

This would be useful in cases when you know for sure focal length
(which could be obtained from lens, EXIF and so) but not sure
about how good you manual calibration is.

Be careful tho, there're no internal constraints on this
coefficients so distortion model could just screw up into insane
values.
This commit is contained in:
Sergey Sharybin 2013-02-26 11:46:38 +00:00
parent 05a5cbbda2
commit 0ec75be1c6
4 changed files with 11 additions and 3 deletions

@ -437,7 +437,9 @@ int libmv_refineParametersAreValid(int parameters) {
LIBMV_REFINE_RADIAL_DISTORTION_K1 | LIBMV_REFINE_RADIAL_DISTORTION_K1 |
LIBMV_REFINE_RADIAL_DISTORTION_K2)) || LIBMV_REFINE_RADIAL_DISTORTION_K2)) ||
(parameters == (LIBMV_REFINE_FOCAL_LENGTH | (parameters == (LIBMV_REFINE_FOCAL_LENGTH |
LIBMV_REFINE_RADIAL_DISTORTION_K1)); LIBMV_REFINE_RADIAL_DISTORTION_K1)) ||
(parameters == (LIBMV_REFINE_RADIAL_DISTORTION_K1 |
LIBMV_REFINE_RADIAL_DISTORTION_K2));
} }
static void libmv_solveRefineIntrinsics(libmv::Tracks *tracks, libmv::CameraIntrinsics *intrinsics, static void libmv_solveRefineIntrinsics(libmv::Tracks *tracks, libmv::CameraIntrinsics *intrinsics,

@ -208,6 +208,9 @@ void BundleIntrinsicsLogMessage(int bundle_intrinsics) {
} else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH | } else if (bundle_intrinsics == (BUNDLE_FOCAL_LENGTH |
BUNDLE_RADIAL_K1)) { BUNDLE_RADIAL_K1)) {
LG << "Bundling f, k1."; LG << "Bundling f, k1.";
} else if (bundle_intrinsics == (BUNDLE_RADIAL_K1 |
BUNDLE_RADIAL_K2)) {
LG << "Bundling k1, k2.";
} else { } else {
LOG(FATAL) << "Unsupported bundle combination."; LOG(FATAL) << "Unsupported bundle combination.";
} }

@ -2864,10 +2864,10 @@ static int reconstruct_refine_intrinsics_get_flags(MovieTracking *tracking, Movi
flags |= LIBMV_REFINE_PRINCIPAL_POINT; flags |= LIBMV_REFINE_PRINCIPAL_POINT;
if (refine & REFINE_RADIAL_DISTORTION_K1) if (refine & REFINE_RADIAL_DISTORTION_K1)
flags |= REFINE_RADIAL_DISTORTION_K1; flags |= LIBMV_REFINE_RADIAL_DISTORTION_K1;
if (refine & REFINE_RADIAL_DISTORTION_K2) if (refine & REFINE_RADIAL_DISTORTION_K2)
flags |= REFINE_RADIAL_DISTORTION_K2; flags |= LIBMV_REFINE_RADIAL_DISTORTION_K2;
return flags; return flags;
} }

@ -579,6 +579,9 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
{REFINE_FOCAL_LENGTH | {REFINE_FOCAL_LENGTH |
REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center",
"Refine focal length and optical center"}, "Refine focal length and optical center"},
{REFINE_RADIAL_DISTORTION_K1 |
REFINE_RADIAL_DISTORTION_K2, "RADIAL_K1_K2", 0, "K1, K2",
"Refine radial distortion K1 and K2"},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };