├── .coveragerc ├── .editorconfig ├── .github └── workflows │ ├── build.yml │ └── tests.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── 3rdparty ├── demo_ASIFT_src │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── Makefile │ ├── README.txt │ ├── adam1.png │ ├── adam2.png │ ├── compute_asift_keypoints.cpp │ ├── compute_asift_keypoints.h │ ├── compute_asift_matches.cpp │ ├── compute_asift_matches.h │ ├── demo_ASIFT.cpp │ ├── demo_ASIFT.m │ ├── demo_lib_sift.cpp │ ├── demo_lib_sift.h │ ├── domain.cpp │ ├── domain.h │ ├── filter.cpp │ ├── filter.h │ ├── flimage.cpp │ ├── flimage.h │ ├── fproj.cpp │ ├── fproj.h │ ├── frot.cpp │ ├── frot.h │ ├── io_png │ │ ├── CMakeLists.txt │ │ ├── io_png.c │ │ ├── io_png.h │ │ └── libs │ │ │ ├── CMakeLists.txt │ │ │ ├── makefile │ │ │ ├── makefile.libjpeg │ │ │ ├── makefile.libpng │ │ │ ├── makefile.libtiff │ │ │ ├── makefile.zlib │ │ │ ├── png │ │ │ ├── CMakeLists.txt │ │ │ ├── LICENSE │ │ │ ├── README │ │ │ ├── example.c │ │ │ ├── png.c │ │ │ ├── png.h │ │ │ ├── pngconf.h │ │ │ ├── pngerror.c │ │ │ ├── pnggccrd.c │ │ │ ├── pngget.c │ │ │ ├── pngmem.c │ │ │ ├── pngpread.c │ │ │ ├── pngread.c │ │ │ ├── pngrio.c │ │ │ ├── pngrtran.c │ │ │ ├── pngrutil.c │ │ │ ├── pngset.c │ │ │ ├── pngtest.c │ │ │ ├── pngtrans.c │ │ │ ├── pngvcrd.c │ │ │ ├── pngwio.c │ │ │ ├── pngwrite.c │ │ │ ├── pngwtran.c │ │ │ └── pngwutil.c │ │ │ └── zlib │ │ │ ├── CMakeLists.txt │ │ │ ├── README │ │ │ ├── adler32.c │ │ │ ├── compress.c │ │ │ ├── crc32.c │ │ │ ├── crc32.h │ │ │ ├── deflate.c │ │ │ ├── deflate.h │ │ │ ├── example.c │ │ │ ├── gzio.c │ │ │ ├── infback.c │ │ │ ├── inffast.c │ │ │ ├── inffast.h │ │ │ ├── inffixed.h │ │ │ ├── inflate.c │ │ │ ├── inflate.h │ │ │ ├── inftrees.c │ │ │ ├── inftrees.h │ │ │ ├── minigzip.c │ │ │ ├── trees.c │ │ │ ├── trees.h │ │ │ ├── uncompr.c │ │ │ ├── zconf.h │ │ │ ├── zconf.in.h │ │ │ ├── zlib.h │ │ │ ├── zutil.c │ │ │ └── zutil.h │ ├── libMatch │ │ ├── CMakeLists.txt │ │ ├── match.cpp │ │ └── match.h │ ├── libNumerics │ │ ├── CMakeLists.txt │ │ ├── computeH.cpp │ │ ├── homography.cpp │ │ ├── homography.h │ │ ├── matrix.cpp │ │ ├── matrix.h │ │ ├── numerics.cpp │ │ ├── numerics.h │ │ ├── rodrigues.cpp │ │ ├── rodrigues.h │ │ └── vector.cpp │ ├── library.cpp │ ├── library.h │ ├── log.txt │ ├── numerics1.cpp │ ├── numerics1.h │ ├── orsa.cpp │ ├── orsa.h │ ├── splines.cpp │ ├── splines.h │ ├── test_demo_ASIFT.m │ └── third_party │ │ └── Eigen │ │ ├── Array │ │ ├── CMakeLists.txt │ │ ├── COPYING.GPL │ │ ├── COPYING.LGPL │ │ ├── Cholesky │ │ ├── Core │ │ ├── Dense │ │ ├── Eigen │ │ ├── Eigen2Support │ │ ├── Eigenvalues │ │ ├── Geometry │ │ ├── Householder │ │ ├── Jacobi │ │ ├── LU │ │ ├── LeastSquares │ │ ├── QR │ │ ├── QtAlignedMalloc │ │ ├── README.ipol │ │ ├── SVD │ │ ├── Sparse │ │ ├── StdDeque │ │ ├── StdList │ │ ├── StdVector │ │ └── src │ │ ├── CMakeLists.txt │ │ ├── Cholesky │ │ ├── CMakeLists.txt │ │ ├── LDLT.h │ │ └── LLT.h │ │ ├── Core │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── CMakeLists.txt │ │ ├── CommaInitializer.h │ │ ├── CwiseBinaryOp.h │ │ ├── CwiseNullaryOp.h │ │ ├── CwiseUnaryOp.h │ │ ├── CwiseUnaryView.h │ │ ├── DenseBase.h │ │ ├── DenseCoeffsBase.h │ │ ├── DenseStorage.h │ │ ├── Diagonal.h │ │ ├── DiagonalMatrix.h │ │ ├── DiagonalProduct.h │ │ ├── Dot.h │ │ ├── EigenBase.h │ │ ├── Flagged.h │ │ ├── ForceAlignedAccess.h │ │ ├── Functors.h │ │ ├── Fuzzy.h │ │ ├── GenericPacketMath.h │ │ ├── GlobalFunctions.h │ │ ├── IO.h │ │ ├── Map.h │ │ ├── MapBase.h │ │ ├── MathFunctions.h │ │ ├── Matrix.h │ │ ├── MatrixBase.h │ │ ├── NestByValue.h │ │ ├── NoAlias.h │ │ ├── NumTraits.h │ │ ├── PermutationMatrix.h │ │ ├── PlainObjectBase.h │ │ ├── Product.h │ │ ├── ProductBase.h │ │ ├── Random.h │ │ ├── Redux.h │ │ ├── Replicate.h │ │ ├── ReturnByValue.h │ │ ├── Reverse.h │ │ ├── Select.h │ │ ├── SelfAdjointView.h │ │ ├── SelfCwiseBinaryOp.h │ │ ├── SolveTriangular.h │ │ ├── StableNorm.h │ │ ├── Stride.h │ │ ├── Swap.h │ │ ├── Transpose.h │ │ ├── Transpositions.h │ │ ├── TriangularMatrix.h │ │ ├── VectorBlock.h │ │ ├── VectorwiseOp.h │ │ ├── Visitor.h │ │ ├── arch │ │ │ ├── AltiVec │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Default │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Settings.h │ │ │ ├── NEON │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ └── SSE │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── products │ │ │ ├── CMakeLists.txt │ │ │ ├── CoeffBasedProduct.h │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── GeneralMatrixMatrix.h │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ ├── GeneralMatrixVector.h │ │ │ ├── Parallelizer.h │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ ├── SelfadjointMatrixVector.h │ │ │ ├── SelfadjointProduct.h │ │ │ ├── SelfadjointRank2Update.h │ │ │ ├── TriangularMatrixMatrix.h │ │ │ ├── TriangularMatrixVector.h │ │ │ ├── TriangularSolverMatrix.h │ │ │ └── TriangularSolverVector.h │ │ └── util │ │ │ ├── BlasUtil.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── StaticAssert.h │ │ │ └── XprHelper.h │ │ ├── Eigen2Support │ │ ├── Block.h │ │ ├── CMakeLists.txt │ │ ├── Cwise.h │ │ ├── CwiseOperators.h │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── All.h │ │ │ ├── AngleAxis.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Hyperplane.h │ │ │ ├── ParametrizedLine.h │ │ │ ├── Quaternion.h │ │ │ ├── Rotation2D.h │ │ │ ├── RotationBase.h │ │ │ ├── Scaling.h │ │ │ ├── Transform.h │ │ │ └── Translation.h │ │ ├── LU.h │ │ ├── Lazy.h │ │ ├── LeastSquares.h │ │ ├── Macros.h │ │ ├── MathFunctions.h │ │ ├── Memory.h │ │ ├── Meta.h │ │ ├── Minor.h │ │ ├── QR.h │ │ ├── SVD.h │ │ ├── TriangularSolver.h │ │ └── VectorBlock.h │ │ ├── Eigenvalues │ │ ├── CMakeLists.txt │ │ ├── ComplexEigenSolver.h │ │ ├── ComplexSchur.h │ │ ├── EigenSolver.h │ │ ├── EigenvaluesCommon.h │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ ├── HessenbergDecomposition.h │ │ ├── MatrixBaseEigenvalues.h │ │ ├── RealSchur.h │ │ ├── SelfAdjointEigenSolver.h │ │ └── Tridiagonalization.h │ │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── AngleAxis.h │ │ ├── CMakeLists.txt │ │ ├── EulerAngles.h │ │ ├── Homogeneous.h │ │ ├── Hyperplane.h │ │ ├── OrthoMethods.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ ├── Translation.h │ │ ├── Umeyama.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── CMakeLists.txt │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── Jacobi │ │ ├── CMakeLists.txt │ │ └── Jacobi.h │ │ ├── LU │ │ ├── CMakeLists.txt │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── Inverse.h │ │ ├── PartialPivLU.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Inverse_SSE.h │ │ ├── QR │ │ ├── CMakeLists.txt │ │ ├── ColPivHouseholderQR.h │ │ ├── FullPivHouseholderQR.h │ │ └── HouseholderQR.h │ │ ├── SVD │ │ ├── CMakeLists.txt │ │ ├── JacobiSVD.h │ │ └── UpperBidiagonalization.h │ │ ├── Sparse │ │ ├── AmbiVector.h │ │ ├── CMakeLists.txt │ │ ├── CompressedStorage.h │ │ ├── CoreIterators.h │ │ ├── DynamicSparseMatrix.h │ │ ├── MappedSparseMatrix.h │ │ ├── SparseAssign.h │ │ ├── SparseBlock.h │ │ ├── SparseCwiseBinaryOp.h │ │ ├── SparseCwiseUnaryOp.h │ │ ├── SparseDenseProduct.h │ │ ├── SparseDiagonalProduct.h │ │ ├── SparseDot.h │ │ ├── SparseFuzzy.h │ │ ├── SparseMatrix.h │ │ ├── SparseMatrixBase.h │ │ ├── SparseProduct.h │ │ ├── SparseRedux.h │ │ ├── SparseSelfAdjointView.h │ │ ├── SparseSparseProduct.h │ │ ├── SparseTranspose.h │ │ ├── SparseTriangularView.h │ │ ├── SparseUtil.h │ │ ├── SparseVector.h │ │ ├── SparseView.h │ │ └── TriangularSolver.h │ │ ├── StlSupport │ │ ├── CMakeLists.txt │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── misc │ │ ├── CMakeLists.txt │ │ ├── Image.h │ │ ├── Kernel.h │ │ └── Solve.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CMakeLists.txt │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── MatrixCwiseBinaryOps.h │ │ └── MatrixCwiseUnaryOps.h ├── micmac_params.xml ├── msmw │ ├── CMakeLists.txt │ ├── example_calls.sh │ ├── libmw │ │ ├── CMakeLists.txt │ │ ├── fgrain.c │ │ ├── fgrain.h │ │ ├── flst │ │ │ ├── flst.c │ │ │ ├── flst_pixels.c │ │ │ ├── flst_reconstruct.c │ │ │ ├── flstb_dualchain.c │ │ │ ├── fsaddles.c │ │ │ └── mw3-modules-specific.h │ │ └── mw3 │ │ │ ├── definitions.h │ │ │ ├── error.c │ │ │ ├── error.h │ │ │ ├── fimage.c │ │ │ ├── fimage.h │ │ │ ├── fsignal.c │ │ │ ├── fsignal.h │ │ │ ├── libmw.c │ │ │ ├── libmw.h │ │ │ ├── list.c │ │ │ ├── list.h │ │ │ ├── mw3-modules.h │ │ │ ├── mw3-x11.h │ │ │ ├── mw3.h │ │ │ ├── shape.c │ │ │ └── shape.h │ ├── libraryStable │ │ ├── CMakeLists.txt │ │ ├── iio.c │ │ ├── iio.h │ │ ├── libpm_io.cpp │ │ ├── libpm_io.h │ │ ├── libraryBasic.cpp │ │ └── libraryBasic.h │ └── libstereo │ │ ├── CMakeLists.txt │ │ ├── cubic.h │ │ ├── iip_stereo_correlation.cpp │ │ ├── iip_stereo_correlation_multi_win2.cpp │ │ ├── iip_stereo_subpixel_computation.cpp │ │ ├── libstereo.cpp │ │ ├── libstereo.h │ │ ├── libstereoCV.cpp │ │ └── smartparameter.h ├── msmw2 │ ├── CMakeLists.txt │ ├── call.sh │ ├── libmw │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── fgrain.c │ │ ├── fgrain.h │ │ ├── flst │ │ │ ├── flst.c │ │ │ ├── flst_pixels.c │ │ │ ├── flst_reconstruct.c │ │ │ ├── flstb_dualchain.c │ │ │ ├── fsaddles.c │ │ │ └── mw3-modules-specific.h │ │ └── mw3 │ │ │ ├── definitions.h │ │ │ ├── error.c │ │ │ ├── error.h │ │ │ ├── fimage.c │ │ │ ├── fimage.h │ │ │ ├── fsignal.c │ │ │ ├── fsignal.h │ │ │ ├── libmw.c │ │ │ ├── libmw.h │ │ │ ├── list.c │ │ │ ├── list.h │ │ │ ├── mw3-modules.h │ │ │ ├── mw3-x11.h │ │ │ ├── mw3.h │ │ │ ├── shape.c │ │ │ └── shape.h │ ├── libraryStable │ │ ├── CMakeLists.txt │ │ ├── FindFFTW.cmake │ │ ├── iio.c │ │ ├── iio.h │ │ ├── libraryBasic.cpp │ │ └── libraryBasic.h │ └── libstereo_newversion │ │ ├── CMakeLists.txt │ │ ├── cc_postprocess.cc │ │ ├── cubic.h │ │ ├── iip_stereo_correlation_multi_win2.cpp │ │ ├── libstereo.cpp │ │ ├── libstereo.h │ │ ├── libstereo.with_lots_of_flags_Used_in_KITTI_challenge.cpp │ │ ├── ransacFIX.h │ │ ├── smartparameter.h │ │ └── vvector.h ├── sgbm │ ├── Makefile │ ├── alloc.cpp │ ├── arithm.cpp │ ├── array.cpp │ ├── convert.cpp │ ├── copy.cpp │ ├── datastructs.cpp │ ├── gpumat.cpp │ ├── iio.c │ ├── include │ │ ├── _geom.h │ │ ├── _list.h │ │ ├── calib3d.hpp │ │ ├── core.hpp │ │ ├── core_c.h │ │ ├── cuda_devptrs.hpp │ │ ├── devmem2d.hpp │ │ ├── eigen.hpp │ │ ├── gpumat.hpp │ │ ├── iio.h │ │ ├── imgproc.hpp │ │ ├── imgproc │ │ │ └── types_c.h │ │ ├── imgproc_c.h │ │ ├── internal.hpp │ │ ├── mat.hpp │ │ ├── opengl_interop.hpp │ │ ├── opengl_interop_deprecated.hpp │ │ ├── operations.hpp │ │ ├── precomp_core.hpp │ │ ├── precomp_imgproc.hpp │ │ ├── types_c.h │ │ ├── version.hpp │ │ └── wimage.hpp │ ├── lapack.cpp │ ├── mathfuncs.cpp │ ├── matmul.cpp │ ├── matop.cpp │ ├── matrix.cpp │ ├── opengl_interop.cpp │ ├── opengl_interop_deprecated.cpp │ ├── parallel.cpp │ ├── persistence.cpp │ ├── sgbm.cpp │ ├── smooth.cpp │ ├── stat.cpp │ ├── stereosgbm.cpp │ ├── system.cpp │ ├── tables_core.cpp │ └── tables_imgproc.cpp ├── stereo_hirschmuller_2002 │ ├── boofcv_readme.txt │ ├── build.xml │ ├── build │ │ └── boofcv_stereo.jar │ ├── compile.txt │ ├── pix.sh │ ├── src │ │ ├── pix.java │ │ ├── pixLoG.java │ │ ├── subpix.java │ │ └── subpixLoG.java │ ├── subpix.sh │ ├── test.sh │ └── testdata │ │ ├── a.png │ │ └── b.png └── stereo_hirschmuller_2008 │ ├── CMakeLists.txt │ ├── callSGBM.sh │ ├── callSGBM_cauchy.sh │ ├── callSGBM_lap.sh │ ├── iio.c │ ├── iio.h │ ├── sgbm.cpp │ └── sgbm2.cpp ├── Dockerfile ├── HACKERS ├── LICENSE.txt ├── MANIFEST.in ├── README.md ├── bin └── .dummy ├── c ├── abstract_dsf.c ├── backflow.c ├── bicubic.c ├── cldmask.c ├── colorcoordsf.c ├── disp_to_h.c ├── downsa.c ├── drawsegment.c ├── fail.c ├── getpixel.c ├── help_stuff.c ├── iio.c ├── iio.h ├── lists.c ├── morphoop.c ├── morsi.c ├── parsenumbers.c ├── pickopt.c ├── plambda.c ├── pview.c ├── qauto.c ├── random.c ├── read_matrix.c ├── remove_small_cc.c ├── rpc.c ├── rpc.h ├── smapa.h ├── spline.c ├── timing.c ├── timing.h ├── vvector.h ├── xfopen.c └── xmalloc.c ├── lib └── .dummy ├── makefile ├── s2p ├── __init__.py ├── block_matching.py ├── cli.py ├── common.py ├── config.py ├── estimation.py ├── evaluation.py ├── fusion.py ├── geographiclib.py ├── initialization.py ├── masking.py ├── parallel.py ├── ply.py ├── pointing_accuracy.py ├── rectification.py ├── rpc_utils.py ├── sift.py ├── triangulation.py └── visualisation.py ├── setup.cfg ├── setup.py ├── tests ├── block_matching_test.py ├── common_test.py ├── data │ ├── expected_output │ │ ├── pair │ │ │ └── dsm.tif │ │ ├── plyflatten │ │ │ └── dsm_40cm.tiff │ │ ├── triplet │ │ │ ├── dsm.tif │ │ │ └── height_map.tif │ │ └── units │ │ │ ├── F.txt │ │ │ ├── H1.txt │ │ │ ├── H2.txt │ │ │ ├── matches_on_rpc_roi.txt │ │ │ ├── unit_image_keypoints.txt │ │ │ ├── unit_keypoints_match.txt │ │ │ └── unit_matches_from_rpc.txt │ ├── input_pair │ │ ├── config.json │ │ ├── img_01.tif │ │ └── img_02.tif │ ├── input_ply │ │ └── cloud.ply │ ├── input_triangulation │ │ ├── global_pointing_pair_1.txt │ │ ├── mask.png │ │ └── pair_1 │ │ │ ├── H_ref.txt │ │ │ ├── H_sec.txt │ │ │ ├── rectified_disp.tif │ │ │ ├── rectified_mask.png │ │ │ └── rectified_ref.tif │ ├── input_triplet │ │ ├── config.json │ │ ├── img_01.tif │ │ ├── img_02.tif │ │ └── img_03.tif │ └── units │ │ ├── sift1.txt │ │ └── sift2.txt ├── end2end_test.py ├── estimation_test.py ├── evaluation_test.py ├── initialization_test.py ├── parallel_test.py ├── rasterization_test.py ├── rectification_test.py ├── rpc_utils_test.py ├── sift_test.py ├── tests_utils.py └── triangulation_test.py └── utils ├── __init__.py ├── extract_rpc_from_ntf.py ├── kml_tilemap.py ├── s2p_mosaic.py ├── s2p_to_lidarviewer.py ├── s2p_to_potree.py ├── scale_image_and_rpc.py └── svg_tilemap.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | omit = 4 | */cli.py 5 | [report] 6 | exclude_lines = 7 | if __name__ == .__main__.: 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # utf8, unix-style newlines, no end of file newline, no trailing whitespaces 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | insert_final_newline = false 11 | trim_trailing_whitespace = true 12 | 13 | # 4 space indentation 14 | [*.{py,c,cc,cpp,h,hpp}] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | # tab indentation (no size specified) 19 | [Makefile] 20 | indent_style = tab 21 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | 7 | python-packaging: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Install dependencies 11 | run: | 12 | sudo apt-get update 13 | sudo apt-get install libgdal-dev gdal-bin libfftw3-dev 14 | - uses: actions/checkout@v2 15 | with: 16 | submodules: true 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.10' 20 | - name: Build sdist 21 | run: | 22 | python -m pip install --upgrade pip 23 | python setup.py sdist 24 | - name: Test sdist install 25 | run: pip install dist/*.tar.gz 26 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | 7 | tests: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Install dependencies 11 | run: | 12 | sudo apt-get update 13 | sudo apt-get install libgdal-dev gdal-bin libfftw3-dev 14 | - uses: actions/checkout@v2 15 | with: 16 | submodules: true 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.10' 20 | - name: Install s2p 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e ".[test]" 24 | - name: Run tests 25 | run: | 26 | pyproj sync -v --file us_nga_egm96_15 27 | pytest tests -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.o 3 | *.a 4 | *.so 5 | *~ 6 | dist 7 | *.egg-info 8 | .coverage 9 | 10 | bin 11 | build 12 | .srtm 13 | experiments 14 | 3rdparty/sgbm/sgbm 15 | 3rdparty/mgm/mgm 16 | 3rdparty/tvl1flow_3/backflow 17 | 3rdparty/tvl1flow_3/tvl1flow 18 | 3rdparty/stereo_hirschmuller_2008/testdata 19 | c/sift/sift_roi 20 | c/sift/matching 21 | c/homography/homography 22 | 23 | .DS_Store 24 | ipynb 25 | 26 | iterate.dat 27 | 28 | testoutput 29 | .idea 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "3rdparty/iio"] 2 | path = 3rdparty/iio 3 | url = https://github.com/mnhrdt/iio.git 4 | ignore = untracked 5 | [submodule "3rdparty/mgm"] 6 | path = 3rdparty/mgm 7 | url = https://github.com/gfacciol/mgm.git 8 | ignore = untracked 9 | [submodule "3rdparty/tvl1flow"] 10 | path = 3rdparty/tvl1flow 11 | url = https://github.com/mnhrdt/tvl1flow.git 12 | ignore = untracked 13 | [submodule "3rdparty/mgm_multi"] 14 | path = 3rdparty/mgm_multi 15 | url = https://github.com/gfacciol/mgm.git 16 | branch = multiscale 17 | ignore = untracked 18 | [submodule "3rdparty/lsd"] 19 | path = 3rdparty/lsd 20 | url = https://github.com/cmla/lsd.git 21 | ignore = untracked 22 | [submodule "3rdparty/imscript"] 23 | path = 3rdparty/imscript 24 | url = https://github.com/mnhrdt/imscript.git 25 | ignore = untracked 26 | [submodule "3rdparty/sift"] 27 | path = 3rdparty/sift 28 | url = https://github.com/cmla/sift 29 | ignore = untracked 30 | [submodule "3rdparty/homography"] 31 | path = 3rdparty/homography 32 | url = https://github.com/cmla/homography 33 | ignore = untracked 34 | [submodule "3rdparty/msmw3"] 35 | path = 3rdparty/msmw3 36 | url = https://github.com/cmla/msmw3 37 | ignore = untracked 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: linux 2 | dist: xenial 3 | language: python 4 | python: 3.7 5 | sudo: required 6 | fast_finish: true 7 | 8 | addons: 9 | apt: 10 | sources: 11 | - sourceline: 'ppa:ubuntugis/ppa' 12 | packages: 13 | - libfftw3-dev 14 | - libgdal-dev 15 | homebrew: 16 | packages: 17 | # GDAL is already included on osx images 18 | - fftw 19 | 20 | install: 21 | - | 22 | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 23 | # Work in a virtual environment to avoid having to do 24 | # "pip3 install --user" 25 | python3 -m venv venv 26 | source venv/bin/activate 27 | fi 28 | - pip install -e ".[test]" --upgrade --upgrade-strategy eager 29 | 30 | script: pytest tests 31 | 32 | jobs: 33 | include: 34 | - stage: packaging 35 | name: "Python sdist installation" 36 | install: skip 37 | script: 38 | - python setup.py sdist 39 | - pip install dist/*.tar.gz 40 | - stage: packaging 41 | name: "Docker build" 42 | addons: skip 43 | install: skip 44 | script: docker build . 45 | 46 | - stage: test 47 | - stage: test 48 | os: osx 49 | # The default osx image (xcode9.4 as of 2019-09-30) has a very old brew, 50 | # which crashes with the `addons` feature, so we use a non-default more recent one 51 | # (see https://github.com/Homebrew/homebrew-bundle/issues/540#issuecomment-518301382) 52 | osx_image: xcode11 53 | language: generic 54 | 55 | - stage: deploy 56 | if: tag IS present AND repo = cmla/s2p 57 | install: skip 58 | script: skip 59 | deploy: 60 | - provider: pypi 61 | user: carlodef 62 | password: 63 | secure: G7hXKw6wtWtHk8MfC+3pmtZbgCLyclacsHEf6o1tEqKWy+7D5+zeKRM2IjtbckIRPiM9zSVtUyGsZiBzNu6TMKUlzrDtIl+76CdyiFjMevbF6D8KZ2tMC9lDX5Ug3LmaYn5jzFOr16/ntEnCt4wEjyob5nESKf34Uly754cf/1afBo090Jw339U1JNLa4RwEwFLmaW1TcEa8H3ZVMST1t80uiUZ/VVDXzgvdxAwIMqnxSO4nYJ/TnU4cFJAULtSGhZ/swypSvgwCrBpyzjoT6f3BkTQnUuFTYuqbmKpflY3uvMzUxUCB0ZnsLi30uQs30R7Htzz0e0kZ/4NpXHlljsvZ2rhzHXeStp2A4RSGgRVPJMlhwbGJfIXuuuzpHER/RM2SdkEohfalVSkPYF9yxIRyhk3mL2ADkFaky54bXTgZgBOfPRxU4Hdoo9l34h1Rbbv2xax0nMgPHf8YGMvM4+Hh5Jf3Ve52/WBjzlDBb18Z2YYnfLcRuCdd5EkSn16jiqjnc7rrPd5vwJxcv+8BT68qRkyIb8OwZYQ4/Bg22Uxkx7xhZJWPYXioQjYSYLAK30No9Y9Cg/3LIL1z7rzAwrjMlQobSIRjM5MX7kKj0lwmWIV+1agWefM3LIXn7Bc4tKtAf9JnEUfEQA/6FxGB/GLBS8DBu4zoYF3uQ6FKqUY= 64 | distributions: sdist 65 | on: 66 | tags: true 67 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | # Author : Pierre Moulon 4 | # Date : December 2010. 5 | # README : 6 | # The following cmake works for windows. 7 | # Openmp is accessible only on the professionnal version of Visual Studio. 8 | # In order to use OPENMP in visual your have to add the preprocessor _OPENMP 9 | # and enable OPENMP library in C/C++/Language. 10 | PROJECT(ASIFT) 11 | 12 | ADD_SUBDIRECTORY(io_png) 13 | ADD_SUBDIRECTORY(libMatch) 14 | ADD_SUBDIRECTORY(libNumerics) 15 | 16 | FIND_PACKAGE(OpenMP) 17 | if (OPENMP_FOUND) 18 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 19 | endif (OPENMP_FOUND) 20 | 21 | IF(MSVC) 22 | ADD_DEFINITIONS(/arch:SSE2) 23 | ENDIF(MSVC) 24 | 25 | IF(CMAKE_COMPILER_IS_GNUCXX) 26 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-strict-aliasing") 27 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wno-write-strings") 28 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -ansi") 29 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ftree-vectorize -funroll-loops") 30 | ENDIF(CMAKE_COMPILER_IS_GNUCXX) 31 | 32 | 33 | set(ASIFT_srcs 34 | numerics1.cpp frot.cpp splines.cpp fproj.cpp 35 | library.cpp flimage.cpp filter.cpp 36 | demo_lib_sift.cpp compute_asift_keypoints.cpp 37 | compute_asift_matches.cpp 38 | orsa.cpp demo_ASIFT.cpp 39 | 40 | io_png/io_png.c) 41 | 42 | include_directories(. 43 | ./io_png 44 | ./io_png/libs/png) 45 | 46 | 47 | add_executable(demo_ASIFT ${ASIFT_srcs}) 48 | TARGET_LINK_LIBRARIES(demo_ASIFT png zlib Match Numerics) 49 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/Makefile: -------------------------------------------------------------------------------- 1 | # C source code 2 | CSRC = io_png/io_png.c 3 | # C++ source code 4 | CXXSRC = numerics1.cpp frot.cpp splines.cpp fproj.cpp \ 5 | library.cpp flimage.cpp filter.cpp \ 6 | demo_lib_sift.cpp compute_asift_keypoints.cpp \ 7 | compute_asift_matches.cpp \ 8 | libMatch/match.cpp libNumerics/numerics.cpp \ 9 | orsa.cpp demo_ASIFT.cpp 10 | # all source code 11 | SRC = $(CSRC) $(CXXSRC) 12 | 13 | # C objects 14 | COBJ = $(CSRC:.c=.o) 15 | # C++ objects 16 | CXXOBJ = $(CXXSRC:.cpp=.o) 17 | # all objects 18 | OBJ = $(COBJ) $(CXXOBJ) 19 | # binary target 20 | BIN = demo_ASIFT 21 | 22 | default : $(BIN) 23 | 24 | # C optimization flags 25 | COPT = -O3 -ftree-vectorize -funroll-loops 26 | 27 | # C++ optimization flags 28 | CXXOPT = $(COPT) 29 | 30 | # C compilation flags 31 | CFLAGS = $(COPT) -Wall -Wextra \ 32 | -Wno-write-strings -ansi 33 | # C++ compilation flags 34 | CXXFLAGS = $(CXXOPT) -Wall -Wextra \ 35 | -Wno-write-strings -Wno-deprecated -ansi 36 | # link flags 37 | LDFLAGS = -lpng -lm 38 | 39 | # use local embedded libraries with `make LOCAL_LIBS=1` 40 | ifdef LOCAL_LIBS 41 | # library location 42 | LIBDIR = io_png/libs/build/lib 43 | INCDIR = io_png/libs/build/include 44 | # libpng is required 45 | LIBDEPS += libpng 46 | # compile options to use the local libpng header 47 | CFLAGS += -I$(INCDIR) -D_LOCAL_LIBS 48 | # link options to use the local libraries 49 | LDFLAGS = $(LIBDIR)/libpng.a $(LIBDIR)/libz.a -lm 50 | # io_png.o needs png.h 51 | io_png/io_png.o : $(LIBDEPS) 52 | endif 53 | 54 | # use openMP with `make OMP=1` 55 | ifdef OMP 56 | CFLAGS += -fopenmp 57 | CXXFLAGS += -fopenmp 58 | LDFLAGS += -lgomp 59 | else 60 | CFLAGS += -Wno-unknown-pragmas 61 | CXXFLAGS += -Wno-unknown-pragmas 62 | endif 63 | 64 | # build the local png library 65 | .PHONY : libpng 66 | libpng : 67 | $(MAKE) -C io_png/libs libpng 68 | 69 | CFLAGS += -I./io_png/ 70 | CXXFLAGS += -I./ 71 | 72 | # partial compilation of C source code 73 | %.o: %.c %.h 74 | $(CC) -c -o $@ $< $(CFLAGS) 75 | # partial compilation of C++ source code 76 | %.o: %.cpp %.h 77 | $(CXX) -c -o $@ $< $(CXXFLAGS) 78 | 79 | # link all the opject code 80 | $(BIN): $(OBJ) $(LIBDEPS) 81 | $(CXX) -o $@ $(OBJ) $(LDFLAGS) 82 | 83 | # housekeeping 84 | .PHONY : clean distclean 85 | clean : 86 | $(RM) $(OBJ) 87 | $(MAKE) -C ./io_png/libs $@ 88 | distclean : clean 89 | $(RM) $(BIN) 90 | $(MAKE) -C ./io_png/libs $@ 91 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/adam1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/demo_ASIFT_src/adam1.png -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/adam2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/demo_ASIFT_src/adam2.png -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/compute_asift_keypoints.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008-2011, Guoshen Yu 2 | // Copyright (c) 2008-2011, Jean-Michel Morel 3 | // 4 | // WARNING: 5 | // This file implements an algorithm possibly linked to the patent 6 | // 7 | // Jean-Michel Morel and Guoshen Yu, Method and device for the invariant 8 | // affine recognition recognition of shapes (WO/2009/150361), patent pending. 9 | // 10 | // This file is made available for the exclusive aim of serving as 11 | // scientific tool to verify of the soundness and 12 | // completeness of the algorithm description. Compilation, 13 | // execution and redistribution of this file may violate exclusive 14 | // patents rights in certain countries. 15 | // The situation being different for every country and changing 16 | // over time, it is your responsibility to determine which patent 17 | // rights restrictions apply to you before you compile, use, 18 | // modify, or redistribute this file. A patent lawyer is qualified 19 | // to make this determination. 20 | // If and only if they don't conflict with any patent terms, you 21 | // can benefit from the following license terms attached to this 22 | // file. 23 | // 24 | // This program is provided for scientific and educational only: 25 | // you can use and/or modify it for these purposes, but you are 26 | // not allowed to redistribute this work or derivative works in 27 | // source or executable form. A license must be obtained from the 28 | // patent right holders for any other use. 29 | // 30 | // 31 | //*------------------------ compute_asift_keypoints -------------------------*/ 32 | // Compute the ASIFT keypoints on the input image. 33 | // 34 | // Please report bugs and/or send comments to Guoshen Yu yu@cmap.polytechnique.fr 35 | // 36 | // Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image 37 | // Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009. 38 | // Reference: ASIFT online demo (You can try ASIFT with your own images online.) 39 | // http://www.ipol.im/pub/algo/my_affine_sift/ 40 | /*---------------------------------------------------------------------------*/ 41 | 42 | 43 | #include "library.h" 44 | #include "demo_lib_sift.h" 45 | #include "frot.h" 46 | #include "fproj.h" 47 | #include 48 | using namespace std; 49 | 50 | 51 | int compute_asift_keypoints(vector& image, int width, int height, int num_of_tilts, int verb, vector< vector< keypointslist > >& keys_all, siftPar &siftparameters); 52 | 53 | void GaussianBlur1D(vector& image, int width, int height, float sigma, int flag_dir); 54 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/compute_asift_matches.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008-2011, Guoshen Yu 2 | // Copyright (c) 2008-2011, Jean-Michel Morel 3 | // 4 | // WARNING: 5 | // This file implements an algorithm possibly linked to the patent 6 | // 7 | // Jean-Michel Morel and Guoshen Yu, Method and device for the invariant 8 | // affine recognition recognition of shapes (WO/2009/150361), patent pending. 9 | // 10 | // This file is made available for the exclusive aim of serving as 11 | // scientific tool to verify of the soundness and 12 | // completeness of the algorithm description. Compilation, 13 | // execution and redistribution of this file may violate exclusive 14 | // patents rights in certain countries. 15 | // The situation being different for every country and changing 16 | // over time, it is your responsibility to determine which patent 17 | // rights restrictions apply to you before you compile, use, 18 | // modify, or redistribute this file. A patent lawyer is qualified 19 | // to make this determination. 20 | // If and only if they don't conflict with any patent terms, you 21 | // can benefit from the following license terms attached to this 22 | // file. 23 | // 24 | // This program is provided for scientific and educational only: 25 | // you can use and/or modify it for these purposes, but you are 26 | // not allowed to redistribute this work or derivative works in 27 | // source or executable form. A license must be obtained from the 28 | // patent right holders for any other use. 29 | // 30 | // 31 | //*------------------------ compute_asift_matches-- -------------------------*/ 32 | // Match the ASIFT keypoints. 33 | // 34 | // Please report bugs and/or send comments to Guoshen Yu yu@cmap.polytechnique.fr 35 | // 36 | // Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image 37 | // Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009. 38 | // Reference: ASIFT online demo (You can try ASIFT with your own images online.) 39 | // http://www.ipol.im/pub/algo/my_affine_sift/ 40 | /*---------------------------------------------------------------------------*/ 41 | 42 | #include "library.h" 43 | #include "demo_lib_sift.h" 44 | #include "frot.h" 45 | #include "fproj.h" 46 | #include 47 | using namespace std; 48 | 49 | 50 | int compute_asift_matches(int num_of_tilts1, int num_of_tilts2, int w1, int h1, int w2, int h2, int verb, vector< vector< keypointslist > >& keys1, vector< vector< keypointslist > >& keys2, matchingslist &matchings, siftPar &siftparameters); 51 | 52 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/domain.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | 6 | #ifndef _DOMAIN_H_ 7 | #define _DOMAIN_H_ 8 | 9 | 10 | #include "numerics1.h" 11 | #include "library.h" 12 | #include "splines.h" 13 | 14 | 15 | /// Compute homography from n points using svd 16 | void compute_planar_homography_n_points(float *x0, float *y0, float *x1, float *y1, int n, float **H); 17 | 18 | 19 | /// Compute homography using svd + Ransac 20 | void compute_ransac_planar_homography_n_points(float *x0, float *y0, float *x1, float *y1, int n, int niter, float tolerance, float **H); 21 | 22 | /// Compute homography by using Lionel Code 23 | void compute_moisan_planar_homography_n_points(float *x0, float *y0, float *x1, float *y1, int n, int niter, float &epsilon, float **H, int &counter, int recursivity); 24 | 25 | 26 | /// Apply planar homography to image 27 | void compute_planar_homography_bounding_box(int width, int height, float **H, float *x0, float *y0, int *nwidth, int *nheight); 28 | 29 | 30 | void apply_planar_homography(float *input, int width, int height, float **H, float bg, int order, float *out, float x0, float y0, int nwidth, int nheight); 31 | 32 | 33 | /// Apply zoom of factor z 34 | void apply_zoom(float *input, float *out, float zoom, int order, int width, int height); 35 | 36 | /// Apply general transformation 37 | void apply_general_transformation(float *input, float *transformx, float* transformy, float *out, float bg, int order, int width, int height, int nwidth,int nheight); 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/filter.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | 6 | #ifndef _FILTER_H_ 7 | #define _FILTER_H_ 8 | 9 | 10 | #include "library.h" 11 | 12 | 13 | float * directional_gauss_filter(float xsigma, float ysigma, float angle, int *kwidth, int *kheight); 14 | 15 | 16 | void median(float *u,float *v, float radius, int niter, int width,int height); 17 | void remove_outliers(float *igray,float *ogray,int width, int height); 18 | 19 | /// Convolution with a separable kernel, boundary condition: 0=zero, 1=symmetry 20 | void separable_convolution(float *u, float *v, int width, int height, float *xkernel, int xsize, float *ykernel, int ysize,int boundary); 21 | 22 | void buffer_convolution(float *buffer,float *kernel,int size,int ksize); 23 | void horizontal_convolution(float *u, float *v, int width, int height, float *kernel, int ksize, int boundary); 24 | void vertical_convolution(float *u, float *v, int width, int height, float *kernel,int ksize, int boundary); 25 | 26 | void fast_separable_convolution(float *u, float *v, int width, int height,float * xkernel, int xsize,float *ykernel,int ysize,int boundary); 27 | 28 | /// Can be called with u=v 29 | void gaussian_convolution(float *u, float *v, int width, int height, float sigma); 30 | void gaussian_convolution(float *u, float *v, int width, int height, float sigma, int ksize); 31 | 32 | void convol(float *u, float *v, int width, int height, float *kernel, int kwidth, int kheight); /// Convolution with a kernel, No padding applied to the image 33 | 34 | void heat(float *u, float *v, float step, int niter, float sigma, int width, int height); 35 | 36 | 37 | #endif // _FILTER_H_ 38 | 39 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/flimage.cpp: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #include "flimage.h" 6 | 7 | 8 | 9 | //////////////////////////////////////////////// Class flimage 10 | //// Construction 11 | flimage::flimage() : width(0), height(0), p(0) 12 | { 13 | } 14 | 15 | flimage::flimage(int w, int h) : width(w), height(h), p(new float[w*h]) 16 | { 17 | for (int j=width*height-1; j>=0 ; j--) p[j] = 0.0; 18 | } 19 | 20 | 21 | flimage::flimage(int w, int h, float v) : width(w), height(h), p(new float[w*h]) 22 | { 23 | for (int j=width*height-1; j>=0 ; j--) p[j] = v; 24 | } 25 | 26 | 27 | flimage::flimage(int w, int h, float* v) : width(w), height(h), p(new float[w*h]) 28 | { 29 | for (int j=width*height-1; j>=0 ; j--) p[j] = v[j]; 30 | } 31 | 32 | 33 | void flimage::create(int w, int h) 34 | { 35 | erase(); 36 | width = w; height = h; 37 | p = new float[w*h]; 38 | for (int j=width*height-1; j>=0 ; j--) p[j] = 0.0; 39 | } 40 | 41 | void flimage::create(int w, int h, float* v) 42 | { 43 | erase(); 44 | width = w; height = h; p = new float[w*h]; 45 | for (int j=width*height-1; j>=0 ; j--) p[j] = v[j]; 46 | } 47 | 48 | 49 | flimage::flimage(const flimage& im) : width(im.width), height(im.height), p(new float[im.width*im.height]) 50 | { 51 | for (int j=width*height-1; j>=0 ; j--) p[j] = im.p[j]; 52 | } 53 | 54 | flimage& flimage::operator= (const flimage& im) 55 | { 56 | if (&im == this) { 57 | return *this; 58 | } 59 | 60 | if (width != im.width || height != im.height) 61 | { 62 | erase(); 63 | width = im.width; height=im.height; p = new float[width*height]; 64 | } 65 | 66 | for (int j=width*height-1; j>=0 ; j--) p[j] = im.p[j]; 67 | return *this; 68 | } 69 | 70 | 71 | //// Destruction 72 | void flimage::erase() 73 | { 74 | width = height = 0; 75 | if (p) delete[] p; 76 | p=0; 77 | } 78 | 79 | flimage::~flimage() 80 | { 81 | erase(); 82 | } 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/flimage.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | 6 | #ifndef _FLIMAGE_H_ 7 | #define _FLIMAGE_H_ 8 | 9 | #include 10 | #include 11 | 12 | class flimage { 13 | 14 | private: 15 | 16 | int width, height; // image size 17 | float* p; // array of color levels: level of pixel (x,y) is p[y*width+x] 18 | 19 | public: 20 | 21 | 22 | //// Construction 23 | flimage(); 24 | flimage(int w, int h); 25 | flimage(int w, int h, float v); 26 | flimage(int w, int h, float* v); 27 | flimage(const flimage& im); 28 | flimage& operator= (const flimage& im); 29 | 30 | 31 | void create(int w, int h); 32 | void create(int w, int h, float *v); 33 | 34 | //// Destruction 35 | void erase(); 36 | ~flimage(); 37 | 38 | //// Get Basic Data 39 | int nwidth() const {return width;} // image size 40 | int nheight() const {return height;} 41 | 42 | /// Access values 43 | float* getPlane() {return p;} // return the adress of the array of values 44 | 45 | float operator()(int x, int y) const {return p[ y*width + x ];} // acces to the (x,y) value 46 | float& operator()(int x, int y) {return p[ y*width + x ];} // by value (for const images) and by reference 47 | 48 | 49 | }; 50 | 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/fproj.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007 Lionel Moisan 2 | 3 | #include "library.h" 4 | #include 5 | using namespace std; 6 | 7 | //void fproj(float *in, float *out, int nx, int ny, int *sx, int *sy, float *bg, int *o, float *p, char *i, float X1, float Y1, float X2, float Y2, float X3, float Y3, float *x4, float *y4); 8 | void fproj(vector& in, vector& out, int nx, int ny, int *sx, int *sy, float *bg, int *o, float *p, char *i, float X1, float Y1, float X2, float Y2, float X3, float Y3, float *x4, float *y4); 9 | 10 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/frot.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007 Lionel Moisan 2 | 3 | #include "library.h" 4 | #include 5 | using namespace std; 6 | 7 | 8 | /*void frot(float *in, float *out, int nx, int ny, int *nx_out, int *ny_out, float *a, float *b, char *k_flag)*/ 9 | //void frot(float *, float (*)[], int, int, int *, int *, float *, float *, char *); 10 | void frot(vector&, vector&, int, int, int *, int *, float *, float *, char *); 11 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(libs) -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/io_png.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | #define IO_PNG_VERSION 0.20100727 6 | 7 | /* io_png.c */ 8 | unsigned char *read_png_u8(const char *fname, size_t *nx, size_t *ny, size_t *nc); 9 | unsigned char *read_png_u8_rgb(const char *fname, size_t *nx, size_t *ny); 10 | unsigned char *read_png_u8_gray(const char *fname, size_t *nx, size_t *ny); 11 | float *read_png_f32(const char *fname, size_t *nx, size_t *ny, size_t *nc); 12 | float *read_png_f32_rgb(const char *fname, size_t *nx, size_t *ny); 13 | float *read_png_f32_gray(const char *fname, size_t *nx, size_t *ny); 14 | int write_png_u8(const char *fname, const unsigned char *data, size_t nx, size_t ny, size_t nc); 15 | int write_png_f32(const char *fname, const float *data, size_t nx, size_t ny, size_t nc); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(zlib) 2 | ADD_SUBDIRECTORY(png) -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Nicolas Limare 2 | # 3 | # Copying and distribution of this file, with or without 4 | # modification, are permitted in any medium without royalty provided 5 | # the copyright notice and this notice are preserved. This file is 6 | # offered as-is, without any warranty. 7 | # 8 | # This makefile imports and compiles libraries libraries 9 | # for local use in static form 10 | 11 | DEST_DIR = build 12 | LIB_DIR = $(DEST_DIR)/lib 13 | INC_DIR = $(DEST_DIR)/include 14 | 15 | # 16 | # COMMON 17 | # 18 | 19 | default : all 20 | all : zlib libpng libtiff libjpeg 21 | 22 | $(LIB_DIR) $(INC_DIR) : 23 | mkdir -p $@ 24 | $(LIB_DIR)/% $(INC_DIR)/% : 25 | cp $(filter %.h %.a, $^) $@ 26 | 27 | 28 | -include makefile.zlib 29 | -include makefile.libpng 30 | -include makefile.libjpeg 31 | -include makefile.libtiff 32 | 33 | # 34 | # HOUSEKEEPING 35 | # 36 | 37 | .PHONY : clean distclean scrub 38 | clean : 39 | $(RM) -r $(ZLIB_DIR) 40 | $(RM) -r $(LIBPNG_DIR) 41 | $(RM) -r $(LIBJPEG_DIR) 42 | $(RM) -r $(LIBTIFF_DIR) 43 | distclean : clean 44 | $(RM) -r $(DEST_DIR) 45 | scrub : distclean 46 | $(RM) $(ZLIB_ARC) 47 | $(RM) $(LIBPNG_ARC) 48 | $(RM) $(LIBJPEG_ARC) 49 | $(RM) $(LIBTIFF_ARC) 50 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/makefile.libjpeg: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Nicolas Limare 2 | # 3 | # Copying and distribution of this file, with or without 4 | # modification, are permitted in any medium without royalty provided 5 | # the copyright notice and this notice are preserved. This file is 6 | # offered as-is, without any warranty. 7 | # 8 | # This makefile imports and compiles libraries libraries 9 | # for local use in static form 10 | 11 | LIBJPEG_LIB = $(LIB_DIR)/libjpeg.a 12 | LIBJPEG_INC = $(addprefix $(INC_DIR), jconfig.h jerror.h jmorecfg.h jpeglib.h) 13 | LIBJPEG_FILES = $(LIBJPEG_LIB) $(LIBJPEG_INC) 14 | LIBJPEG_DIR = jpeg-8b 15 | LIBJPEG_ARC = jpegsrc.v8b.tar.gz 16 | LIBJPEG_URL = http://www.ijg.org/files/jpegsrc.v8b.tar.gz 17 | 18 | # 19 | # LIBJPEG 20 | # 21 | 22 | .PHONY : libjpeg 23 | libjpeg : $(LIBJPEG_DIR) 24 | 25 | $(LIBJPEG_FILES) : $(LIB_DIR) $(INC_DIR) 26 | $(LIB_DIR)/libjpeg.a : $(LIBJPEG_DIR)/lib/libjpeg.a 27 | $(INC_DIR)/jconfig.h : $(LIBJPEG_DIR)/include/jconfig.h 28 | $(INC_DIR)/jerror.h : $(LIBJPEG_DIR)/include/jerror.h 29 | $(INC_DIR)/jmorecfg.h : $(LIBJPEG_DIR)/include/jmorecfg.h 30 | $(INC_DIR)/jpeglib.h : $(LIBJPEG_DIR)/include/jpeglib.h 31 | 32 | $(LIBJPEG_DIR)/lib/libjpeg.a : $(LIBJPEG_DIR) 33 | cd ./$(LIBJPEG_DIR)/; ./configure \ 34 | --enable-static \ 35 | --disable-shared \ 36 | --prefix=$$PWD 37 | $(MAKE) -C $(LIBJPEG_DIR) libjpeg.la 38 | $(MAKE) -C $(LIBJPEG_DIR) install 39 | $(LIBJPEG_DIR)/jconfig.h : $(LIBJPEG_DIR) 40 | $(LIBJPEG_DIR)/jerror.h : $(LIBJPEG_DIR) 41 | $(LIBJPEG_DIR)/jmorecfg.h : $(LIBJPEG_DIR) 42 | $(LIBJPEG_DIR)/jpeglib.h : $(LIBJPEG_DIR) 43 | 44 | $(LIBJPEG_DIR) : $(LIBJPEG_ARC) 45 | tar xvzf $< 46 | touch $@ 47 | 48 | $(LIBJPEG_ARC) : 49 | curl -L $(LIBJPEG_URL) > $@ 50 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/makefile.libpng: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Nicolas Limare 2 | # 3 | # Copying and distribution of this file, with or without 4 | # modification, are permitted in any medium without royalty provided 5 | # the copyright notice and this notice are preserved. This file is 6 | # offered as-is, without any warranty. 7 | # 8 | # This makefile imports and compiles libraries libraries 9 | # for local use in static form 10 | 11 | LIBPNG_LIB = $(LIB_DIR)/libpng.a 12 | LIBPNG_INC = $(addprefix $(INC_DIR)/, png.h pngconf.h) 13 | LIBPNG_FILES = $(LIBPNG_LIB) $(LIBPNG_INC) 14 | LIBPNG_DIR = libpng-1.4.3 15 | LIBPNG_ARC = libpng-1.4.3.tar.gz 16 | LIBPNG_URL = http://sourceforge.net/projects/libpng/files/01-libpng-master/1.4.3/libpng-1.4.3.tar.gz/download 17 | 18 | # 19 | # LIBPNG 20 | # 21 | 22 | .PHONY : libpng 23 | libpng : $(LIBPNG_FILES) 24 | 25 | $(LIBPNG_FILES) : $(LIB_DIR) $(INC_DIR) 26 | $(LIB_DIR)/libpng.a : $(LIBPNG_DIR)/lib/libpng.a 27 | $(INC_DIR)/png.h : $(LIBPNG_DIR)/png.h 28 | $(INC_DIR)/pngconf.h : $(LIBPNG_DIR)/pngconf.h 29 | 30 | $(LIBPNG_DIR)/lib/libpng.a : $(LIBPNG_DIR) $(ZLIB_FILES) 31 | cd ./$(LIBPNG_DIR)/; ./configure \ 32 | --enable-static \ 33 | --disable-shared \ 34 | --prefix=$$PWD 35 | $(MAKE) -C $(LIBPNG_DIR) libpng14.la ZLIBLIB=../ ZLIBINC=../ 36 | $(MAKE) -C $(LIBPNG_DIR) install 37 | $(LIBPNG_DIR)/png.h : $(LIBPNG_DIR) 38 | $(LIBPNG_DIR)/pngconf.h : $(LIBPNG_DIR) 39 | 40 | $(LIBPNG_DIR) : $(LIBPNG_ARC) 41 | tar xvzf $< 42 | touch $@ 43 | 44 | $(LIBPNG_ARC) : 45 | curl -L $(LIBPNG_URL) > $@ 46 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/makefile.libtiff: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Nicolas Limare 2 | # 3 | # Copying and distribution of this file, with or without 4 | # modification, are permitted in any medium without royalty provided 5 | # the copyright notice and this notice are preserved. This file is 6 | # offered as-is, without any warranty. 7 | # 8 | # This makefile imports and compiles libraries libraries 9 | # for local use in static form 10 | 11 | LIBTIFF_LIB = $(LIB_DIR)/libtiff.a 12 | LIBTIFF_INC = $(addprefix $(INC_DIR)/, tiffconf.h tiff.h tiffio.h tiffvers.h) 13 | LIBTIFF_FILES = $(LIBTIFF_LIB) $(LIBTIFF_INC) 14 | LIBTIFF_DIR = tiff-3.9.4 15 | LIBTIFF_ARC = tiff-3.9.4.tar.gz 16 | LIBTIFF_URL = http://download.osgeo.org/libtiff/tiff-3.9.4.tar.gz 17 | 18 | # 19 | # LIBTIFF 20 | # 21 | 22 | .PHONY : libtiff 23 | libtiff : $(LIBTIFF_FILES) 24 | 25 | $(LIBTIFF_FILES) : $(LIB_DIR) $(INC_DIR) 26 | $(LIB_DIR)/libtiff.a : $(LIBTIFF_DIR)/lib/libtiff.a 27 | $(INC_DIR)/tiff.h : $(LIBTIFF_DIR)/include/tiff.h 28 | $(INC_DIR)/tiffio.h : $(LIBTIFF_DIR)/include/tiffio.h 29 | $(INC_DIR)/tiffconf.h : $(LIBTIFF_DIR)/include/tiffconf.h 30 | $(INC_DIR)/tiffvers.h : $(LIBTIFF_DIR)/include/tiffvers.h 31 | 32 | $(LIBTIFF_DIR)/lib/libtiff.a : $(LIBTIFF_DIR) $(ZLIB_FILES) $(LIBJPEG_FILES) 33 | cd ./$(LIBTIFF_DIR)/; ./configure \ 34 | --with-zlib-include-dir=../ \ 35 | --with-zlib-lib-dir=../ \ 36 | --with-jpeg-include-dir=../ \ 37 | --with-jpeg-lib-dir=../ \ 38 | --disable-cxx \ 39 | --enable-static \ 40 | --disable-shared \ 41 | --disable-rpath --prefix=$$PWD 42 | $(MAKE) -C $(LIBTIFF_DIR)/port libport.la 43 | $(MAKE) -C $(LIBTIFF_DIR)/libtiff libtiff.la 44 | $(MAKE) -C $(LIBTIFF_DIR)/libtiff install 45 | $(LIBTIFF_DIR)/include/tiff.h : $(LIBTIFF_DIR) 46 | $(LIBTIFF_DIR)/include/tiffio.h : $(LIBTIFF_DIR) 47 | $(LIBTIFF_DIR)/include/tiffconf.h : $(LIBTIFF_DIR) 48 | $(LIBTIFF_DIR)/include/tiffvers.h : $(LIBTIFF_DIR) 49 | 50 | $(LIBTIFF_DIR) : $(LIBTIFF_ARC) 51 | tar xvzf $< 52 | touch $@ 53 | 54 | $(LIBTIFF_ARC) : 55 | curl -L $(LIBTIFF_URL) > $@ 56 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/makefile.zlib: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Nicolas Limare 2 | # 3 | # Copying and distribution of this file, with or without 4 | # modification, are permitted in any medium without royalty provided 5 | # the copyright notice and this notice are preserved. This file is 6 | # offered as-is, without any warranty. 7 | # 8 | # This makefile imports and compiles libraries libraries 9 | # for local use in static form 10 | 11 | ZLIB_LIB = $(LIB_DIR)/libz.a 12 | ZLIB_INC = $(addprefix $(INC_DIR)/, zlib.h zconf.h) 13 | ZLIB_FILES = $(ZLIB_LIB) $(ZLIB_INC) 14 | ZLIB_DIR = zlib-1.2.5 15 | ZLIB_ARC = zlib-1.2.5.tar.gz 16 | ZLIB_URL = http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz/download 17 | 18 | # 19 | # ZLIB 20 | # 21 | 22 | .PHONY : zlib 23 | zlib : $(ZLIB_FILES) 24 | 25 | $(ZLIB_FILES) : $(LIB_DIR) $(INC_DIR) 26 | $(LIB_DIR)/libz.a : $(ZLIB_DIR)/libz.a 27 | $(INC_DIR)/zlib.h : $(ZLIB_DIR)/zlib.h 28 | $(INC_DIR)/zconf.h : $(ZLIB_DIR)/zconf.h 29 | 30 | $(ZLIB_DIR)/libz.a : $(ZLIB_DIR) 31 | cd ./$(ZLIB_DIR)/; ./configure --static 32 | $(MAKE) -C $(ZLIB_DIR) libz.a 33 | $(ZLIB_DIR)/zlib.h : $(ZLIB_DIR) 34 | $(ZLIB_DIR)/zconf.h : $(ZLIB_DIR) 35 | 36 | $(ZLIB_DIR) : $(ZLIB_ARC) 37 | tar xvzf $< 38 | touch $@ 39 | 40 | $(ZLIB_ARC) : 41 | curl -L $(ZLIB_URL) > $@ 42 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/png/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(png) 2 | 3 | SET(PNG_SRCS 4 | pngget.c pngrio.c pngwrite.c png.c pngmem.c pngrtran.c pngtrans.c 5 | pngwtran.c pngerror.c pngpread.c pngrutil.c pngvcrd.c pngwutil.c pnggccrd.c 6 | pngread.c pngset.c pngwio.c pngconf.h png.h 7 | ) 8 | 9 | IF (WIN32) 10 | ADD_DEFINITIONS(-DPNG_STATIC) 11 | # TODO(keir): I don't know why, but CMake *refuses* to add this to the 12 | # command line flags. After much frustration, I am giving up and leaving the 13 | # compile errors. Please, someone who knows CMake, try to fix this. 14 | SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") 15 | ENDIF (WIN32) 16 | 17 | INCLUDE_DIRECTORIES(../zlib) 18 | ADD_LIBRARY(png ${PNG_SRCS} ) 19 | TARGET_LINK_LIBRARIES(png zlib) 20 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/png/pngvcrd.c: -------------------------------------------------------------------------------- 1 | /* pnggvrd.c was removed from libpng-1.2.20. */ 2 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/zlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(zlib) 2 | 3 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) 4 | 5 | ADD_LIBRARY(zlib STATIC 6 | adler32.c compress.c crc32.c deflate.c gzio.c infback.c 7 | inffast.c inflate.c inftrees.c minigzip.c trees.c uncompr.c 8 | zutil.c crc32.h deflate.h inffast.h inffixed.h inflate.h 9 | inftrees.h trees.h zconf.h zconf.in.h zlib.h zutil.h 10 | ) 11 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/zlib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (Bytef*)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; 79 | } 80 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of dynamic tree. The maximum found in a long but non- 39 | exhaustive search was 1444 code structures (852 for length/literals 40 | and 592 for distances, the latter actually the result of an 41 | exhaustive search). The true maximum is not known, but the value 42 | below is more than safe. */ 43 | #define ENOUGH 2048 44 | #define MAXD 592 45 | 46 | /* Type of code to build for inftable() */ 47 | typedef enum { 48 | CODES, 49 | LENS, 50 | DISTS 51 | } codetype; 52 | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, 54 | unsigned codes, code FAR * FAR *table, 55 | unsigned FAR *bits, unsigned short FAR *work)); 56 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/io_png/libs/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | This function can be used to decompress a whole file at once if the 20 | input file is mmap'ed. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 23 | enough memory, Z_BUF_ERROR if there was not enough room in the output 24 | buffer, or Z_DATA_ERROR if the input data was corrupted. 25 | */ 26 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 27 | Bytef *dest; 28 | uLongf *destLen; 29 | const Bytef *source; 30 | uLong sourceLen; 31 | { 32 | z_stream stream; 33 | int err; 34 | 35 | stream.next_in = (Bytef*)source; 36 | stream.avail_in = (uInt)sourceLen; 37 | /* Check for source > 64K on 16-bit machine: */ 38 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 39 | 40 | stream.next_out = dest; 41 | stream.avail_out = (uInt)*destLen; 42 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 43 | 44 | stream.zalloc = (alloc_func)0; 45 | stream.zfree = (free_func)0; 46 | 47 | err = inflateInit(&stream); 48 | if (err != Z_OK) return err; 49 | 50 | err = inflate(&stream, Z_FINISH); 51 | if (err != Z_STREAM_END) { 52 | inflateEnd(&stream); 53 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 54 | return Z_DATA_ERROR; 55 | return err; 56 | } 57 | *destLen = stream.total_out; 58 | 59 | err = inflateEnd(&stream); 60 | return err; 61 | } 62 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libMatch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | PROJECT(libMatch) 4 | 5 | ADD_LIBRARY(Match 6 | match.cpp match.h) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libMatch/match.cpp: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #include "match.h" 6 | #include 7 | #include 8 | 9 | bool loadMatch(const char* nameFile, std::vector& match) { 10 | match.clear(); 11 | std::ifstream f(nameFile); 12 | while( f.good() ) { 13 | std::string str; 14 | std::getline(f, str); 15 | if( f.good() ) { 16 | std::istringstream s(str); 17 | Match m; 18 | s >> m.x1 >> m.y1 >> m.x2 >> m.y2; 19 | if(!s.fail() ) 20 | match.push_back(m); 21 | } 22 | } 23 | return !match.empty(); 24 | } 25 | 26 | bool saveMatch(const char* nameFile, const std::vector& match) { 27 | std::ofstream f(nameFile); 28 | if( f.is_open() ) { 29 | std::vector::const_iterator it = match.begin(); 30 | for(; it != match.end(); ++it) 31 | f << it->x1 << " " << it->y1 << " " 32 | << it->x2 << " " << it->y2 << std::endl; 33 | } 34 | return f.is_open(); 35 | } 36 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libMatch/match.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #ifndef MATCH_H 6 | #define MATCH_H 7 | 8 | #include 9 | 10 | struct Match { 11 | float x1, y1, x2, y2; 12 | }; 13 | 14 | bool loadMatch(const char* nameFile, std::vector& match); 15 | bool saveMatch(const char* nameFile, const std::vector& match); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libNumerics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | PROJECT(libNumerics) 4 | 5 | INCLUDE_DIRECTORIES(..) 6 | 7 | ADD_LIBRARY(Numerics 8 | computeH.cpp 9 | homography.cpp homography.h 10 | matrix.cpp matrix.h 11 | numerics.cpp numerics.h 12 | rodrigues.cpp rodrigues.h 13 | vector.cpp) 14 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libNumerics/homography.cpp: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #include "homography.h" 6 | 7 | namespace libNumerics { 8 | 9 | /// Constructor. 10 | Homography::Homography() 11 | : m_H( matrix::eye(3) ) 12 | {} 13 | 14 | /// Put to identity. 15 | void Homography::setId() 16 | { 17 | m_H = matrix::eye(3); 18 | } 19 | 20 | /// Set to translation. 21 | void Homography::setTrans(double dx, double dy) 22 | { 23 | setId(); 24 | m_H(0,2) = dx; 25 | m_H(1,2) = dy; 26 | } 27 | 28 | /// Set to zoom. 29 | void Homography::setZoom(double zx, double zy) 30 | { 31 | setId(); 32 | m_H(0,0) = zx; 33 | m_H(1,1) = zy; 34 | } 35 | 36 | /// Apply homography. 37 | void Homography::operator()(double& x, double& y) const 38 | { 39 | vector m(3); 40 | m(0) = x; 41 | m(1) = y; 42 | m(2) = 1.0f; 43 | m = m_H * m; 44 | double z_1 = 1.0 / m(2); 45 | x = m(0) * z_1; 46 | y = m(1) * z_1; 47 | } 48 | 49 | /// Compose homographies. 50 | Homography Homography::operator*(const Homography& rhs) const 51 | { 52 | Homography h; 53 | h.m_H = m_H * rhs.m_H; 54 | h.normalize(); 55 | return h; 56 | } 57 | 58 | /// Inverse homography. 59 | Homography Homography::inverse() const 60 | { 61 | Homography h; 62 | h.m_H = m_H.inv(); 63 | h.normalize(); 64 | return h; 65 | } 66 | 67 | /// Put coef(2,2) to 1. 68 | void Homography::normalize() 69 | { 70 | m_H /= m_H(2,2); 71 | } 72 | 73 | } // libNumerics 74 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libNumerics/numerics.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #ifndef NUMERICS_H 6 | #define NUMERICS_H 7 | 8 | #include "matrix.h" 9 | #include 10 | 11 | namespace libNumerics { 12 | class NumericsException {}; 13 | class SvdConvergenceError : public NumericsException {}; 14 | typedef double flnum; 15 | 16 | /// Solve system AX = B. 17 | bool solveLU(const matrix& A, const vector& B, 18 | vector& X); 19 | bool solveLU(matrix A, vector& B); 20 | 21 | /// Singular Value Decomposition 22 | class SVD { 23 | public: 24 | SVD(const matrix& A); 25 | matrix& U() { return m_U; } 26 | vector& W() { return m_W; } 27 | matrix& V() { return m_V; } 28 | matrix compose() const; 29 | 30 | private: 31 | matrix m_U, m_V; 32 | vector m_W; 33 | static flnum withSignOf(flnum a, flnum b); 34 | static flnum hypot(flnum a, flnum b); 35 | static void rotate(flnum& a, flnum& b, flnum c, flnum s); 36 | void compute(); 37 | void sort(); 38 | }; 39 | 40 | /// Levenberg-Marquardt minimization. 41 | class MinLM { 42 | static const flnum DEFAULT_RELATIVE_TOL; 43 | static const flnum DEFAULT_LAMBDA_INIT; 44 | static const flnum DEFAULT_LAMBDA_FACT; 45 | static const flnum EPSILON_KERNEL; 46 | public: 47 | MinLM(); 48 | flnum minimize(vector& P, const vector& ydata, 49 | flnum targetRMSE=0.1, int maxIters=300); 50 | virtual void modelData(const vector& P, 51 | vector& ymodel) const = 0; 52 | virtual void modelJacobian(const vector& P, 53 | matrix& J) const = 0; 54 | int iterations; 55 | flnum relativeTol; 56 | flnum lambdaInit; 57 | flnum lambdaFact; 58 | private: 59 | std::vector m_nullCols; 60 | void compress(matrix& JtJ, vector& B); 61 | void uncompress(vector& B); 62 | }; 63 | 64 | } // namespace libNumerics 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libNumerics/rodrigues.cpp: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #ifdef RODRIGUES_H 6 | 7 | namespace libNumerics { 8 | 9 | template 10 | matrix skew(const vector& v) 11 | { 12 | assert(v.nrow() == 3); 13 | matrix M(3,3); 14 | M(0,0) = M(1,1) = M(2,2) = 0; 15 | M(1,2) = -(M(2,1)=v(0)); 16 | M(2,0) = -(M(0,2)=v(1)); 17 | M(0,1) = -(M(1,0)=v(2)); 18 | return M; 19 | } 20 | 21 | template 22 | matrix rotation(vector w) 23 | { 24 | assert(w.nrow() == 3); 25 | T n = sqrt(w.qnorm()); 26 | T c = cos(n); 27 | matrix R = c*matrix::eye(3); 28 | if(n) { 29 | w /= n; 30 | R += skew(sin(n)*w); 31 | R += (1-c)*w*w.t(); 32 | } 33 | return R; 34 | } 35 | 36 | template 37 | vector rotationAxis(const matrix& R) 38 | { 39 | assert(R.nrow() == 3 && R.ncol() == 3); 40 | vector w(3); 41 | T n = acos(0.5*(R.tr()-1)); 42 | if(n == 0) 43 | w = 0; 44 | else { 45 | w(0) = R(2,1)-R(1,2); 46 | w(1) = R(0,2)-R(2,0); 47 | w(2) = R(1,0)-R(0,1); 48 | w *= n/(2*sin(n)); 49 | } 50 | return w; 51 | } 52 | 53 | } // libNumerics 54 | 55 | #endif // RODRIGUES_H 56 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/libNumerics/rodrigues.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #ifndef RODRIGUES_H 6 | #define RODRIGUES_H 7 | 8 | #include "matrix.h" 9 | #include 10 | 11 | namespace libNumerics { 12 | 13 | /// Skew-symmetric matrix of 3-vector v. 14 | template matrix skew(const vector& v); 15 | /// Rodrigues's rotation: exp(w_x). 16 | template matrix rotation(vector w); 17 | /// Inverse Rodrigues's formula: w s.t. R=exp(w_x). 18 | template vector rotationAxis(const matrix& R); 19 | 20 | } // libNumerics 21 | 22 | #include "rodrigues.cpp" 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/log.txt: -------------------------------------------------------------------------------- 1 | - 2010.04.08, Pierre Moulon 2 | Use Eigen matrix library in order to compute the SVD in ORSA. 3 | Add a Cmake based build, for easier compilation on Windows. 4 | 5 | - 2010.11.08, Guoshen Yu 6 | Remove a few minor bugs in orsa.cpp. 7 | Code compiled with Intel C++ and Visual C++ compilers under Windows (32 bits). Both OpenMP and vectorization work with Intel C++. OpenMP but vectorization withs with Visual C++. 8 | 9 | - 2010.08.17, Guoshen Yu 10 | In compute_asift_matches.c, change the nfa_max value from 0 to -2 to reduce false matching. 11 | 12 | - 2010.08.28, Guoshen Yu 13 | In demo_lib_sift.cpp, change par.MatchRatio from 0.75 to 0.73 to reduce et number of false matches. 14 | In demo_ASIFT.cpp, change the image resize target dimension from 640x480 to 800x600. 15 | In demo_ASIFT.cpp, add a white band between the images in the output image for better visibility. 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/numerics1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/demo_ASIFT_src/numerics1.cpp -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/numerics1.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | 6 | #ifndef _NUMERICS_H_ 7 | #define _NUMERICS_H_ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | #include "library.h" 17 | 18 | #define NRMAX(i,j) ( (i)<(j) ? (j):(i) ) 19 | #define NRMIN(i,j) ( (i)<(j) ? (i):(j) ) 20 | #define NRTINY 1.0e-10 21 | 22 | 23 | // ********************************************** 24 | // float ** basic functions 25 | // ********************************************** 26 | 27 | float ** allocate_float_matrix(int nrows, int ncols); 28 | 29 | void desallocate_float_matrix(float **matrix, int nrows, int ncols); 30 | 31 | // ********************************************** 32 | // LU based algorithms 33 | // ********************************************** 34 | 35 | // Solves Ax=b by using lu decomposition 36 | // a matrix a[1..n][1..n] is replaced by the LU decompositions of a rowwise permutation of itself 37 | // b[1..n] and x[1..n] 38 | int lusolve(float **a, float *x, float *b, int n); 39 | 40 | 41 | /*-- LU decomposition */ 42 | /* Given a matrix a[1..n][1..n] this routine replacess it by the LU decompositions of a rowwise permutation of itself. */ 43 | /* a and n are input, a is output, arranged as in equation (2.3.14) above; indx[1..n] in an output vector that records */ 44 | /* the row permutation effected by the partial pivoting; d is output as +-1 depending on whether the number of row */ 45 | /* interchanges was even or odd respectively. */ 46 | int ludcmp(float **a, int n, int *indx, float *d); /* LU decomposition */ 47 | 48 | /* Solves the set of n linear equations Ax=b. Here a[0..n-1][0..n-1] as input, not as the matrix A but rather as its LU decomposition,*/ 49 | /* determined by the routine ludcmp. indx[0..n-1] is input as the permutation vector returned by ludcmp. b[0..n-1] is input as the */ 50 | /* right hand side vector and returns with the solution vector x. */ 51 | void lubksb(float **a, int n, int *indx, float *b); /* LU linear solution */ 52 | 53 | 54 | 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/orsa.h: -------------------------------------------------------------------------------- 1 | // 2 | // C++ Implementation: stereomatch 3 | // 4 | // Description: eliminate the false matches with epipolar geometry constraint. 5 | // See http://www.math-info.univ-paris5.fr/~moisan/epipolar/ 6 | // 7 | // Copyright (c) 2007 Lionel Moisan 8 | // Changelog : 2011 Use Eigen SVD 9 | // 10 | // Copyright: See COPYING file that comes with this distribution 11 | // 12 | // 13 | 14 | #ifndef STEREOMATCH_H 15 | #define STEREOMATCH_H 16 | 17 | #include 18 | 19 | #include "libNumerics/numerics.h" 20 | #include "libMatch/match.h" 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /*-------------------- GENERAL PURPOSE ROUTINES --------------------*/ 31 | 32 | /* routines for vectors and matrices */ 33 | 34 | //float *vector(int nl, int nh); 35 | 36 | float **matrix(int nrl, int nrh, int ncl, int nch); 37 | 38 | void free_vector(float *v, int nl, int nh); 39 | 40 | void free_matrix(float **m, int nrl, int nrh, int ncl, int nch); 41 | 42 | /* Singular Value Decomposition routine */ 43 | void svdcmp(float **a, int m, int n, float *w, float **v); 44 | 45 | /* Compute the real roots of a third order polynomial */ 46 | /* returns 1 or 3, the number of roots found */ 47 | int FindCubicRoots(float coeff[4], float x[3]); 48 | 49 | /* logarithm (base 10) of binomial coefficient */ 50 | float logcombi(int k, int n); 51 | 52 | /* tabulate logcombi(.,n) */ 53 | float *makelogcombi_n(int n); 54 | 55 | 56 | /* tabulate logcombi(k,.) */ 57 | float *makelogcombi_k(int k, int nmax); 58 | 59 | 60 | /* get a (sorted) random 7-uple of 0..n-1 */ 61 | void random_p7(int *k, int n); 62 | 63 | /*-------------------- END OF GENERAL PURPOSE ROUTINES --------------------*/ 64 | 65 | 66 | /* float comparison for qsort() */ 67 | //According to http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/, 68 | //we should have: void qsort ( void * base, size_t num, size_t size, int ( * comparator ) ( const void *, const void * ) ); that means, for "qsort", the "comparator" has two constant void* type input parameters 69 | int compf(const void *i, const void *j); 70 | 71 | void matcherrorn(float **F, const std::vector& p1, const std::vector& p2, float *e); 72 | 73 | int epipolar(std::vector& m1, std::vector& m2, int *k, float *z, float **F1, float **F2); 74 | 75 | float orsa(int width, int height, std::vector& match, std::vector& index, int t_value, int verb_value, int n_flag_value, int mode_value, int stop_value); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/splines.h: -------------------------------------------------------------------------------- 1 | // Authors: Unknown. Please, if you are the author of this file, or if you 2 | // know who are the authors of this file, let us know, so we can give the 3 | // adequate credits and/or get the adequate authorizations. 4 | 5 | #ifndef _SPLINES_H_ 6 | #define _SPLINES_H_ 7 | 8 | #include "numerics1.h" 9 | #include "library.h" 10 | #include "string.h" 11 | #include 12 | using namespace std; 13 | 14 | 15 | //float v(float *in,int x,int y,float bg, int width, int height); 16 | 17 | // Guoshen Yu, 2010.09.21, Windows version 18 | float v(vector& in,int x,int y,float bg, int width, int height); 19 | //float v(float *in, int x,int y,float bg, int width, int height); 20 | 21 | void keys(float *c,float t,float a); 22 | void spline3(float *c,float t); 23 | void init_splinen(float *a,int n); 24 | void splinen(float *c,float t,float *a,int n); 25 | 26 | //void finvspline(float *in,int order,float *out, int width, int height); 27 | 28 | // Guoshen Yu, 2010.09.22, Windows versions 29 | void finvspline(vector& in,int order,vector& out, int width, int height); 30 | // void finvspline(float *in,int order,float *out, int width, int height); 31 | 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/test_demo_ASIFT.m: -------------------------------------------------------------------------------- 1 | % ************************************************************************* 2 | % NOTE: The ASIFT SOFTWARE ./demo_ASIFT IS STANDALONE AND CAN BE EXECUTED 3 | % WITHOUT MATLAB. 4 | % ************************************************************************* 5 | % 6 | % demo_ASIFT.m is a MATLAB interface for the ASIFT software. This 7 | % script provides an example of using demo_ASIFT.m. The input/output of 8 | % demo_ASIFT.m follow those of the ASIFT software and a description can 9 | % found in README.txt. (Note that the ASIFT software support only the PNG format, 10 | % the Matlab interface reads most standard image formats.) 11 | % 12 | % The ASIFT C/C++ source code must be compiled before running the ASIFT software 13 | % for the first time. See README.txt for more details. 14 | % 15 | % Copyright, Jean-Michel Morel, Guoshen Yu, 2008. 16 | % 17 | % Please report bugs and/or send comments to Guoshen Yu yu@cmap.polytechnique.fr 18 | % 19 | % Reference: J.M. Morel and G.Yu, ASIFT: A New Framework for Fully Affine Invariant Image 20 | % Comparison, SIAM Journal on Imaging Sciences, vol. 2, issue 2, pp. 438-469, 2009. 21 | % Reference: ASIFT online demo (You can try ASIFT with your own images online.) 22 | % http://www.ipol.im/pub/algo/my_affine_sift/ 23 | % 24 | % 2010.08.17 25 | 26 | file_img1 = 'adam1.png'; 27 | file_img2 = 'adam2.png'; 28 | imgOutVert = 'imgOutVert.png'; 29 | imgOutHori = 'imgOutHori.png'; 30 | matchings = 'matchings.txt'; 31 | keys1 = 'keys1.txt'; 32 | keys2 = 'keys2.txt'; 33 | flag_resize = 0; 34 | 35 | demo_ASIFT(file_img1, file_img2, imgOutVert, imgOutHori, matchings, keys1, keys2, flag_resize); 36 | 37 | 38 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Array: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Cholesky_Module Cholesky module 11 | * 12 | * 13 | * 14 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 15 | * Those decompositions are accessible via the following MatrixBase methods: 16 | * - MatrixBase::llt(), 17 | * - MatrixBase::ldlt() 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/Cholesky/LLT.h" 26 | #include "src/Cholesky/LDLT.h" 27 | 28 | } // namespace Eigen 29 | 30 | #include "src/Core/util/ReenableStupidWarnings.h" 31 | 32 | #endif // EIGEN_CHOLESKY_MODULE_H 33 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 34 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #define EIGEN_EIGENVALUES_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | #include "LU" 12 | 13 | namespace Eigen { 14 | 15 | /** \defgroup Eigenvalues_Module Eigenvalues module 16 | * 17 | * 18 | * 19 | * This module mainly provides various eigenvalue solvers. 20 | * This module also provides some MatrixBase methods, including: 21 | * - MatrixBase::eigenvalues(), 22 | * - MatrixBase::operatorNorm() 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/Eigenvalues/Tridiagonalization.h" 30 | #include "src/Eigenvalues/RealSchur.h" 31 | #include "src/Eigenvalues/EigenSolver.h" 32 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 34 | #include "src/Eigenvalues/HessenbergDecomposition.h" 35 | #include "src/Eigenvalues/ComplexSchur.h" 36 | #include "src/Eigenvalues/ComplexEigenSolver.h" 37 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 38 | 39 | } // namespace Eigen 40 | 41 | #include "src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_EIGENVALUES_MODULE_H 44 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 45 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #define EIGEN_GEOMETRY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SVD" 9 | #include "LU" 10 | #include 11 | 12 | #ifndef M_PI 13 | #define M_PI 3.14159265358979323846 14 | #endif 15 | 16 | namespace Eigen { 17 | 18 | /** \defgroup Geometry_Module Geometry module 19 | * 20 | * 21 | * 22 | * This module provides support for: 23 | * - fixed-size homogeneous transformations 24 | * - translation, scaling, 2D and 3D rotations 25 | * - quaternions 26 | * - \ref MatrixBase::cross() "cross product" 27 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 28 | * - some linear components: parametrized-lines and hyperplanes 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/Geometry/OrthoMethods.h" 36 | #include "src/Geometry/EulerAngles.h" 37 | 38 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | #if defined EIGEN_VECTORIZE_SSE 53 | #include "src/Geometry/arch/Geometry_SSE.h" 54 | #endif 55 | #endif 56 | 57 | #ifdef EIGEN2_SUPPORT 58 | #include "src/Eigen2Support/Geometry/All.h" 59 | #endif 60 | 61 | } // namespace Eigen 62 | 63 | #include "src/Core/util/ReenableStupidWarnings.h" 64 | 65 | #endif // EIGEN_GEOMETRY_MODULE_H 66 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 67 | 68 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Householder_Module Householder module 11 | * This module provides Householder transformations. 12 | * 13 | * \code 14 | * #include 15 | * \endcode 16 | */ 17 | 18 | #include "src/Householder/Householder.h" 19 | #include "src/Householder/HouseholderSequence.h" 20 | #include "src/Householder/BlockHouseholder.h" 21 | 22 | } // namespace Eigen 23 | 24 | #include "src/Core/util/ReenableStupidWarnings.h" 25 | 26 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 27 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 28 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Jacobi_Module Jacobi module 11 | * This module provides Jacobi and Givens rotations. 12 | * 13 | * \code 14 | * #include 15 | * \endcode 16 | * 17 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 18 | * - MatrixBase::applyOnTheLeft() 19 | * - MatrixBase::applyOnTheRight(). 20 | */ 21 | 22 | #include "src/Jacobi/Jacobi.h" 23 | 24 | } // namespace Eigen 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_JACOBI_MODULE_H 29 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 30 | 31 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup LU_Module LU module 11 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 12 | * This module defines the following MatrixBase methods: 13 | * - MatrixBase::inverse() 14 | * - MatrixBase::determinant() 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | */ 20 | 21 | #include "src/misc/Solve.h" 22 | #include "src/misc/Kernel.h" 23 | #include "src/misc/Image.h" 24 | #include "src/LU/FullPivLU.h" 25 | #include "src/LU/PartialPivLU.h" 26 | #include "src/LU/Determinant.h" 27 | #include "src/LU/Inverse.h" 28 | 29 | #if defined EIGEN_VECTORIZE_SSE 30 | #include "src/LU/arch/Inverse_SSE.h" 31 | #endif 32 | 33 | #ifdef EIGEN2_SUPPORT 34 | #include "src/Eigen2Support/LU.h" 35 | #endif 36 | 37 | } // namespace Eigen 38 | 39 | #include "src/Core/util/ReenableStupidWarnings.h" 40 | 41 | #endif // EIGEN_LU_MODULE_H 42 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 43 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | namespace Eigen { 19 | 20 | /** \defgroup LeastSquares_Module LeastSquares module 21 | * This module provides linear regression and related features. 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigen2Support/LeastSquares.h" 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/Core/util/ReenableStupidWarnings.h" 33 | 34 | #endif // EIGEN2_SUPPORT 35 | 36 | #endif // EIGEN_REGRESSION_MODULE_H 37 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | namespace Eigen { 13 | 14 | /** \defgroup QR_Module QR module 15 | * 16 | * 17 | * 18 | * This module provides various QR decompositions 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::qr(), 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | */ 26 | 27 | #include "src/misc/Solve.h" 28 | #include "src/QR/HouseholderQR.h" 29 | #include "src/QR/FullPivHouseholderQR.h" 30 | #include "src/QR/ColPivHouseholderQR.h" 31 | 32 | #ifdef EIGEN2_SUPPORT 33 | #include "src/Eigen2Support/QR.h" 34 | #endif 35 | 36 | } // namespace Eigen 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/README.ipol: -------------------------------------------------------------------------------- 1 | Project: EIGEN 2 | URL: http://eigen.tuxfamily.org/ 3 | License: GPL/LGPL 4 | Upstream version: Eigen 3.0 released on March 19, 2011. 5 | 6 | Local modifications: 7 | 8 | * Use only the Eigen directory 9 | * Copy *.GPL and *.LGPL licence file 10 | * Add this readme file 11 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | namespace Eigen { 11 | 12 | /** \defgroup SVD_Module SVD module 13 | * 14 | * 15 | * 16 | * This module provides SVD decomposition for (currently) real matrices. 17 | * This decomposition is accessible via the following MatrixBase method: 18 | * - MatrixBase::svd() 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/SVD/JacobiSVD.h" 27 | #include "src/SVD/UpperBidiagonalization.h" 28 | 29 | #ifdef EIGEN2_SUPPORT 30 | #include "src/Eigen2Support/SVD.h" 31 | #endif 32 | 33 | } // namespace Eigen 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif // EIGEN_SVD_MODULE_H 38 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 39 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef EIGEN2_SUPPORT 15 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 16 | #endif 17 | 18 | #ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 19 | #error The sparse module API is not stable yet. To use it anyway, please define the EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET preprocessor token. 20 | #endif 21 | 22 | namespace Eigen { 23 | 24 | /** \defgroup Sparse_Module Sparse module 25 | * 26 | * 27 | * 28 | * See the \ref TutorialSparse "Sparse tutorial" 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | /** The type used to identify a general sparse storage. */ 36 | struct Sparse {}; 37 | 38 | #include "src/Sparse/SparseUtil.h" 39 | #include "src/Sparse/SparseMatrixBase.h" 40 | #include "src/Sparse/CompressedStorage.h" 41 | #include "src/Sparse/AmbiVector.h" 42 | #include "src/Sparse/SparseMatrix.h" 43 | #include "src/Sparse/DynamicSparseMatrix.h" 44 | #include "src/Sparse/MappedSparseMatrix.h" 45 | #include "src/Sparse/SparseVector.h" 46 | #include "src/Sparse/CoreIterators.h" 47 | #include "src/Sparse/SparseBlock.h" 48 | #include "src/Sparse/SparseTranspose.h" 49 | #include "src/Sparse/SparseCwiseUnaryOp.h" 50 | #include "src/Sparse/SparseCwiseBinaryOp.h" 51 | #include "src/Sparse/SparseDot.h" 52 | #include "src/Sparse/SparseAssign.h" 53 | #include "src/Sparse/SparseRedux.h" 54 | #include "src/Sparse/SparseFuzzy.h" 55 | #include "src/Sparse/SparseProduct.h" 56 | #include "src/Sparse/SparseSparseProduct.h" 57 | #include "src/Sparse/SparseDenseProduct.h" 58 | #include "src/Sparse/SparseDiagonalProduct.h" 59 | #include "src/Sparse/SparseTriangularView.h" 60 | #include "src/Sparse/SparseSelfAdjointView.h" 61 | #include "src/Sparse/TriangularSolver.h" 62 | #include "src/Sparse/SparseView.h" 63 | 64 | } // namespace Eigen 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_STDDEQUE_MODULE_H 27 | #define EIGEN_STDDEQUE_MODULE_H 28 | 29 | #include "Core" 30 | #include 31 | 32 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 33 | 34 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 35 | 36 | #else 37 | 38 | #include "src/StlSupport/StdDeque.h" 39 | 40 | #endif 41 | 42 | #endif // EIGEN_STDDEQUE_MODULE_H 43 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_STDLIST_MODULE_H 26 | #define EIGEN_STDLIST_MODULE_H 27 | 28 | #include "Core" 29 | #include 30 | 31 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 32 | 33 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 34 | 35 | #else 36 | 37 | #include "src/StlSupport/StdList.h" 38 | 39 | #endif 40 | 41 | #endif // EIGEN_STDLIST_MODULE_H 42 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_STDVECTOR_MODULE_H 27 | #define EIGEN_STDVECTOR_MODULE_H 28 | 29 | #include "Core" 30 | #include 31 | 32 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 33 | 34 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 35 | 36 | #else 37 | 38 | #include "src/StlSupport/StdVector.h" 39 | 40 | #endif 41 | 42 | #endif // EIGEN_STDVECTOR_MODULE_H 43 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | 27 | /* All the parameters defined in this file can be specialized in the 28 | * architecture specific files, and/or by the user. 29 | * More to come... */ 30 | 31 | #ifndef EIGEN_DEFAULT_SETTINGS_H 32 | #define EIGEN_DEFAULT_SETTINGS_H 33 | 34 | /** Defines the maximal loop size to enable meta unrolling of loops. 35 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 36 | * it does not correspond to the number of iterations or the number of instructions 37 | */ 38 | #ifndef EIGEN_UNROLLING_LIMIT 39 | #define EIGEN_UNROLLING_LIMIT 100 40 | #endif 41 | 42 | /** Defines the threshold between a "small" and a "large" matrix. 43 | * This threshold is mainly used to select the proper product implementation. 44 | */ 45 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 46 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 47 | #endif 48 | 49 | /** Defines the maximal width of the blocks used in the triangular product and solver 50 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 51 | */ 52 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 53 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 54 | #endif 55 | 56 | 57 | /** Defines the default number of registers available for that architecture. 58 | * Currently it must be 8 or 16. Other values will fail. 59 | */ 60 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 61 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 62 | #endif 63 | 64 | #endif // EIGEN_DEFAULT_SETTINGS_H 65 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // 2536 - type qualifiers are meaningless here 25 | // ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent 26 | // typedef that may be a reference type. 27 | // 279 - controlling expression is constant 28 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 29 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 30 | #pragma warning push 31 | #endif 32 | #pragma warning disable 2196 2536 279 33 | #elif defined __clang__ 34 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 35 | // this is really a stupid warning as it warns on compile-time expressions involving enums 36 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 37 | #pragma clang diagnostic push 38 | #endif 39 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 40 | #endif 41 | 42 | #endif // not EIGEN_WARNINGS_DISABLED 43 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MACROS_H 26 | #define EIGEN2_MACROS_H 27 | 28 | #define ei_assert eigen_assert 29 | #define ei_internal_assert eigen_internal_assert 30 | 31 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 32 | 33 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 34 | 35 | #endif // EIGEN2_MACROS_H 36 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MEMORY_H 26 | #define EIGEN2_MEMORY_H 27 | 28 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 29 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 30 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 31 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 32 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 33 | 34 | template inline void* ei_conditional_aligned_malloc(size_t size) 35 | { 36 | return internal::conditional_aligned_malloc(size); 37 | } 38 | template inline void ei_conditional_aligned_free(void *ptr) 39 | { 40 | internal::conditional_aligned_free(ptr); 41 | } 42 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 43 | { 44 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 45 | } 46 | 47 | template inline T* ei_aligned_new(size_t size) 48 | { 49 | return internal::aligned_new(size); 50 | } 51 | template inline void ei_aligned_delete(T *ptr, size_t size) 52 | { 53 | return internal::aligned_delete(ptr, size); 54 | } 55 | 56 | 57 | 58 | #endif // EIGEN2_MACROS_H 59 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN2_QR_H 27 | #define EIGEN2_QR_H 28 | 29 | template 30 | class QR : public HouseholderQR 31 | { 32 | public: 33 | 34 | typedef HouseholderQR Base; 35 | typedef Block MatrixRBlockType; 36 | 37 | QR() : Base() {} 38 | 39 | template 40 | explicit QR(const T& t) : Base(t) {} 41 | 42 | template 43 | bool solve(const MatrixBase& b, ResultType *result) const 44 | { 45 | *result = static_cast(this)->solve(b); 46 | return true; 47 | } 48 | 49 | MatrixType matrixQ(void) const { 50 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 51 | ret = this->householderQ() * ret; 52 | return ret; 53 | } 54 | 55 | bool isFullRank() const { 56 | return true; 57 | } 58 | 59 | const TriangularView 60 | matrixR(void) const 61 | { 62 | int cols = this->cols(); 63 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 64 | } 65 | }; 66 | 67 | /** \return the QR decomposition of \c *this. 68 | * 69 | * \sa class QR 70 | */ 71 | template 72 | const QR::PlainObject> 73 | MatrixBase::qr() const 74 | { 75 | return QR(eval()); 76 | } 77 | 78 | 79 | #endif // EIGEN2_QR_H 80 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 26 | #define EIGEN_TRIANGULAR_SOLVER2_H 27 | 28 | const unsigned int UnitDiagBit = UnitDiag; 29 | const unsigned int SelfAdjointBit = SelfAdjoint; 30 | const unsigned int UpperTriangularBit = Upper; 31 | const unsigned int LowerTriangularBit = Lower; 32 | 33 | const unsigned int UpperTriangular = Upper; 34 | const unsigned int LowerTriangular = Lower; 35 | const unsigned int UnitUpperTriangular = UnitUpper; 36 | const unsigned int UnitLowerTriangular = UnitLower; 37 | 38 | template 39 | template 40 | typename ExpressionType::PlainObject 41 | Flagged::solveTriangular(const MatrixBase& other) const 42 | { 43 | return m_matrix.template triangularView().solve(other.derived()); 44 | } 45 | 46 | template 47 | template 48 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 49 | { 50 | m_matrix.template triangularView().solveInPlace(other.derived()); 51 | } 52 | 53 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 54 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Eigenvalues/EigenvaluesCommon.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Jitse Niesen 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_EIGENVALUES_COMMON_H 26 | #define EIGEN_EIGENVALUES_COMMON_H 27 | 28 | 29 | 30 | #endif // EIGEN_EIGENVALUES_COMMON_H 31 | 32 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Sparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Sparse_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Sparse_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Sparse COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Sparse/SparseAssign.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/demo_ASIFT_src/third_party/Eigen/src/Sparse/SparseAssign.h -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Sparse/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSE_FUZZY_H 26 | #define EIGEN_SPARSE_FUZZY_H 27 | 28 | // template 29 | // template 30 | // bool SparseMatrixBase::isApprox( 31 | // const OtherDerived& other, 32 | // typename NumTraits::Real prec 33 | // ) const 34 | // { 35 | // const typename internal::nested::type nested(derived()); 36 | // const typename internal::nested::type otherNested(other.derived()); 37 | // return (nested - otherNested).cwise().abs2().sum() 38 | // <= prec * prec * std::min(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 39 | // } 40 | 41 | #endif // EIGEN_SPARSE_FUZZY_H 42 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/Sparse/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSEREDUX_H 26 | #define EIGEN_SPARSEREDUX_H 27 | 28 | template 29 | typename internal::traits::Scalar 30 | SparseMatrixBase::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | Scalar res = 0; 34 | for (Index j=0; j 41 | typename internal::traits >::Scalar 42 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 43 | { 44 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 45 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 46 | } 47 | 48 | template 49 | typename internal::traits >::Scalar 50 | SparseVector<_Scalar,_Options,_Index>::sum() const 51 | { 52 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 53 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 54 | } 55 | 56 | #endif // EIGEN_SPARSEREDUX_H 57 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/third_party/Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /3rdparty/micmac_params.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 50.0 6 | 7 | 8 | 9 | 10 | eGeomImage_EpipolairePure 11 | 12 | rectified_ref.tif 13 | rectified_sec.tif 14 | 15 | 16 | 17 | 18 | 19 | -1 20 | 1 21 | 22 | 0.5 23 | 24 | 3 25 | 4 26 | 27 | eAlgoCoxRoy 28 | 0.05 29 | eInterpolMPD 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 8 37 | 38 | 39 | 4 40 | 41 | 42 | 2 43 | 44 | 45 | 1 46 | 47 | 48 | 1 49 | 0.25 50 | 1 51 | 2 52 | 53 | 54 | 55 | eAlgoDequant 56 | 1 57 | 1 58 | 59 | 60 | 61 | 62 | 63 | eGeomPxBiDim 64 | 65 | 66 | 67 | ThisDir 68 | MEC-EPI/ 69 | MEC-EPI/ 70 | Pyram-Epi/ 71 | 2 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /3rdparty/msmw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -funroll-loops -Wno-unused -DNDEBUG") 5 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -funroll-loops -Wno-unused -DNDEBUG") 6 | 7 | #SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 8 | #SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) 9 | 10 | 11 | ADD_SUBDIRECTORY(libraryStable) 12 | ADD_SUBDIRECTORY(libstereo) 13 | ADD_SUBDIRECTORY(libmw) 14 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | 4 | include_directories("mw3") 5 | SET(SRC fgrain.c mw3/error.c mw3/fimage.c mw3/fsignal.c mw3/libmw.c mw3/list.c mw3/shape.c flst/flst.c flst/flst_reconstruct.c flst/flst_pixels.c flst/flstb_dualchain.c flst/fsaddles.c) 6 | 7 | ADD_LIBRARY(libmw ${SRC}) 8 | 9 | 10 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/fgrain.c: -------------------------------------------------------------------------------- 1 | /*--------------------------- MegaWave2 Module -----------------------------*/ 2 | /* mwcommand 3 | name = {fgrain}; 4 | version = {"1.2"}; 5 | author = {"Pascal Monasse, Frederic Guichard, G. Facciolo"}; 6 | function = {"Grain filter of an image"}; 7 | usage = { 8 | 'a': [min_area=20]-> pMinArea "Min area of grains we keep", 9 | image_in -> pFloatImageInput "Input fimage", 10 | image_out <- pFloatImageOutput "Output fimage" 11 | }; 12 | */ 13 | /*---------------------------------------------------------------------- 14 | v1.2 (04/2007): simplified header (LM) 15 | v1.3 (2013): portable version (GF) 16 | ----------------------------------------------------------------------*/ 17 | 18 | #include "mw3.h" 19 | #include "stdio.h" 20 | #include "stdlib.h" 21 | 22 | extern void flst(); 23 | extern void flst_reconstruct(); 24 | 25 | /* This removes the shapes from the tree associated to pFloatImageInput 26 | that are too small (threshold *pMinArea). As a consequence all the remaining 27 | shapes of pFloatImageOutput are of area larger or equal than *pMinArea */ 28 | 29 | void mw_fgrain(int *pMinArea, Fimage pFloatImageInput, Fimage pFloatImageOutput) 30 | { 31 | int i; 32 | Shapes pTree; 33 | 34 | if(mw_change_fimage(pFloatImageOutput, pFloatImageInput->nrow, 35 | pFloatImageInput->ncol) == NULL) 36 | mwerror(FATAL, 1, 37 | "fgrain --> Not enough memory to allocate the output image"); 38 | if((pTree = mw_new_shapes()) == NULL) 39 | mwerror(FATAL, 1, 40 | "fgrain --> Not enough memory to allocate the tree of shapes"); 41 | 42 | /* Compute the Level Sets Transform of the input image */ 43 | flst(NULL, pFloatImageInput, pTree, NULL, NULL); 44 | 45 | /* Kill too small grains. 46 | Bound i>0 because it is forbidden to delete the root, at index 0 */ 47 | for(i = pTree->nb_shapes-1; i > 0; i--) 48 | if(pTree->the_shapes[i].area < *pMinArea) 49 | pTree->the_shapes[i].removed = (char)1; 50 | 51 | /* Reconstruct in pFloatImageOutput the modified tree of shapes */ 52 | flst_reconstruct(pTree, pFloatImageOutput); 53 | 54 | mw_delete_shapes(pTree); 55 | } 56 | 57 | /*in and out must be allocated*/ 58 | void fgrain(int MinArea, float *in, int nx, int ny, float *out) { 59 | int i; 60 | Fimage mwin = mw_change_fimage(NULL,ny,nx); 61 | Fimage mwout = mw_new_fimage(); 62 | for(i=0;igray[i] = in[i]; 63 | 64 | mw_fgrain( &MinArea, mwin, mwout); 65 | 66 | for(i=0;igray[i]; 67 | mw_delete_fimage(mwin); 68 | mw_delete_fimage(mwout); 69 | } 70 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/fgrain.h: -------------------------------------------------------------------------------- 1 | void fgrain(int MinArea, float *in, int nx, int ny, float *out); 2 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/flst/flst_reconstruct.c: -------------------------------------------------------------------------------- 1 | /*--------------------------- MegaWave2 Module -----------------------------*/ 2 | /* mwcommand 3 | name = {flst_reconstruct}; 4 | version = {"1.0"}; 5 | author = {"Pascal Monasse, Frederic Guichard"}; 6 | function = {"Reconstruct an image from its Fast Level Sets Transform"}; 7 | usage = { 8 | tree->pTree "Input tree of shapes", 9 | image<-pFloatImageOutput "Output fimage" 10 | }; 11 | */ 12 | 13 | #include "mw3.h" 14 | //#include "mw3-modules.h" 15 | #include "mw3-modules-specific.h" 16 | 17 | void flst_reconstruct(Shapes pTree, Fimage pFloatImageOutput) 18 | { 19 | int i; 20 | float *pOutputPixel; 21 | Shape *ppShapeOfPixel; 22 | Shape pShape; 23 | 24 | if (!mw_change_fimage(pFloatImageOutput, pTree->nrow, pTree->ncol)) 25 | mwerror(FATAL, 1, 26 | "flst_reconstruct --> impossible " 27 | "to allocate the output image\n"); 28 | 29 | pOutputPixel = pFloatImageOutput->gray; 30 | ppShapeOfPixel = pTree->smallest_shape; 31 | for (i = pTree->nrow * pTree->ncol - 1; i >= 0; i--) 32 | { 33 | pShape = *ppShapeOfPixel++; 34 | while (pShape->removed) 35 | pShape = pShape->parent; 36 | *pOutputPixel++ = pShape->value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/flst/mw3-modules-specific.h: -------------------------------------------------------------------------------- 1 | /* src/image/level_lines/flstb_dualchain.c */ 2 | void flstb_dualchain(Shapes pTree, Shape pShape, Flist pBoundary, 3 | char *ctabtabSaddleValues); 4 | /* src/image/level_lines/flst_reconstruct.c */ 5 | void flst_reconstruct(Shapes pTree, Fimage pFloatImageOutput); 6 | /* src/image/level_lines/fsaddles.c */ 7 | int fsaddles(Fimage pImage, Fimage pSaddlesImage); 8 | /* src/image/level_lines/flst_pixels.c */ 9 | void flst_pixels(Shapes pTree); 10 | 11 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/error.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file error.c 3 | * 4 | * @version 1.14 5 | * @author Jacques Froment & Sylvain Parrino (1995-2005) 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "definitions.h" 15 | 16 | #include "error.h" 17 | 18 | /* TODO: move to config.h or definitions.h */ 19 | int mwerrcnt = 0; 20 | 21 | void mwdebug(char *fmt, ...) 22 | { 23 | if (mwdbg) 24 | { 25 | va_list marker; 26 | 27 | va_start(marker, fmt); 28 | fprintf(stderr, " "); 29 | vfprintf(stderr, fmt, marker); 30 | va_end(marker); 31 | } 32 | } 33 | 34 | void mwerror(int code, int exit_code, char *fmt, ...) 35 | { 36 | va_list marker; 37 | 38 | va_start(marker, fmt); 39 | 40 | switch (code) 41 | { 42 | case WARNING: 43 | fprintf(stderr, "megawave warning (%s) : ", mwname); 44 | vfprintf(stderr, fmt, marker); 45 | break; 46 | case ERROR: 47 | fprintf(stderr, "megawave error (%s) : ", mwname); 48 | vfprintf(stderr, fmt, marker); 49 | mwerrcnt++; 50 | break; 51 | case FATAL: 52 | fprintf(stderr, "megawave fatal (%s) : ", mwname); 53 | vfprintf(stderr, fmt, marker); 54 | fprintf(stderr, "Exit.\n"); 55 | exit(exit_code); 56 | break; 57 | case INTERNAL: 58 | fprintf(stderr, "megawave internal (%s) : ", mwname); 59 | vfprintf(stderr, fmt, marker); 60 | fprintf(stderr, "Exit.\n"); 61 | exit(exit_code); 62 | break; 63 | case USAGE: 64 | fprintf(stderr, "Bad parameter; use the '--help' option for details"); 65 | exit(exit_code); 66 | break; 67 | default: 68 | mwerror(FATAL, 1, "Bad usage of mwerror : code %d is unknown\n", 69 | code); 70 | break; 71 | } 72 | va_end(marker); 73 | } 74 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * error.h 3 | */ 4 | 5 | #ifndef _ERROR_H_ 6 | #define _ERROR_H_ 7 | 8 | /* src/error.c */ 9 | void mwdebug(char *fmt, ...); 10 | void mwerror(int code, int exit_code, char *fmt, ...); 11 | 12 | #endif /* !_ERROR_H_ */ 13 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/fimage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fimage.h 3 | */ 4 | 5 | #ifndef _FIMAGE_H_ 6 | #define _FIMAGE_H_ 7 | 8 | /* src/fimage.c */ 9 | Fimage mw_new_fimage(void); 10 | Fimage mw_alloc_fimage(Fimage image, int nrow, int ncol); 11 | void mw_delete_fimage(Fimage image); 12 | Fimage mw_change_fimage(Fimage image, int nrow, int ncol); 13 | float mw_getdot_fimage(Fimage image, int x, int y); 14 | void mw_plot_fimage(Fimage image, int x, int y, float v); 15 | void mw_draw_fimage(Fimage image, int a0, int b0, int a1, int b1, float c); 16 | void mw_clear_fimage(Fimage image, float v); 17 | void mw_copy_fimage(Fimage in, Fimage out); 18 | float **mw_newtab_gray_fimage(Fimage image); 19 | 20 | #endif /* !_FIMAGE_H_ */ 21 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/fsignal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fsignal.h 3 | */ 4 | 5 | #ifndef _FSIGNAL_H_ 6 | #define _FSIGNAL_H_ 7 | 8 | /* src/fsignal.c */ 9 | Fsignal mw_new_fsignal(void); 10 | Fsignal mw_alloc_fsignal(Fsignal signal, int N); 11 | void mw_delete_fsignal(Fsignal signal); 12 | Fsignal mw_change_fsignal(Fsignal signal, int N); 13 | void mw_clear_fsignal(Fsignal signal, float v); 14 | void mw_copy_fsignal_values(Fsignal in, Fsignal out); 15 | void mw_copy_fsignal_header(Fsignal in, Fsignal out); 16 | void mw_copy_fsignal(Fsignal in, Fsignal out); 17 | 18 | #endif /* !_FSIGNAL_H_ */ 19 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/libmw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmw.h 3 | */ 4 | 5 | #ifndef _LIBMW_H_ 6 | #define _LIBMW_H_ 7 | 8 | /* src/libmw.c */ 9 | 10 | #endif /* !_LIBMW_H_ */ 11 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * list.h 3 | */ 4 | 5 | #ifndef _LIST_H_ 6 | #define _LIST_H_ 7 | 8 | /* src/list.c */ 9 | Flist mw_new_flist(void); 10 | Flist mw_realloc_flist(Flist l, int n); 11 | Flist mw_enlarge_flist(Flist l); 12 | Flist mw_change_flist(Flist l, int max_size, int size, int dimension); 13 | void mw_delete_flist(Flist l); 14 | void mw_clear_flist(Flist l, float v); 15 | Flist mw_copy_flist(Flist in, Flist out); 16 | Flists mw_new_flists(void); 17 | Flists mw_realloc_flists(Flists ls, int n); 18 | Flists mw_enlarge_flists(Flists ls); 19 | Flists mw_change_flists(Flists ls, int max_size, int size); 20 | void mw_delete_flists(Flists ls); 21 | Flists mw_copy_flists(Flists in, Flists out); 22 | Dlist mw_new_dlist(void); 23 | Dlist mw_realloc_dlist(Dlist l, int n); 24 | Dlist mw_enlarge_dlist(Dlist l); 25 | Dlist mw_change_dlist(Dlist l, int max_size, int size, int dimension); 26 | void mw_delete_dlist(Dlist l); 27 | void mw_clear_dlist(Dlist l, double v); 28 | Dlist mw_copy_dlist(Dlist in, Dlist out); 29 | Dlists mw_new_dlists(void); 30 | Dlists mw_realloc_dlists(Dlists ls, int n); 31 | Dlists mw_enlarge_dlists(Dlists ls); 32 | Dlists mw_change_dlists(Dlists ls, int max_size, int size); 33 | void mw_delete_dlists(Dlists ls); 34 | Dlists mw_copy_dlists(Dlists in, Dlists out); 35 | 36 | #endif /* !_LIST_H_ */ 37 | -------------------------------------------------------------------------------- /3rdparty/msmw/libmw/mw3/shape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * shape.h 3 | */ 4 | 5 | #ifndef _SHAPE_H_ 6 | #define _SHAPE_H_ 7 | 8 | /* src/shape.c */ 9 | Point_plane mw_new_point_plane(void); 10 | Point_plane mw_change_point_plane(Point_plane point); 11 | Shape mw_new_shape(void); 12 | Shape mw_change_shape(Shape sh); 13 | void mw_delete_shape(Shape shape); 14 | Shape mw_get_not_removed_shape(Shape sh); 15 | Shape mw_get_parent_shape(Shape sh); 16 | Shape mw_get_first_child_shape(Shape sh); 17 | Shape mw_get_next_sibling_shape(Shape sh); 18 | Shape mw_get_smallest_shape(Shapes shs, int iX, int iY); 19 | Shapes mw_new_shapes(void); 20 | Shapes mw_alloc_shapes(Shapes shs, int nrow, int ncol, float value); 21 | Shapes mw_change_shapes(Shapes shs, int nrow, int ncol, float value); 22 | void mw_delete_shapes(Shapes shs); 23 | 24 | #endif /* !_SHAPE_H_ */ 25 | -------------------------------------------------------------------------------- /3rdparty/msmw/libraryStable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | SET(SRC iio.c iio.h libraryBasic.cpp libraryBasic.h ) 5 | 6 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -std=c99 -funroll-loops -Wno-unused -DNDEBUG") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ") 8 | 9 | # debug 10 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 ") 11 | 12 | 13 | ADD_LIBRARY(library2013 ${SRC}) 14 | 15 | FIND_PACKAGE(JPEG) 16 | FIND_PACKAGE(TIFF) 17 | FIND_PACKAGE(PNG) 18 | 19 | ADD_DEFINITIONS(${PNG_DEFINITIONS}) 20 | 21 | INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 22 | INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) 23 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 24 | INCLUDE_DIRECTORIES(..) 25 | 26 | TARGET_LINK_LIBRARIES(library2013 ${TIFF_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ) 27 | -------------------------------------------------------------------------------- /3rdparty/msmw/libstereo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | FIND_PACKAGE( OpenMP ) 5 | if(OPENMP_FOUND) 6 | message("OPENMP FOUND") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 9 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") 10 | endif() 11 | 12 | 13 | # debug 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 ") 15 | 16 | INCLUDE_DIRECTORIES(..) 17 | 18 | 19 | 20 | 21 | ADD_EXECUTABLE(iip_stereo_correlation_multi_win3 iip_stereo_correlation_multi_win2.cpp libstereo.h libstereoCV.cpp ) 22 | TARGET_LINK_LIBRARIES(iip_stereo_correlation_multi_win3 library2013 fftw3f libmw) 23 | 24 | ADD_EXECUTABLE(iip_stereo_correlation_multi_win2 iip_stereo_correlation_multi_win2.cpp libstereo.h libstereo.cpp ) 25 | TARGET_LINK_LIBRARIES(iip_stereo_correlation_multi_win2 library2013 fftw3f libmw) 26 | 27 | ADD_EXECUTABLE(iip_stereo_correlation iip_stereo_correlation.cpp libstereo.h libstereo.cpp ) 28 | TARGET_LINK_LIBRARIES(iip_stereo_correlation library2013 fftw3f libmw) 29 | 30 | 31 | ADD_EXECUTABLE(iip_stereo_subpixel_computation iip_stereo_subpixel_computation.cpp libstereo.h libstereo.cpp ) 32 | TARGET_LINK_LIBRARIES(iip_stereo_subpixel_computation library2013 fftw3f libmw) 33 | 34 | -------------------------------------------------------------------------------- /3rdparty/msmw/libstereo/cubic.h: -------------------------------------------------------------------------------- 1 | #include 2 | //double cubicInterpolate (double p[4], double x) { 3 | // assert(x<=1); 4 | // assert(x>=0); 5 | // return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))); 6 | //} 7 | // 8 | //// find the minimum in the iterval [0,1] of a cubic interpolated function 9 | //double cubicMinimum(double p[4]) { 10 | // // trivial minimums 11 | // double cmin = fmin(p[1],p[2]); 12 | // 13 | // double a,b,c,z1,z2,discr; 14 | // // coefficients of: ax^2 +bx +c = 0 15 | // a = 0.5 * 3.0 * (3.0*(p[1] - p[2]) + p[3] - p[0]); 16 | // b = 2.0 * p[0] - 5.0*p[1] + 4.0*p[2] - p[3]; 17 | // c = 0.5 * (p[2] - p[0]); 18 | // 19 | // // discriminant 20 | // discr=b*b -4.0 *a *c; 21 | // if (discr >=0) { 22 | // z1 = (-b+ sqrt(discr))/(2.0*a); 23 | // z2 = (-b- sqrt(discr))/(2.0*a); 24 | // if(z1>0.0 && z1<1.0) cmin = fmin(z1,cmin); 25 | // if(z2>0.0 && z2<1.0) cmin = fmin(z2,cmin); 26 | // } 27 | // return cmin; 28 | //} 29 | 30 | 31 | 32 | inline float cubicInterpolate (const float p[4], const float x) { 33 | // assert(x<=1); 34 | // assert(x>=0); 35 | return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))); 36 | } 37 | 38 | 39 | // find the minimum in the iterval [0,1] of a cubic interpolated function 40 | float cubicMinimum(float p[4], float *out_pmin, float *out_xmin) { 41 | // trivial minimums 42 | float pmin,xmin; 43 | if(p[1] < p[2]) { 44 | pmin=p[1]; 45 | xmin=0.0; 46 | } else { 47 | pmin=p[2]; 48 | xmin=1.0; 49 | } 50 | 51 | double a,b,c,z1,z2,discr; 52 | // coefficients of: ax^2 +bx +c = 0 53 | a = 0.5 * 3.0 * (3.0*(p[1] - p[2]) + p[3] - p[0]); 54 | b = 2.0 * p[0] - 5.0*p[1] + 4.0*p[2] - p[3]; 55 | c = 0.5 * (p[2] - p[0]); 56 | 57 | // discriminant 58 | discr=b*b -4.0 *a *c; 59 | if (discr >=0) { 60 | z1 = (-b+ sqrt(discr))/(2.0*a); 61 | z2 = (-b- sqrt(discr))/(2.0*a); 62 | if(z1>0.0 && z1<1.0) { 63 | float tmp = cubicInterpolate(p,z1); 64 | if(tmp < pmin) { 65 | pmin=tmp; 66 | xmin=z1; 67 | } 68 | } 69 | if(z2>0.0 && z2<1.0) { 70 | float tmp = cubicInterpolate(p,z2); 71 | if(tmp < pmin) { 72 | pmin=tmp; 73 | xmin=z2; 74 | } 75 | } 76 | } 77 | 78 | // if( *out_pmin < pmin) { 79 | *out_pmin = pmin; 80 | *out_xmin = xmin; 81 | // } 82 | return pmin; 83 | } 84 | -------------------------------------------------------------------------------- /3rdparty/msmw/libstereo/smartparameter.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Original QNM's version from E. Meinhardt-Llopis 5 | * Megawave port by G. Facciolo*/ 6 | 7 | /*/ a smart parameter is just like a regular parameter, but it can be 8 | // re-defined at the shell-environment. Instead of 9 | // 10 | // #define NUMBER 42 11 | // ... 12 | // printf("%g", NUMBER); 13 | // 14 | // do 15 | // SMART_PARAMETER(NUMBER,42) 16 | // ... 17 | // printf("%g", NUMBER()); 18 | // 19 | // Notice that the environment only gets queried once, at the first use. 20 | // 21 | */ 22 | #ifndef VERBOSE_SMART_PARAMETER 23 | #define VERBOSE_SMART_PARAMETER 0 24 | #endif 25 | 26 | #define SMART_PARAMETER(n,v) static double n(void)\ 27 | {\ 28 | static int smapa_known_ ## n = false;\ 29 | static double smapa_value_ ## n = v;\ 30 | if (!smapa_known_ ## n)\ 31 | {\ 32 | int r;\ 33 | char *sv;\ 34 | double y;\ 35 | sv = getenv(#n);\ 36 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr,"scanning the environment for \"%s\"... ", #n);\ 37 | if (sv)\ 38 | r = sscanf(sv, "%lf", &y);\ 39 | if (sv && r == 1)\ 40 | {\ 41 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr, "got value %g\n", y);\ 42 | smapa_value_ ## n = y;\ 43 | } else {\ 44 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr, "kept default value %g\n",\ 45 | smapa_value_ ## n);\ 46 | }\ 47 | smapa_known_ ## n = true;\ 48 | }\ 49 | return smapa_value_ ## n;\ 50 | } 51 | 52 | 53 | #define SMART_PARAMETER_INT(n,v) static int n(void)\ 54 | {\ 55 | static int smapa_known_ ## n = false;\ 56 | static int smapa_value_ ## n = v;\ 57 | if (!smapa_known_ ## n)\ 58 | {\ 59 | int r;\ 60 | int y;\ 61 | char *sv;\ 62 | sv = getenv(#n);\ 63 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr,"scanning the environment for \"%s\"... ", #n);\ 64 | if (sv)\ 65 | r = sscanf(sv, "%d", &y);\ 66 | if (sv && r == 1)\ 67 | {\ 68 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr, "got int value %d\n", y);\ 69 | smapa_value_ ## n = y;\ 70 | } else {\ 71 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr, "kept default int value %d\n",\ 72 | smapa_value_ ## n);\ 73 | }\ 74 | smapa_known_ ## n = true;\ 75 | }\ 76 | return smapa_value_ ## n;\ 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /3rdparty/msmw2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -funroll-loops -Wno-unused -DNDEBUG") 5 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -funroll-loops -Wno-unused -DNDEBUG") 6 | 7 | #SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 8 | #SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) 9 | 10 | 11 | ADD_SUBDIRECTORY(libraryStable) 12 | ADD_SUBDIRECTORY(libstereo_newversion) 13 | ADD_SUBDIRECTORY(libmw) 14 | -------------------------------------------------------------------------------- /3rdparty/msmw2/call.sh: -------------------------------------------------------------------------------- 1 | 2 | LR_REVERSE=1 CC_POSTPROCESS=0 time ../bin/iip_stereo_correlation_multi_win2_newversion -i 1 -n 4 -p 4 -W 5 -x 9 -y 9 -r 1 -D 1 -d 1 -t -1 -s 0 -b 1.25 -o -0.25 -O 25 -c 0 -f 0 -m -15 -M 5 -P 32 a.tif b.tif pixell.tif maskl.tif [pixelr.tif maskr.tif] 3 | 4 | 5 | # in python 6 | #common.run("%s -i 1 -n 4 -p 4 -W 5 -x 9 -y 9 -r 1 -D 1 -d 1 -t -1 -s 0 -b 1.25 -o -0.25 -O 25 -c 0 -f 0 -P 32 -m %d -M %d %s %s %s %s" %(msmw2_binary, 7 | # disp_min, disp_max, im1, im2, out_disp, out_mask)) 8 | 9 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | 4 | include_directories("mw3") 5 | SET(SRC fgrain.c mw3/error.c mw3/fimage.c mw3/fsignal.c mw3/libmw.c mw3/list.c mw3/shape.c flst/flst.c flst/flst_reconstruct.c flst/flst_pixels.c flst/flstb_dualchain.c flst/fsaddles.c) 6 | 7 | ADD_LIBRARY(libmw ${SRC}) 8 | 9 | 10 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/fgrain.c: -------------------------------------------------------------------------------- 1 | /*--------------------------- MegaWave2 Module -----------------------------*/ 2 | /* mwcommand 3 | name = {fgrain}; 4 | version = {"1.2"}; 5 | author = {"Pascal Monasse, Frederic Guichard, G. Facciolo"}; 6 | function = {"Grain filter of an image"}; 7 | usage = { 8 | 'a': [min_area=20]-> pMinArea "Min area of grains we keep", 9 | image_in -> pFloatImageInput "Input fimage", 10 | image_out <- pFloatImageOutput "Output fimage" 11 | }; 12 | */ 13 | /*---------------------------------------------------------------------- 14 | v1.2 (04/2007): simplified header (LM) 15 | v1.3 (2013): portable version (GF) 16 | ----------------------------------------------------------------------*/ 17 | 18 | #include "mw3.h" 19 | #include "stdio.h" 20 | #include "stdlib.h" 21 | 22 | extern void flst(); 23 | extern void flst_reconstruct(); 24 | 25 | /* This removes the shapes from the tree associated to pFloatImageInput 26 | that are too small (threshold *pMinArea). As a consequence all the remaining 27 | shapes of pFloatImageOutput are of area larger or equal than *pMinArea */ 28 | 29 | void mw_fgrain(int *pMinArea, Fimage pFloatImageInput, Fimage pFloatImageOutput) 30 | { 31 | int i; 32 | Shapes pTree; 33 | 34 | if(mw_change_fimage(pFloatImageOutput, pFloatImageInput->nrow, 35 | pFloatImageInput->ncol) == NULL) 36 | mwerror(FATAL, 1, 37 | "fgrain --> Not enough memory to allocate the output image"); 38 | if((pTree = mw_new_shapes()) == NULL) 39 | mwerror(FATAL, 1, 40 | "fgrain --> Not enough memory to allocate the tree of shapes"); 41 | 42 | /* Compute the Level Sets Transform of the input image */ 43 | flst(NULL, pFloatImageInput, pTree, NULL, NULL); 44 | 45 | /* Kill too small grains. 46 | Bound i>0 because it is forbidden to delete the root, at index 0 */ 47 | for(i = pTree->nb_shapes-1; i > 0; i--) 48 | if(pTree->the_shapes[i].area < *pMinArea) 49 | pTree->the_shapes[i].removed = (char)1; 50 | 51 | /* Reconstruct in pFloatImageOutput the modified tree of shapes */ 52 | flst_reconstruct(pTree, pFloatImageOutput); 53 | 54 | mw_delete_shapes(pTree); 55 | } 56 | 57 | /*in and out must be allocated*/ 58 | void fgrain(int MinArea, float *in, int nx, int ny, float *out) { 59 | int i; 60 | Fimage mwin = mw_change_fimage(NULL,ny,nx); 61 | Fimage mwout = mw_new_fimage(); 62 | for(i=0;igray[i] = in[i]; 63 | 64 | mw_fgrain( &MinArea, mwin, mwout); 65 | 66 | for(i=0;igray[i]; 67 | mw_delete_fimage(mwin); 68 | mw_delete_fimage(mwout); 69 | } 70 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/fgrain.h: -------------------------------------------------------------------------------- 1 | void fgrain(int MinArea, float *in, int nx, int ny, float *out); 2 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/flst/flst_reconstruct.c: -------------------------------------------------------------------------------- 1 | /*--------------------------- MegaWave2 Module -----------------------------*/ 2 | /* mwcommand 3 | name = {flst_reconstruct}; 4 | version = {"1.0"}; 5 | author = {"Pascal Monasse, Frederic Guichard"}; 6 | function = {"Reconstruct an image from its Fast Level Sets Transform"}; 7 | usage = { 8 | tree->pTree "Input tree of shapes", 9 | image<-pFloatImageOutput "Output fimage" 10 | }; 11 | */ 12 | 13 | #include "mw3.h" 14 | //#include "mw3-modules.h" 15 | #include "mw3-modules-specific.h" 16 | 17 | void flst_reconstruct(Shapes pTree, Fimage pFloatImageOutput) 18 | { 19 | int i; 20 | float *pOutputPixel; 21 | Shape *ppShapeOfPixel; 22 | Shape pShape; 23 | 24 | if (!mw_change_fimage(pFloatImageOutput, pTree->nrow, pTree->ncol)) 25 | mwerror(FATAL, 1, 26 | "flst_reconstruct --> impossible " 27 | "to allocate the output image\n"); 28 | 29 | pOutputPixel = pFloatImageOutput->gray; 30 | ppShapeOfPixel = pTree->smallest_shape; 31 | for (i = pTree->nrow * pTree->ncol - 1; i >= 0; i--) 32 | { 33 | pShape = *ppShapeOfPixel++; 34 | while (pShape->removed) 35 | pShape = pShape->parent; 36 | *pOutputPixel++ = pShape->value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/flst/mw3-modules-specific.h: -------------------------------------------------------------------------------- 1 | /* src/image/level_lines/flstb_dualchain.c */ 2 | void flstb_dualchain(Shapes pTree, Shape pShape, Flist pBoundary, 3 | char *ctabtabSaddleValues); 4 | /* src/image/level_lines/flst_reconstruct.c */ 5 | void flst_reconstruct(Shapes pTree, Fimage pFloatImageOutput); 6 | /* src/image/level_lines/fsaddles.c */ 7 | int fsaddles(Fimage pImage, Fimage pSaddlesImage); 8 | /* src/image/level_lines/flst_pixels.c */ 9 | void flst_pixels(Shapes pTree); 10 | 11 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/error.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file error.c 3 | * 4 | * @version 1.14 5 | * @author Jacques Froment & Sylvain Parrino (1995-2005) 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "definitions.h" 15 | 16 | #include "error.h" 17 | 18 | /* TODO: move to config.h or definitions.h */ 19 | int mwerrcnt = 0; 20 | 21 | void mwdebug(char *fmt, ...) 22 | { 23 | if (mwdbg) 24 | { 25 | va_list marker; 26 | 27 | va_start(marker, fmt); 28 | fprintf(stderr, " "); 29 | vfprintf(stderr, fmt, marker); 30 | va_end(marker); 31 | } 32 | } 33 | 34 | void mwerror(int code, int exit_code, char *fmt, ...) 35 | { 36 | va_list marker; 37 | 38 | va_start(marker, fmt); 39 | 40 | switch (code) 41 | { 42 | case WARNING: 43 | fprintf(stderr, "megawave warning (%s) : ", mwname); 44 | vfprintf(stderr, fmt, marker); 45 | break; 46 | case ERROR: 47 | fprintf(stderr, "megawave error (%s) : ", mwname); 48 | vfprintf(stderr, fmt, marker); 49 | mwerrcnt++; 50 | break; 51 | case FATAL: 52 | fprintf(stderr, "megawave fatal (%s) : ", mwname); 53 | vfprintf(stderr, fmt, marker); 54 | fprintf(stderr, "Exit.\n"); 55 | exit(exit_code); 56 | break; 57 | case INTERNAL: 58 | fprintf(stderr, "megawave internal (%s) : ", mwname); 59 | vfprintf(stderr, fmt, marker); 60 | fprintf(stderr, "Exit.\n"); 61 | exit(exit_code); 62 | break; 63 | case USAGE: 64 | fprintf(stderr, "Bad parameter; use the '--help' option for details"); 65 | exit(exit_code); 66 | break; 67 | default: 68 | mwerror(FATAL, 1, "Bad usage of mwerror : code %d is unknown\n", 69 | code); 70 | break; 71 | } 72 | va_end(marker); 73 | } 74 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * error.h 3 | */ 4 | 5 | #ifndef _ERROR_H_ 6 | #define _ERROR_H_ 7 | 8 | /* src/error.c */ 9 | void mwdebug(char *fmt, ...); 10 | void mwerror(int code, int exit_code, char *fmt, ...); 11 | 12 | #endif /* !_ERROR_H_ */ 13 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/fimage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fimage.h 3 | */ 4 | 5 | #ifndef _FIMAGE_H_ 6 | #define _FIMAGE_H_ 7 | 8 | /* src/fimage.c */ 9 | Fimage mw_new_fimage(void); 10 | Fimage mw_alloc_fimage(Fimage image, int nrow, int ncol); 11 | void mw_delete_fimage(Fimage image); 12 | Fimage mw_change_fimage(Fimage image, int nrow, int ncol); 13 | float mw_getdot_fimage(Fimage image, int x, int y); 14 | void mw_plot_fimage(Fimage image, int x, int y, float v); 15 | void mw_draw_fimage(Fimage image, int a0, int b0, int a1, int b1, float c); 16 | void mw_clear_fimage(Fimage image, float v); 17 | void mw_copy_fimage(Fimage in, Fimage out); 18 | float **mw_newtab_gray_fimage(Fimage image); 19 | 20 | #endif /* !_FIMAGE_H_ */ 21 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/fsignal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fsignal.h 3 | */ 4 | 5 | #ifndef _FSIGNAL_H_ 6 | #define _FSIGNAL_H_ 7 | 8 | /* src/fsignal.c */ 9 | Fsignal mw_new_fsignal(void); 10 | Fsignal mw_alloc_fsignal(Fsignal signal, int N); 11 | void mw_delete_fsignal(Fsignal signal); 12 | Fsignal mw_change_fsignal(Fsignal signal, int N); 13 | void mw_clear_fsignal(Fsignal signal, float v); 14 | void mw_copy_fsignal_values(Fsignal in, Fsignal out); 15 | void mw_copy_fsignal_header(Fsignal in, Fsignal out); 16 | void mw_copy_fsignal(Fsignal in, Fsignal out); 17 | 18 | #endif /* !_FSIGNAL_H_ */ 19 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/libmw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libmw.h 3 | */ 4 | 5 | #ifndef _LIBMW_H_ 6 | #define _LIBMW_H_ 7 | 8 | /* src/libmw.c */ 9 | 10 | #endif /* !_LIBMW_H_ */ 11 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * list.h 3 | */ 4 | 5 | #ifndef _LIST_H_ 6 | #define _LIST_H_ 7 | 8 | /* src/list.c */ 9 | Flist mw_new_flist(void); 10 | Flist mw_realloc_flist(Flist l, int n); 11 | Flist mw_enlarge_flist(Flist l); 12 | Flist mw_change_flist(Flist l, int max_size, int size, int dimension); 13 | void mw_delete_flist(Flist l); 14 | void mw_clear_flist(Flist l, float v); 15 | Flist mw_copy_flist(Flist in, Flist out); 16 | Flists mw_new_flists(void); 17 | Flists mw_realloc_flists(Flists ls, int n); 18 | Flists mw_enlarge_flists(Flists ls); 19 | Flists mw_change_flists(Flists ls, int max_size, int size); 20 | void mw_delete_flists(Flists ls); 21 | Flists mw_copy_flists(Flists in, Flists out); 22 | Dlist mw_new_dlist(void); 23 | Dlist mw_realloc_dlist(Dlist l, int n); 24 | Dlist mw_enlarge_dlist(Dlist l); 25 | Dlist mw_change_dlist(Dlist l, int max_size, int size, int dimension); 26 | void mw_delete_dlist(Dlist l); 27 | void mw_clear_dlist(Dlist l, double v); 28 | Dlist mw_copy_dlist(Dlist in, Dlist out); 29 | Dlists mw_new_dlists(void); 30 | Dlists mw_realloc_dlists(Dlists ls, int n); 31 | Dlists mw_enlarge_dlists(Dlists ls); 32 | Dlists mw_change_dlists(Dlists ls, int max_size, int size); 33 | void mw_delete_dlists(Dlists ls); 34 | Dlists mw_copy_dlists(Dlists in, Dlists out); 35 | 36 | #endif /* !_LIST_H_ */ 37 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libmw/mw3/shape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * shape.h 3 | */ 4 | 5 | #ifndef _SHAPE_H_ 6 | #define _SHAPE_H_ 7 | 8 | /* src/shape.c */ 9 | Point_plane mw_new_point_plane(void); 10 | Point_plane mw_change_point_plane(Point_plane point); 11 | Shape mw_new_shape(void); 12 | Shape mw_change_shape(Shape sh); 13 | void mw_delete_shape(Shape shape); 14 | Shape mw_get_not_removed_shape(Shape sh); 15 | Shape mw_get_parent_shape(Shape sh); 16 | Shape mw_get_first_child_shape(Shape sh); 17 | Shape mw_get_next_sibling_shape(Shape sh); 18 | Shape mw_get_smallest_shape(Shapes shs, int iX, int iY); 19 | Shapes mw_new_shapes(void); 20 | Shapes mw_alloc_shapes(Shapes shs, int nrow, int ncol, float value); 21 | Shapes mw_change_shapes(Shapes shs, int nrow, int ncol, float value); 22 | void mw_delete_shapes(Shapes shs); 23 | 24 | #endif /* !_SHAPE_H_ */ 25 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libraryStable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | SET(SRC iio.c iio.h libraryBasic.cpp libraryBasic.h ) 5 | 6 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -std=c99 -funroll-loops -Wno-unused -DNDEBUG") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ") 8 | 9 | # debug 10 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 ") 11 | 12 | 13 | 14 | ADD_LIBRARY(library2013 ${SRC}) 15 | 16 | 17 | # ADD LOCAL PATH TO SEARCH MODULES 18 | 19 | LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_PREFIX}") 20 | SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}) 21 | 22 | FIND_PACKAGE(JPEG) 23 | FIND_PACKAGE(TIFF) 24 | FIND_PACKAGE(PNG) 25 | FIND_PACKAGE(FFTW) 26 | 27 | ADD_DEFINITIONS(${PNG_DEFINITIONS}) 28 | 29 | INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR}) 30 | INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) 31 | INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR}) 32 | INCLUDE_DIRECTORIES(${FFTW_INCLUDE_DIR}) 33 | INCLUDE_DIRECTORIES(..) 34 | 35 | TARGET_LINK_LIBRARIES(library2013 ${TIFF_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${FFTW_LIBRARIES} m) 36 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libraryStable/FindFFTW.cmake: -------------------------------------------------------------------------------- 1 | ## FFTW can be compiled and subsequently linked against 2 | ## various data types. 3 | ## There is a single set of include files, and then muttiple libraries, 4 | ## One for each type. I.e. libfftw.a-->double, libfftwf.a-->float 5 | 6 | ## The following logic belongs in the individual package 7 | ## mark_as_advanced(ITK_USE_FFTWD) 8 | ## option(ITK_USE_FFTWD "Use double precision FFTW if found" ON) 9 | ## mark_as_advanced(ITK_USE_FFTWF) 10 | ## option(ITK_USE_FFTWF "Use single precision FFTW if found" ON) 11 | 12 | if(ITK_USE_FFTWD OR ITK_USE_FFTWF) 13 | 14 | set(FFTW_INC_SEARCHPATH 15 | /sw/include 16 | /usr/include 17 | /usr/local/include 18 | /usr/include/fftw 19 | /usr/local/include/fftw 20 | ) 21 | 22 | find_path(FFTW_INCLUDE_PATH fftw3.h ${FFTW_INC_SEARCHPATH}) 23 | 24 | if(FFTW_INCLUDE_PATH) 25 | set(FFTW_INCLUDE ${FFTW_INCLUDE_PATH}) 26 | endif() 27 | 28 | if(FFTW_INCLUDE) 29 | include_directories( ${FFTW_INCLUDE}) 30 | endif() 31 | 32 | get_filename_component(FFTW_INSTALL_BASE_PATH ${FFTW_INCLUDE_PATH} PATH) 33 | 34 | set(FFTW_LIB_SEARCHPATH 35 | ${FFTW_INSTALL_BASE_PATH}/lib 36 | /usr/lib/fftw 37 | /usr/local/lib/fftw 38 | ) 39 | 40 | if(ITK_USE_FFTWD) 41 | mark_as_advanced(FFTWD_LIB) 42 | find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib 43 | find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH}) #Double Precision Lib only if compiled with threads support 44 | 45 | if(FFTWD_LIB) 46 | set(FFTWD_FOUND 1) 47 | get_filename_component(FFTW_LIBDIR ${FFTWD_LIB} PATH) 48 | if(FFTWD_THREADS_LIB) 49 | set(FFTWD_LIB ${FFTWD_LIB} ${FFTWD_THREADS_LIB} ) 50 | endif() 51 | endif() 52 | endif() 53 | 54 | if(ITK_USE_FFTWF) 55 | mark_as_advanced(FFTWF_LIB) 56 | find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib 57 | find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH}) #Single Precision Lib only if compiled with threads support 58 | 59 | if(FFTWF_LIB) 60 | set(FFTWF_FOUND 1) 61 | get_filename_component(FFTW_LIBDIR ${FFTWF_LIB} PATH) 62 | if(FFTWF_THREADS_LIB) 63 | set(FFTWF_LIB ${FFTWF_LIB} ${FFTWF_THREADS_LIB} ) 64 | endif() 65 | endif() 66 | endif() 67 | 68 | endif() 69 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libstereo_newversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | 4 | FIND_PACKAGE( OpenMP ) 5 | if(OPENMP_FOUND) 6 | message("OPENMP FOUND") 7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 9 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") 10 | endif() 11 | 12 | 13 | # debug 14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 ") 15 | 16 | INCLUDE_DIRECTORIES(..) 17 | 18 | 19 | 20 | 21 | ADD_EXECUTABLE(iip_stereo_correlation_multi_win2_newversion iip_stereo_correlation_multi_win2.cpp libstereo.h libstereo.cpp cubic.h ransacFIX.h vvector.h smartparameter.h) 22 | TARGET_LINK_LIBRARIES(iip_stereo_correlation_multi_win2_newversion library2013 fftw3f libmw) 23 | 24 | 25 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libstereo_newversion/cubic.h: -------------------------------------------------------------------------------- 1 | #include 2 | //double cubicInterpolate (double p[4], double x) { 3 | // assert(x<=1); 4 | // assert(x>=0); 5 | // return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))); 6 | //} 7 | // 8 | //// find the minimum in the iterval [0,1] of a cubic interpolated function 9 | //double cubicMinimum(double p[4]) { 10 | // // trivial minimums 11 | // double cmin = fmin(p[1],p[2]); 12 | // 13 | // double a,b,c,z1,z2,discr; 14 | // // coefficients of: ax^2 +bx +c = 0 15 | // a = 0.5 * 3.0 * (3.0*(p[1] - p[2]) + p[3] - p[0]); 16 | // b = 2.0 * p[0] - 5.0*p[1] + 4.0*p[2] - p[3]; 17 | // c = 0.5 * (p[2] - p[0]); 18 | // 19 | // // discriminant 20 | // discr=b*b -4.0 *a *c; 21 | // if (discr >=0) { 22 | // z1 = (-b+ sqrt(discr))/(2.0*a); 23 | // z2 = (-b- sqrt(discr))/(2.0*a); 24 | // if(z1>0.0 && z1<1.0) cmin = fmin(z1,cmin); 25 | // if(z2>0.0 && z2<1.0) cmin = fmin(z2,cmin); 26 | // } 27 | // return cmin; 28 | //} 29 | 30 | 31 | 32 | inline float cubicInterpolate (const float p[4], const float x) { 33 | // assert(x<=1); 34 | // assert(x>=0); 35 | return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0]))); 36 | } 37 | 38 | 39 | // find the minimum in the iterval [0,1] of a cubic interpolated function 40 | float cubicMinimum(float p[4], float *out_pmin, float *out_xmin) { 41 | // trivial minimums 42 | float pmin,xmin; 43 | if(p[1] < p[2]) { 44 | pmin=p[1]; 45 | xmin=0.0; 46 | } else { 47 | pmin=p[2]; 48 | xmin=1.0; 49 | } 50 | 51 | double a,b,c,z1,z2,discr; 52 | // coefficients of: ax^2 +bx +c = 0 53 | a = 0.5 * 3.0 * (3.0*(p[1] - p[2]) + p[3] - p[0]); 54 | b = 2.0 * p[0] - 5.0*p[1] + 4.0*p[2] - p[3]; 55 | c = 0.5 * (p[2] - p[0]); 56 | 57 | // discriminant 58 | discr=b*b -4.0 *a *c; 59 | if (discr >=0) { 60 | z1 = (-b+ sqrt(discr))/(2.0*a); 61 | z2 = (-b- sqrt(discr))/(2.0*a); 62 | if(z1>0.0 && z1<1.0) { 63 | float tmp = cubicInterpolate(p,z1); 64 | if(tmp < pmin) { 65 | pmin=tmp; 66 | xmin=z1; 67 | } 68 | } 69 | if(z2>0.0 && z2<1.0) { 70 | float tmp = cubicInterpolate(p,z2); 71 | if(tmp < pmin) { 72 | pmin=tmp; 73 | xmin=z2; 74 | } 75 | } 76 | } 77 | 78 | // if( *out_pmin < pmin) { 79 | *out_pmin = pmin; 80 | *out_xmin = xmin; 81 | // } 82 | return pmin; 83 | } 84 | -------------------------------------------------------------------------------- /3rdparty/msmw2/libstereo_newversion/smartparameter.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Original QNM's version from E. Meinhardt-Llopis 5 | * Megawave port by G. Facciolo*/ 6 | 7 | /*/ a smart parameter is just like a regular parameter, but it can be 8 | // re-defined at the shell-environment. Instead of 9 | // 10 | // #define NUMBER 42 11 | // ... 12 | // printf("%g", NUMBER); 13 | // 14 | // do 15 | // SMART_PARAMETER(NUMBER,42) 16 | // ... 17 | // printf("%g", NUMBER()); 18 | // 19 | // Notice that the environment only gets queried once, at the first use. 20 | // 21 | */ 22 | #ifndef VERBOSE_SMART_PARAMETER 23 | #define VERBOSE_SMART_PARAMETER 0 24 | #endif 25 | 26 | #define SMART_PARAMETER(n,v) static double n(void)\ 27 | {\ 28 | static int smapa_known_ ## n = false;\ 29 | static double smapa_value_ ## n = v;\ 30 | if (!smapa_known_ ## n)\ 31 | {\ 32 | int r;\ 33 | char *sv;\ 34 | double y;\ 35 | sv = getenv(#n);\ 36 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr,"scanning the environment for \"%s\"... ", #n);\ 37 | if (sv)\ 38 | r = sscanf(sv, "%lf", &y);\ 39 | if (sv && r == 1)\ 40 | {\ 41 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr, "got value %g\n", y);\ 42 | smapa_value_ ## n = y;\ 43 | } else {\ 44 | if(VERBOSE_SMART_PARAMETER) fprintf(stderr, "kept default value %g\n",\ 45 | smapa_value_ ## n);\ 46 | }\ 47 | smapa_known_ ## n = true;\ 48 | }\ 49 | return smapa_value_ ## n;\ 50 | } 51 | 52 | 53 | #define SMART_PARAMETER_INT(n,v) static int n(void)\ 54 | {\ 55 | static int smapa_known_ ## n = false;\ 56 | static int smapa_value_ ## n = v;\ 57 | if (!smapa_known_ ## n)\ 58 | {\ 59 | int r;\ 60 | int y;\ 61 | char *sv;\ 62 | sv = getenv(#n);\ 63 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr,"scanning the environment for \"%s\"... ", #n);\ 64 | if (sv)\ 65 | r = sscanf(sv, "%d", &y);\ 66 | if (sv && r == 1)\ 67 | {\ 68 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr, "got int value %d\n", y);\ 69 | smapa_value_ ## n = y;\ 70 | } else {\ 71 | if(VERBOSE_SMART_PARAMETER)fprintf(stderr, "kept default int value %d\n",\ 72 | smapa_value_ ## n);\ 73 | }\ 74 | smapa_known_ ## n = true;\ 75 | }\ 76 | return smapa_value_ ## n;\ 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /3rdparty/sgbm/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CXX = c++ 3 | CFLAGS = -std=c99 -O3 4 | CPPFLAGS = -O3 5 | CV_CORE_OBJS = alloc.o arithm.o array.o convert.o copy.o datastructs.o gpumat.o lapack.o mathfuncs.o matmul.o matop.o matrix.o opengl_interop.o opengl_interop_deprecated.o parallel.o persistence.o stat.o system.o tables_core.o 6 | CV_IMGPROC_OBJS = smooth.o tables_imgproc.o 7 | 8 | all: sgbm 9 | 10 | sgbm: sgbm.cpp stereosgbm.cpp libiio.a libcv_core.a libcv_imgproc.a 11 | $(CXX) -o sgbm sgbm.cpp stereosgbm.cpp -L. -liio -lcv_core -lcv_imgproc -lpng -ltiff -ljpeg -lz 12 | libiio.a: iio.o 13 | ar rcs libiio.a iio.o 14 | libcv_core.a: $(CV_CORE_OBJS) 15 | ar rcs libcv_core.a $(CV_CORE_OBJS) 16 | libcv_imgproc.a: $(CV_IMGPROC_OBJS) 17 | ar rcs libcv_imgproc.a $(CV_IMGPROC_OBJS) 18 | .cpp.o: 19 | $(CXX) $(CPPFLAGS) -c $< -I. 20 | iio.o: 21 | $(CC) $(CFLAGS) -c iio.c -o iio.o -Wno-deprecated-declarations 22 | clean: 23 | $(RM) *.o 24 | $(RM) *.a 25 | $(RM) sgbm 26 | -------------------------------------------------------------------------------- /3rdparty/sgbm/include/devmem2d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #include "cuda_devptrs.hpp" 44 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/build.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/build/boofcv_stereo.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/stereo_hirschmuller_2002/build/boofcv_stereo.jar -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/compile.txt: -------------------------------------------------------------------------------- 1 | Download boofcv (only tested with v0.12) 2 | http://sourceforge.net/projects/boofcv/files/v0.12/boofcv-v0.12-src.zip/download 3 | 4 | Compile the boofcv library 5 | 6 | Run "ant" to copile the modules in src 7 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/test.sh: -------------------------------------------------------------------------------- 1 | ./pix.sh testdata/a.png testdata/b.png testdata/disp.pgm -90 30 2 | ./subpix.sh testdata/a.png testdata/b.png testdata/disp.pgm -90 30 3 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/testdata/a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/stereo_hirschmuller_2002/testdata/a.png -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/testdata/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/3rdparty/stereo_hirschmuller_2002/testdata/b.png -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2008/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | 3 | PROJECT( SGBM ) 4 | 5 | # DEFAULT BUILD: RELEASE 6 | if (NOT CMAKE_BUILD_TYPE) 7 | message(STATUS "No build type selected, default to Release") 8 | set(CMAKE_BUILD_TYPE "Release") 9 | endif() 10 | 11 | 12 | FIND_PACKAGE(OpenCV REQUIRED core highgui calib3d) 13 | FIND_PACKAGE(PNG) 14 | FIND_PACKAGE(JPEG) 15 | FIND_PACKAGE(TIFF) 16 | 17 | # OpenMP 18 | FIND_PACKAGE( OpenMP ) 19 | IF(OPENMP_FOUND) 20 | MESSAGE("OPENMP FOUND") 21 | SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}" ) 22 | ENDIF() 23 | 24 | 25 | #### GF: HACK 26 | add_library(IIOLIB iio.c iio.h) #Define that those files create the lib FooLib 27 | target_link_libraries(IIOLIB ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES}) 28 | SET_TARGET_PROPERTIES(IIOLIB PROPERTIES 29 | COMPILE_FLAGS "-O3 -std=c99 -funroll-loops -Wno-unused -DNDEBUG") 30 | 31 | 32 | set(CORELIBS ${OpenCV_LIBRARIES} ${OPENCV_LIB_COMPONENTS} m IIOLIB) 33 | 34 | ADD_EXECUTABLE( ${PROJECT_NAME} sgbm.cpp ) 35 | target_link_libraries(${PROJECT_NAME} ${CORELIBS}) 36 | 37 | 38 | ADD_EXECUTABLE( sgbm2 sgbm2.cpp ) 39 | target_link_libraries(sgbm2 ${CORELIBS}) 40 | SET_TARGET_PROPERTIES(sgbm2 PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}") 41 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2008/callSGBM.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # get real path of the binary file 4 | rel_path_script=`dirname $0` 5 | 6 | if [ "$3" == "" ]; then 7 | echo "Usage:" 8 | echo " $0 im1 im2 out_disp out_mask mindisp maxdisp win P1 P2 lr" 9 | echo "" 10 | echo " win: matched block size. It must be an odd number >=1." 11 | echo " P1: The first parameter controlling the disparity smoothness." 12 | echo " P2: The second parameter controlling the disparity smoothness. The" 13 | echo " larger the values are, the smoother the disparity is. P1 is the penalty on" 14 | echo " the disparity change by plus or minus 1 between neighbor pixels. P2 is the" 15 | echo " penalty on the disparity change by more than 1 between neighbor pixels. The" 16 | echo " algorithm requires P2 > P1" 17 | echo " lr: max allowed difference in the left-right disparity check." 18 | echo "" 19 | echo " Wrapper to opencv SGBM function, which implements a modified version" 20 | echo " of Hirschmuller's Semi-Global Matching (SGM):" 21 | echo " Hirschmuller, H. \"Stereo Processing by Semiglobal Matching and Mutual Information\"" 22 | echo " PAMI(30), No. 2, February 2008, pp. 328-34" 23 | exit 1 24 | fi 25 | 26 | a=$1 27 | b=$2 28 | disp=$3 29 | mask=$4 30 | im=$5 31 | iM=$6 32 | SAD_win=$7 33 | P1=$8 34 | P2=$9 35 | lr=${10} 36 | 37 | 38 | # convert input images to png 39 | aa=$(basename "$a") 40 | a_extension="${aa##*.}" 41 | a_name="${aa%.*}" 42 | bb=$(basename "$b") 43 | b_extension="${bb##*.}" 44 | b_name="${bb%.*}" 45 | if [ $a_extension == "tif" ]; then 46 | thresholds=`plambda $a "x isnan 0 x if" | qauto - $a.png 2>&1 | cut -f2 -d=` 47 | a=$a.png 48 | # use the same threshods for the second image 49 | qeasy $thresholds $b $b.png 50 | b=$b.png 51 | fi 52 | 53 | #usage: ./build/SGBM im1 im2 out [mindisp(0) maxdisp(64) SADwindow(1) P1(0) P2(0) LRdiff(1)] 54 | echo "sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr" 55 | sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr 56 | # the points are either unmatched or not present in the original images $1/$2, we remove these points 57 | plambda $disp "x 0 join " | backflow - $2 | plambda $disp $1 - "x isnan y isnan z isnan or or 0 255 if" | iion - $mask 58 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2008/callSGBM_cauchy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # get real path of the binary file 4 | rel_path_script=`dirname $0` 5 | 6 | if [ "$3" == "" ]; then 7 | echo "Usage:" 8 | echo " $0 im1 im2 out_disp out_mask mindisp maxdisp win P1 P2 lr" 9 | echo "" 10 | echo " win: matched block size. It must be an odd number >=1." 11 | echo " P1: The first parameter controlling the disparity smoothness." 12 | echo " P2: The second parameter controlling the disparity smoothness. The" 13 | echo " larger the values are, the smoother the disparity is. P1 is the penalty on" 14 | echo " the disparity change by plus or minus 1 between neighbor pixels. P2 is the" 15 | echo " penalty on the disparity change by more than 1 between neighbor pixels. The" 16 | echo " algorithm requires P2 > P1" 17 | echo " lr: max allowed difference in the left-right disparity check." 18 | echo "" 19 | echo " Wrapper to opencv SGBM function, which implements a modified version" 20 | echo " of Hirschmuller's Semi-Global Matching (SGM):" 21 | echo " Hirschmuller, H. \"Stereo Processing by Semiglobal Matching and Mutual Information\"" 22 | echo " PAMI(30), No. 2, February 2008, pp. 328-34" 23 | echo " >>> Preprocess the images computing the laplacian" 24 | exit 1 25 | fi 26 | 27 | a=$1 28 | b=$2 29 | disp=$3 30 | mask=$4 31 | im=$5 32 | iM=$6 33 | SAD_win=$7 34 | P1=$8 35 | P2=$9 36 | lr=${10} 37 | 38 | 39 | ## convert input images to png 40 | ## HACK! local contrast equalization/enhancement 41 | plambda $a "x isnan 0 x if" | blur C 1 | qauto - $a.png 42 | a=$a.png 43 | plambda $b "x isnan 0 x if" | blur C 1 | qauto - $b.png 44 | b=$b.png 45 | 46 | #usage: ./build/SGBM im1 im2 out [mindisp(0) maxdisp(64) SADwindow(1) P1(0) P2(0) LRdiff(1)] 47 | echo "sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr" 48 | sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr 49 | # the points are either unmatched or not present in the original images $1/$2, we remove these points 50 | plambda $disp "x 0 join " | backflow - $2 | plambda $disp $1 - "x isnan y isnan z isnan or or 0 255 if" | iion - $mask 51 | -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2008/callSGBM_lap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # get real path of the binary file 4 | rel_path_script=`dirname $0` 5 | 6 | if [ "$3" == "" ]; then 7 | echo "Usage:" 8 | echo " $0 im1 im2 out_disp out_mask mindisp maxdisp win P1 P2 lr" 9 | echo "" 10 | echo " win: matched block size. It must be an odd number >=1." 11 | echo " P1: The first parameter controlling the disparity smoothness." 12 | echo " P2: The second parameter controlling the disparity smoothness. The" 13 | echo " larger the values are, the smoother the disparity is. P1 is the penalty on" 14 | echo " the disparity change by plus or minus 1 between neighbor pixels. P2 is the" 15 | echo " penalty on the disparity change by more than 1 between neighbor pixels. The" 16 | echo " algorithm requires P2 > P1" 17 | echo " lr: max allowed difference in the left-right disparity check." 18 | echo "" 19 | echo " Wrapper to opencv SGBM function, which implements a modified version" 20 | echo " of Hirschmuller's Semi-Global Matching (SGM):" 21 | echo " Hirschmuller, H. \"Stereo Processing by Semiglobal Matching and Mutual Information\"" 22 | echo " PAMI(30), No. 2, February 2008, pp. 328-34" 23 | echo " >>> Preprocess the images computing the laplacian" 24 | exit 1 25 | fi 26 | 27 | a=$1 28 | b=$2 29 | disp=$3 30 | mask=$4 31 | im=$5 32 | iM=$6 33 | SAD_win=$7 34 | P1=$8 35 | P2=$9 36 | lr=${10} 37 | 38 | 39 | ## convert input images to png 40 | # HACK! make it invariant to illumination changes? 41 | plambda $a "x isnan 0 x if" | gblur 1 | plambda - " x 4 * x(-1,0) -1 * + x(1,0) -1 * + x(0,-1) -1 * + x(0,1) -1 * + " -o $a.tif 42 | thresholds=`plambda $a.tif "x isnan 0 x if" | qauto - $a.png 2>&1 | cut -f2 -d=` 43 | plambda $b "x isnan 0 x if" | gblur 1 | plambda - " x 4 * x(-1,0) -1 * + x(1,0) -1 * + x(0,-1) -1 * + x(0,1) -1 * + " | qeasy $thresholds - $b.png 44 | 45 | a=$a.png 46 | b=$b.png 47 | 48 | 49 | #usage: ./build/SGBM im1 im2 out [mindisp(0) maxdisp(64) SADwindow(1) P1(0) P2(0) LRdiff(1)] 50 | echo "sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr" 51 | sgbm2 $a $b $disp $im $iM $SAD_win $P1 $P2 $lr 52 | # the points are either unmatched or not present in the original images $1/$2, we remove these points 53 | plambda $disp "x 0 join " | backflow - $2 | plambda $disp $1 - "x isnan y isnan z isnan or or 0 255 if" | iion - $mask 54 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | LABEL maintainer="Carlo de Franchis " 4 | 5 | # https://goo.gl/aypXVx 6 | ARG DEBIAN_FRONTEND=noninteractive 7 | # https://github.com/mapbox/rasterio#ssl-certs 8 | ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt 9 | 10 | RUN apt-get update && apt-get install -y --no-install-recommends \ 11 | build-essential \ 12 | curl \ 13 | cmake \ 14 | libfftw3-dev \ 15 | libgdal-dev \ 16 | libgeotiff-dev \ 17 | libtiff5-dev \ 18 | python3-dev \ 19 | python3-pip && \ 20 | rm -fr /var/lib/apt/lists/* 21 | 22 | # Copy files needed to install s2p 23 | WORKDIR /root 24 | COPY LICENSE.txt MANIFEST.in README.md setup.py makefile s2p/ 25 | WORKDIR /root/s2p 26 | COPY 3rdparty/ 3rdparty/ 27 | COPY c/ c/ 28 | COPY s2p/ s2p/ 29 | COPY bin/ bin/ 30 | COPY lib/ lib/ 31 | 32 | # Install s2p 33 | RUN pip install --no-cache-dir -e . 34 | 35 | -------------------------------------------------------------------------------- /HACKERS: -------------------------------------------------------------------------------- 1 | GITIQUETTE 2 | 3 | (E1) To contribute, make a pull request to https://github.com/cmla/s2p 4 | 5 | (E2) Make sure that your pull request passes all the tests before sending it. 6 | 7 | (E3) Any pull request must be explicitly accepted by two persons before being 8 | merged: a member of the CMLA team and a member of the CNES team. These two 9 | persons must be different to the author of the pull request. 10 | 11 | (E4) Exception to (E3): typos and trivial bugfixes can be merged right away. 12 | 13 | (E5) Optional: If the intent of the pull request is not clear, it may be 14 | helpful to refer to the philosophy points (P1)--(P7) outlined below. 15 | 16 | (E6) Admissible types of pull requests: 17 | * [bugfix] solves a concrete problem, changing one or at most two files 18 | * [feature] adds a new feature which is disabled by default 19 | * [config] changes the default configuration options 20 | * [refactor] moves files/functions around without changing the algorithm 21 | * [testing] changes the testing system, adds test data, etc. 22 | * [doc] documentation / comments 23 | * [trivial] typo or trivial bugfix on a single file 24 | 25 | (E7) As far as possible, the types of pull requests in (E6) should be mutually exclusive. 26 | For example, you cannot refactor and bugfix. 27 | 28 | 29 | PHILOSOPHY 30 | 31 | Since a perfect program is impossible, compromises are necessary. 32 | We prefer to solve compromises according to the following order: 33 | 34 | (P1) The program works. 35 | (P2) The results are precise. 36 | (P3) The program is fast. 37 | (P4) The code is modular. 38 | (P5) The code is the simplest possible. 39 | (P6) The code has the least amount of dependences possible. 40 | (P7) The code is portable. 41 | -------------------------------------------------------------------------------- /bin/.dummy: -------------------------------------------------------------------------------- 1 | dummy 2 | -------------------------------------------------------------------------------- /c/abstract_dsf.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/abstract_dsf.c -------------------------------------------------------------------------------- /c/backflow.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/backflow.c -------------------------------------------------------------------------------- /c/bicubic.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/bicubic.c -------------------------------------------------------------------------------- /c/cldmask.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/misc/cldmask.c -------------------------------------------------------------------------------- /c/colorcoordsf.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/colorcoordsf.c -------------------------------------------------------------------------------- /c/downsa.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/downsa.c -------------------------------------------------------------------------------- /c/drawsegment.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/drawsegment.c -------------------------------------------------------------------------------- /c/fail.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/fail.c -------------------------------------------------------------------------------- /c/getpixel.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/getpixel.c -------------------------------------------------------------------------------- /c/help_stuff.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/help_stuff.c -------------------------------------------------------------------------------- /c/iio.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/iio/iio.c -------------------------------------------------------------------------------- /c/iio.h: -------------------------------------------------------------------------------- 1 | ../3rdparty/iio/iio.h -------------------------------------------------------------------------------- /c/lists.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | struct list { 7 | char *current; 8 | struct list *next; 9 | }; 10 | 11 | struct list *push(struct list *l, char *s) 12 | { 13 | if (l == NULL) { 14 | l = (struct list *) malloc(sizeof(struct list)); 15 | l->current = strdup(s); 16 | l->next = NULL; 17 | } else { 18 | l->next = push(l->next, s); 19 | } 20 | return l; 21 | } 22 | 23 | 24 | void list_print(struct list *l) 25 | { 26 | if (l != NULL) { 27 | printf("%s\n", l->current); 28 | list_print(l->next); 29 | } 30 | } 31 | 32 | 33 | #ifdef MAIN_LISTS 34 | int main(int c, char *v[]) 35 | { 36 | // process input arguments 37 | if (c != 1) { 38 | fprintf(stderr, "usage:\n\t" 39 | "echo strings | %s\n", *v); 40 | return 1; 41 | } 42 | 43 | // add each string from stdin to the list 44 | struct list *l = NULL; 45 | char s[FILENAME_MAX]; 46 | 47 | while (fgets(s, FILENAME_MAX, stdin)) 48 | { 49 | strtok(s, "\n"); 50 | l = push(l, s); 51 | } 52 | 53 | // print list 54 | list_print(l); 55 | return 0; 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /c/morsi.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/morsi.c -------------------------------------------------------------------------------- /c/parsenumbers.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/parsenumbers.c -------------------------------------------------------------------------------- /c/pickopt.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/pickopt.c -------------------------------------------------------------------------------- /c/plambda.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/plambda.c -------------------------------------------------------------------------------- /c/pview.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/pview.c -------------------------------------------------------------------------------- /c/qauto.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/qauto.c -------------------------------------------------------------------------------- /c/random.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/random.c -------------------------------------------------------------------------------- /c/remove_small_cc.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/misc/remove_small_cc.c -------------------------------------------------------------------------------- /c/rpc.h: -------------------------------------------------------------------------------- 1 | #ifndef _RPC_H 2 | #define _RPC_H 3 | 4 | // rational polynomial coefficient stuff 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | // rational polynomial coefficients (and those of the inverse model) 14 | struct rpc { 15 | double numx[20]; 16 | double denx[20]; 17 | double numy[20]; 18 | double deny[20]; 19 | double scale[3], offset[3]; 20 | 21 | double inumx[20]; 22 | double idenx[20]; 23 | double inumy[20]; 24 | double ideny[20]; 25 | double iscale[3], ioffset[3]; 26 | 27 | double dmval[4]; 28 | double imval[4]; 29 | 30 | // initialization factor for iterative localization 31 | double delta; 32 | }; 33 | 34 | 35 | // read an XML file specifying an RPC model 36 | void read_rpc_file_xml(struct rpc *p, char *filename); 37 | 38 | void print_rpc(FILE *f, struct rpc *p, char *n); 39 | 40 | // evaluate the direct rpc model 41 | void eval_rpc(double *result, 42 | struct rpc *p, double x, double y, double z); 43 | 44 | // evaluate the inverse rpc model 45 | void eval_rpci(double *result, 46 | struct rpc *p, double x, double y, double z); 47 | 48 | // evaluate an epipolar correspondence 49 | static void eval_rpc_pair(double xprime[2], 50 | struct rpc *a, struct rpc *b, 51 | double x, double y, double z); 52 | 53 | // compute the height of a point given its location inside two images 54 | double rpc_height(struct rpc *rpca, struct rpc *rpcb, 55 | double x, double y, double xp, double yp, double *outerr); 56 | 57 | #endif // _RPC_H 58 | -------------------------------------------------------------------------------- /c/smapa.h: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/smapa.h -------------------------------------------------------------------------------- /c/spline.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/spline.c -------------------------------------------------------------------------------- /c/vvector.h: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/vvector.h -------------------------------------------------------------------------------- /c/xfopen.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/xfopen.c -------------------------------------------------------------------------------- /c/xmalloc.c: -------------------------------------------------------------------------------- 1 | ../3rdparty/imscript/src/xmalloc.c -------------------------------------------------------------------------------- /lib/.dummy: -------------------------------------------------------------------------------- 1 | dummy 2 | -------------------------------------------------------------------------------- /s2p/cli.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import argparse 4 | 5 | import s2p 6 | 7 | 8 | def main(): 9 | """ 10 | Command line parsing for s2p command line interface. 11 | """ 12 | parser = argparse.ArgumentParser(description=('S2P: Satellite Stereo ' 13 | 'Pipeline')) 14 | parser.add_argument('config', metavar='config.json', 15 | help=('path to a json file containing the paths to ' 16 | 'input and output files and the algorithm ' 17 | 'parameters')) 18 | parser.add_argument('--start_from', dest='start_from', type=int, 19 | default=0, help="Restart the process from a given step in " 20 | "case of an interruption or to try different parameters.") 21 | args = parser.parse_args() 22 | 23 | user_cfg = s2p.read_config_file(args.config) 24 | 25 | s2p.main(user_cfg, start_from=args.start_from) 26 | 27 | # Backup input file for sanity check 28 | if not args.config.startswith(os.path.abspath(s2p.cfg['out_dir']+os.sep)): 29 | shutil.copy2(args.config,os.path.join(s2p.cfg['out_dir'],'config.json.orig')) 30 | -------------------------------------------------------------------------------- /s2p/evaluation.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015, Carlo de Franchis 2 | # Copyright (C) 2015, Gabriele Facciolo 3 | # Copyright (C) 2015, Enric Meinhardt 4 | # Copyright (C) 2015, Julien Michel 5 | 6 | import numpy as np 7 | 8 | def distance_point_to_line(x, l): 9 | """ 10 | Computes the distance between a point and a line expressed in homogeneous 11 | coordinates. 12 | 13 | Args: 14 | x: 3-vector, containing the homogeneous coordinates of a point 15 | l: 3-vector, containing the homogeneous coordinates of a line 16 | 17 | Returns: 18 | the distance between x and l 19 | In the case where x is an ideal point or l is the line at infinity, the 20 | returned distance is infinity 21 | """ 22 | if (np.abs(x[2]) < np.finfo(float).eps): 23 | # x is an ideal point, distance is +infty 24 | return np.finfo(float).max 25 | if (np.hypot(l[0], l[1]) < np.finfo(float).eps): 26 | # l is the line at infinity, distance is +infty 27 | return np.finfo(float).max 28 | 29 | num = np.abs(np.dot(x, l)) 30 | den = np.hypot(l[0], l[1]) * np.abs(x[2]) 31 | return num/den 32 | -------------------------------------------------------------------------------- /s2p/fusion.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015, Carlo de Franchis 2 | # Copyright (C) 2015, Gabriele Facciolo 3 | # Copyright (C) 2015, Enric Meinhardt 4 | # Copyright (C) 2015, Julien Michel 5 | 6 | import os 7 | import sys 8 | import shutil 9 | import numpy as np 10 | import rasterio 11 | 12 | from s2p.config import cfg 13 | from s2p import common 14 | 15 | 16 | def average_if_close(x, threshold): 17 | """ 18 | """ 19 | if np.nanmax(x) - np.nanmin(x) > threshold: 20 | return np.nan 21 | else: 22 | return np.nanmedian(x) 23 | 24 | 25 | def merge_n(output, inputs, offsets, averaging='average_if_close', threshold=1): 26 | """ 27 | Merge n images of equal sizes by taking the median/mean/min/max pixelwise. 28 | 29 | Args: 30 | inputs: list of paths to the input images 31 | output: path to the output image 32 | averaging: string containing the name of a function that accepts 33 | 1D arrays. It is applied to 1D slices of the stack of images along 34 | the last axis. Possible values are, for instance np.min, np.max, 35 | np.mean, np.median and their nanproof counterparts, ie np.nanmin, 36 | np.nanmax, np.nanmean, np.nanmedian 37 | """ 38 | assert(len(inputs) == len(offsets)) 39 | 40 | # get input images size 41 | if inputs: 42 | with rasterio.open(inputs[0], 'r') as f: 43 | h, w = f.shape 44 | 45 | # read input images and apply offsets 46 | x = np.empty((h, w, len(inputs))) 47 | for i, img in enumerate(inputs): 48 | with rasterio.open(img, 'r') as f: 49 | x[:, :, i] = f.read(1) - offsets[i] 50 | if cfg['debug']: 51 | common.rasterio_write('{}_registered.tif'.format(os.path.splitext(img)[0]), 52 | x[:, :, i] + np.mean(offsets)) 53 | 54 | # apply the averaging operator 55 | if averaging.startswith(('np.', 'numpy.')): 56 | avg = np.apply_along_axis(getattr(sys.modules['numpy'], averaging.split('.')[1]), 57 | axis=2, arr=x) 58 | elif averaging == 'average_if_close': 59 | avg = np.apply_along_axis(average_if_close, 2, x, threshold) 60 | 61 | # add the mean offset 62 | avg += np.mean(offsets) 63 | 64 | # write the average to output 65 | if inputs: 66 | shutil.copy(inputs[0], output) # copy an input file to get the metadata 67 | with rasterio.open(output, 'r+') as f: 68 | f.write(np.asarray([avg]).astype('float32')) # update the output file content 69 | -------------------------------------------------------------------------------- /s2p/ply.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019, Carlo de Franchis 2 | 3 | import numpy as np 4 | import plyfile 5 | 6 | 7 | def read_3d_point_cloud_from_ply(path_to_ply_file): 8 | """ 9 | Read a 3D point cloud from a ply file and return a numpy array. 10 | 11 | Args: 12 | path_to_ply_file (str): path to a .ply file 13 | 14 | Returns: 15 | numpy array with the list of 3D points, one point per line 16 | list of strings with the ply header comments 17 | """ 18 | plydata = plyfile.PlyData.read(path_to_ply_file) 19 | d = np.asarray(plydata['vertex'].data) 20 | array = np.column_stack([d[p.name] for p in plydata['vertex'].properties]) 21 | return array, plydata.comments 22 | 23 | 24 | def write_3d_point_cloud_to_ply(path_to_ply_file, coordinates, colors=None, 25 | extra_properties=None, 26 | extra_properties_names=None, comments=[]): 27 | """ 28 | Write a 3D point cloud to a ply file. 29 | 30 | Args: 31 | path_to_ply_file (str): path to a .ply file 32 | coordinates (array): numpy array of shape (n, 3) containing x, y, z coordinates 33 | colors (array): numpy array of shape (n, 3) or (n, 1) containing either 34 | r, g, b or gray levels 35 | extra_properties (array): optional numpy array of shape (n, k) 36 | extra_properties_names (list): list of k strings with the names of the 37 | (optional) extra properties 38 | comments (list): list of strings containing the ply header comments 39 | """ 40 | points = coordinates 41 | dtypes = [('x', coordinates.dtype), 42 | ('y', coordinates.dtype), 43 | ('z', coordinates.dtype)] 44 | 45 | if colors is not None: 46 | if colors.shape[1] == 1: # replicate grayscale 3 times 47 | colors = np.column_stack([colors] * 3) 48 | elif colors.shape[1] not in [3, 4]: 49 | raise Exception('Error: colors must have either 1, 3 or 4 channels') 50 | points = np.column_stack((points, colors)) 51 | dtypes += [('red', colors.dtype), 52 | ('green', colors.dtype), 53 | ('blue', colors.dtype)] 54 | if colors.shape[1] == 4: 55 | dtypes += [('ir', colors.dtype)] 56 | 57 | if extra_properties is not None: 58 | points = np.column_stack((points, extra_properties)) 59 | dtypes += [(s, extra_properties.dtype) for s in extra_properties_names] 60 | 61 | tuples = [tuple(x) for x in points] 62 | plydata = plyfile.PlyElement.describe(np.asarray(tuples, dtype=dtypes), 63 | 'vertex') 64 | plyfile.PlyData([plydata], comments=comments).write(path_to_ply_file) 65 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [tool:pytest] 2 | addopts = --cov s2p --cov-report term-missing 3 | filterwarnings = 4 | ignore::rasterio.errors.NotGeoreferencedWarning 5 | 6 | [coverage:run] 7 | branch = True 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | from codecs import open 3 | from setuptools import setup, find_packages 4 | from setuptools.command import develop, build_py 5 | 6 | 7 | def readme(): 8 | with open("README.md", "r", "utf-8") as f: 9 | return f.read() 10 | 11 | 12 | class CustomDevelop(develop.develop, object): 13 | """ 14 | Class needed for "pip install -e ." 15 | """ 16 | def run(self): 17 | subprocess.check_call("make", shell=True) 18 | super(CustomDevelop, self).run() 19 | 20 | 21 | class CustomBuildPy(build_py.build_py, object): 22 | """ 23 | Class needed for "pip install s2p" 24 | """ 25 | def run(self): 26 | super(CustomBuildPy, self).run() 27 | subprocess.check_call("make", shell=True) 28 | subprocess.check_call("cp -r bin lib build/lib/", shell=True) 29 | 30 | 31 | try: 32 | from wheel.bdist_wheel import bdist_wheel 33 | class BdistWheel(bdist_wheel): 34 | """ 35 | Class needed to build platform dependent binary wheels 36 | """ 37 | def finalize_options(self): 38 | bdist_wheel.finalize_options(self) 39 | self.root_is_pure = False 40 | 41 | except ImportError: 42 | BdistWheel = None 43 | 44 | 45 | requirements = ['numpy', 46 | 'scipy', 47 | 'rasterio[s3]>=1.2a1', 48 | 'utm', 49 | 'pyproj>=3.0.0', 50 | 'beautifulsoup4[lxml]', 51 | 'plyfile', 52 | 'plyflatten>=0.2.0', 53 | 'ransac', 54 | 'rpcm>=1.4.6', 55 | 'srtm4>=1.1.2', 56 | 'requests'] 57 | 58 | extras_require = { 59 | "test": ["pytest", "pytest-cov", "psutil"], 60 | } 61 | 62 | setup(name="s2p", 63 | version="1.0b26.dev0", 64 | description="Satellite Stereo Pipeline.", 65 | long_description=readme(), 66 | long_description_content_type='text/markdown', 67 | url='https://github.com/cmla/s2p', 68 | packages=['s2p'], 69 | install_requires=requirements, 70 | extras_require=extras_require, 71 | cmdclass={'develop': CustomDevelop, 72 | 'build_py': CustomBuildPy, 73 | 'bdist_wheel': BdistWheel}, 74 | python_requires=">=3", 75 | entry_points=""" 76 | [console_scripts] 77 | s2p=s2p.cli:main 78 | """) 79 | -------------------------------------------------------------------------------- /tests/block_matching_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | 4 | import pytest 5 | 6 | import s2p 7 | from tests_utils import data_path 8 | 9 | 10 | def test_compute_disparity_map_timeout(timeout=1): 11 | """ 12 | Run a long call to compute_disparity_map to check that the timeout kills it. 13 | """ 14 | img = data_path(os.path.join("input_pair", "img_01.tif")) 15 | disp = data_path(os.path.join("testoutput", "d.tif")) 16 | mask = data_path(os.path.join("testoutput", "m.tif")) 17 | 18 | with pytest.raises(subprocess.TimeoutExpired): 19 | s2p.block_matching.compute_disparity_map(img, img, disp, mask, 20 | "mgm_multi", -100, 100, 21 | timeout) 22 | 23 | 24 | def test_compute_disparity_map_max_disp_range(max_disp_range=10): 25 | """ 26 | Run a call to compute_disparity_map with a small max_disp_range 27 | to check that an error is raised. 28 | """ 29 | img = data_path(os.path.join("input_pair", "img_01.tif")) 30 | disp = data_path(os.path.join("testoutput", "d.tif")) 31 | mask = data_path(os.path.join("testoutput", "m.tif")) 32 | 33 | with pytest.raises(s2p.block_matching.MaxDisparityRangeError): 34 | s2p.block_matching.compute_disparity_map(img, img, disp, mask, 35 | "mgm_multi", -100, 100, 36 | max_disp_range=max_disp_range) 37 | -------------------------------------------------------------------------------- /tests/common_test.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import psutil 4 | import pytest 5 | 6 | from s2p import common 7 | 8 | 9 | def test_run_success(): 10 | """ 11 | Test s2p.common.run() success with Unix "true" utility command. 12 | """ 13 | common.run("true") 14 | 15 | 16 | def test_run_error(): 17 | """ 18 | Test s2p.common.run() error run with Unix "false" utility command. 19 | """ 20 | with pytest.raises(subprocess.CalledProcessError): 21 | common.run("false") 22 | 23 | 24 | def test_run_timeout(): 25 | """ 26 | Test s2p.common.run() timeout with Unix "sleep" utility command, 27 | and check that when the command times out, the launched process is killed. 28 | """ 29 | with pytest.raises(subprocess.TimeoutExpired): 30 | common.run("sleep 10", timeout=1) 31 | 32 | # Get the names of the running processes 33 | proc_names = [] 34 | for proc in psutil.process_iter(attrs=['pid', 'name']): 35 | proc_names.append(proc.info['name']) 36 | 37 | # Check that our process has effectively been killed 38 | assert "sleep" not in proc_names 39 | -------------------------------------------------------------------------------- /tests/data/expected_output/pair/dsm.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/expected_output/pair/dsm.tif -------------------------------------------------------------------------------- /tests/data/expected_output/plyflatten/dsm_40cm.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/expected_output/plyflatten/dsm_40cm.tiff -------------------------------------------------------------------------------- /tests/data/expected_output/triplet/dsm.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/expected_output/triplet/dsm.tif -------------------------------------------------------------------------------- /tests/data/expected_output/triplet/height_map.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/expected_output/triplet/height_map.tif -------------------------------------------------------------------------------- /tests/data/expected_output/units/F.txt: -------------------------------------------------------------------------------- 1 | 0.000000 0.000000 -0.691382 2 | 0.000000 0.000000 -0.146680 3 | 0.691857 0.147682 7.733764 4 | -------------------------------------------------------------------------------- /tests/data/expected_output/units/H1.txt: -------------------------------------------------------------------------------- 1 | 0.208853 -0.978433 272.644638 2 | 0.978433 0.208853 -118.728664 3 | 0.000000 0.000000 1.000000 4 | -------------------------------------------------------------------------------- /tests/data/expected_output/units/H2.txt: -------------------------------------------------------------------------------- 1 | 0.207436 -0.977763 272.644638 2 | 0.977763 0.207436 -129.665861 3 | 0.000000 0.000000 1.000000 4 | -------------------------------------------------------------------------------- /tests/data/input_pair/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "out_dir" : "../../testoutput/output_pair", 3 | "images" : [ 4 | {"img" : "img_01.tif"}, 5 | {"img" : "img_02.tif"} 6 | ], 7 | "roi" : { 8 | "x" : 150, 9 | "y" : 150, 10 | "w" : 700, 11 | "h" : 700 12 | }, 13 | "horizontal_margin": 20, 14 | "vertical_margin": 5, 15 | "tile_size" : 300, 16 | "disp_range_method" : "sift", 17 | "msk_erosion": 0, 18 | "dsm_resolution": 0.5, 19 | "3d_filtering_r": 5, 20 | "3d_filtering_n": 50 21 | } 22 | -------------------------------------------------------------------------------- /tests/data/input_pair/img_01.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_pair/img_01.tif -------------------------------------------------------------------------------- /tests/data/input_pair/img_02.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_pair/img_02.tif -------------------------------------------------------------------------------- /tests/data/input_ply/cloud.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_ply/cloud.ply -------------------------------------------------------------------------------- /tests/data/input_triangulation/global_pointing_pair_1.txt: -------------------------------------------------------------------------------- 1 | 1.000186 0.000156 0.518804 2 | 0.000040 1.000032 0.109895 3 | 0.000000 0.000000 1.000000 4 | -------------------------------------------------------------------------------- /tests/data/input_triangulation/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triangulation/mask.png -------------------------------------------------------------------------------- /tests/data/input_triangulation/pair_1/H_ref.txt: -------------------------------------------------------------------------------- 1 | 0.208851 -0.978414 428.781592 2 | 0.978414 0.208851 -515.534899 3 | 0.000000 0.000000 1.000000 4 | -------------------------------------------------------------------------------- /tests/data/input_triangulation/pair_1/H_sec.txt: -------------------------------------------------------------------------------- 1 | 0.228126 -0.972586 445.653011 2 | 0.977783 0.207429 -525.775029 3 | 0.000000 0.000000 1.000000 4 | -------------------------------------------------------------------------------- /tests/data/input_triangulation/pair_1/rectified_disp.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triangulation/pair_1/rectified_disp.tif -------------------------------------------------------------------------------- /tests/data/input_triangulation/pair_1/rectified_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triangulation/pair_1/rectified_mask.png -------------------------------------------------------------------------------- /tests/data/input_triangulation/pair_1/rectified_ref.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triangulation/pair_1/rectified_ref.tif -------------------------------------------------------------------------------- /tests/data/input_triplet/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "out_dir" : "../../testoutput/output_triplet", 3 | "images" : [ 4 | {"img" : "img_02.tif"}, 5 | {"img" : "img_01.tif"}, 6 | {"img" : "img_03.tif"} 7 | ], 8 | "roi" : { 9 | "x" : 150, 10 | "y" : 150, 11 | "w" : 700, 12 | "h" : 700 13 | }, 14 | "horizontal_margin": 20, 15 | "vertical_margin": 5, 16 | "tile_size" : 300, 17 | "disp_range_method" : "sift", 18 | "msk_erosion": 0, 19 | "dsm_resolution": 0.5 20 | } 21 | -------------------------------------------------------------------------------- /tests/data/input_triplet/img_01.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triplet/img_01.tif -------------------------------------------------------------------------------- /tests/data/input_triplet/img_02.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triplet/img_02.tif -------------------------------------------------------------------------------- /tests/data/input_triplet/img_03.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/tests/data/input_triplet/img_03.tif -------------------------------------------------------------------------------- /tests/estimation_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015, Carlo de Franchis 2 | # Copyright (C) 2015, Gabriele Facciolo 3 | # Copyright (C) 2015, Enric Meinhardt 4 | # Copyright (C) 2015, Julien Michel 5 | 6 | import numpy as np 7 | import s2p 8 | 9 | 10 | def rotation_matrix(t): 11 | R = np.eye(3) 12 | R[0, 0] = np.cos(t) 13 | R[0, 1] = np.sin(t) 14 | R[1, 0] = -np.sin(t) 15 | R[1, 1] = np.cos(t) 16 | return R 17 | 18 | 19 | def similarity_matrix(t, s): 20 | R = np.eye(3) 21 | R[0, 0] = s * np.cos(t) 22 | R[0, 1] = s * np.sin(t) 23 | R[1, 0] = -s * np.sin(t) 24 | R[1, 1] = s * np.cos(t) 25 | return R 26 | 27 | 28 | def test_affine_transformation(): 29 | """ 30 | """ 31 | x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) 32 | 33 | # list of transformations to be tested 34 | T = np.eye(3) 35 | I = np.eye(3) 36 | S = np.eye(3) 37 | A = np.eye(3) 38 | translations = [] 39 | isometries = [] 40 | similarities = [] 41 | affinities = [] 42 | 43 | for i in range(100): 44 | translations.append(T) 45 | isometries.append(I) 46 | similarities.append(S) 47 | affinities.append(A) 48 | T[:2, 2] = np.random.random(2) 49 | I = rotation_matrix(2*np.pi * np.random.random_sample()) 50 | I[:2, 2] = np.random.random(2) 51 | S = similarity_matrix(2*np.pi * np.random.random_sample(), 52 | np.random.random_sample()) 53 | S[:2, 2] = 100 * np.random.random(2) 54 | A[:2, :] = np.random.random((2, 3)) 55 | 56 | for B in translations + isometries + similarities + affinities: 57 | xx = s2p.common.points_apply_homography(B, x) 58 | E = s2p.estimation.affine_transformation(x, xx) 59 | np.testing.assert_array_almost_equal(E, B) 60 | -------------------------------------------------------------------------------- /tests/evaluation_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2015, Carlo de Franchis 2 | # Copyright (C) 2015, Gabriele Facciolo 3 | # Copyright (C) 2015, Enric Meinhardt 4 | # Copyright (C) 2015, Julien Michel 5 | 6 | import numpy as np 7 | import s2p 8 | 9 | 10 | def test_finite_distances(): 11 | x = np.array([1, 1, 1]) 12 | l = np.array([0, 1, 0]) 13 | np.testing.assert_equal(s2p.evaluation.distance_point_to_line(x, l), 1) 14 | x = np.array([-1, -1, -1]) 15 | l = np.array([0, 1, 0]) 16 | np.testing.assert_equal(s2p.evaluation.distance_point_to_line(x, l), 1) 17 | x = np.array([1, 1, 1]) 18 | l = np.array([3, 2, -1]) 19 | np.testing.assert_equal(s2p.evaluation.distance_point_to_line(x, l), 20 | 4 / np.sqrt(13)) 21 | 22 | 23 | def test_infinite_distances(): 24 | x = np.array([1, 1, 0]) 25 | l = np.array([0, 1, 0]) 26 | np.testing.assert_equal(s2p.evaluation.distance_point_to_line(x, l), 27 | np.finfo(float).max) 28 | x = np.array([1, 1, -7]) 29 | l = np.array([0, 0, 2.3]) 30 | np.testing.assert_equal(s2p.evaluation.distance_point_to_line(x, l), 31 | np.finfo(float).max) 32 | -------------------------------------------------------------------------------- /tests/parallel_test.py: -------------------------------------------------------------------------------- 1 | import time 2 | import subprocess 3 | 4 | import pytest 5 | 6 | from s2p import parallel 7 | 8 | 9 | def raise_exception(t, e): 10 | """ 11 | Wait for t seconds then raise exception e. 12 | """ 13 | time.sleep(t) 14 | raise e 15 | 16 | 17 | def test_launch_calls_error(): 18 | """ 19 | Run several calls to an erroring function through a multiprocessing.Pool. 20 | """ 21 | with pytest.raises(subprocess.CalledProcessError): 22 | parallel.launch_calls(raise_exception, [1, 1, 1, 1], 2, 23 | subprocess.CalledProcessError(1, "failcmd"), tilewise=False) 24 | -------------------------------------------------------------------------------- /tests/rasterization_test.py: -------------------------------------------------------------------------------- 1 | # s2p (Satellite Stereo Pipeline) testing module 2 | 3 | import math 4 | 5 | import numpy as np 6 | import rasterio 7 | from plyflatten import plyflatten_from_plyfiles_list 8 | 9 | from tests_utils import data_path 10 | 11 | 12 | def test_plyflatten(): 13 | # Test data 14 | f = data_path("input_ply/cloud.ply") 15 | raster, profile = plyflatten_from_plyfiles_list([f], resolution=0.4) 16 | test_raster = raster[:, :, 0] # keep only band with height 17 | 18 | # Expected data 19 | e = data_path("expected_output/plyflatten/dsm_40cm.tiff") 20 | with rasterio.open(e) as src: 21 | expected_raster = src.read(1) 22 | expected_crs = src.crs 23 | expected_transform = src.transform 24 | expected_is_tiled = src.is_tiled 25 | expected_nodata = src.nodata 26 | 27 | # Check that both rasters are equal pixel-wise within a tolerance 28 | assert np.allclose(test_raster, expected_raster, equal_nan=True) 29 | 30 | # Check that both images have the same CRS 31 | test_crs = profile['crs'] 32 | assert test_crs == expected_crs 33 | 34 | # Check that both images have the same transform 35 | test_transform = profile['transform'] 36 | assert np.allclose(test_transform, expected_transform) 37 | 38 | test_is_tiled = profile['tiled'] 39 | assert test_is_tiled == expected_is_tiled 40 | 41 | test_nodata = profile.get('nodata') 42 | if expected_nodata and math.isnan(expected_nodata): 43 | assert math.isnan(test_nodata) 44 | else: 45 | assert test_nodata == expected_nodata 46 | -------------------------------------------------------------------------------- /tests/rpc_utils_test.py: -------------------------------------------------------------------------------- 1 | # s2p (Satellite Stereo Pipeline) testing module 2 | 3 | import os 4 | import numpy as np 5 | import rpcm 6 | import pytest 7 | 8 | from s2p import rpc_utils 9 | from tests_utils import data_path 10 | 11 | 12 | def test_matches_from_rpc(): 13 | """ 14 | Test for rpc_utils.matches_from_rpc(). 15 | """ 16 | r1 = rpcm.rpc_from_geotiff(data_path(os.path.join('input_pair', 'img_01.tif'))) 17 | r2 = rpcm.rpc_from_geotiff(data_path(os.path.join('input_pair', 'img_02.tif'))) 18 | 19 | test_matches = rpc_utils.matches_from_rpc(r1, r2, 100, 100, 200, 200, 5) 20 | expected_matches = np.loadtxt(data_path(os.path.join('expected_output', 21 | 'units', 22 | 'unit_matches_from_rpc.txt'))) 23 | 24 | np.testing.assert_equal(test_matches.shape[0], 125, verbose=True) 25 | np.testing.assert_allclose(test_matches, expected_matches, rtol=0.01, 26 | atol=0.1, verbose=True) 27 | 28 | 29 | @pytest.mark.parametrize( 30 | "use_srtm, exogenous_dem, exogenous_dem_geoid_mode, expected", 31 | [ 32 | ( 33 | False, 34 | None, 35 | True, 36 | (271.48531, 1.59019, 407.37861, 413.53010), 37 | ), 38 | ( 39 | True, 40 | None, 41 | True, 42 | (353.49632, 296.69818, 408.16015, 413.54849), 43 | ), 44 | ( 45 | False, 46 | data_path(os.path.join("expected_output", "pair", "dsm.tif")), 47 | True, 48 | (356.65154, 308.01931, 408.19018, 413.54920) 49 | ), 50 | ( 51 | False, 52 | data_path(os.path.join("expected_output", "pair", "dsm.tif")), 53 | False, 54 | (356.46596, 307.35347, 408.18841, 413.54916), 55 | ), 56 | ], 57 | ) 58 | def test_roi_process(use_srtm, exogenous_dem, exogenous_dem_geoid_mode, expected): 59 | """ 60 | Test for rpc_utils.roi_process(). 61 | """ 62 | rpc = rpcm.rpc_from_geotiff(data_path(os.path.join("input_pair", "img_01.tif"))) 63 | ll_poly = np.asarray( 64 | [ 65 | [55.649517, -21.231542], 66 | [55.651502, -21.231542], 67 | [55.651502, -21.229672], 68 | [55.649517, -21.229672], 69 | ] 70 | ) 71 | output = rpc_utils.roi_process( 72 | rpc, 73 | ll_poly, 74 | use_srtm=use_srtm, 75 | exogenous_dem=exogenous_dem, 76 | exogenous_dem_geoid_mode=exogenous_dem_geoid_mode, 77 | ) 78 | computed = [output[k] for k in ["x", "y", "w", "h"]] 79 | np.testing.assert_allclose(computed, expected, atol=1e-3) 80 | -------------------------------------------------------------------------------- /tests/sift_test.py: -------------------------------------------------------------------------------- 1 | # s2p.sift testing module 2 | # Copyright (C) 2019, Carlo de Franchis (CMLA) 3 | # Copyright (C) 2019, Julien Michel (CNES) 4 | 5 | import numpy as np 6 | import rpcm 7 | 8 | from s2p import sift 9 | from tests_utils import data_path 10 | 11 | 12 | def test_image_keypoints(): 13 | """ 14 | Unit test for the function s2p.sift.image_keypoints. 15 | 16 | Right now it tests only the x, y, scale, orientation of keypoints, not the 17 | descriptors. 18 | """ 19 | computed = sift.image_keypoints(data_path('input_triplet/img_02.tif'), 20 | 100, 100, 200, 200) 21 | expected = np.loadtxt(data_path('expected_output/units/unit_image_keypoints.txt')) 22 | np.testing.assert_allclose(computed[:, :4], expected[:, :4], atol=1e-3) 23 | 24 | 25 | def test_matching(): 26 | """ 27 | Unit test for the function s2p.sift.keypoints_match. 28 | """ 29 | computed = sift.keypoints_match(np.loadtxt(data_path('units/sift1.txt')), 30 | np.loadtxt(data_path('units/sift2.txt'))) 31 | expected = np.loadtxt(data_path('expected_output/units/unit_keypoints_match.txt')) 32 | np.testing.assert_allclose(computed, expected, rtol=0.01, atol=0.1, 33 | verbose=True) 34 | 35 | 36 | def test_matches_on_rpc_roi(): 37 | """ 38 | Unit test for the function sift.matches_on_rpc_roi. 39 | """ 40 | img1 = data_path('input_triplet/img_01.tif') 41 | img2 = data_path('input_triplet/img_02.tif') 42 | rpc1 = rpcm.rpc_from_geotiff(img1) 43 | rpc2 = rpcm.rpc_from_geotiff(img2) 44 | computed = sift.matches_on_rpc_roi( 45 | img1, img2, rpc1, rpc2, 100, 100, 200, 200, 46 | method='relative', sift_thresh=0.6, epipolar_threshold=10 47 | ) 48 | expected = np.loadtxt(data_path('expected_output/units/matches_on_rpc_roi.txt')) 49 | np.testing.assert_allclose(computed, expected, rtol=0.01, atol=0.1, 50 | verbose=True) 51 | -------------------------------------------------------------------------------- /tests/tests_utils.py: -------------------------------------------------------------------------------- 1 | # s2p (Satellite Stereo Pipeline) testing module 2 | # Copyright (C) 2019, Julien Michel (CNES) 3 | 4 | import os 5 | import s2p 6 | 7 | 8 | def data_path(p): 9 | """ 10 | Build an absolute data path from an input test datafile. 11 | 12 | Args: 13 | p (str): path to the input test data 14 | 15 | Returns: 16 | str: absolute path to that data file 17 | """ 18 | here = os.path.abspath(os.path.dirname(__file__)) 19 | return os.path.join(here, 'data', p) 20 | -------------------------------------------------------------------------------- /tests/triangulation_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | import pytest 5 | 6 | from s2p import disparity_to_ply, read_config_file 7 | from s2p.initialization import build_cfg 8 | from s2p.ply import read_3d_point_cloud_from_ply 9 | from tests_utils import data_path 10 | 11 | 12 | @pytest.mark.parametrize("out_crs", [None, "epsg:32740", "epsg:32740+5773"]) 13 | def test_disparity_to_ply(tmp_path, out_crs): 14 | """ 15 | Check that disparity_to_ply() functions correctly when given 16 | different out_crs parameters 17 | """ 18 | # Setup test data 19 | tile_dir = str(tmp_path / "tile_dir") 20 | shutil.copytree(data_path("input_triangulation"), tile_dir) 21 | 22 | # Initialize s2p's state 23 | config_file = data_path(os.path.join("input_pair", "config.json")) 24 | test_cfg = read_config_file(config_file) 25 | test_cfg["out_crs"] = out_crs 26 | build_cfg(test_cfg) 27 | 28 | tile = {"coordinates": [500, 150, 350, 350], "dir": tile_dir} 29 | disparity_to_ply(tile) 30 | 31 | _, comments = read_3d_point_cloud_from_ply(os.path.join(tile_dir, "cloud.ply")) 32 | expected_crs = out_crs or "epsg:32740" 33 | assert comments[-1] == "projection: CRS {}".format(expected_crs) 34 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/centreborelli/s2p/4a0b2d8f5025f0ff459eda5c7b4de254a4ad0e7b/utils/__init__.py -------------------------------------------------------------------------------- /utils/extract_rpc_from_ntf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # tools for extracting RPC from NTIF/NTF file 3 | # Copyright (C) 2016, Gabriele Facciolo 4 | 5 | import sys, subprocess 6 | if len(sys.argv)<2: 7 | print(" extracts RPC from NTIF/NTF file"%sys.argv[0]) 8 | print(" usage: %s file.NTF > file.RPC"%sys.argv[0]) 9 | exit() 10 | x=subprocess.Popen(["gdalinfo", sys.argv[1]], stdout=subprocess.PIPE).communicate()[0] 11 | x=x.splitlines() 12 | #x=sys.stdin.readlines() 13 | for l in x: 14 | if ('SAMP_' not in l) and ('LINE_' not in l) and ('HEIGHT_' not in l) and ('LAT_' not in l) and ('LONG_' not in l) and ('MAX_' not in l) and ('MIN_' not in l): 15 | continue 16 | y = l.strip().replace('=',': ') 17 | if 'COEFF' in y: 18 | z = y.split(' ') 19 | t=1 20 | for j in z[1:]: 21 | print('%s_%d: %s'%(z[0][:-1],t,j)) 22 | t+=1 23 | else: 24 | print(y) 25 | --------------------------------------------------------------------------------