Skip to content

Commit

Permalink
Merge pull request #1750 from alicevision/dev/exportDistortion
Browse files Browse the repository at this point in the history
Distortion export for pipelines without lens grids
  • Loading branch information
cbentejac authored Sep 27, 2024
2 parents 573a69a + 7541fea commit b7c7a6b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/aliceVision/camera/Undistortion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class Undistortion
public:
Undistortion(int width, int height)
{
setSize(width, height);
setOffset({0.0, 0.0});
_pixelAspectRatio = 1.0;
_isDesqueezed = false;

setSize(width, height);
setOffset({0.0, 0.0});
}

virtual EUNDISTORTION getType() const = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/software/convert/main_convertDistortion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ bool convert(std::shared_ptr<camera::Undistortion> & undistortion, const camera:
calibration::PointPair ppt;
ppt.distortedPoint = pobs.second.getCoordinates();
ppt.undistortedPoint = intrinsic.getUndistortedPixel(ppt.distortedPoint);
ppt.scale = pobs.second.getScale();

Vec2 check = intrinsic.getDistortedPixel(ppt.undistortedPoint);
if ((check - ppt.distortedPoint).norm() > 1e-2)
if ((check - ppt.distortedPoint).norm() > 1e-3)
{
countErrors++;
continue;
Expand Down Expand Up @@ -170,6 +171,8 @@ int aliceVision_main(int argc, char** argv)
continue;
}

ALICEVISION_LOG_INFO("Processing intrinsic " << pairIntrinsic.first);

if (from == "distortion")
{
if (to == "undistortion")
Expand Down
6 changes: 6 additions & 0 deletions src/software/export/main_exportDistortion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,17 @@ int aliceVision_main(int argc, char* argv[])

const auto intrinsicDisto = std::dynamic_pointer_cast<IntrinsicScaleOffsetDisto>(intrinsicPtr);
if (!intrinsicDisto)
{
ALICEVISION_LOG_INFO("Intrinsic " << intrinsicId << " has incorrect format");
continue;
}

const auto undistortion = intrinsicDisto->getUndistortion();
if (!undistortion)
{
ALICEVISION_LOG_INFO("Intrinsic " << intrinsicId << " is not exported as it has no undistortion object.");
continue;
}

if (exportNukeNode)
{
Expand Down

0 comments on commit b7c7a6b

Please sign in to comment.