Skip to content

Commit 89d0c26

Browse files
authored
Merge pull request #1613 from alicevision/fix/anamorphic4
Fix errors on sfm with applyCalibration
2 parents c641b6b + fd58f62 commit 89d0c26

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/aliceVision/camera/IntrinsicScaleOffsetDisto.cpp

+37-3
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,51 @@ bool IntrinsicScaleOffsetDisto::operator==(const IntrinsicBase& otherBase) const
2828
return false;
2929
}
3030

31+
int countNonNull = 0;
32+
if (_pDistortion == nullptr)
33+
{
34+
countNonNull++;
35+
}
36+
if (other._pDistortion == nullptr)
37+
{
38+
countNonNull++;
39+
}
40+
if (countNonNull == 1)
41+
{
42+
return false;
43+
}
44+
45+
countNonNull = 0;
46+
if (_pUndistortion == nullptr)
47+
{
48+
countNonNull++;
49+
}
50+
if (other._pUndistortion == nullptr)
51+
{
52+
countNonNull++;
53+
}
54+
if (countNonNull == 1)
55+
{
56+
return false;
57+
}
58+
3159
if (_pDistortion && other._pDistortion)
3260
{
33-
return (*_pDistortion) == (*other._pDistortion);
61+
if (!((*_pDistortion) == (*other._pDistortion)))
62+
{
63+
return false;
64+
}
3465
}
3566

3667
if (_pUndistortion && other._pUndistortion)
3768
{
38-
return (*_pUndistortion) == (*other._pUndistortion);
69+
if (!((*_pUndistortion) == (*other._pUndistortion)))
70+
{
71+
return false;
72+
}
3973
}
4074

41-
return _pDistortion == nullptr && other._pDistortion == nullptr && _pUndistortion == nullptr && other._pUndistortion == nullptr;
75+
return true;
4276
}
4377

4478
Vec2 IntrinsicScaleOffsetDisto::get_ud_pixel(const Vec2& p) const { return cam2ima(removeDistortion(ima2cam(p))); }

src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ ceres::CostFunction* createCostFunctionFromIntrinsics(const IntrinsicBase* intri
224224
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole3DEClassicLD, 2, 9, 6, 3>(
225225
new ResidualErrorFunctor_Pinhole3DEClassicLD(w, h, obsUndistorted));
226226
case EINTRINSIC::PINHOLE_CAMERA_3DEANAMORPHIC4:
227-
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole, 2, 4, 6, 3>(new ResidualErrorFunctor_Pinhole(w, h, obsUndistorted));
227+
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_Pinhole, 2, 18, 6, 3>(new ResidualErrorFunctor_Pinhole(w, h, obsUndistorted));
228228
case EINTRINSIC::PINHOLE_CAMERA_BROWN:
229229
return new ceres::AutoDiffCostFunction<ResidualErrorFunctor_PinholeBrownT2, 2, 9, 6, 3>(
230230
new ResidualErrorFunctor_PinholeBrownT2(w, h, obsUndistorted));

0 commit comments

Comments
 (0)