Skip to content

Commit

Permalink
Merge pull request #1613 from alicevision/fix/anamorphic4
Browse files Browse the repository at this point in the history
Fix errors on sfm with applyCalibration
  • Loading branch information
cbentejac authored Nov 30, 2023
2 parents c641b6b + fd58f62 commit 89d0c26
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
40 changes: 37 additions & 3 deletions src/aliceVision/camera/IntrinsicScaleOffsetDisto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,51 @@ bool IntrinsicScaleOffsetDisto::operator==(const IntrinsicBase& otherBase) const
return false;
}

int countNonNull = 0;
if (_pDistortion == nullptr)
{
countNonNull++;
}
if (other._pDistortion == nullptr)
{
countNonNull++;
}
if (countNonNull == 1)
{
return false;
}

countNonNull = 0;
if (_pUndistortion == nullptr)
{
countNonNull++;
}
if (other._pUndistortion == nullptr)
{
countNonNull++;
}
if (countNonNull == 1)
{
return false;
}

if (_pDistortion && other._pDistortion)
{
return (*_pDistortion) == (*other._pDistortion);
if (!((*_pDistortion) == (*other._pDistortion)))
{
return false;
}
}

if (_pUndistortion && other._pUndistortion)
{
return (*_pUndistortion) == (*other._pUndistortion);
if (!((*_pUndistortion) == (*other._pUndistortion)))
{
return false;
}
}

return _pDistortion == nullptr && other._pDistortion == nullptr && _pUndistortion == nullptr && other._pUndistortion == nullptr;
return true;
}

Vec2 IntrinsicScaleOffsetDisto::get_ud_pixel(const Vec2& p) const { return cam2ima(removeDistortion(ima2cam(p))); }
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ ceres::CostFunction* createCostFunctionFromIntrinsics(const IntrinsicBase* intri
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole3DEClassicLD, 2, 9, 6, 3>(
new ResidualErrorFunctor_Pinhole3DEClassicLD(w, h, obsUndistorted));
case EINTRINSIC::PINHOLE_CAMERA_3DEANAMORPHIC4:
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole, 2, 4, 6, 3>(new ResidualErrorFunctor_Pinhole(w, h, obsUndistorted));
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole, 2, 18, 6, 3>(new ResidualErrorFunctor_Pinhole(w, h, obsUndistorted));
case EINTRINSIC::PINHOLE_CAMERA_BROWN:
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_PinholeBrownT2, 2, 9, 6, 3>(
new ResidualErrorFunctor_PinholeBrownT2(w, h, obsUndistorted));
Expand Down

0 comments on commit 89d0c26

Please sign in to comment.