├── .editorconfig ├── .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 ├── sift_anatomy_20140911 │ ├── CHANGELOG │ ├── Makefile │ ├── README.txt │ └── src │ │ ├── anatomy2lowe.c │ │ ├── demo_extract_patch.c │ │ ├── example.c │ │ ├── io_png.c │ │ ├── io_png.h │ │ ├── lib_description.c │ │ ├── lib_description.h │ │ ├── lib_discrete.c │ │ ├── lib_discrete.h │ │ ├── lib_io_scalespace.c │ │ ├── lib_io_scalespace.h │ │ ├── lib_keypoint.c │ │ ├── lib_keypoint.h │ │ ├── lib_matching.c │ │ ├── lib_matching.h │ │ ├── lib_scalespace.c │ │ ├── lib_scalespace.h │ │ ├── lib_sift.c │ │ ├── lib_sift.h │ │ ├── lib_sift_anatomy.c │ │ ├── lib_sift_anatomy.h │ │ ├── lib_util.c │ │ ├── lib_util.h │ │ ├── match_cli.c │ │ ├── sift_cli.c │ │ └── sift_cli_default.c ├── 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 ├── c ├── abstract_dsf.c ├── abstract_dsf.h ├── backflow.c ├── bicubic_gray.c ├── bilinear_interpolation.c ├── bin2asc.c ├── cldmask.c ├── colorcoordsf.c ├── colormesh.c ├── coordconvert.c ├── coordconvert.h ├── disp2ply.c ├── disp_to_h.c ├── downsa.c ├── drawsegment.c ├── egm96-15.pgm ├── fail.c ├── geographiclib_wrapper.cpp ├── geoid_height_wrapper.cpp ├── getpixel.c ├── homographies.c ├── homography │ ├── LibHomography │ │ ├── Homography.cpp │ │ ├── Homography.h │ │ ├── Splines.cpp │ │ └── Splines.h │ ├── LibImages │ │ ├── LibImages.cpp │ │ └── LibImages.h │ ├── Makefile │ ├── Utilities │ │ ├── Memory.cpp │ │ ├── Memory.h │ │ ├── Parameters.cpp │ │ ├── Parameters.h │ │ ├── Time.cpp │ │ ├── Time.h │ │ ├── Utilities.cpp │ │ └── Utilities.h │ ├── build.sh │ ├── linalg.c │ ├── main.cpp │ ├── pickopt.c │ └── test_data │ │ ├── homography.txt │ │ ├── identity.txt │ │ ├── input_uint16.tif │ │ └── input_uint16_tiled.tif ├── homwarp.c ├── iio.c ├── iio.h ├── imprintf.c ├── lists.c ├── marching_interpolation.c ├── moistiv_epipolar.c ├── morphoop.c ├── morsi.c ├── msmw │ ├── CMakeLists.txt │ ├── LibImages │ │ ├── LibImages.cpp │ │ └── LibImages.h │ ├── LibMSMW │ │ ├── ConnectedComponents.cpp │ │ ├── ConnectedComponents.h │ │ ├── LibMSMW.cpp │ │ ├── LibMSMW.h │ │ ├── UtilitiesMSMW.cpp │ │ └── UtilitiesMSMW.h │ ├── Makefile │ ├── Utilities │ │ ├── Memory.cpp │ │ ├── Memory.h │ │ ├── Parameters.cpp │ │ ├── Parameters.h │ │ ├── Time.cpp │ │ ├── Time.h │ │ ├── Utilities.cpp │ │ └── Utilities.h │ ├── main.cpp │ └── test_data │ │ ├── a.tif │ │ └── b.tif ├── multidisp2ply.c ├── parsenumbers.c ├── pickopt.c ├── plambda.c ├── plyextrema.c ├── plyflatten.c ├── pview.c ├── qauto.c ├── random.c ├── ransac.c ├── ransac_cases.c ├── read_matrix.c ├── remove_small_cc.c ├── rpc.c ├── rpc.h ├── sift │ ├── LibImages │ │ ├── LibImages.cpp │ │ └── LibImages.h │ ├── LibSSE │ │ ├── LibSSE.cpp │ │ └── LibSSE.h │ ├── LibSift │ │ ├── KeyPoint.cpp │ │ ├── KeyPoint.h │ │ ├── LibSift.cpp │ │ ├── LibSift.h │ │ ├── Octave.cpp │ │ ├── Octave.h │ │ ├── ScaleSpace.cpp │ │ └── ScaleSpace.h │ ├── Makefile │ ├── Utilities │ │ ├── Memory.cpp │ │ ├── Memory.h │ │ ├── Parameters.cpp │ │ ├── Parameters.h │ │ ├── Time.cpp │ │ ├── Time.h │ │ ├── Utilities.cpp │ │ └── Utilities.h │ ├── linalg.c │ ├── matching.c │ ├── pickopt.c │ ├── sift4ctypes.cpp │ ├── sift_anatomy_20141201 │ │ ├── lib_keypoint.c │ │ ├── lib_keypoint.h │ │ ├── lib_matching.c │ │ ├── lib_matching.h │ │ ├── lib_util.c │ │ └── lib_util.h │ ├── test_data │ │ ├── img_tiled.tif │ │ ├── keypoints_1.txt │ │ └── keypoints_2.txt │ └── timing.c ├── smapa.h ├── spline.c ├── synflow.c ├── synflow_core.c ├── test_colormesh │ ├── height_map.tif │ ├── makefile │ ├── roi_ref.png │ └── rpc.xml ├── timing.c ├── timing.h ├── triangulation.c ├── triangulation.h ├── vvector.h ├── xfopen.c └── xmalloc.c ├── 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 ├── pointing_accuracy.py ├── rectification.py ├── rpc_model.py ├── rpc_utils.py ├── sift.py ├── test_estimation.py ├── test_evaluation.py ├── triangulation.py └── visualisation.py ├── setup.py ├── tests ├── data │ ├── expected_output │ │ ├── pair │ │ │ └── dsm.tif │ │ ├── plyflatten │ │ │ └── dsm_40cm.tiff │ │ ├── triplet │ │ │ ├── dsm.tif │ │ │ ├── dsm_geo.tif │ │ │ └── height_map.tif │ │ └── units │ │ │ ├── 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 │ │ ├── rpc_01.xml │ │ └── rpc_02.xml │ ├── input_ply │ │ └── cloud.ply │ ├── input_triplet │ │ ├── config.json │ │ ├── config_geo.json │ │ ├── img_01.tif │ │ ├── img_02.tif │ │ ├── img_03.tif │ │ ├── rpc_01.xml │ │ ├── rpc_02.xml │ │ └── rpc_03.xml │ └── units │ │ ├── sift1.txt │ │ └── sift2.txt └── test_s2p.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 /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.o 3 | *.a 4 | *.so 5 | *~ 6 | 7 | bin 8 | build 9 | .srtm 10 | experiments 11 | 3rdparty/sgbm/sgbm 12 | 3rdparty/mgm/mgm 13 | 3rdparty/tvl1flow_3/backflow 14 | 3rdparty/tvl1flow_3/tvl1flow 15 | 3rdparty/stereo_hirschmuller_2008/testdata 16 | c/sift/sift_roi 17 | c/sift/matching 18 | c/homography/homography 19 | 20 | .DS_Store 21 | ipynb 22 | 23 | iterate.dat 24 | 25 | testoutput 26 | .idea 27 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | sudo: required 3 | fast_finish: true 4 | 5 | matrix: 6 | include: 7 | - os: linux 8 | dist: trusty 9 | python: 2.7 10 | env: CPLUS_INCLUDE_PATH=/usr/include/gdal C_INCLUDE_PATH=/usr/include/gdal 11 | - os: linux 12 | dist: trusty 13 | python: 3.5 14 | env: CPLUS_INCLUDE_PATH=/usr/include/gdal C_INCLUDE_PATH=/usr/include/gdal 15 | - os: osx 16 | language: generic 17 | python: 2.7 18 | env: PATH=/Library/Frameworks/GDAL.framework/Versions/2.1/unix/bin:$PATH 19 | 20 | before_install: 21 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo rm -vf /etc/apt/sources.list.d/*riak*; fi 22 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-add-repository -y ppa:ubuntugis/ppa; fi 23 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi 24 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gdal-bin libfftw3-dev libgdal-dev libgeotiff-dev geographiclib-tools libgeographiclib-dev; fi 25 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink gdal && (brew install gcc || brew link --overwrite gcc) && brew install geographiclib fftw; fi 26 | 27 | install: 28 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install numpy; fi 29 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install .; fi 30 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget http://www.kyngchaos.com/files/software/frameworks/GDAL_Complete-2.1.dmg; fi 31 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then X=$(echo `hdiutil mount GDAL_Complete-2.1.dmg | tail -1 | awk '{$1=$2=""; print $0}'` | xargs -0 echo) && sudo installer -pkg "${X}/"GDAL\ Complete.pkg -target /; export PATH="/Library/Frameworks/GDAL.framework/Programs:$PATH"; fi 32 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip2 install numpy; fi 33 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip2 install .; fi 34 | 35 | script: 36 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then python -u tests/test_s2p.py --all; fi 37 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python2 -u tests/test_s2p.py --all; fi 38 | -------------------------------------------------------------------------------- /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/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/3rdparty/demo_ASIFT_src/adam1.png -------------------------------------------------------------------------------- /3rdparty/demo_ASIFT_src/adam2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/3rdparty/demo_ASIFT_src/adam2.png -------------------------------------------------------------------------------- /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/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/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/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/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/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/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/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/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/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/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/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/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/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.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/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.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/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/sift_anatomy_20140911/src/example.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "lib_sift.h" 3 | 4 | int main(void) 5 | { 6 | // create input image 7 | int w = 512; 8 | int h = 512; 9 | float *x = (float*)malloc(w*h*sizeof(float)); 10 | for (int i = 0; i < w*h; i++) 11 | x[i] = rand(); 12 | 13 | // compute sift keypoints 14 | int n; 15 | struct sift_keypoint_std *k = sift_compute_points(x, w, h, &n); 16 | 17 | // write to standard output 18 | sift_write_to_file("/dev/stdout", k, n); 19 | 20 | // cleanup 21 | free(k); 22 | free(x); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /3rdparty/sift_anatomy_20140911/src/io_png.h: -------------------------------------------------------------------------------- 1 | #ifndef _IO_PNG_H 2 | #define _IO_PNG_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define IO_PNG_VERSION "0.20110825" 9 | 10 | #include 11 | 12 | /* io_png.c */ 13 | char *io_png_info(void); 14 | unsigned char *io_png_read_u8(const char *fname, size_t *nxp, size_t *nyp, size_t *ncp); 15 | unsigned char *io_png_read_u8_rgb(const char *fname, size_t *nxp, size_t *nyp); 16 | unsigned char *io_png_read_u8_gray(const char *fname, size_t *nxp, size_t *nyp); 17 | float *io_png_read_f32(const char *fname, size_t *nxp, size_t *nyp, size_t *ncp); 18 | float *io_png_read_f32_rgb(const char *fname, size_t *nxp, size_t *nyp); 19 | float *io_png_read_f32_gray(const char *fname, size_t *nxp, size_t *nyp); 20 | int io_png_write_u8(const char *fname, const unsigned char *data, size_t nx, size_t ny, size_t nc); 21 | int io_png_write_f32(const char *fname, const float *data, size_t nx, size_t ny, size_t nc); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* !_IO_PNG_H */ 28 | -------------------------------------------------------------------------------- /3rdparty/sift_anatomy_20140911/src/lib_util.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_UTIL_H_ 2 | #define _LIB_UTIL_H_ 3 | 4 | #include 5 | #include 6 | 7 | #ifndef M_PI 8 | #define M_PI 3.14159265358979323846 9 | #endif 10 | 11 | #ifndef M_SQRT2 12 | #define M_SQRT2 1.41421356237309504880 13 | #endif 14 | 15 | #ifndef M_LN2 16 | #define M_LN2 0.693147180559945309417 17 | #endif 18 | 19 | // Allocate memory or abord on failure 20 | void* xmalloc(size_t size); 21 | 22 | // Reallocate memory of abort on failure 23 | void* xrealloc(void* p, size_t size); 24 | 25 | // Free memory allocated by xmalloc or xrealloc. 26 | void xfree(void* p); 27 | 28 | // Write a formatted message to standard error and abort the program, for 29 | // example, fatal_error("Failed to open file %s for writing", filename); 30 | void fatal_error(const char* format, ...); 31 | 32 | // Write formatted message to standard error for debugging. 33 | void debug(const char* format, ...); 34 | 35 | // Linearly rescale input such that its values are in the range [0, 250]. 36 | void linear_conversion(const float *in, float *out, int l); 37 | 38 | // Find the maximum value of an array. 39 | float array_max(const float* array, int length); 40 | 41 | // Find the minimum value of an array. 42 | float array_min(const float* array, int length); 43 | 44 | // Find the maximum value of an array. 45 | float find_array_max(const float* array, int length, int *position); 46 | 47 | // Find the minimum value of an array. 48 | float find_array_min(const float* array, int length, int *position); 49 | 50 | // Find the two minimal values in an array. 51 | void find_array_two_min(const float* array, int length, float* minA, float* minB, int* iA, int* iB); 52 | 53 | // L2 norm of an array. 54 | float array_l2norm(const float* array, int length); 55 | 56 | // Compute the SQUARE of the euclidean distance 57 | float euclidean_distance_square(const float* a1, const float* a2, int length); 58 | 59 | // Compute the euclidean distance 60 | float euclidean_distance(const float* a1, const float* a2, int length); 61 | 62 | // Compute the x modulus y 63 | float modulus(float x, float y); 64 | 65 | // Multiply the rotation matric R_alpha with [x,y]^T 66 | void apply_rotation(float x, float y, float *rx, float *ry, float alpha); 67 | 68 | #endif // _LIB_UTIL_H_ 69 | -------------------------------------------------------------------------------- /3rdparty/sift_anatomy_20140911/src/sift_cli_default.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lib_sift.h" 4 | #include "io_png.h" 5 | 6 | 7 | int main(int argc, char **argv) 8 | { 9 | if(argc != 2){ 10 | fprintf(stderr, "usage:\n./sift_basic image.png\n"); 11 | return -1; 12 | } 13 | 14 | // Loading image 15 | size_t w, h; 16 | float* x = io_png_read_f32_gray(argv[1], &w, &h); 17 | if(!x) 18 | fatal_error("File \"%s\" not found.", argv[1]); 19 | for(int i=0; i < w*h; i++) 20 | x[i] /=256.; 21 | 22 | // compute sift keypoints 23 | int n; 24 | struct sift_keypoint_std *k = sift_compute_features(x, w, h, &n); 25 | 26 | // write to standard output 27 | sift_write_to_file("/dev/stdout", k, n); 28 | 29 | // cleanup 30 | free(k); 31 | free(x); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /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/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/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/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/3rdparty/stereo_hirschmuller_2002/testdata/a.png -------------------------------------------------------------------------------- /3rdparty/stereo_hirschmuller_2002/testdata/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/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:latest 2 | MAINTAINER Carlo de Franchis 3 | # https://goo.gl/aypXVx 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | RUN apt-get update && apt-get install -y \ 6 | build-essential \ 7 | cmake \ 8 | gdal-bin \ 9 | geographiclib-tools \ 10 | libfftw3-dev \ 11 | libgdal-dev \ 12 | libgeographic-dev \ 13 | libgeotiff-dev \ 14 | libtiff5-dev \ 15 | python3 \ 16 | python3-numpy \ 17 | python3-pip 18 | 19 | # Install s2p 20 | RUN pip3 install s2p 21 | -------------------------------------------------------------------------------- /HACKERS: -------------------------------------------------------------------------------- 1 | GITIQUETTE 2 | 3 | (E1) To contribute, make a pull request to https://github.com/MISS3D/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 | -------------------------------------------------------------------------------- /c/abstract_dsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "abstract_dsf.h" 3 | 4 | // API 5 | void adsf_assert_consistency(int *t, int n) 6 | { 7 | assert(n > 0); 8 | assert(t); 9 | for (int i = 0; i < n; i++) { 10 | assert(t[i] >= 0); 11 | assert(t[i] < n); 12 | } 13 | } 14 | 15 | // API 16 | void adsf_begin(int *t, int n) 17 | { 18 | for (int i = 0; i < n; i++) 19 | t[i] = i; 20 | } 21 | 22 | // API 23 | int adsf_find(int *t, int n, int a) 24 | { 25 | assert(a >= 0 && a < n); 26 | if (a != t[a]) 27 | t[a] = adsf_find(t, n, t[a]); 28 | return t[a]; 29 | } 30 | 31 | static int adsf_make_link(int *t, int n, int a, int b) 32 | { 33 | if (a < b) { // arbitrary choice 34 | t[b] = a; 35 | return a; 36 | } else { 37 | t[a] = b; 38 | return b; 39 | } 40 | } 41 | 42 | // API 43 | int adsf_union(int *t, int n, int a, int b) 44 | { 45 | assert(a >= 0 && a < n); 46 | assert(b >= 0 && b < n); 47 | a = adsf_find(t, n, a); 48 | b = adsf_find(t, n, b); 49 | if (a != b) 50 | b = adsf_make_link(t, n, a, b); 51 | return b; 52 | } 53 | 54 | // API 55 | //int adsf_number_of_classes(int *t, int n) 56 | //{ 57 | // adsf_assert_consistency(t, n); 58 | // error("not yet implemented"); 59 | // return -1; 60 | //} 61 | -------------------------------------------------------------------------------- /c/abstract_dsf.h: -------------------------------------------------------------------------------- 1 | #ifndef _ABSTRACT_DSF_H 2 | #define _ABSTRACT_DSF_H 3 | 4 | 5 | // implementation of a DSF with path compression but without union by rank 6 | 7 | //void adsf_assert_consistency(int *t, int n); 8 | void adsf_begin(int *t, int n); 9 | int adsf_union(int *t, int n, int a, int b); 10 | int adsf_find(int *t, int n, int a); 11 | int adsf_number_of_classes(int *t, int n); 12 | 13 | 14 | // implementation of a DSF with path compression and union by rank 15 | 16 | //void adsfr_assert_consistency(int *t, int *r, int n); 17 | //void adsfr_begin(int *t, int *r, int n); 18 | //int adsfr_union(int *t, int *r, int n, int a, int b); 19 | //int adsfr_find(int *t, int *r, int n, int a); 20 | //int adsfr_number_of_classes(int *t, int *r, int n); 21 | 22 | 23 | 24 | #endif /* _ABSTRACT_DSF_H */ 25 | -------------------------------------------------------------------------------- /c/bicubic_gray.c: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BICUBIC_C 3 | #define _BICUBIC_C 4 | 5 | 6 | typedef float (*getpixel_operator)(float*,int,int,int,int); 7 | 8 | // extrapolate by 0 9 | inline 10 | static float getpixel_0(float *x, int w, int h, int i, int j) 11 | { 12 | if (i < 0 || i >= w || j < 0 || j >= h) 13 | return 0; 14 | return x[i+j*w]; 15 | } 16 | 17 | // extrapolate by nearest value 18 | inline 19 | static float getpixel_1(float *x, int w, int h, int i, int j) 20 | { 21 | if (i < 0) i = 0; 22 | if (j < 0) j = 0; 23 | if (i >= w) i = w-1; 24 | if (j >= h) j = h-1; 25 | return x[i+j*w]; 26 | } 27 | 28 | 29 | static float cubic_interpolation(float v[4], float x) 30 | { 31 | return v[1] + 0.5 * x*(v[2] - v[0] 32 | + x*(2.0*v[0] - 5.0*v[1] + 4.0*v[2] - v[3] 33 | + x*(3.0*(v[1] - v[2]) + v[3] - v[0]))); 34 | 35 | float y = 3.0*(v[1] - v[2]) + v[3] - v[0]; 36 | y = x*y + 2.0*v[0] - 5.0*v[1] + 4.0*v[2] - v[3]; 37 | y = x*y + v[2] - v[0]; 38 | y = 0.5*x*y + v[1]; 39 | return y; 40 | } 41 | 42 | static float bicubic_interpolation_cell(float p[4][4], float x, float y) 43 | { 44 | float v[4]; 45 | v[0] = cubic_interpolation(p[0], y); 46 | v[1] = cubic_interpolation(p[1], y); 47 | v[2] = cubic_interpolation(p[2], y); 48 | v[3] = cubic_interpolation(p[3], y); 49 | return cubic_interpolation(v, x); 50 | } 51 | 52 | float bicubic_interpolation_gray(float *img, int w, int h, float x, float y) 53 | { 54 | x -= 1; 55 | y -= 1; 56 | 57 | getpixel_operator p = getpixel_0; 58 | 59 | int ix = floor(x); 60 | int iy = floor(y); 61 | float c[4][4]; 62 | for (int j = 0; j < 4; j++) 63 | for (int i = 0; i < 4; i++) 64 | c[i][j] = p(img, w, h, ix + i, iy + j); 65 | float r = bicubic_interpolation_cell(c, x - ix, y - iy); 66 | return r; 67 | } 68 | 69 | #endif//_BICUBIC_C 70 | -------------------------------------------------------------------------------- /c/bilinear_interpolation.c: -------------------------------------------------------------------------------- 1 | static float evaluate_bilinear_cell(float a, float b, float c, float d, 2 | float x, float y) 3 | { 4 | float r = 0; 5 | r += a * (1-x) * (1-y); 6 | r += b * ( x ) * (1-y); 7 | r += c * (1-x) * ( y ); 8 | r += d * ( x ) * ( y ); 9 | return r; 10 | } 11 | 12 | static float getsamplec(float *fx, int w, int h, int pd, int i, int j, int l) 13 | { 14 | if (i < 0) i = 0; 15 | if (j < 0) j = 0; 16 | if (l < 0) l = 0; 17 | if (i >= w) i = w-1; 18 | if (j >= h) j = h-1; 19 | if (l >= pd) l = pd-1; 20 | float (*x)[w][pd] = (void*)fx; 21 | return x[j][i][l]; 22 | //return x[(i+j*w)*pd + l]; 23 | } 24 | 25 | static void bilinear_interpolation_vec_at(float *result, 26 | float *x, int w, int h, int pd, 27 | float p, float q) 28 | { 29 | int ip = p; 30 | int iq = q; 31 | for (int l = 0; l < pd; l++) { 32 | float a = getsamplec(x, w, h, pd, ip , iq , l); 33 | float b = getsamplec(x, w, h, pd, ip+1, iq , l); 34 | float c = getsamplec(x, w, h, pd, ip , iq+1, l); 35 | float d = getsamplec(x, w, h, pd, ip+1, iq+1, l); 36 | float r = evaluate_bilinear_cell(a, b, c, d, p-ip, q-iq); 37 | result[l] = r; 38 | } 39 | } 40 | 41 | static float bilinear_interpolation_at(float *x, int w, int h, float p, float q) 42 | { 43 | int ip = p; 44 | int iq = q; 45 | float a = getsamplec(x, w, h, 1, ip , iq , 0); 46 | float b = getsamplec(x, w, h, 1, ip+1, iq , 0); 47 | float c = getsamplec(x, w, h, 1, ip , iq+1, 0); 48 | float d = getsamplec(x, w, h, 1, ip+1, iq+1, 0); 49 | float r = evaluate_bilinear_cell(a, b, c, d, p-ip, q-iq); 50 | return r; 51 | } 52 | -------------------------------------------------------------------------------- /c/coordconvert.c: -------------------------------------------------------------------------------- 1 | #include "coordconvert.h" 2 | #include "math.h" 3 | 4 | // Some numerical values related to WGS 84 ellipsoid 5 | #define A 6378137 // semi major axis 6 | #define E 0.081819190842622 // first eccentricity 7 | 8 | // convert (long,lat,h) to ECEF coord sys. (X,Y,Z) 9 | void geotedic_to_ECEF(double lg, double lt, double h, 10 | double *X, double *Y, double *Z) 11 | { 12 | double pi = acos(-1); 13 | lg = lg*pi/180.; 14 | lt = lt*pi/180.; 15 | 16 | double N = A/sqrt(1.-E*E*sin(lt)*sin(lt)); 17 | *X=(N+h)*cos(lt)*cos(lg); 18 | *Y=(N+h)*cos(lt)*sin(lg); 19 | *Z=(N*(1.-E*E)+h)*sin(lt); 20 | } 21 | 22 | // given (X,Y,Z) ECEF coord, computes the alt above the WGS 84 ellipsoid 23 | // (faster than ECEF_to_lgt_lat_alt, but only gives the altitude) 24 | double get_altitude_from_ECEF(double X, double Y, double Z) 25 | { 26 | double p = sqrt(X*X+Y*Y); 27 | double k0 = 1./(1.-E*E); 28 | double c0 = pow(p*p+(1.-E*E)*Z*Z*k0*k0,1.5)/(A*E*E); 29 | double k1 = k0; 30 | double c1 = c0; 31 | double h0=-10000.,h; 32 | double diff=10000.; 33 | 34 | // newton-raphson; most of the time, 35 | // only takes 2 iterations 36 | int max_nb_iter=15,nb_iter=0; 37 | while( (fabs(diff)>0.001) && (nb_iter <= max_nb_iter) ) 38 | { 39 | k1 = 1. + (p*p+(1.-E*E)*Z*Z*k1*k1*k1)/(c1-p*p); 40 | c1 = pow(p*p+(1.-E*E)*Z*Z*k1*k1,1.5)/(A*E*E); 41 | h = sqrt(p*p+Z*Z*k1*k1)*(1./k1-1./k0)/(E*E); 42 | diff=h0-h; 43 | h0=h; 44 | 45 | nb_iter++; 46 | } 47 | 48 | return h; 49 | } 50 | 51 | // given (X,Y,Z) ECEF coord, computes the lat/long/alt 52 | // above the WGS 84 ellipsoid 53 | void ECEF_to_lgt_lat_alt(double X, double Y, double Z, 54 | double *lgt, double *lat, double *h) 55 | { 56 | double E2=E*E; 57 | double deg2rad=atan2(1,1)/45.; 58 | double epsilon_phi = 1e-12; 59 | double kpi=45./atan2(1,1); 60 | 61 | double R=sqrt(X*X+Y*Y); 62 | double phi1 = atan2(Z,R*(1-A*E2/sqrt(X*X+Y*Y+Z*Z))); 63 | double phi0 = phi1 + 10.*epsilon_phi; 64 | 65 | // altitude 66 | int max_nb_iter=15,nb_iter=0; 67 | while ( (fabs(phi1-phi0) > epsilon_phi) && (nb_iter <= max_nb_iter) ) 68 | { 69 | phi0 = phi1; 70 | phi1 = atan2(Z/R,1-A*E2*cos(phi0)/(R*sqrt(1-E2*sin(phi0)*sin(phi0)))); 71 | *h=R/cos(phi1)-A/sqrt(1-E2*sin(phi1)*sin(phi1)); 72 | nb_iter++; 73 | } 74 | 75 | // longitude 76 | *lgt = atan2(Y,X)*kpi; 77 | 78 | //latitude 79 | *lat = phi1*kpi; 80 | } 81 | -------------------------------------------------------------------------------- /c/coordconvert.h: -------------------------------------------------------------------------------- 1 | #ifndef _COORDCONVERT_H 2 | #define _COORDCONVERT_H 3 | 4 | // convert (long,lat,h) to ECEF coord sys. (X,Y,Z) 5 | void geotedic_to_ECEF(double lg, double lt, double h, 6 | double *X, double *Y, double *Z); 7 | 8 | // given (X,Y,Z) ECEF coord, computes the alt above the WGS 84 ellipsoid 9 | // (faster than ECEF_to_lgt_lat_alt, but only gives the altitude) 10 | double get_altitude_from_ECEF(double X, double Y, double Z); 11 | 12 | // given (X,Y,Z) ECEF coord, computes the lat/long/alt 13 | // above the WGS 84 ellipsoid 14 | void ECEF_to_lgt_lat_alt(double X, double Y, double Z, 15 | double *lgt, double *lat, double *h); 16 | 17 | #endif // _COORDCONVERT_H 18 | -------------------------------------------------------------------------------- /c/drawsegment.c: -------------------------------------------------------------------------------- 1 | #ifndef _DRAWSEGMENT_C 2 | #define _DRAWSEGMENT_C 3 | 4 | #include 5 | #include 6 | 7 | // draw a segment between two points 8 | void traverse_segment(int px, int py, int qx, int qy, 9 | void (*f)(int,int,void*), void *e) 10 | { 11 | if (px == qx && py == qy) 12 | f(px, py, e); 13 | else if (qx + qy < px + py) // bad quadrants 14 | traverse_segment(qx, qy, px, py, f, e); 15 | else { 16 | if (abs(qx - px) > qy - py) { // horitzontal 17 | float slope = (qy - py)/(float)(qx - px); 18 | for (int i = 0; i < qx-px; i++) 19 | f(i+px, lrint(py + i*slope), e); 20 | } else { // vertical 21 | float slope = (qx - px)/(float)(qy - py); 22 | for (int j = 0; j <= qy-py; j++) 23 | f(lrint(px+j*slope), j+py, e); 24 | } 25 | } 26 | } 27 | 28 | // draw a segment between two points (somewhat anti-aliased) 29 | void traverse_segment_aa(int px, int py, int qx, int qy, 30 | void (*f)(int,int,float,void*), void *e) 31 | { 32 | if (px == qx && py == qy) 33 | f(px, py, 1.0, e); 34 | else if (qx + qy < px + py) // bad quadrants 35 | traverse_segment_aa(qx, qy, px, py, f, e); 36 | else { 37 | if (abs(qx - px) > qy - py) { // horitzontal 38 | float slope = (qy - py); slope /= (qx - px); 39 | assert(px < qx); 40 | assert(fabs(slope) <= 1); 41 | for (int i = 0; i <= qx-px; i++) { 42 | float exact = py + i*slope; 43 | int whole = lrint(exact); 44 | float part = fabs(whole - exact); 45 | int owhole = (whole= abs(qx - px)); 53 | assert(py < qy); 54 | assert(fabs(slope) <= 1); 55 | for (int j = 0; j <= qy-py; j++) { 56 | float exact = px + j*slope; 57 | int whole = lrint(exact); 58 | float part = fabs(whole - exact); 59 | int owhole = (whole 5 | #include 6 | 7 | #ifdef __linux 8 | # include 9 | # include 10 | static const char *emptystring = ""; 11 | static const char *myname(void) 12 | { 13 | # define n 0x29a 14 | //const int n = 0x29a; 15 | static char buf[n]; 16 | pid_t p = getpid(); 17 | snprintf(buf, n, "/proc/%d/cmdline", p); 18 | FILE *f = fopen(buf, "r"); 19 | if (!f) return emptystring; 20 | int c, i = 0; 21 | while ((c = fgetc(f)) != EOF && i < n) { 22 | # undef n 23 | buf[i] = c ? c : ' '; 24 | i += 1; 25 | } 26 | if (i) buf[i-1] = '\0'; 27 | fclose(f); 28 | return buf; 29 | } 30 | #else 31 | static const char *myname(void) { return ""; } 32 | #endif//__linux 33 | 34 | #ifdef DOTRACE 35 | #include 36 | #endif 37 | 38 | #ifndef BACKTRACE_SYMBOLS 39 | #define BACKTRACE_SYMBOLS 50 40 | #endif 41 | 42 | static void print_trace(FILE *f) 43 | { 44 | (void)f; 45 | #ifdef DOTRACE 46 | void *array[BACKTRACE_SYMBOLS]; 47 | size_t size, i; 48 | char **strings; 49 | 50 | size = backtrace (array, BACKTRACE_SYMBOLS); 51 | strings = backtrace_symbols (array, size); 52 | 53 | fprintf (f, "Obtained %zu stack frames.\n", size); 54 | 55 | for (i = 0; i < size; i++) 56 | fprintf (f, "%s\n", strings[i]); 57 | 58 | free (strings); 59 | #endif 60 | } 61 | 62 | #include 63 | 64 | //static void fail(const char *fmt, ...) __attribute__((noreturn,format(printf,1,2))); 65 | static void fail(const char *fmt, ...) __attribute__((noreturn)); 66 | static void fail(const char *fmt, ...) 67 | 68 | { 69 | va_list argp; 70 | fprintf(stderr, "\nFAIL(\"%s\"): ", myname()); 71 | va_start(argp, fmt); 72 | vfprintf(stderr, fmt, argp); 73 | va_end(argp); 74 | fprintf(stderr, "\n\n"); 75 | fflush(NULL); 76 | print_trace(stderr); 77 | #ifdef NDEBUG 78 | exit(-1); 79 | #else//NDEBUG 80 | exit(*(volatile int *)0x43); 81 | #endif//NDEBUG 82 | } 83 | 84 | #endif//_FAIL_C 85 | -------------------------------------------------------------------------------- /c/geographiclib_wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" void utm(double *out, double lat, double lon) 6 | { 7 | GeographicLib::GeoCoords p(lat, lon); 8 | out[0] = p.Easting(); 9 | out[1] = p.Northing(); 10 | } 11 | 12 | extern "C" void utm_alt_zone(double *out, double lat, double lon, int zone) 13 | { 14 | GeographicLib::GeoCoords p(lat, lon); 15 | p.SetAltZone(zone); 16 | out[0] = p.AltEasting(); 17 | out[1] = p.AltNorthing(); 18 | } 19 | 20 | extern "C" void utm_zone(int *zone, bool *northp, double lat, double lon) 21 | { 22 | GeographicLib::GeoCoords p(lat, lon); 23 | zone[0] = p.Zone(); 24 | northp[0] = p.Northp(); 25 | } 26 | 27 | // returns the signed zone 28 | extern "C" 29 | int utm_from_lonlat(double out_eastnorth[2], double lon, double lat) 30 | { 31 | GeographicLib::GeoCoords p(lat, lon); 32 | out_eastnorth[0] = p.Easting(); 33 | out_eastnorth[1] = p.Northing(); 34 | return p.Zone() * (p.Northp() ? 1 : -1); 35 | } 36 | 37 | // expects a signed zone 38 | extern "C" 39 | void lonlat_from_eastnorthzone(double out_lonlat[2], double e, double n, int z) 40 | { 41 | GeographicLib::GeoCoords p(std::abs(z), z>0, e, n); 42 | out_lonlat[0] = p.Longitude(); 43 | out_lonlat[1] = p.Latitude(); 44 | } 45 | -------------------------------------------------------------------------------- /c/geoid_height_wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" void geoid_height(double *out, double lat, double lon) 6 | { 7 | GeographicLib::Geoid egm96("egm96-15", GEOID_DATA_FILE_PATH); 8 | *out = egm96(lat, lon); 9 | } 10 | -------------------------------------------------------------------------------- /c/homography/LibHomography/Homography.h: -------------------------------------------------------------------------------- 1 | #ifndef HOMOGRAPHY_H_INCLUDED 2 | #define HOMOGRAPHY_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | 7 | 8 | //! Local includes 9 | #include "../Utilities/Parameters.h" 10 | #include "../LibImages/LibImages.h" 11 | 12 | /** 13 | * @brief new function. 14 | **/ 15 | void runHomography( 16 | const Image& i_im, 17 | const double i_mat[9], 18 | Image& o_im, 19 | const Parameters& p_params); 20 | 21 | 22 | /** 23 | * @brief Map the image. May be recursive if zoom != 1. 24 | **/ 25 | void mapImage( 26 | const Image& i_im, 27 | const double i_mat[9], 28 | Image& o_im, 29 | const bool p_verbose, 30 | const bool p_adjustSize, 31 | const bool p_useAntiAliasing = true); 32 | 33 | 34 | /** 35 | * @brief Adjust the size of the output image according to the input image size 36 | * and the homography that will be applied on it. 37 | **/ 38 | void adjustImage( 39 | const Image& i_im, 40 | const double i_mat[9], 41 | Image& o_im, 42 | int &o_offsetI, 43 | int &o_offsetJ); 44 | 45 | 46 | /** 47 | * @brief Apply the homography to (x, y, 1). 48 | **/ 49 | void apply( 50 | const double i_mat[9], 51 | double& io_x, 52 | double& io_y); 53 | 54 | 55 | /** 56 | * @brief Invert an homography. 57 | **/ 58 | void invert( 59 | const double i_mat[9], 60 | double o_mat[9]); 61 | 62 | 63 | /** 64 | * @brief Compute min linear compression of H in rectangle [0,w]x[0,h]. 65 | **/ 66 | float getMinZoomOut( 67 | const double i_mat[9], 68 | const size_t p_w, 69 | const size_t p_h); 70 | 71 | 72 | /** 73 | * @brief Min singular value of the Jacobian of H at point (x, y). 74 | **/ 75 | float getMinSVJacob( 76 | const double i_mat[9], 77 | const double i_x, 78 | const double i_y); 79 | 80 | 81 | #endif // HOMOGRAPHY_H_INCLUDED 82 | -------------------------------------------------------------------------------- /c/homography/Makefile: -------------------------------------------------------------------------------- 1 | CXXFLAGS ?= -march=native -O3 2 | override CXXFLAGS := $(CXXFLAGS) `gdal-config --cflags` -std=c++11 3 | override CXXLIBS := $(CXXLIBS) `gdal-config --libs` 4 | 5 | OBJ = main.o \ 6 | LibImages/LibImages.o \ 7 | Utilities/Utilities.o \ 8 | Utilities/Memory.o \ 9 | Utilities/Parameters.o \ 10 | Utilities/Time.o \ 11 | LibHomography/Homography.o \ 12 | LibHomography/Splines.o 13 | 14 | homography: $(OBJ) 15 | $(CXX) -o $@ $^ $(CXXLIBS) 16 | 17 | clean: 18 | rm -f homography $(OBJ) 19 | -------------------------------------------------------------------------------- /c/homography/Utilities/Memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | /** 14 | * @file Memory.cpp 15 | * @brief Generic function for allocation and freeing of aligned memory. 16 | * 17 | * @author Marc Lebrun 18 | **/ 19 | 20 | 21 | //! Global includes 22 | #include 23 | #include 24 | #ifdef _WIN32 25 | #include 26 | #endif 27 | 28 | 29 | //! Local includes 30 | 31 | 32 | //! Memory aligned allocation. 33 | void* memalloc( 34 | const size_t p_pad, 35 | const size_t p_size) { 36 | 37 | #ifdef _WIN32 38 | return _aligned_malloc(p_size, p_pad); 39 | #else 40 | void* ptr; 41 | if (posix_memalign(&ptr, p_pad, p_size) != 0) { 42 | std::cout << "Error during the allocation." << std::endl; 43 | exit(EXIT_FAILURE); 44 | } 45 | return ptr; 46 | #endif 47 | } 48 | 49 | 50 | //! Release the memory allocated with memalloc. 51 | void memfree( 52 | void* i_ptr) { 53 | 54 | if (i_ptr != NULL) { 55 | #ifdef _WIN32 56 | _aligned_free(i_ptr) 57 | #else 58 | free(i_ptr); 59 | #endif 60 | i_ptr = NULL; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /c/homography/Utilities/Memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | #ifndef MEMORY_H_INCLUDED 14 | #define MEMORY_H_INCLUDED 15 | 16 | 17 | /** 18 | * @brief Memory aligned allocation. 19 | **/ 20 | void* memalloc( 21 | const size_t p_pad, 22 | const size_t p_size); 23 | 24 | 25 | /** 26 | * @brief Release the memory allocated with memalloc. 27 | **/ 28 | void memfree( 29 | void* i_ptr); 30 | 31 | 32 | 33 | #endif // MEMORY_H_INCLUDED 34 | -------------------------------------------------------------------------------- /c/homography/Utilities/Time.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Time.cpp 3 | * 4 | * @brief Class to handle the elapsed time. 5 | * 6 | * @author Marc Lebrun (original linux version) 7 | * @author Carlo de Franchis (osx compatible version) 8 | **/ 9 | 10 | 11 | #include 12 | 13 | #ifdef __MACH__ 14 | #include 15 | #include 16 | #endif 17 | 18 | 19 | #include "Time.h" 20 | 21 | 22 | using namespace std; 23 | 24 | //! Portable way to get current time 25 | static void portable_gettime(struct timespec *ts) 26 | { 27 | #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time 28 | clock_serv_t cclock; 29 | mach_timespec_t mts; 30 | host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); 31 | clock_get_time(cclock, &mts); 32 | mach_port_deallocate(mach_task_self(), cclock); 33 | ts->tv_sec = mts.tv_sec; 34 | ts->tv_nsec = mts.tv_nsec; 35 | #else 36 | clock_gettime(CLOCK_REALTIME, ts); 37 | #endif 38 | } 39 | 40 | 41 | //! Default constructor 42 | Time::Time() : 43 | 44 | m_time((struct timespec) {0, 0}) { 45 | 46 | //! Initialize the time 47 | portable_gettime(&m_time); 48 | } 49 | 50 | 51 | 52 | 53 | //! Compute an amount of time elapsed. 54 | void Time::get_time( 55 | const char *p_name, 56 | const size_t p_nbChar) { 57 | //! Check the current time 58 | struct timespec finish; 59 | portable_gettime(&finish); 60 | 61 | //! Compute the elapsed time 62 | double elapsed = (finish.tv_sec - m_time.tv_sec) * 1000; 63 | elapsed += (finish.tv_nsec - m_time.tv_nsec) / 1000000.0; 64 | 65 | //! Determine the space to add at the end 66 | string sentence = p_name; 67 | sentence += string(max(0, int(p_nbChar) - int(sentence.size())), ' '); 68 | 69 | //! Print the result 70 | cout << sentence << ": (ms) = " << elapsed << endl; 71 | 72 | //! Start a new timer 73 | portable_gettime(&m_time); 74 | } 75 | -------------------------------------------------------------------------------- /c/homography/Utilities/Time.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_H_INCLUDED 2 | #define TIME_H_INCLUDED 3 | 4 | 5 | #include 6 | 7 | 8 | /** 9 | * @brief Small class to handle the elapsed time. For now, only works on linux 10 | * system (problem of portability of CLOCK_MONOTONIC). 11 | **/ 12 | 13 | class Time { 14 | 15 | public: 16 | /** 17 | * @brief Default constructor. 18 | **/ 19 | Time(); 20 | 21 | 22 | /** 23 | * @brief Compute an amount of time elapsed. 24 | * 25 | * @param p_name : name of the section to print; 26 | * @param p_nbChar: number of characters to print. 27 | * 28 | * @return none. 29 | **/ 30 | void get_time( 31 | const char *p_name, 32 | const size_t p_nbChar = 35); 33 | 34 | 35 | private: 36 | 37 | struct timespec m_time; 38 | }; 39 | #endif // TIME_H_INCLUDED 40 | -------------------------------------------------------------------------------- /c/homography/Utilities/Utilities.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILITIES_H_INCLUDED 2 | #define UTILITIES_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | //! Local includes 17 | #include "../LibImages/LibImages.h" 18 | 19 | 20 | /** 21 | * @brief Return the optimal cut of the lines of an image according to 22 | * the number of threads available. 23 | * 24 | * @param i_height: the height of the image; 25 | * @param o_heights: will contain the lines position (must be already allocated) 26 | * @param p_nbThreads: the number of threads available. 27 | **/ 28 | void initializeHeights( 29 | const size_t i_height, 30 | size_t* o_heights, 31 | const size_t p_nbThreads); 32 | 33 | 34 | /** 35 | * @brief Test if x is not NaN. 36 | **/ 37 | inline bool isNumber( 38 | const float i_x) { 39 | return (i_x == i_x); 40 | } 41 | 42 | 43 | /** 44 | * @brief Read an homography: [a b c; 45 | d e f; 46 | g h i] 47 | **/ 48 | void readHomography( 49 | const char* i_fileName, 50 | double o_mat[9]); 51 | 52 | 53 | 54 | #endif // UTILITIES_H_INCLUDED 55 | -------------------------------------------------------------------------------- /c/homography/build.sh: -------------------------------------------------------------------------------- 1 | CXX="c++ -mavx -march=native -O3" 2 | CXX="c++ -mavx" 3 | CXXFLAGS=`pkg-config gdal --cflags` 4 | CXXLIBS=`pkg-config gdal --libs` 5 | rm -f *.o 6 | $CXX $CXXFLAGS -c main.cpp 7 | $CXX $CXXFLAGS -c LibImages/LibImages.cpp 8 | $CXX $CXXFLAGS -c Utilities/Memory.cpp 9 | $CXX $CXXFLAGS -c Utilities/Parameters.cpp 10 | $CXX $CXXFLAGS -c Utilities/Time.cpp 11 | $CXX $CXXFLAGS -c Utilities/Utilities.cpp 12 | $CXX $CXXFLAGS -c LibHomography/Homography.cpp 13 | $CXX $CXXFLAGS -c LibHomography/Splines.cpp 14 | $CXX *.o -o homography $CXXLIBS 15 | rm -f *.o 16 | -------------------------------------------------------------------------------- /c/homography/pickopt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // @c pointer to original argc 5 | // @v pointer to original argv 6 | // @o option name (after hyphen) 7 | // @d default value 8 | const char * pick_option(int *c, char ***v, const char *o, const char *d) 9 | { 10 | int argc = *c; 11 | char **argv = *v; 12 | int id = d ? 1 : 0; 13 | for (int i = 0; i < argc - id; i++) 14 | if (argv[i][0] == '-' && 0 == strcmp(argv[i]+1, o)) 15 | { 16 | char *r = argv[i+id]+1-id; 17 | *c -= id+1; 18 | for (int j = i; j < argc - id; j++) 19 | (*v)[j] = (*v)[j+id+1]; 20 | return r; 21 | } 22 | return d; 23 | } 24 | 25 | // char *oval = pick_option(&argc, &argv, "o", "37"); 26 | // returns "37" or the value of the option, removes 0 or 2 arguments 27 | // 28 | // bool o = pick_option(&argc, &argv, "o", NULL); 29 | // returns NULL or true, removes 0 or 1 arguments 30 | // 31 | 32 | #ifdef MAIN_PICKOPT 33 | #include 34 | 35 | static void print_args(int c, char **v) 36 | { 37 | for (int i = 0; i <= c; i++) 38 | printf("ARG[%d/%d] = \"%s\"\n", i, c, v[i]); 39 | } 40 | 41 | int main(int c, char **v) 42 | { 43 | printf("arguments before processing:\n"); 44 | print_args(c, v); 45 | // char *o = pick_option(&c, &v, "o", "42"); 46 | // printf("o = \"%s\"\n", o); 47 | printf("pick_option 'o' is: \"%d\"\n", (bool) pick_option(&c, &v, "o", NULL)); 48 | printf("arguments after processing:\n"); 49 | print_args(c, v); 50 | return 0; 51 | } 52 | #endif//MAIN_PICKOPT 53 | -------------------------------------------------------------------------------- /c/homography/test_data/homography.txt: -------------------------------------------------------------------------------- 1 | 2.088379999999999959e-01 -9.784209999999999852e-01 6.848946999999999434e+02 2 | 9.784209999999999852e-01 2.088379999999999959e-01 -1.136868377216160297e-13 3 | 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+00 4 | -------------------------------------------------------------------------------- /c/homography/test_data/identity.txt: -------------------------------------------------------------------------------- 1 | 1 0 0 2 | 0 1 0 3 | 0 0 1 4 | -------------------------------------------------------------------------------- /c/homography/test_data/input_uint16.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/homography/test_data/input_uint16.tif -------------------------------------------------------------------------------- /c/homography/test_data/input_uint16_tiled.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/homography/test_data/input_uint16_tiled.tif -------------------------------------------------------------------------------- /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/msmw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(msmw) 3 | 4 | # The build type "Release" adds some optimizations 5 | if (NOT CMAKE_BUILD_TYPE) 6 | set (CMAKE_BUILD_TYPE "Release") 7 | endif () 8 | 9 | # Are we using gcc? 10 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 11 | # GCC on MacOs needs this option to use the clang assembler 12 | if (APPLE) 13 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wa,-q") 14 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-q") 15 | endif () 16 | endif () 17 | 18 | # Optimize to the current CPU and enable warnings 19 | #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -march=native") 20 | #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -march=native") 21 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -mavx") 22 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -mavx") 23 | 24 | # Enable C99 25 | if (CMAKE_VERSION VERSION_LESS "3.1") 26 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") 27 | else () 28 | set (CMAKE_C_STANDARD 99) 29 | endif () 30 | 31 | # Enable OpenMP 32 | find_package (OpenMP) 33 | if(OPENMP_FOUND) 34 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 35 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 36 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") 37 | endif() 38 | 39 | # Link LibTIFF, LibJPEG, LibPNG, LibFFTW 40 | find_package (TIFF REQUIRED) 41 | find_package (PNG REQUIRED) 42 | find_package (JPEG REQUIRED) 43 | find_path (FFTW_INCLUDE_DIR fftw3.h) 44 | find_library (FFTWF_LIBRARIES NAMES fftw3f) 45 | include_directories (PUBLIC ${TIFF_INCLUDE_DIR} PUBLIC ${JPEG_INCLUDE_DIR} PUBLIC ${PNG_INCLUDE_DIRS} PUBLIC ${FFTW_INCLUDE_DIR}) 46 | link_libraries (${TIFF_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${FFTWF_LIBRARIES}) 47 | 48 | 49 | set(SOURCE_FILES 50 | LibMSMW/ConnectedComponents.cpp 51 | LibMSMW/ConnectedComponents.h 52 | LibMSMW/LibMSMW.cpp 53 | LibMSMW/LibMSMW.h 54 | LibMSMW/UtilitiesMSMW.cpp 55 | LibMSMW/UtilitiesMSMW.h 56 | LibImages/LibImages.cpp 57 | LibImages/LibImages.h 58 | Utilities/Memory.cpp 59 | Utilities/Memory.h 60 | Utilities/Time.cpp 61 | Utilities/Time.h 62 | Utilities/Parameters.h 63 | Utilities/Parameters.cpp 64 | Utilities/Utilities.cpp 65 | Utilities/Utilities.h 66 | main.cpp) 67 | 68 | add_executable(msmw ${SOURCE_FILES}) 69 | -------------------------------------------------------------------------------- /c/msmw/LibMSMW/ConnectedComponents.h: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTEDCOMPONENTS_H_INCLUDED 2 | #define CONNECTEDCOMPONENTS_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | 7 | 8 | //! Local includes 9 | #include "../LibImages/LibImages.h" 10 | 11 | 12 | /** 13 | * @brief Structure that contains pixel value and position. 14 | **/ 15 | struct pix_new{ 16 | int i; 17 | int j; 18 | float v; 19 | }; 20 | 21 | 22 | /** 23 | * @brief Connected components of positive pixels of the image rep (8 connected) 24 | * 25 | * @param io_rep: repository of index position; 26 | * @param p_width, p_height: size of io_rep 2D array stored in 1D. 27 | **/ 28 | void updatePositiveConnectedComponent( 29 | int *io_rep, 30 | const int p_width, 31 | const int p_height); 32 | 33 | 34 | /** 35 | * @brief Find index such as i_array[index] = index and update i_array[p_value]. 36 | * 37 | * @param i_array: array of indexes that will be updated; 38 | * @param p_value: index. 39 | **/ 40 | int findCC( 41 | int *io_array, 42 | const int p_value); 43 | 44 | 45 | /** 46 | * @brief Join connected components. 47 | * 48 | * @param io_array: array of index to be updated; 49 | * @param p_a: first index, 50 | * @param p_b: second index. 51 | **/ 52 | void joinCC( 53 | int *io_array, 54 | const int p_a, 55 | const int p_b); 56 | 57 | 58 | /** 59 | * @brief Initialize index of an image. 60 | * 61 | * @param i_im: input image; 62 | * @param o_rep: output index repository. Must be allocated. 63 | **/ 64 | void initRep( 65 | const Image& i_im, 66 | int* o_rep); 67 | 68 | 69 | /** 70 | * @brief Remove small regions of an image based on connected components. 71 | **/ 72 | void removeRegions( 73 | Image& io_im, 74 | int* io_rep, 75 | const size_t p_minArea); 76 | 77 | 78 | #endif // CONNECTEDCOMPONENTS_H_INCLUDED 79 | -------------------------------------------------------------------------------- /c/msmw/Makefile: -------------------------------------------------------------------------------- 1 | # C source code 2 | 3 | # C++ source code 4 | CXXSRC = main.cpp \ 5 | ./LibImages/LibImages.cpp \ 6 | ./LibMSMW/ConnectedComponents.cpp \ 7 | ./LibMSMW/LibMSMW.cpp \ 8 | ./LibMSMW/UtilitiesMSMW.cpp \ 9 | ./Utilities/Memory.cpp \ 10 | ./Utilities/Parameters.cpp \ 11 | ./Utilities/Time.cpp \ 12 | ./Utilities/Utilities.cpp 13 | 14 | # all source code 15 | SRC = $(CSRC) $(CXXSRC) 16 | 17 | # C objects 18 | COBJ = $(CSRC:.c=.o) 19 | # C++ objects 20 | CXXOBJ = $(CXXSRC:.cpp=.o) 21 | # all objects 22 | OBJ = $(COBJ) $(CXXOBJ) 23 | # binary target 24 | BIN = msmw 25 | 26 | # C optimization flags 27 | COPT = -O3 -ftree-vectorize -funroll-loops -g -msse2 -mavx 28 | #COPT = -O3 -ftree-vectorize -funroll-loops -g -msse2 29 | 30 | # C++ optimization flags 31 | CXXOPT = $(COPT) 32 | 33 | # C compilation flags 34 | CFLAGS = $(COPT) -Wall -Wextra \ 35 | -Wno-write-strings -ansi 36 | # C++ compilation flags 37 | CXXFLAGS = $(CXXOPT) -Wall -Wextra \ 38 | -Wno-write-strings -Wno-deprecated -ansi 39 | # link flags 40 | LDFLAGS = -lpng -ltiff -lfftw3f -lm -lrt -lpthread 41 | 42 | # use openMP with `make OMP=1` 43 | ifdef OMP 44 | CFLAGS += -fopenmp 45 | CXXFLAGS += -fopenmp 46 | LDFLAGS += -lgomp 47 | else 48 | CFLAGS += -Wno-unknown-pragmas 49 | CXXFLAGS += -Wno-unknown-pragmas 50 | endif 51 | 52 | # partial compilation of C source code 53 | %.o: %.c %.h 54 | $(CC) -c -o $@ $< $(CFLAGS) 55 | # partial compilation of C++ source code 56 | %.o: %.cpp %.h 57 | $(CXX) -c -o $@ $< $(CXXFLAGS) 58 | 59 | # link all the object code 60 | $(BIN): $(OBJ) $(LIBDEPS) 61 | $(CXX) -o $@ $(OBJ) $(LDFLAGS) 62 | -------------------------------------------------------------------------------- /c/msmw/Utilities/Memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | /** 14 | * @file Memory.cpp 15 | * @brief Generic function for allocation and freeing of aligned memory. 16 | * 17 | * @author Marc Lebrun 18 | **/ 19 | 20 | 21 | //! Global includes 22 | #include 23 | #include 24 | #ifdef _WIN32 25 | #include 26 | #endif 27 | 28 | 29 | //! Local includes 30 | #include "Memory.h" 31 | 32 | 33 | //! Memory aligned allocation. 34 | void* memalloc( 35 | const size_t p_pad, 36 | const size_t p_size) { 37 | 38 | #ifdef _WIN32 39 | return _aligned_malloc(p_size, p_pad); 40 | #else 41 | void* ptr; 42 | if (posix_memalign(&ptr, p_pad, p_size) != 0) { 43 | std::cout << "Error during the allocation." << std::endl; 44 | exit(EXIT_FAILURE); 45 | } 46 | return ptr; 47 | #endif 48 | } 49 | 50 | 51 | //! Release the memory allocated with memalloc. 52 | void memfree( 53 | void* i_ptr) { 54 | 55 | if (i_ptr != NULL) { 56 | #ifdef _WIN32 57 | _aligned_free(i_ptr) 58 | #else 59 | free(i_ptr); 60 | #endif 61 | i_ptr = NULL; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /c/msmw/Utilities/Memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | #ifndef MEMORY_H_INCLUDED 14 | #define MEMORY_H_INCLUDED 15 | 16 | 17 | /** 18 | * @brief Memory aligned allocation. 19 | **/ 20 | void* memalloc( 21 | const size_t p_pad, 22 | const size_t p_size); 23 | 24 | 25 | /** 26 | * @brief Release the memory allocated with memalloc. 27 | **/ 28 | void memfree( 29 | void* i_ptr); 30 | 31 | 32 | 33 | #endif // MEMORY_H_INCLUDED 34 | -------------------------------------------------------------------------------- /c/msmw/Utilities/Time.cpp: -------------------------------------------------------------------------------- 1 | ../../homography/Utilities/Time.cpp -------------------------------------------------------------------------------- /c/msmw/Utilities/Time.h: -------------------------------------------------------------------------------- 1 | ../../homography/Utilities/Time.h -------------------------------------------------------------------------------- /c/msmw/Utilities/Utilities.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILITIES_H_INCLUDED 2 | #define UTILITIES_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | //! Local includes 17 | #include "../LibImages/LibImages.h" 18 | 19 | 20 | /** 21 | * @brief Return the optimal cut of the lines of an image according to 22 | * the number of threads available. 23 | * 24 | * @param i_height: the height of the image; 25 | * @param o_heights: will contain the lines position (must be already allocated) 26 | * @param p_nbThreads: the number of threads available. 27 | **/ 28 | void initializeHeights( 29 | const size_t i_height, 30 | size_t* o_heights, 31 | const size_t p_nbThreads); 32 | 33 | 34 | /** 35 | * @brief Test if x is not NaN. 36 | **/ 37 | inline bool isNumber( 38 | const float i_x) { 39 | return (i_x == i_x); 40 | } 41 | 42 | 43 | /** 44 | * @brief Read an homography: [a b c; 45 | d e f; 46 | g h i] 47 | **/ 48 | void readHomography( 49 | const char* i_fileName, 50 | double o_mat[9]); 51 | 52 | 53 | /** 54 | * @brief If else then SSE implementation. 55 | **/ 56 | inline __m128 applyMask_ps( 57 | const __m128 i_mask, 58 | const __m128 i_then, 59 | const __m128 i_else){ 60 | 61 | // return mask ? then : else 62 | return _mm_or_ps(_mm_and_ps(i_mask, i_then), _mm_andnot_ps(i_mask, i_else)); 63 | } 64 | 65 | 66 | /** 67 | * @brief If else then SSE implementation. 68 | **/ 69 | inline __m256 applyMask256_ps( 70 | const __m256 i_mask, 71 | const __m256 i_then, 72 | const __m256 i_else){ 73 | 74 | // return mask ? then : else 75 | return _mm256_or_ps(_mm256_and_ps(i_mask, i_then), 76 | _mm256_andnot_ps(i_mask, i_else)); 77 | } 78 | 79 | 80 | 81 | #endif // UTILITIES_H_INCLUDED 82 | -------------------------------------------------------------------------------- /c/msmw/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file main.cpp 3 | * 4 | * @brief Main function to compute the MSMW algorithm. 5 | * 6 | * @author Marc Lebrun 7 | **/ 8 | 9 | 10 | //! Global includes 11 | #include 12 | #include 13 | 14 | 15 | //! Local includes 16 | #include "Utilities/Parameters.h" 17 | #include "Utilities/Time.h" 18 | #include "LibImages/LibImages.h" 19 | #include "LibMSMW/LibMSMW.h" 20 | 21 | using namespace std; 22 | 23 | // ./msmw -il a.png -ir b.png -dl pixell.tif -kl maskl.tif -dr pixelr.tif -kr maskr.tif -n 4 -W 5 -x 9 -y 9 -m -87 -M 63 24 | 25 | int main(int argc, char **argv) { 26 | 27 | //! Retrieve the arguments 28 | Parameters params; 29 | if (params.checkArgs(argc, argv) != EXIT_SUCCESS) 30 | return EXIT_FAILURE; 31 | 32 | //! Time 33 | Time time; 34 | 35 | //! Read left and right input images 36 | Image imL, imR; 37 | imL.read(params.inpLeft()); 38 | imR.read(params.inpRight()); 39 | time.get_time("Read images"); 40 | 41 | //! Set to 0 all NaNs and Inf in the input images 42 | imL.removeNaN(); 43 | imR.removeNaN(); 44 | time.get_time("Remove NaN"); 45 | 46 | //! Output images 47 | Image imDispL, imDispR, imDistL, imDistR, imMaskL, imMaskR; 48 | 49 | //! Initialize MSMW 50 | MSMW msmw; 51 | msmw.init(imL, imR, params); 52 | time.get_time("Initialize msmw object"); 53 | 54 | //! Launch the stereo multiscale chain 55 | msmw.run(imDispL, imDispR, imDistL, imDistR, imMaskL, imMaskR); 56 | time.get_time("StereoMultiscaleChain"); 57 | 58 | //! Save images 59 | imDispL.write(params.outDispL()); 60 | imMaskL.write(params.outMaskL()); 61 | if (params.outDispR() != NULL) 62 | imDispR.write(params.outDispR()); 63 | if (params.outMaskR() != NULL) 64 | imMaskR.write(params.outMaskR()); 65 | time.get_time("Write images"); 66 | 67 | return EXIT_SUCCESS; 68 | } 69 | -------------------------------------------------------------------------------- /c/msmw/test_data/a.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/msmw/test_data/a.tif -------------------------------------------------------------------------------- /c/msmw/test_data/b.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/msmw/test_data/b.tif -------------------------------------------------------------------------------- /c/pickopt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // @c pointer to original argc 5 | // @v pointer to original argv 6 | // @o option name (after hyphen) 7 | // @d default value 8 | char * pick_option(int *c, char ***v, char *o, char *d) 9 | { 10 | int argc = *c; 11 | char **argv = *v; 12 | int id = d ? 1 : 0; 13 | for (int i = 0; i < argc - id; i++) 14 | if (argv[i][0] == '-' && 0 == strcmp(argv[i]+1, o)) 15 | { 16 | char *r = argv[i+id]+1-id; 17 | *c -= id+1; 18 | for (int j = i; j < argc - id; j++) 19 | (*v)[j] = (*v)[j+id+1]; 20 | return r; 21 | } 22 | return d; 23 | } 24 | 25 | // char *oval = pick_option(&argc, &argv, "o", "37"); 26 | // returns "37" or the value of the option, removes 0 or 2 arguments 27 | // 28 | // bool o = pick_option(&argc, &argv, "o", NULL); 29 | // returns NULL or true, removes 0 or 1 arguments 30 | // 31 | 32 | #ifdef MAIN_PICKOPT 33 | #include 34 | 35 | static void print_args(int c, char **v) 36 | { 37 | for (int i = 0; i <= c; i++) 38 | printf("ARG[%d/%d] = \"%s\"\n", i, c, v[i]); 39 | } 40 | 41 | int main(int c, char **v) 42 | { 43 | printf("arguments before processing:\n"); 44 | print_args(c, v); 45 | // char *o = pick_option(&c, &v, "o", "42"); 46 | // printf("o = \"%s\"\n", o); 47 | printf("pick_option 'o' is: \"%d\"\n", (bool) pick_option(&c, &v, "o", NULL)); 48 | printf("arguments after processing:\n"); 49 | print_args(c, v); 50 | return 0; 51 | } 52 | #endif//MAIN_PICKOPT 53 | -------------------------------------------------------------------------------- /c/qauto.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "iio.h" 6 | 7 | #define xmalloc malloc 8 | 9 | static int compare_floats(const void *a, const void *b) 10 | { 11 | const float *da = (const float *) a; 12 | const float *db = (const float *) b; 13 | return (*da > *db) - (*da < *db); 14 | } 15 | 16 | static void get_rminmax(float *rmin, float *rmax, float *x, int n) 17 | { 18 | float *tx = xmalloc(n*sizeof*tx); 19 | int N = 0; 20 | for (int i = 0; i < n; i++) 21 | if (!isnan(x[i])) 22 | tx[N++] = x[i]; 23 | qsort(tx, N, sizeof*tx, compare_floats); 24 | int rb = N/200; 25 | *rmin = tx[rb]; 26 | *rmax = tx[N-1-rb]; 27 | free(tx); 28 | } 29 | 30 | int main(int c, char *v[]) 31 | { 32 | if (c != 3 && c != 2 && c != 1) { 33 | fprintf(stderr, "usage:\n\t%s [in [out]]\n", *v); 34 | // 0 1 2 35 | return EXIT_FAILURE; 36 | } 37 | char *in = c > 1 ? v[1] : "-"; 38 | char *out = c > 2 ? v[2] : "-"; 39 | 40 | int w, h, pd; 41 | float *x = iio_read_image_float_vec(in, &w, &h, &pd); 42 | 43 | float rmin, rmax; 44 | get_rminmax(&rmin, &rmax, x, w*h*pd); 45 | fprintf(stderr, "qauto: rminmax = %g %g\n", rmin, rmax); 46 | 47 | uint8_t *y = xmalloc(w*h*pd); 48 | for (int i = 0; i < w*h*pd; i++) { 49 | float g = x[i]; 50 | g = floor(255 * (g - rmin)/(rmax - rmin)); 51 | if (g < 0) g = 0; 52 | if (g > 255) g = 255; 53 | y[i] = g; 54 | } 55 | iio_save_image_uint8_vec(out, y, w, h, pd); 56 | return EXIT_SUCCESS; 57 | } 58 | -------------------------------------------------------------------------------- /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 | 31 | 32 | // read an XML file specifying an RPC model 33 | void read_rpc_file_xml(struct rpc *p, char *filename); 34 | 35 | void print_rpc(FILE *f, struct rpc *p, char *n); 36 | 37 | // evaluate the direct rpc model 38 | void eval_rpc(double *result, 39 | struct rpc *p, double x, double y, double z); 40 | 41 | // evaluate the inverse rpc model 42 | void eval_rpci(double *result, 43 | struct rpc *p, double x, double y, double z); 44 | 45 | // evaluate an epipolar correspondence 46 | static void eval_rpc_pair(double xprime[2], 47 | struct rpc *a, struct rpc *b, 48 | double x, double y, double z); 49 | 50 | // compute the height of a point given its location inside two images 51 | double rpc_height(struct rpc *rpca, struct rpc *rpcb, 52 | double x, double y, double xp, double yp, double *outerr); 53 | 54 | #endif // _RPC_H 55 | -------------------------------------------------------------------------------- /c/sift/LibSift/ScaleSpace.h: -------------------------------------------------------------------------------- 1 | #ifndef SCALESPACE_H_INCLUDED 2 | #define SCALESPACE_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | 7 | 8 | //! Local includes 9 | #include "Octave.h" 10 | 11 | 12 | /** 13 | * @brief A ScaleSpace contains multiple octaves. 14 | **/ 15 | class ScaleSpace { 16 | 17 | //! Methods 18 | public: 19 | /** 20 | * @brief Differents type of initialization. 21 | **/ 22 | enum Space { 23 | DOG, 24 | LOWE 25 | }; 26 | 27 | 28 | /** 29 | * @brief Default constructor. 30 | **/ 31 | ScaleSpace(); 32 | 33 | 34 | /** 35 | * @brief Copy constructor. 36 | **/ 37 | ScaleSpace( 38 | const ScaleSpace& i_scaleSpace); 39 | 40 | 41 | /** 42 | * @brief Operator overload. 43 | **/ 44 | ScaleSpace& operator=( 45 | const ScaleSpace& i_scaleSpace); 46 | 47 | 48 | /** 49 | *@brief Default destructor. 50 | **/ 51 | ~ScaleSpace(); 52 | 53 | 54 | /** 55 | * @brief Initialization. Depends on the wanted space. 56 | **/ 57 | void init( 58 | ScaleSpace::Space const& p_space, 59 | const size_t p_nbOctaves, 60 | const size_t p_nbScales = 0, 61 | const size_t p_width = 0, 62 | const size_t p_height = 0, 63 | const float p_delta = 0, 64 | const float p_sigma = 0); 65 | 66 | 67 | /** 68 | * @brief Getters. 69 | **/ 70 | size_t getNbOctaves() const {return m_nbOctaves;} 71 | Octave* getOctave(const size_t p_n) const {return m_octaves[p_n];} 72 | 73 | 74 | private: 75 | 76 | /** 77 | * @brief Release the memory. 78 | **/ 79 | void releaseMemory(); 80 | 81 | 82 | //! Data members 83 | private: 84 | size_t m_nbOctaves; // number of octaves 85 | Octave** m_octaves; // octaves 86 | }; 87 | #else 88 | class Octave; 89 | 90 | #endif // SCALESPACE_H_INCLUDED 91 | -------------------------------------------------------------------------------- /c/sift/Makefile: -------------------------------------------------------------------------------- 1 | CXXFLAGS ?= -march=native -O3 2 | override CXXFLAGS := $(CXXFLAGS) -fPIC 3 | override CXXLIBS := $(CXXLIBS) 4 | override LDLIBS := $(LDLIBS) -lm 5 | 6 | OBJ = LibImages/LibImages.o \ 7 | LibSSE/LibSSE.o \ 8 | LibSift/KeyPoint.o \ 9 | LibSift/LibSift.o \ 10 | LibSift/Octave.o \ 11 | LibSift/ScaleSpace.o \ 12 | Utilities/Memory.o \ 13 | Utilities/Parameters.o \ 14 | Utilities/Time.o \ 15 | Utilities/Utilities.o\ 16 | sift4ctypes.o \ 17 | 18 | LIB = libsift4ctypes.so 19 | 20 | all: $(LIB) matching 21 | 22 | $(LIB): $(OBJ) 23 | $(CXX) -fPIC -shared -o $@ $^ 24 | 25 | clean: 26 | rm -f $(LIB) matching $(OBJ) 27 | -------------------------------------------------------------------------------- /c/sift/Utilities/Memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | /** 14 | * @file Memory.cpp 15 | * @brief Generic function for allocation and freeing of aligned memory. 16 | * 17 | * @author Marc Lebrun 18 | **/ 19 | 20 | 21 | //! Global includes 22 | #include 23 | #include 24 | #ifdef _WIN32 25 | #include 26 | #endif 27 | 28 | 29 | //! Local includes 30 | #include "Memory.h" 31 | 32 | 33 | //! Memory aligned allocation. 34 | void* memalloc( 35 | const size_t p_pad, 36 | const size_t p_size) { 37 | 38 | #ifdef _WIN32 39 | return _aligned_malloc(p_size, p_pad); 40 | #else 41 | void* ptr; 42 | if (posix_memalign(&ptr, p_pad, p_size) != 0) { 43 | std::cout << "Error during the allocation." << std::endl; 44 | exit(EXIT_FAILURE); 45 | } 46 | return ptr; 47 | #endif 48 | } 49 | 50 | 51 | //! Release the memory allocated with memalloc. 52 | void memfree( 53 | void* i_ptr) { 54 | 55 | if (i_ptr != NULL) { 56 | #ifdef _WIN32 57 | _aligned_free(i_ptr) 58 | #else 59 | free(i_ptr); 60 | #endif 61 | i_ptr = NULL; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /c/sift/Utilities/Memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Marc Lebrun 3 | * All rights reserved. 4 | * 5 | * This program is free software: you can use, modify and/or 6 | * redistribute it under the terms of the GNU General Public 7 | * License as published by the Free Software Foundation, either 8 | * version 3 of the License, or (at your option) any later 9 | * version. You should have received a copy of this license along 10 | * this program. If not, see . 11 | */ 12 | 13 | #ifndef MEMORY_H_INCLUDED 14 | #define MEMORY_H_INCLUDED 15 | 16 | 17 | /** 18 | * @brief Memory aligned allocation. 19 | **/ 20 | void* memalloc( 21 | const size_t p_pad, 22 | const size_t p_size); 23 | 24 | 25 | /** 26 | * @brief Release the memory allocated with memalloc. 27 | **/ 28 | void memfree( 29 | void* i_ptr); 30 | 31 | 32 | 33 | #endif // MEMORY_H_INCLUDED 34 | -------------------------------------------------------------------------------- /c/sift/Utilities/Time.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Time.cpp 3 | * 4 | * @brief Class to handle the elapsed time. 5 | * 6 | * @author Marc Lebrun (original linux version) 7 | * @author Carlo de Franchis (osx compatible version) 8 | **/ 9 | 10 | 11 | #include 12 | 13 | #ifdef __MACH__ 14 | #include 15 | #include 16 | #endif 17 | 18 | 19 | #include "Time.h" 20 | 21 | 22 | using namespace std; 23 | 24 | //! Portable way to get current time 25 | static void portable_gettime(struct timespec *ts) 26 | { 27 | #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time 28 | clock_serv_t cclock; 29 | mach_timespec_t mts; 30 | host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); 31 | clock_get_time(cclock, &mts); 32 | mach_port_deallocate(mach_task_self(), cclock); 33 | ts->tv_sec = mts.tv_sec; 34 | ts->tv_nsec = mts.tv_nsec; 35 | #else 36 | clock_gettime(CLOCK_REALTIME, ts); 37 | #endif 38 | } 39 | 40 | 41 | //! Default constructor 42 | Time::Time() : 43 | 44 | m_time((struct timespec) {0, 0}) { 45 | 46 | //! Initialize the time 47 | portable_gettime(&m_time); 48 | } 49 | 50 | 51 | 52 | 53 | //! Compute an amount of time elapsed. 54 | void Time::get_time( 55 | const char *p_name, 56 | const size_t p_nbChar) { 57 | //! Check the current time 58 | struct timespec finish; 59 | portable_gettime(&finish); 60 | 61 | //! Compute the elapsed time 62 | double elapsed = (finish.tv_sec - m_time.tv_sec) * 1000; 63 | elapsed += (finish.tv_nsec - m_time.tv_nsec) / 1000000.0; 64 | 65 | //! Determine the space to add at the end 66 | string sentence = p_name; 67 | sentence += string(max(0, int(p_nbChar) - int(sentence.size())), ' '); 68 | 69 | //! Print the result 70 | cout << sentence << ": (ms) = " << elapsed << endl; 71 | 72 | //! Start a new timer 73 | portable_gettime(&m_time); 74 | } 75 | -------------------------------------------------------------------------------- /c/sift/Utilities/Time.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_H_INCLUDED 2 | #define TIME_H_INCLUDED 3 | 4 | 5 | #include 6 | 7 | 8 | /** 9 | * @brief Small class to handle the elapsed time. For now, only works on linux 10 | * system (problem of portability of CLOCK_MONOTONIC). 11 | **/ 12 | 13 | class Time { 14 | 15 | public: 16 | /** 17 | * @brief Default constructor. 18 | **/ 19 | Time(); 20 | 21 | 22 | /** 23 | * @brief Compute an amount of time elapsed. 24 | * 25 | * @param p_name : name of the section to print; 26 | * @param p_nbChar: number of characters to print. 27 | * 28 | * @return none. 29 | **/ 30 | void get_time( 31 | const char *p_name, 32 | const size_t p_nbChar = 35); 33 | 34 | 35 | private: 36 | 37 | struct timespec m_time; 38 | }; 39 | #endif // TIME_H_INCLUDED 40 | -------------------------------------------------------------------------------- /c/sift/Utilities/Utilities.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILITIES_H_INCLUDED 2 | #define UTILITIES_H_INCLUDED 3 | 4 | 5 | //! Global includes 6 | 7 | 8 | //! Local includes 9 | #include "../LibImages/LibImages.h" 10 | 11 | 12 | /** 13 | * @brief Return the optimal cut of the lines of an image according to 14 | * the number of threads available. 15 | * 16 | * @param i_height: the height of the image; 17 | * @param o_heights: will contain the lines position (must be already allocated) 18 | * @param p_nbThreads: the number of threads available. 19 | **/ 20 | void initializeHeights( 21 | const size_t i_height, 22 | size_t* o_heights, 23 | const size_t p_nbThreads); 24 | 25 | 26 | /** 27 | * @brief Compute the x modulus y. 28 | **/ 29 | float mod( 30 | const float i_x, 31 | const float i_y); 32 | 33 | 34 | /** 35 | * @brief Get the bins from the orientation. 36 | **/ 37 | int ori2bin( 38 | const float i_ori, 39 | const int i_nbBins); 40 | 41 | 42 | /** 43 | * @brief Get the orientation from the bins. 44 | **/ 45 | float bin2ori( 46 | const float i_bin, 47 | const int i_nbBins); 48 | 49 | 50 | /** 51 | * @brief Iterative box filter of w 3 bins. 52 | * 53 | * @param p_nbBins: number of bins; 54 | * @param p_nbIter: number of iterations; 55 | * @param io_hist: histogram to smooth. 56 | **/ 57 | void smoothCircularHistogram( 58 | const int p_nbBins, 59 | const int p_nbIter, 60 | float* io_hist); 61 | 62 | 63 | #endif // UTILITIES_H_INCLUDED 64 | -------------------------------------------------------------------------------- /c/sift/pickopt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // @c pointer to original argc 5 | // @v pointer to original argv 6 | // @o option name (after hyphen) 7 | // @d default value 8 | const char * pick_option(int *c, char ***v, const char *o, const char *d) 9 | { 10 | int argc = *c; 11 | char **argv = *v; 12 | int id = d ? 1 : 0; 13 | for (int i = 0; i < argc - id; i++) 14 | if (argv[i][0] == '-' && 0 == strcmp(argv[i]+1, o)) 15 | { 16 | char *r = argv[i+id]+1-id; 17 | *c -= id+1; 18 | for (int j = i; j < argc - id; j++) 19 | (*v)[j] = (*v)[j+id+1]; 20 | return r; 21 | } 22 | return d; 23 | } 24 | 25 | // char *oval = pick_option(&argc, &argv, "o", "37"); 26 | // returns "37" or the value of the option, removes 0 or 2 arguments 27 | // 28 | // bool o = pick_option(&argc, &argv, "o", NULL); 29 | // returns NULL or true, removes 0 or 1 arguments 30 | // 31 | 32 | #ifdef MAIN_PICKOPT 33 | #include 34 | 35 | static void print_args(int c, char **v) 36 | { 37 | for (int i = 0; i <= c; i++) 38 | printf("ARG[%d/%d] = \"%s\"\n", i, c, v[i]); 39 | } 40 | 41 | int main(int c, char **v) 42 | { 43 | printf("arguments before processing:\n"); 44 | print_args(c, v); 45 | // char *o = pick_option(&c, &v, "o", "42"); 46 | // printf("o = \"%s\"\n", o); 47 | printf("pick_option 'o' is: \"%d\"\n", (bool) pick_option(&c, &v, "o", NULL)); 48 | printf("arguments after processing:\n"); 49 | print_args(c, v); 50 | return 0; 51 | } 52 | #endif//MAIN_PICKOPT 53 | -------------------------------------------------------------------------------- /c/sift/sift_anatomy_20141201/lib_matching.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lib_matching.h 3 | * @brief data structures to store information relative to a pair of keypoints 4 | * 5 | * @li struct keypointPr : Pair of keypoint data structure. 6 | * @li struct keypointPr_list : List of pairs. 7 | * @li print,save, read for lists of pairs. 8 | * 9 | * @author Ives Rey-Otero 10 | */ 11 | #ifndef _LIB_MATCHING_H_ 12 | #define _LIB_MATCHING_H_ 13 | 14 | void matching(struct sift_keypoints *k1, struct sift_keypoints *k2, 15 | struct sift_keypoints *out_k1, struct sift_keypoints *out_k2, 16 | float sift_thresh, int flag, 17 | double fund_mat[5], float epi_thresh); 18 | 19 | void fprintf_pairs(const char *filename, 20 | const struct sift_keypoints *k1, 21 | const struct sift_keypoints *k2); 22 | 23 | void print_pairs(const struct sift_keypoints *k1, 24 | const struct sift_keypoints *k2); 25 | 26 | void save_pairs_extra(const char* name, 27 | const struct sift_keypoints *k1, 28 | const struct sift_keypoints *k2A, 29 | const struct sift_keypoints *k2B); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /c/sift/sift_anatomy_20141201/lib_util.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_UTIL_H_ 2 | #define _LIB_UTIL_H_ 3 | 4 | #include 5 | #include 6 | 7 | #ifndef M_PI 8 | #define M_PI 3.14159265358979323846 9 | #endif 10 | 11 | #ifndef M_SQRT2 12 | #define M_SQRT2 1.41421356237309504880 13 | #endif 14 | 15 | #ifndef M_LN2 16 | #define M_LN2 0.693147180559945309417 17 | #endif 18 | 19 | // Find the minimum among two int 20 | int min_2(int a, int b); 21 | 22 | // Allocate memory or abord on failure 23 | void* xmalloc(size_t size); 24 | 25 | // Reallocate memory of abort on failure 26 | void* xrealloc(void* p, size_t size); 27 | 28 | // Free memory allocated by xmalloc or xrealloc. 29 | void xfree(void* p); 30 | 31 | // Write a formatted message to standard error and abort the program, for 32 | // example, fatal_error("Failed to open file %s for writing", filename); 33 | void fatal_error(const char* format, ...); 34 | 35 | // Write formatted message to standard error for debugging. 36 | void debug(const char* format, ...); 37 | 38 | // Linearly rescale input such that its values are in the range [0, 250]. 39 | void linear_conversion(const float *in, float *out, int l); 40 | 41 | // Find the maximum value of an array. 42 | float array_max(const float* array, int length); 43 | 44 | // Find the minimum value of an array. 45 | float array_min(const float* array, int length); 46 | 47 | // Find the maximum value of an array. 48 | float find_array_max(const float* array, int length, int *position); 49 | 50 | // Find the minimum value of an array. 51 | float find_array_min(const float* array, int length, int *position); 52 | 53 | // Find the two minimal values in an array. 54 | void find_array_two_min(const float* array, int length, float* minA, float* minB, int* iA, int* iB); 55 | 56 | // L2 norm of an array. 57 | float array_l2norm(const float* array, int length); 58 | 59 | // Compute the SQUARE of the euclidean distance 60 | float euclidean_distance_square(const float* a1, const float* a2, int length); 61 | 62 | // Compute the euclidean distance 63 | float euclidean_distance(const float* a1, const float* a2, int length); 64 | 65 | // Compute the x modulus y 66 | float modulus(float x, float y); 67 | 68 | // Multiply the rotation matric R_alpha with [x,y]^T 69 | void apply_rotation(float x, float y, float *rx, float *ry, float alpha); 70 | 71 | #endif // _LIB_UTIL_H_ 72 | -------------------------------------------------------------------------------- /c/sift/test_data/img_tiled.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/sift/test_data/img_tiled.tif -------------------------------------------------------------------------------- /c/sift/timing.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef __MACH__ 5 | #include 6 | #include 7 | #endif 8 | 9 | // portable way to get current time 10 | void portable_gettime(struct timespec *ts) 11 | { 12 | #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time 13 | clock_serv_t cclock; 14 | mach_timespec_t mts; 15 | host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); 16 | clock_get_time(cclock, &mts); 17 | mach_port_deallocate(mach_task_self(), cclock); 18 | ts->tv_sec = mts.tv_sec; 19 | ts->tv_nsec = mts.tv_nsec; 20 | #else 21 | clock_gettime(CLOCK_REALTIME, ts); 22 | #endif 23 | } 24 | 25 | 26 | // print an amount of time elapsed and start a new timer 27 | void print_elapsed_time(struct timespec *ts, char *title, int title_width) 28 | { 29 | // get the current time 30 | struct timespec finish; 31 | portable_gettime(&finish); 32 | 33 | // compute the elapsed time 34 | double elapsed = (finish.tv_sec - ts->tv_sec) * 1000; 35 | elapsed += (finish.tv_nsec - ts->tv_nsec) / 1000000.0; 36 | 37 | // print the result 38 | printf("%-*s %7.3f (ms)\n", title_width, title, elapsed); // see K&R p154 39 | 40 | // start a new timer 41 | portable_gettime(ts); 42 | } 43 | -------------------------------------------------------------------------------- /c/smapa.h: -------------------------------------------------------------------------------- 1 | 2 | // a smart parameter is just like a regular parameter, but it can be 3 | // re-defined at the shell-environment. Instead of 4 | // 5 | // #define NUMBER 42 6 | // ... 7 | // printf("%g", NUMBER); 8 | // 9 | // do 10 | // SMART_PARAMETER(NUMBER,42) 11 | // ... 12 | // printf("%g", NUMBER()); 13 | // 14 | // Notice that the environment only gets queried once, at the first use. 15 | // 16 | #define SMART_PARAMETER(n,v) static double n(void)\ 17 | {\ 18 | static bool smapa_known_ ## n = false;\ 19 | static double smapa_value_ ## n = v;\ 20 | if (!smapa_known_ ## n)\ 21 | {\ 22 | fprintf(stderr,"scanning the environment for \"%s\"... ", #n);\ 23 | int r;\ 24 | char *sv = getenv(#n);\ 25 | double y;\ 26 | if (sv)\ 27 | r = sscanf(sv, "%lf", &y);\ 28 | if (sv && r == 1)\ 29 | {\ 30 | fprintf(stderr, "got value %g\n", y);\ 31 | smapa_value_ ## n = y;\ 32 | } else {\ 33 | fprintf(stderr, "kept default value %g\n",\ 34 | smapa_value_ ## n);\ 35 | }\ 36 | smapa_known_ ## n = true;\ 37 | }\ 38 | return smapa_value_ ## n;\ 39 | } 40 | 41 | #define SMART_PARAMETER_SILENT(n,v) static double n(void)\ 42 | {\ 43 | static bool smapa_known_ ## n = false;\ 44 | static double smapa_value_ ## n = v;\ 45 | if (!smapa_known_ ## n)\ 46 | {\ 47 | int r;\ 48 | char *sv = getenv(#n);\ 49 | double y;\ 50 | if (sv)\ 51 | r = sscanf(sv, "%lf", &y);\ 52 | if (sv && r == 1)\ 53 | smapa_value_ ## n = y;\ 54 | smapa_known_ ## n = true;\ 55 | }\ 56 | return smapa_value_ ## n;\ 57 | } 58 | -------------------------------------------------------------------------------- /c/synflow.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "iio.h" 8 | 9 | 10 | 11 | #ifndef M_PI 12 | #define M_PI 3.14159265358979323846264338328 13 | #endif 14 | 15 | #define FORI(n) for(int i=0;i<(n);i++) 16 | #define FORJ(n) for(int j=0;j<(n);j++) 17 | #define FORL(n) for(int l=0;l<(n);l++) 18 | 19 | 20 | #include "xmalloc.c" 21 | #include "synflow_core.c" 22 | 23 | 24 | static int parse_doubles(double *t, int nmax, const char *s) 25 | { 26 | int i = 0, w; 27 | while (i < nmax && 1 == sscanf(s, "%lg %n", t + i, &w)) { 28 | i += 1; 29 | s += w; 30 | } 31 | return i; 32 | } 33 | 34 | 35 | 36 | int main_synflow(int c, char *v[]) 37 | { 38 | if (c != 6) { 39 | fprintf(stderr, "usage:\n\t%s model \"params\"" 40 | // 0 1 2 41 | " in out flow\n", *v); 42 | //3 4 5 43 | return EXIT_FAILURE; 44 | } 45 | 46 | int w, h, pd; 47 | float *x = iio_read_image_float_vec(v[3], &w, &h, &pd); 48 | 49 | float *y = xmalloc(w * h * pd * sizeof*y); 50 | float *f = xmalloc(w * h * 2 * sizeof*y); 51 | 52 | int maxparam = 40; 53 | double param[maxparam]; 54 | int nparams = parse_doubles(param, maxparam, v[2]); 55 | 56 | struct flow_model fm[1]; 57 | produce_flow_model(fm, param, nparams, v[1], w, h); 58 | fill_flow_field(f, fm, w, h); 59 | transform_forward(y, fm, x, w, h, pd); 60 | 61 | iio_save_image_float_vec(v[4], y, w, h, pd); 62 | iio_save_image_float_vec(v[5], f, w, h, 2); 63 | 64 | free(x); 65 | free(y); 66 | free(f); 67 | 68 | return EXIT_SUCCESS; 69 | } 70 | 71 | #ifndef OMIT_MAIN 72 | int main(int c, char *v[]) 73 | { 74 | return main_synflow(c, v); 75 | } 76 | #endif//OMIT_MAIN 77 | -------------------------------------------------------------------------------- /c/test_colormesh/height_map.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/test_colormesh/height_map.tif -------------------------------------------------------------------------------- /c/test_colormesh/makefile: -------------------------------------------------------------------------------- 1 | CC = gcc -std=c99 -g -lprofiler 2 | CFLAGS = -O2 -fopenmp 3 | LDLIBS = -lpng -ltiff -ljpeg -lm -lgeotiff -lstdc++ -lrt 4 | SRCDIR = .. 5 | NTH=1 6 | 7 | default: 8 | $(CC) $(CFLAGS) $(SRCDIR)/iio.o $(SRCDIR)/rpc.o $(SRCDIR)/geographiclib_wrapper.o $(SRCDIR)/DMS.o $(SRCDIR)/GeoCoords.o $(SRCDIR)/MGRS.o $(SRCDIR)/PolarStereographic.o $(SRCDIR)/TransverseMercator.o $(SRCDIR)/UTMUPS.o $(SRCDIR)/colormesh.c $(SRCDIR)/timing.c $(LDLIBS) -o colormesh 9 | 10 | test: 11 | OMP_NUM_THREADS=$(NTH) ./colormesh out.ply height_map.tif rpc.xml roi_ref.png 12 | 13 | test_nocolor: 14 | OMP_NUM_THREADS=$(NTH) ./colormesh out.ply height_map.tif rpc.xml 15 | 16 | test_with_normals: 17 | OMP_NUM_THREADS=$(NTH) ./colormesh out.ply height_map.tif rpc.xml roi_ref.png --with-normals 18 | 19 | valgrind: 20 | OMP_NUM_THREADS=$(NTH) valgrind --tool=memcheck --leak-check=full ./colormesh out.ply height_map.tif rpc.xml roi_ref.png 21 | 22 | clean: 23 | rm colormesh 24 | -------------------------------------------------------------------------------- /c/test_colormesh/roi_ref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/c/test_colormesh/roi_ref.png -------------------------------------------------------------------------------- /c/xfopen.c: -------------------------------------------------------------------------------- 1 | #ifndef _XFOPEN_C 2 | #define _XFOPEN_C 3 | 4 | #include 5 | #include 6 | 7 | #include "fail.c" 8 | 9 | static FILE *xfopen(const char *s, const char *p) 10 | { 11 | FILE *f; 12 | 13 | if (!s) fail("trying to open a file with NULL name"); 14 | 15 | if (0 == strcmp("-", s)) 16 | { 17 | if (0 == strcmp("w", p)) 18 | return stdout; 19 | else if (0 == strcmp("r", p)) 20 | return stdin; 21 | else 22 | fail("unknown fopen mode \"%s\"", p); 23 | } 24 | if (0 == strcmp("--", s) && 0 == strcmp("w", p)) return stderr; 25 | 26 | f = fopen(s, p); 27 | if (f == NULL) 28 | fail("can not open file \"%s\" in mode \"%s\", // (%s)", 29 | s, p);//, strerror(errno)); 30 | return f; 31 | } 32 | 33 | static void xfclose(FILE *f) 34 | { 35 | if (f != stdout && f != stdin && f != stderr) { 36 | int r = fclose(f); 37 | if (r) fail("fclose error \"%s\"", "");//strerror(errno)); 38 | } 39 | } 40 | 41 | #endif//_XFOPEN_C 42 | -------------------------------------------------------------------------------- /c/xmalloc.c: -------------------------------------------------------------------------------- 1 | #ifndef _XMALLOC_C 2 | #define _XMALLOC_C 3 | 4 | #include 5 | 6 | #include "fail.c" 7 | 8 | static void *xmalloc(size_t size) 9 | { 10 | #ifndef NDEBUG 11 | { 12 | double sm = size / (0x100000 * 1.0); 13 | if (sm > 1000) 14 | fprintf(stderr, "WARNING: large malloc" 15 | " %zu bytes (%gMB)\n", size, sm); 16 | } 17 | #endif 18 | if (size == 0) 19 | fail("xmalloc: zero size"); 20 | void *new = malloc(size); 21 | if (!new) 22 | { 23 | double sm = size / (0x100000 * 1.0); 24 | fail("xmalloc: out of memory when requesting " 25 | "%zu bytes (%gMB)",//:\"%s\"", 26 | size, sm);//, strerror(errno)); 27 | } 28 | return new; 29 | } 30 | 31 | inline // to avoid unused warnings 32 | static void *xrealloc(void *p, size_t s) 33 | { 34 | void *r = realloc(p, s); 35 | if (!r) fail("realloc failed"); 36 | return r; 37 | } 38 | 39 | inline // to avoid unused warnings 40 | static void xfree(void *p) 41 | { 42 | if (!p) 43 | fail("thou shalt not free a null pointer!"); 44 | free(p); 45 | } 46 | 47 | #endif//_XMALLOC_C 48 | -------------------------------------------------------------------------------- /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 | args = parser.parse_args() 19 | 20 | user_cfg = s2p.read_config_file(args.config) 21 | 22 | s2p.main(user_cfg) 23 | 24 | # Backup input file for sanity check 25 | if not args.config.startswith(os.path.abspath(s2p.cfg['out_dir']+os.sep)): 26 | shutil.copy2(args.config,os.path.join(s2p.cfg['out_dir'],'config.json.orig')) 27 | -------------------------------------------------------------------------------- /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 | from __future__ import print_function 7 | import numpy as np 8 | 9 | def distance_point_to_line(x, l): 10 | """ 11 | Computes the distance between a point and a line expressed in homogeneous 12 | coordinates. 13 | 14 | Args: 15 | x: 3-vector, containing the homogeneous coordinates of a point 16 | l: 3-vector, containing the homogeneous coordinates of a line 17 | 18 | Returns: 19 | the distance between x and l 20 | In the case where x is an ideal point or l is the line at infinity, the 21 | returned distance is infinity 22 | """ 23 | if (np.abs(x[2]) < np.finfo(float).eps): 24 | # x is an ideal point, distance is +infty 25 | return np.finfo(float).max 26 | if (np.hypot(l[0], l[1]) < np.finfo(float).eps): 27 | # l is the line at infinity, distance is +infty 28 | return np.finfo(float).max 29 | 30 | num = np.abs(np.dot(x, l)) 31 | den = np.hypot(l[0], l[1]) * np.abs(x[2]) 32 | return num/den 33 | -------------------------------------------------------------------------------- /s2p/geographiclib.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 subprocess 8 | 9 | 10 | def geoid_above_ellipsoid(lat, lon): 11 | """ 12 | Computes the height, in meters, of the EGM96 geoid above the WGS84 ellipsoid. 13 | 14 | Args: 15 | lat: latitude, in degrees between -90 and 90 16 | lon: longitude, between -180 and 180 17 | 18 | Returns: 19 | the height in meters. It should be between -106 and 85 meters. 20 | 21 | 22 | The conversion is made by a commandline tool, GeoidEval, which is part of 23 | the GeographicLib library: 24 | http://geographiclib.sourceforge.net/html/intro.html 25 | """ 26 | parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 27 | geoid_dir = os.path.join(parent_dir, 'c') 28 | geoid_name = 'egm96-15' 29 | p = subprocess.Popen(['echo', str(lat), str(lon)], stdout=subprocess.PIPE) 30 | q = subprocess.Popen(['GeoidEval', 31 | '-d', geoid_dir, 32 | '-n', geoid_name], stdin=p.stdout, stdout=subprocess.PIPE) 33 | height = float(q.stdout.readline().split()[0]) 34 | return height 35 | -------------------------------------------------------------------------------- /s2p/test_estimation.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 | from numpy.testing import assert_array_almost_equal 8 | 9 | from s2p import estimation 10 | from s2p import common 11 | 12 | def rotation_matrix(t): 13 | R = np.eye(3) 14 | R[0, 0] = np.cos(t) 15 | R[0, 1] = np.sin(t) 16 | R[1, 0] = -np.sin(t) 17 | R[1, 1] = np.cos(t) 18 | return R 19 | 20 | def similarity_matrix(t, s): 21 | R = np.eye(3) 22 | R[0, 0] = s * np.cos(t) 23 | R[0, 1] = s * np.sin(t) 24 | R[1, 0] = -s * np.sin(t) 25 | R[1, 1] = s * np.cos(t) 26 | return R 27 | 28 | 29 | def test_affine_transformation(): 30 | x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) 31 | 32 | # list of transformations to be tested 33 | T = np.eye(3) 34 | I = np.eye(3) 35 | S = np.eye(3) 36 | A = np.eye(3) 37 | translations = [] 38 | isometries = [] 39 | similarities = [] 40 | affinities = [] 41 | 42 | for i in range(100): 43 | translations.append(T) 44 | isometries.append(I) 45 | similarities.append(S) 46 | affinities.append(A) 47 | T[0:2, 2] = np.random.random(2) 48 | I = rotation_matrix(2*np.pi * np.random.random_sample()) 49 | I[0:2, 2] = np.random.random(2) 50 | S = similarity_matrix(2*np.pi * np.random.random_sample(), 51 | np.random.random_sample()) 52 | S[0:2, 2] = 100 * np.random.random(2) 53 | A[0:2, :] = np.random.random((2, 3)) 54 | 55 | for B in translations + isometries + similarities + affinities: 56 | xx = common.points_apply_homography(B, x) 57 | E = estimation.affine_transformation(x, xx) 58 | assert_array_almost_equal(E, B) 59 | -------------------------------------------------------------------------------- /s2p/test_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 | from nose.tools import assert_equals 8 | from nose.tools import assert_almost_equals 9 | from s2p import evaluation 10 | 11 | def test_finite_distances(): 12 | x = np.array([1, 1, 1]) 13 | l = np.array([0, 1, 0]) 14 | assert_equals(evaluation.distance_point_to_line(x, l), 1) 15 | x = np.array([-1, -1, -1]) 16 | l = np.array([0, 1, 0]) 17 | assert_equals(evaluation.distance_point_to_line(x, l), 1) 18 | x = np.array([1, 1, 1]) 19 | l = np.array([3, 2, -1]) 20 | assert_equals(evaluation.distance_point_to_line(x, l), 4/np.sqrt(13)) 21 | 22 | def test_infinite_distances(): 23 | x = np.array([1, 1, 0]) 24 | l = np.array([0, 1, 0]) 25 | assert_equals(evaluation.distance_point_to_line(x, l), np.finfo(float).max) 26 | x = np.array([1, 1, -7]) 27 | l = np.array([0, 0, 2.3]) 28 | assert_equals(evaluation.distance_point_to_line(x, l), np.finfo(float).max) 29 | -------------------------------------------------------------------------------- /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 | requirements = ['numpy', 32 | 'scipy', 33 | 'rasterio[s3,test]', 34 | 'utm', 35 | 'pyproj', 36 | 'beautifulsoup4[lxml]', 37 | 'requests'] 38 | 39 | setup(name="s2p", 40 | version="1.0b6", 41 | description="Satellite Stereo Pipeline.", 42 | long_description=readme(), 43 | long_description_content_type='text/markdown', 44 | url='https://github.com/miss3d/s2p', 45 | packages=['s2p'], 46 | install_requires=requirements, 47 | cmdclass={'develop': CustomDevelop, 48 | 'build_py': CustomBuildPy}, 49 | entry_points=""" 50 | [console_scripts] 51 | s2p=s2p.cli:main 52 | """) 53 | -------------------------------------------------------------------------------- /tests/data/expected_output/pair/dsm.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/expected_output/pair/dsm.tif -------------------------------------------------------------------------------- /tests/data/expected_output/plyflatten/dsm_40cm.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/expected_output/plyflatten/dsm_40cm.tiff -------------------------------------------------------------------------------- /tests/data/expected_output/triplet/dsm.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/expected_output/triplet/dsm.tif -------------------------------------------------------------------------------- /tests/data/expected_output/triplet/dsm_geo.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/expected_output/triplet/dsm_geo.tif -------------------------------------------------------------------------------- /tests/data/expected_output/triplet/height_map.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/expected_output/triplet/height_map.tif -------------------------------------------------------------------------------- /tests/data/input_pair/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "out_dir" : "../../testoutput/output_pair", 3 | "images" : [ 4 | { "img" : "img_01.tif", 5 | "rpc" : "rpc_01.xml" }, 6 | { "img" : "img_02.tif", 7 | "rpc" : "rpc_02.xml" } 8 | ], 9 | "roi" : { 10 | "x" : 150, 11 | "y" : 150, 12 | "w" : 700, 13 | "h" : 700 14 | }, 15 | "full_img" : false, 16 | "matching_algorithm" : "mgm", 17 | "horizontal_margin": 20, 18 | "vertical_margin": 5, 19 | "sift_match_thresh" : 0.6, 20 | "disp_range_extra_margin" : 0.2, 21 | "n_gcp_per_axis" : 5, 22 | "epipolar_thresh" : 0.5, 23 | "debug" : false, 24 | "temporary_dir" : "/tmp", 25 | "tile_size" : 300, 26 | "clean_tmp" : true, 27 | "clean_intermediate" : false, 28 | "fusion_thresh" : 3, 29 | "disp_range_method" : "sift", 30 | "skip_existing" : false, 31 | "msk_erosion": 0, 32 | "dsm_resolution": 0.5, 33 | "utm_bbx" : [359746.062, 360105.562,7651554.000,7651923.000] 34 | } 35 | -------------------------------------------------------------------------------- /tests/data/input_pair/img_01.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_pair/img_01.tif -------------------------------------------------------------------------------- /tests/data/input_pair/img_02.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_pair/img_02.tif -------------------------------------------------------------------------------- /tests/data/input_ply/cloud.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_ply/cloud.ply -------------------------------------------------------------------------------- /tests/data/input_triplet/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "out_dir" : "../../testoutput/output_triplet", 3 | "images" : [ 4 | { "img" : "img_02.tif", 5 | "rpc" : "rpc_02.xml" }, 6 | { "img" : "img_01.tif", 7 | "rpc" : "rpc_01.xml" }, 8 | { "img" : "img_03.tif", 9 | "rpc" : "rpc_03.xml"} 10 | ], 11 | "roi" : { 12 | "x" : 150, 13 | "y" : 150, 14 | "w" : 700, 15 | "h" : 700 16 | }, 17 | "full_img" : false, 18 | "matching_algorithm" : "mgm", 19 | "horizontal_margin": 20, 20 | "vertical_margin": 5, 21 | "sift_match_thresh" : 0.6, 22 | "disp_range_extra_margin" : 0.2, 23 | "n_gcp_per_axis" : 5, 24 | "epipolar_thresh" : 0.5, 25 | "debug" : false, 26 | "temporary_dir" : "/tmp", 27 | "tile_size" : 300, 28 | "clean_tmp" : true, 29 | "clean_intermediate" : false, 30 | "fusion_thresh" : 3, 31 | "disp_range_method" : "sift", 32 | "skip_existing" : false, 33 | "msk_erosion": 0, 34 | "dsm_resolution": 0.5, 35 | "utm_bbx" : [698053.031, 698485.531, 4792556.569, 4792984.069] 36 | } 37 | -------------------------------------------------------------------------------- /tests/data/input_triplet/config_geo.json: -------------------------------------------------------------------------------- 1 | { 2 | "out_dir" : "../../testoutput/output_triplet_geo", 3 | "images" : [ 4 | { "img" : "img_02.tif", 5 | "rpc" : "rpc_02.xml" }, 6 | { "img" : "img_01.tif", 7 | "rpc" : "rpc_01.xml" }, 8 | { "img" : "img_03.tif", 9 | "rpc" : "rpc_03.xml"} 10 | ], 11 | "roi" : { 12 | "x" : 150, 13 | "y" : 150, 14 | "w" : 700, 15 | "h" : 700 16 | }, 17 | "full_img" : false, 18 | "matching_algorithm" : "mgm", 19 | "horizontal_margin": 20, 20 | "vertical_margin": 5, 21 | "sift_match_thresh" : 0.6, 22 | "disp_range_extra_margin" : 0.2, 23 | "n_gcp_per_axis" : 5, 24 | "epipolar_thresh" : 0.5, 25 | "debug" : false, 26 | "temporary_dir" : "/tmp", 27 | "tile_size" : 300, 28 | "clean_tmp" : true, 29 | "clean_intermediate" : false, 30 | "fusion_thresh" : 3, 31 | "disp_range_method" : "sift", 32 | "skip_existing" : false, 33 | "msk_erosion": 0, 34 | "dsm_resolution": 0.5, 35 | "utm_bbx" : [698053.031, 698485.531, 4792556.569, 4792984.069], 36 | "triangulation_mode" : "geometric" 37 | } 38 | -------------------------------------------------------------------------------- /tests/data/input_triplet/img_01.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_triplet/img_01.tif -------------------------------------------------------------------------------- /tests/data/input_triplet/img_02.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_triplet/img_02.tif -------------------------------------------------------------------------------- /tests/data/input_triplet/img_03.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/tests/data/input_triplet/img_03.tif -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MISS3D/s2p/1dc21555db6bb5420800afb5f715d38c8bb1ead0/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 | --------------------------------------------------------------------------------