Skip to content

Commit

Permalink
Merge pull request #1758 from alicevision/fix/applyCalibration
Browse files Browse the repository at this point in the history
[utils] Fix applyCalibration logic for isDesqueezed
  • Loading branch information
cbentejac authored Oct 11, 2024
2 parents b6393db + e2916a2 commit 9025291
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/software/utils/main_applyCalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,20 @@ bool applyJson(sfmData::SfMData & sfmData, boost::json::value & input)
double w = intrinsic->w();
double h = intrinsic->h();
double nh = h / pixelAspect;
double ratio = w / nh;
double ratio = w / h;
double ratioDesqueezed = w / nh;
double iratio = filmbackWidth / filmbackHeight;
double filmratio = filmbackWidth / filmbackHeight;

bool hasSpecialPixelAspect = (std::abs(pixelAspect - 1.0) > 1e-4);

//Compare image size ratio and filmback size ratio
bool isDesqueezed = false;
if (std::abs(ratioDesqueezed - iratio) < 1e-2)
if ((std::abs(ratio - filmratio) < 1e-2) && hasSpecialPixelAspect)
{
ALICEVISION_LOG_INFO("Input image look desqueezed");
isDesqueezed = true;
}
else if (std::abs(ratio - iratio) > 1e-2)
else if (std::abs(ratioDesqueezed - filmratio) > 1e-2)
{
ALICEVISION_LOG_ERROR("Incompatible image ratios");
return false;
Expand Down

0 comments on commit 9025291

Please sign in to comment.