-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47f1a58
commit d0ed530
Showing
7 changed files
with
311 additions
and
6 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/aliceVision/sfm/bundle/costfunctions/constraintPoint.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2025 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include <aliceVision/camera/camera.hpp> | ||
|
||
namespace aliceVision { | ||
namespace sfm { | ||
|
||
struct ConstraintPointErrorFunctor | ||
{ | ||
explicit ConstraintPointErrorFunctor(const Vec3 & normal, const Vec3 & point) | ||
: _normal(normal) | ||
{ | ||
_constraintDistance = _normal.dot(point); | ||
} | ||
|
||
template<typename T> | ||
bool operator()(T const* const* parameters, T* residuals) const | ||
{ | ||
const T* parameter_point = parameters[0]; | ||
|
||
T distance = parameter_point[0] * _normal[0] + parameter_point[1] * _normal[1] + parameter_point[2] * _normal[2]; | ||
residuals[0] = 100.0 * (distance - _constraintDistance); | ||
|
||
return true; | ||
} | ||
|
||
Vec3 _normal; | ||
double _constraintDistance; | ||
}; | ||
|
||
} // namespace sfm | ||
} // namespace aliceVision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2025 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include <aliceVision/numeric/numeric.hpp> | ||
#include <aliceVision/camera/IntrinsicBase.hpp> | ||
|
||
namespace aliceVision | ||
{ | ||
namespace sfm | ||
{ | ||
|
||
class PointFetcher | ||
{ | ||
public: | ||
using uptr = std::unique_ptr<PointFetcher>; | ||
|
||
public: | ||
/** | ||
* Set the pose of the camera | ||
* @param the pose of the camera wrt some global coordinates frame | ||
*/ | ||
virtual void setPose(const geometry::Pose3 & pose) = 0; | ||
|
||
/** | ||
* @brief virtual method to get coordinates and normals of a pixel of an image | ||
* @param point result point in some global coordinates frame | ||
* @param normal result normal in some global coordinates frame | ||
* @param pose pose of the camera wrt some global coordinates frame | ||
* @param intrinsic the camera intrinsic object | ||
* @param imageCoords the input image pixel coordinates in 2D. | ||
* @return false on error | ||
*/ | ||
virtual bool peekPointAndNormal(Vec3 & point, | ||
Vec3 & normal, | ||
const camera::IntrinsicBase & intrinsic, | ||
const Vec2 & imageCoords) = 0; | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.