Skip to content

Commit

Permalink
[software] ApplyCalibration: add warnings if resolutions are not equals
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiencastan committed Mar 13, 2024
1 parent 8413ac3 commit 7aedb94
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/software/utils/main_applyCalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,28 @@ int aliceVision_main(int argc, char** argv)
const unsigned int calibrationHeight = calibratedIntrinsic->h();
const double calibrationAspect = static_cast<double>(calibrationHeight) / static_cast<double>(calibrationWidth);

// Check that aspect ratios are approximately equal
if(width != calibrationWidth || height != calibrationHeight)
{
ALICEVISION_LOG_WARNING(
"The image size used for the calibration is different from the size of the sequence.\n" <<
"Calibration size: " << calibrationWidth << "x" << calibrationHeight << "\n" <<
"Sequence size: " << width << "x" << height);
ALICEVISION_LOG_WARNING(
"Calibration image ratio: " << calibrationAspect << "\n" <<
"Sequence image ratio: " << aspect);
}

// If aspect ratios are not approximately equal
if (std::abs(aspect - calibrationAspect) > 1e-2)
{
bool distortionOnly = (isDistortionCalibrated && !isIntrinsicCalibrated);
bool smaller = (width <= calibrationWidth && height <= calibrationHeight);
ALICEVISION_LOG_WARNING("Image aspect ratios are not approximately equal, so we need more checks.");

const bool distortionOnly = (isDistortionCalibrated && !isIntrinsicCalibrated);
const bool smaller = (width <= calibrationWidth && height <= calibrationHeight);

ALICEVISION_LOG_WARNING("Distorsion is calibrated: " << isDistortionCalibrated);
ALICEVISION_LOG_WARNING("Intrinsics are calibrated: " << isIntrinsicCalibrated);
ALICEVISION_LOG_WARNING("Size is smaller than calibration: " << smaller);

if (distortionOnly == false || smaller == false)
{
Expand Down

0 comments on commit 7aedb94

Please sign in to comment.