├── CMakeLists.txt ├── COPYING ├── OrsaHomography ├── CMakeLists.txt ├── demo │ ├── CMakeLists.txt │ ├── Rect.hpp │ ├── libImage │ │ ├── CMakeLists.txt │ │ ├── image.hpp │ │ ├── image_concat.hpp │ │ ├── image_converter.hpp │ │ ├── image_drawing.hpp │ │ ├── image_drawing_test.cpp │ │ ├── image_io.cpp │ │ ├── image_io.hpp │ │ ├── image_io_test.cpp │ │ ├── image_test.cpp │ │ ├── pixelTypes.hpp │ │ ├── sample.hpp │ │ └── test_image │ │ │ ├── two_pixels.pgm │ │ │ ├── two_pixels.ppm │ │ │ ├── two_pixels_color.jpg │ │ │ ├── two_pixels_color.png │ │ │ ├── two_pixels_gray.pgm │ │ │ ├── two_pixels_monochrome.jpg │ │ │ └── two_pixels_monochrome.png │ ├── orsa_homography.cpp │ ├── siftMatch.hpp │ └── warping.hpp ├── extras │ ├── CMakeLists.txt │ ├── libLWImage │ │ ├── CMakeLists.txt │ │ ├── LWImage.cpp │ │ └── LWImage.h │ ├── libMatch │ │ ├── CMakeLists.txt │ │ └── match.h │ ├── libNumerics │ │ ├── CMakeLists.txt │ │ ├── matrix.cpp │ │ ├── matrix.h │ │ ├── numerics.cpp │ │ ├── numerics.h │ │ └── vector.cpp │ └── sift │ │ ├── CMakeLists.txt │ │ ├── demo_lib_sift.cpp │ │ ├── demo_lib_sift.h │ │ ├── demo_sift.cpp │ │ ├── domain.cpp │ │ ├── domain.h │ │ ├── filter.cpp │ │ ├── filter.h │ │ ├── library.cpp │ │ ├── library.h │ │ ├── splines.cpp │ │ └── splines.h ├── libOrsa │ ├── CMakeLists.txt │ ├── conditioning.cpp │ ├── conditioning.hpp │ ├── fundamental_model.cpp │ ├── fundamental_model.hpp │ ├── homography_model.cpp │ ├── homography_model.hpp │ ├── homography_model_test.cpp │ ├── homography_orsa_test.cpp │ ├── numeric │ │ ├── CMakeLists.txt │ │ └── poly.h │ ├── orsa_model.cpp │ └── orsa_model.hpp ├── testing │ └── testing.h └── third_party │ ├── CMakeLists.txt │ ├── CppUnitLite │ ├── CMakeLists.txt │ ├── Failure.cpp │ ├── Failure.h │ ├── SimpleString.cpp │ ├── SimpleString.h │ ├── Test.cpp │ ├── Test.h │ ├── TestHarness.h │ ├── TestRegistry.cpp │ ├── TestRegistry.h │ ├── TestResult.cpp │ └── TestResult.h │ ├── Eigen │ ├── Array │ ├── COPYING.GPL │ ├── COPYING.LGPL │ ├── Cholesky │ ├── Core │ ├── Dense │ ├── Eigen │ ├── Eigen2Support │ ├── Eigenvalues │ ├── Geometry │ ├── Householder │ ├── Jacobi │ ├── LU │ ├── LeastSquares │ ├── QR │ ├── QtAlignedMalloc │ ├── README.ipol │ ├── RegexUtils.cmake │ ├── SVD │ ├── Sparse │ ├── StdDeque │ ├── StdList │ ├── StdVector │ └── src │ │ ├── Cholesky │ │ ├── LDLT.h │ │ └── LLT.h │ │ ├── Core │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── 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 │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ ├── Default │ │ │ │ └── Settings.h │ │ │ ├── NEON │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ └── SSE │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── products │ │ │ ├── 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 │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── StaticAssert.h │ │ │ └── XprHelper.h │ │ ├── Eigen2Support │ │ ├── Block.h │ │ ├── Cwise.h │ │ ├── CwiseOperators.h │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── All.h │ │ │ ├── AngleAxis.h │ │ │ ├── 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 │ │ ├── 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 │ │ ├── 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 │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── Jacobi │ │ └── Jacobi.h │ │ ├── LU │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── Inverse.h │ │ ├── PartialPivLU.h │ │ └── arch │ │ │ └── Inverse_SSE.h │ │ ├── QR │ │ ├── ColPivHouseholderQR.h │ │ ├── FullPivHouseholderQR.h │ │ └── HouseholderQR.h │ │ ├── SVD │ │ ├── JacobiSVD.h │ │ └── UpperBidiagonalization.h │ │ ├── Sparse │ │ ├── AmbiVector.h │ │ ├── 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 │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── misc │ │ ├── Image.h │ │ ├── Kernel.h │ │ └── Solve.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── MatrixCwiseBinaryOps.h │ │ └── MatrixCwiseUnaryOps.h │ ├── jpeg │ ├── CMakeLists.txt │ ├── README │ ├── README.ipol │ ├── cderror.h │ ├── cdjpeg.h │ ├── jaricom.c │ ├── jcapimin.c │ ├── jcapistd.c │ ├── jcarith.c │ ├── jccoefct.c │ ├── jccolor.c │ ├── jcdctmgr.c │ ├── jchuff.c │ ├── jcinit.c │ ├── jcmainct.c │ ├── jcmarker.c │ ├── jcmaster.c │ ├── jcomapi.c │ ├── jconfig.h │ ├── jconfig_mac.h │ ├── jconfig_windows.h │ ├── jcparam.c │ ├── jcprepct.c │ ├── jcsample.c │ ├── jctrans.c │ ├── jdapimin.c │ ├── jdapistd.c │ ├── jdarith.c │ ├── jdatadst.c │ ├── jdatasrc.c │ ├── jdcoefct.c │ ├── jdcolor.c │ ├── jdct.h │ ├── jddctmgr.c │ ├── jdhuff.c │ ├── jdinput.c │ ├── jdmainct.c │ ├── jdmarker.c │ ├── jdmaster.c │ ├── jdmerge.c │ ├── jdpostct.c │ ├── jdsample.c │ ├── jdtrans.c │ ├── jerror.c │ ├── jerror.h │ ├── jfdctflt.c │ ├── jfdctfst.c │ ├── jfdctint.c │ ├── jidctflt.c │ ├── jidctfst.c │ ├── jidctint.c │ ├── jinclude.h │ ├── jmemmgr.c │ ├── jmemnobs.c │ ├── jmemsys.h │ ├── jmorecfg.h │ ├── jpegint.h │ ├── jpeglib.h │ ├── jquant1.c │ ├── jquant2.c │ ├── jutils.c │ ├── jversion.h │ └── transupp.h │ ├── png │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README │ ├── README.ipol │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pngmem.c │ ├── pngpread.c │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtrans.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c │ ├── svd │ ├── CMakeLists.txt │ ├── eigenWrapper.hpp │ ├── matConversion.hpp │ └── svd.hpp │ └── zlib │ ├── CMakeLists.txt │ ├── ChangeLog │ ├── INDEX │ ├── README │ ├── README.ipol │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── win32 │ ├── zlib.def │ └── zlib1.rc │ ├── zconf.h │ ├── zconf.h.cmakein │ ├── zconf.h.in │ ├── zlib.3 │ ├── zlib.h │ ├── zlib.map │ ├── zlib.pc.in │ ├── zlib2ansi │ ├── zutil.c │ └── zutil.h ├── calibration.cpp ├── convert.cpp ├── convert.h ├── deformable.cpp ├── demo_image ├── IMG_0.jpg ├── IMG_0bis.jpg ├── IMG_1.jpg ├── IMG_1bis.jpg ├── IMG_2.jpg ├── IMG_2bis.jpg ├── IMG_3.jpg ├── IMG_3bis.jpg ├── IMG_4.jpg └── IMG_4bis.jpg ├── demo_output ├── IMG_2_Detectors1.txt ├── IMG_2_Detectors2.txt ├── IMG_2_initial.png ├── IMG_2_initial_matches.txt ├── IMG_2_kvld_filtered.png ├── IMG_2_kvld_matches.txt ├── IMG_2_kvld_matches_score.txt ├── IMG_2_matrix.txt └── readme.txt ├── image.hpp ├── interface.cpp ├── kvld ├── CMakeLists.txt ├── algorithm.cpp ├── algorithm.h ├── image.hpp ├── kvld.cpp ├── kvld.h ├── match.h ├── matrix.cpp └── matrix.h └── readme.txt /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(ProjectName KVLD_DEMO) 2 | PROJECT(${ProjectName}) 3 | 4 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 5 | 6 | FIND_PACKAGE(OpenMP) 7 | if (OPENMP_FOUND) 8 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 9 | endif (OPENMP_FOUND) 10 | 11 | #Detect c++11 support on Unix system 12 | if (UNIX) 13 | if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") 14 | execute_process( 15 | COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) 16 | if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) 17 | if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) 18 | message(STATUS "C++11 activated.") 19 | add_definitions("-std=gnu++11") 20 | elseif (GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3) 21 | message(WARNING "C++0x activated. If you get any errors update to a compiler which fully supports C++11") 22 | add_definitions("-std=gnu++0x") 23 | endif () 24 | endif () 25 | elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") 26 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 27 | else () 28 | message(FATAL_ERROR "Your C++ compiler does not support C++11.") 29 | endif () 30 | endif (UNIX) 31 | 32 | # If you don't want to use openCV and only need KVLD, 33 | # please commande the next line, 34 | # don't forget to also commande ${OpenCV_LIBS} further. 35 | FIND_PACKAGE( OpenCV REQUIRED ) 36 | 37 | 38 | #find Orsa and KVLD librarys 39 | ADD_DEFINITIONS(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") 40 | ADD_SUBDIRECTORY(OrsaHomography) 41 | ADD_SUBDIRECTORY(kvld) 42 | 43 | INCLUDE_DIRECTORIES( 44 | #./OrsaHomography/ 45 | ./OrsaHomography/demo/libImage 46 | $ENV{OPENCV_DIR}/install/include/opencv 47 | ) 48 | 49 | 50 | ADD_EXECUTABLE(KVLD_Deformable deformable.cpp convert.h convert.cpp ) 51 | TARGET_LINK_LIBRARIES(KVLD_Deformable kvld image 52 | ${OpenCV_LIBS}) 53 | 54 | ADD_EXECUTABLE(KVLD_Calibration calibration.cpp convert.h convert.cpp) 55 | TARGET_LINK_LIBRARIES(KVLD_Calibration kvld image 56 | ${OpenCV_LIBS}) 57 | 58 | ADD_EXECUTABLE(KVLD_Interface interface.cpp convert.h convert.cpp) 59 | TARGET_LINK_LIBRARIES(KVLD_Interface kvld image 60 | ${OpenCV_LIBS}) 61 | 62 | 63 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011-12, Zhe Liu and Pierre Moulon 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification for academic purpose, are permitted provided that the following conditions are 6 | met: 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /OrsaHomography/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 3 | 4 | PROJECT(mmm_orsa C CXX) 5 | 6 | ENABLE_TESTING() 7 | 8 | INCLUDE_DIRECTORIES( 9 | ./demo/ 10 | ./third_party/ 11 | ./third_party/Eigen/ 12 | ./ 13 | ) 14 | 15 | IF (WIN32) 16 | INCLUDE_DIRECTORIES( 17 | third_party/jpeg 18 | third_party/zlib 19 | third_party/png) 20 | ENDIF (WIN32) 21 | 22 | MACRO (UNIT_TEST NAME EXTRA_LIBS) 23 | ADD_EXECUTABLE(${NAME}_test ${NAME}_test.cpp) 24 | TARGET_LINK_LIBRARIES(${NAME}_test 25 | ${EXTRA_LIBS} # Extra libs MUST be first. 26 | CppUnitLite) 27 | ADD_TEST(${NAME}_test ${NAME}_test) 28 | ENDMACRO (UNIT_TEST) 29 | 30 | # Third parties libraries 31 | ADD_SUBDIRECTORY(third_party) 32 | 33 | # Orsa Core library 34 | ADD_SUBDIRECTORY(libOrsa) 35 | 36 | # External libraries required for the demo 37 | ADD_SUBDIRECTORY(extras) 38 | 39 | # Demo directory 40 | ADD_SUBDIRECTORY(demo) 41 | 42 | INSTALL(FILES CMakeLists.txt DESTINATION src) 43 | INSTALL(FILES testing/testing.h DESTINATION src/testing) 44 | -------------------------------------------------------------------------------- /OrsaHomography/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(libImage) 2 | 3 | FIND_PACKAGE(OpenMP) 4 | if (OPENMP_FOUND) 5 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 6 | endif (OPENMP_FOUND) 7 | 8 | # Executable demo to estimate a homography matrix from SIFT matches and 9 | # display the corresponding mosaic. 10 | ADD_EXECUTABLE(demo_orsa_homography orsa_homography.cpp) 11 | TARGET_LINK_LIBRARIES(demo_orsa_homography Orsa image sift) 12 | 13 | IF(UNIX) 14 | SET_TARGET_PROPERTIES(demo_orsa_homography PROPERTIES 15 | COMPILE_FLAGS "-Wall -Wextra -Werror") 16 | ENDIF(UNIX) 17 | 18 | INSTALL(FILES CMakeLists.txt 19 | orsa_homography.cpp 20 | Rect.hpp 21 | siftMatch.hpp 22 | warping.hpp 23 | DESTINATION src/demo) 24 | -------------------------------------------------------------------------------- /OrsaHomography/demo/Rect.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Lionel Moisan, Pascal Monasse, Pierre Moulon 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_RECT_H 17 | #define LIBS_RECT_H 18 | 19 | #include 20 | 21 | /// Minimal class for a rectangle 22 | class Rect 23 | { 24 | public: 25 | int top, bottom; 26 | int left, right; 27 | 28 | /// Rectangle constructor 29 | Rect(int l=0, int t=0, int r=0, int b=0) 30 | : top(t), bottom(b), left(l), right(r) 31 | {} 32 | 33 | /// Grow rectangle to include (x,y) 34 | void growTo(double x, double y) { 35 | if(x < left) left = static_cast( floor(x) ); 36 | if(x > right) right = static_cast( ceil(x) ); 37 | if(y < top) top = static_cast( floor(y) ); 38 | if(y > bottom) bottom = static_cast( ceil(y) ); 39 | } 40 | 41 | /// Return true if the rectangle r2 intersect *this. 42 | bool intersect(const Rect &r2) const { 43 | return !(left > r2.right || right < r2.left || 44 | top > r2.bottom || bottom < r2.top); 45 | } 46 | /// Return the same as intersect(r2) and return the common intersection zone 47 | bool intersect(const Rect &r2, Rect &inter) const { 48 | if( this->intersect(r2) ) { 49 | inter = Rect( std::max(left, r2.left) , std::max(top, r2.top), 50 | std::min(right, r2.right), std::min(bottom, r2.bottom)); 51 | return true; 52 | } 53 | return false; 54 | } 55 | 56 | /// Return width of the rectangle 57 | int Width() const {return right - left; } 58 | /// Return height of the rectangle 59 | int Height()const {return bottom - top; } 60 | }; 61 | 62 | #endif //LIBS_RECT_H 63 | -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | ADD_DEFINITIONS(-DTHIS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") 3 | 4 | SET(SRC image.hpp 5 | sample.hpp 6 | pixelTypes.hpp 7 | image_converter.hpp 8 | image_io.hpp 9 | image_io.cpp 10 | image_drawing.hpp 11 | image_concat.hpp) 12 | 13 | ADD_LIBRARY(image ${SRC}) 14 | 15 | TARGET_LINK_LIBRARIES(image png jpeg) 16 | 17 | IF(UNIX) 18 | SET_TARGET_PROPERTIES(image PROPERTIES 19 | COMPILE_FLAGS "-Wall -Wextra -Werror") 20 | ENDIF(UNIX) 21 | 22 | UNIT_TEST(image "image") 23 | UNIT_TEST(image_drawing "image") 24 | UNIT_TEST(image_io "image") 25 | 26 | INSTALL(FILES CMakeLists.txt ${SRC} DESTINATION src/demo/libImage) 27 | INSTALL(FILES image_test.cpp image_drawing_test.cpp image_io_test.cpp 28 | DESTINATION src/demo/libImage) 29 | SET(IMG test_image/two_pixels_color.jpg test_image/two_pixels_monochrome.jpg test_image/two_pixels.ppm test_image/two_pixels_color.png test_image/two_pixels_monochrome.png test_image/two_pixels_gray.pgm test_image/two_pixels.pgm) 30 | 31 | INSTALL(FILES ${IMG} DESTINATION src/demo/libImage/image_test) 32 | -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/image_concat.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Pierre Moulon 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_IMAGE_IMAGE_CONCAT_H_ 17 | #define LIBS_IMAGE_IMAGE_CONCAT_H_ 18 | 19 | #include "image.hpp" 20 | 21 | /// Horizontal concatenation of images 22 | template < class Image > 23 | void ConcatH(const Image & imageA, const Image & imageB, Image & Out) 24 | { 25 | // Compute new dimensions. 26 | int ww = imageA.Width() + imageB.Width(); 27 | 28 | Out = Image(ww, std::max(imageA.Height(), imageB.Height())); 29 | 30 | // Fill with original data from imageA. 31 | for(size_t i = 0; i < imageA.Width(); ++i) 32 | for(size_t j = 0; j < imageA.Height(); ++j) 33 | Out(j,i) = imageA(j,i); 34 | 35 | // Fill with original data from imageB with the imageA Width offset. 36 | const size_t offset = imageA.Width(); 37 | for(size_t i = 0; i < imageB.Width(); ++i) 38 | for(size_t j = 0; j < imageB.Height(); ++j) 39 | Out(j,i+offset) = imageB(j,i); 40 | } 41 | 42 | /// Vertical concatenation of images 43 | template < class Image > 44 | void ConcatV(const Image & imageA, const Image & imageB, Image & Out) 45 | { 46 | // Compute new dimensions. 47 | int hh = imageA.Height() + imageB.Height(); 48 | 49 | Out = Image(std::max(imageA.Width(), imageB.Width()), hh); 50 | 51 | // Fill with original data from imageA. 52 | for(size_t i = 0; i < imageA.Width(); ++i) 53 | for(size_t j = 0; j < imageA.Height(); ++j) 54 | Out(j,i) = imageA(j,i); 55 | 56 | // Fill with original data from imageB with the imageA Height offset. 57 | const size_t offset = imageA.Height(); 58 | for(size_t i = 0; i < imageB.Width(); ++i) 59 | for(size_t j = 0; j < imageB.Height(); ++j) 60 | Out(j+offset,i) = imageB(j,i); 61 | } 62 | 63 | #endif // LIBS_IMAGE_IMAGE_CONCAT_H_ 64 | -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/image_converter.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Pierre Moulon, Pascal Monasse 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_IMAGE_IMAGE_CONVERTER_H 17 | #define LIBS_IMAGE_IMAGE_CONVERTER_H 18 | 19 | #include "image.hpp" 20 | #include "pixelTypes.hpp" 21 | #include 22 | 23 | namespace libs{ 24 | 25 | template 26 | inline void convert(const Tin& in, Tout& out) 27 | { 28 | out = static_cast(in); 29 | } 30 | 31 | template<> 32 | inline void convert(const RGBColor& in, unsigned char& out) 33 | { 34 | out = static_cast(0.2127*in.r + 0.7152*in.g + 0.0722*in.b); 35 | } 36 | 37 | template<> 38 | inline void convert(const unsigned char& in, RGBColor& out) 39 | { 40 | out.r = out.g = out.b = in; 41 | } 42 | 43 | template 44 | void convertImage(const ImageIn & imaIn, ImageOut * imaOut) { 45 | 46 | (*imaOut) = ImageOut(imaIn.Width(), imaIn.Height()); 47 | for(size_t j = 0; j < imaIn.Height(); ++j) 48 | for(size_t i = 0; i < imaIn.Width(); ++i) { 49 | convert(imaIn(j,i), (*imaOut)(j,i)); 50 | } 51 | } 52 | 53 | } // namespace libs 54 | 55 | #endif // LIBS_IMAGE_IMAGE_CONVERTER_H 56 | -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/image_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #include "image.hpp" 22 | #include "pixelTypes.hpp" 23 | #include "testing/testing.h" 24 | 25 | #include 26 | using namespace std; 27 | 28 | TEST(Image, Basis) 29 | { 30 | //-- Gray(unsigned char) Image creation 31 | Image imaGray(10,10); 32 | imaGray(1,1) = 1; //-- Pixel modification 33 | imaGray(2,2) = 2; 34 | imaGray(5,0) = 2; 35 | 36 | cout << imaGray << endl << endl; 37 | //-- Get raw ptr to image data : 38 | const unsigned char * ptr = imaGray.data(); 39 | ((unsigned char*)ptr)[0] = 2; 40 | fill(((unsigned char*)ptr+9*10),((unsigned char*)ptr+10*10),2); 41 | cout << "After" << endl << imaGray; 42 | 43 | // Construction by re-copy 44 | Image imageGray2(imaGray); 45 | 46 | Image imageGray3; 47 | imageGray3 = imaGray; 48 | 49 | //-- RGB Image creation 50 | Image imaRGB(10,10); 51 | imaRGB(0,0) = RGBColor(0,1,2); 52 | } 53 | TEST(Image, PixelTypes) 54 | { 55 | RGBColor a(BLACK); 56 | // RGBColor c(0); // Not accepted because can cause bad pixel affectation value (mixed type...) 57 | // The following issue must used : (at your own risk) 58 | RGBColor b(static_cast(0)); 59 | } 60 | 61 | /* ************************************************************************* */ 62 | int main() { TestResult tr; return TestRegistry::runAllTests(tr);} 63 | /* ************************************************************************* */ -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/pixelTypes.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Pierre Moulon 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_IMAGE_PIXELTYPES_H_ 17 | #define LIBS_IMAGE_PIXELTYPES_H_ 18 | 19 | #include 20 | //using namespace std; 21 | 22 | /// RGB templated pixel type 23 | template 24 | class RGBClass 25 | { 26 | public: 27 | T r, g, b; 28 | 29 | //------------------------------ 30 | //-- construction method 31 | RGBClass(){ r = g = b = T(0);} 32 | RGBClass(T red,T green,T blue){ 33 | r = red; 34 | g = green; 35 | b = blue; 36 | } 37 | //explicit RGBClass(const Base & val) : Base(val) {} 38 | explicit inline RGBClass(const T t[3]) { 39 | r = t[0]; 40 | g = t[1]; 41 | b = t[2]; 42 | } 43 | explicit inline RGBClass(const T val){ 44 | r = g = b = val; 45 | } 46 | 47 | /// Return gray 48 | inline operator T() const { return T(0.3*r+0.59*g+0.11*b);} 49 | 50 | friend std::ostream & operator<<(std::ostream & os, const RGBClass & col) { 51 | os << col.r << " " << col.g << " " << col.b; 52 | return os; 53 | } 54 | 55 | template 56 | inline RGBClass operator /(const Z & val) const 57 | { 58 | return RGBClass(T((Z)(r) / val), 59 | T((Z)(g) / val), 60 | T((Z)(b) / val) ); 61 | } 62 | 63 | template 64 | inline RGBClass operator *(const Z & val) const 65 | { 66 | return RGBClass(T((Z)r * val), 67 | T((Z)g * val), 68 | T((Z)b * val) ); 69 | } 70 | 71 | template 72 | inline RGBClass operator +(const Z & val) const 73 | { 74 | return RGBClass(T((Z)(r) + val), 75 | T((Z)(g) + val), 76 | T((Z)(b) + val) ); 77 | } 78 | 79 | inline RGBClass operator +(const RGBClass & val) const 80 | { 81 | return RGBClass(T(r + val.r), 82 | T(g + val.g), 83 | T(b + val.b) ); 84 | } 85 | }; 86 | typedef RGBClass RGBColor; 87 | 88 | const RGBColor WHITE(255,255,255); 89 | const RGBColor BLACK(0,0,0); 90 | const RGBColor BLUE(0,0,255); 91 | const RGBColor RED(255,0,0); 92 | const RGBColor GREEN(0,255,0); 93 | const RGBColor YELLOW(255,255,0); 94 | const RGBColor CYAN(0,255,255); 95 | const RGBColor MAGENTA(255,0,255); 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels.pgm -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels.ppm -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels_color.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels_color.jpg -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels_color.png -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels_gray.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels_gray.pgm -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels_monochrome.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels_monochrome.jpg -------------------------------------------------------------------------------- /OrsaHomography/demo/libImage/test_image/two_pixels_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/demo/libImage/test_image/two_pixels_monochrome.png -------------------------------------------------------------------------------- /OrsaHomography/demo/siftMatch.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Lionel Moisan, Pascal Monasse, Pierre Moulon 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_SIFT_MATCH_H 17 | #define LIBS_SIFT_MATCH_H 18 | 19 | #include "extras/sift/demo_lib_sift.h" 20 | 21 | /// SIFT matches 22 | static void SIFT(const Image &im1, 23 | const Image &im2, 24 | std::vector& vec_matchings, 25 | float fMatchRatio=0.6f) { 26 | //Convert images to float 27 | Image If1, If2; 28 | libs::convertImage(im1, &If1); 29 | libs::convertImage(im2, &If2); 30 | 31 | siftPar param; 32 | default_sift_parameters(param); 33 | param.MatchRatio = fMatchRatio; 34 | param.DoubleImSize=0; 35 | 36 | keypointslist keyp1, keyp2; 37 | compute_sift_keypoints(If1.data(), keyp1, If1.Width(), If1.Height(), param); 38 | std::cout<< "sift:: 1st image: " << keyp1.size() << " keypoints"<& m) { 49 | std::sort(m.begin(), m.end()); 50 | std::vector::iterator end = std::unique(m.begin(), m.end()); 51 | if(end != m.end()) { 52 | std::cout << "Remove " << std::distance(end, m.end()) 53 | << "/" << m.size() << " duplicate matches, " 54 | << " keeping " << std::distance(m.begin(), end) < 25 | LWImage::LWImage() 26 | : data(0), w(0), h(0), comps(0), planar(true) 27 | {} 28 | 29 | /// Constructor. 30 | template 31 | LWImage::LWImage(T* i_data, int i_w, int i_h, int i_comps) 32 | : data(i_data), w(i_w), h(i_h), comps(i_comps), planar(true) 33 | {} 34 | 35 | /// Is pixel inside image? 36 | template 37 | bool LWImage::valid(int x, int y) const 38 | { 39 | return (0 <= x && x < w && 0 <= y && y < h); 40 | } 41 | 42 | /// Step between one pixel and next one. 43 | template 44 | int LWImage::step() const 45 | { return (planar? 1: comps); } 46 | 47 | /// Step between one component of pixel and next one. 48 | template 49 | int LWImage::stepComp() const 50 | { return (planar? w*h: 1); } 51 | 52 | /// Return pointer to data at pixel. 53 | template 54 | T* LWImage::pixel(int x, int y) 55 | { 56 | return (data + step()*(y*w+x)); 57 | } 58 | 59 | /// Return pointer to data at pixel. 60 | template 61 | const T* LWImage::pixel(int x, int y) const 62 | { 63 | return (data + step()*(y*w+x)); 64 | } 65 | 66 | /// Value of x in [0,w-1], with mirror and periodization. 67 | inline void wrap(int& x, int w) 68 | { 69 | if(x < 0) x =-(x+1); 70 | while(x >= 2*w) x -= 2*w; 71 | if(x >= w) x = 2*w-x-1; 72 | } 73 | 74 | /// Return pixel value even outside image: image is supposed infinite, with 75 | /// mirror effect and periodization. 76 | template 77 | const T* LWImage::pixel_ext(int x, int y) const 78 | { 79 | wrap(x,w); 80 | wrap(y,h); 81 | return pixel(x,y); 82 | } 83 | 84 | #endif // LWIMAGE_H 85 | -------------------------------------------------------------------------------- /OrsaHomography/extras/libLWImage/LWImage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010 Pascal Monasse 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #ifndef LWIMAGE_H 22 | #define LWIMAGE_H 23 | 24 | #include 25 | #include 26 | 27 | /// A lightweight image container around an array. It is not responsible for 28 | /// allocation/free of the array. 29 | template 30 | class LWImage 31 | { 32 | public: 33 | LWImage(); 34 | LWImage(T* i_data, int i_w, int i_h, int i_comps=1); 35 | ~LWImage() {} 36 | 37 | bool valid(int x, int y) const; 38 | int sizeBuffer() const { return w*h*comps; } 39 | int step() const; 40 | int stepComp() const; 41 | T* pixel(int x, int y); 42 | const T* pixel(int x, int y) const; 43 | const T* pixel_ext(int x, int y) const; 44 | 45 | T* data; ///< Array of pixels. 46 | int w; ///< Width of image. 47 | int h; ///< Height of image. 48 | int comps; ///< Components per pixel. 49 | bool planar; ///< Are components separated (true) or contiguous (false) 50 | }; 51 | 52 | /// Utility function, avoiding the need to precise the type: 53 | /// \code 54 | /// void f(LWImage&); 55 | /// unsigned char* data = new unsigned char[10*10]; 56 | /// f( make_image(data, 10, 10) ); 57 | /// \endcode 58 | template 59 | LWImage make_image(T* data, int w, int h, int comps=1) 60 | { 61 | return LWImage(data, w, h, comps); 62 | } 63 | 64 | /// Do not forget free 65 | template 66 | LWImage alloc_image(int w, int h, int comps=1) 67 | { 68 | return LWImage((T*)malloc(w*h*comps*sizeof(T)), w, h, comps); 69 | } 70 | 71 | /// Do not forget free 72 | template 73 | LWImage alloc_image(const LWImage& im) 74 | { 75 | LWImage out = alloc_image(im.w, im.h, im.comps); 76 | out.planar = im.planar; 77 | //for(int i=im.sizeBuffer()-1; i>=0; i--) 78 | // out.data[i] = im.data[i]; 79 | memcpy(out.data, im.data, im.sizeBuffer()*sizeof(float)); 80 | return out; 81 | } 82 | 83 | #include "LWImage.cpp" 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /OrsaHomography/extras/libMatch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | SET(SRC match.h) 4 | 5 | INSTALL(FILES CMakeLists.txt ${SRC} DESTINATION src/extras/libMatch) 6 | -------------------------------------------------------------------------------- /OrsaHomography/extras/libNumerics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | PROJECT(libNumerics) 4 | 5 | SET(SRC 6 | matrix.cpp matrix.h 7 | numerics.cpp numerics.h 8 | vector.cpp) 9 | 10 | 11 | ADD_LIBRARY(Numerics ${SRC}) 12 | 13 | IF(UNIX) 14 | SET_TARGET_PROPERTIES(Numerics PROPERTIES 15 | COMPILE_FLAGS "-Wall -Wextra -Werror") 16 | ENDIF(UNIX) 17 | 18 | INSTALL(FILES CMakeLists.txt ${SRC} DESTINATION src/extras/libNumerics) 19 | -------------------------------------------------------------------------------- /OrsaHomography/extras/libNumerics/numerics.cpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2010 Pascal Monasse 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #include "numerics.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | namespace libNumerics { 23 | 24 | inline flnum ABS(flnum x) 25 | { return (x >= 0)? x: -x; } 26 | 27 | /// Resolution by LU decomposition with pivot. 28 | bool solveLU(const matrix& A, const vector& B, vector& X) 29 | { 30 | X = B; 31 | return solveLU(A, X); 32 | } 33 | 34 | /// Replace X by A^{-1}X, by LU solver. 35 | bool solveLU(matrix A, vector& X) 36 | { 37 | assert(A.nrow() == A.ncol()); 38 | int n = A.nrow(); 39 | vector rowscale(n); // Implicit scaling of each row 40 | std::vector permut(n,0); // Permutation of rows 41 | 42 | // Get the implicit scaling information of each row 43 | for(int i=0; i< n; i++) { 44 | flnum max = 0.0; 45 | for(int j=0; j< n; j++) { 46 | flnum tmp = ABS(A(i,j)); 47 | if (tmp> max) 48 | max = tmp; 49 | } 50 | if(max == 0.0) 51 | return false; 52 | rowscale(i) = 1.0/max; 53 | } 54 | // Perform the decomposition 55 | for(int k=0; k < n; k++) { 56 | // Search for largest pivot element 57 | flnum max = rowscale(k)*ABS(A(k,k)); 58 | int imax = k; 59 | for(int i=k+1; i < n; i++) { 60 | flnum tmp = rowscale(i)*ABS(A(i,k)); 61 | if(tmp > max) { 62 | max = tmp; 63 | imax = i; 64 | } 65 | } 66 | if(max == 0.0) 67 | return false; 68 | 69 | // Interchange rows if needed 70 | if(k != imax) { 71 | A.swapRows(k, imax); 72 | rowscale(imax) = rowscale(k); // Scale of row k no longer needed 73 | } 74 | permut[k] = imax; // permut(k) was not initialized before 75 | flnum Akk = 1/A(k,k); 76 | for(int i=k+1; i < n; i++) { 77 | flnum tmp = A(i,k) *= Akk; // Divide by pivot 78 | for (int j=k+1;j < n; j++) // Reduce the row 79 | A(i,j) -= tmp*A(k,j); 80 | } 81 | } 82 | // Forward substitution 83 | for (int k=0; k < n; k++) { 84 | flnum sum = X(permut[k]); 85 | X(permut[k]) = X(k); 86 | for(int j = 0; j < k; j++) 87 | sum -= A(k,j)*X(j); 88 | X(k) = sum; 89 | } 90 | // Backward substitution 91 | for(int k=n-1; k >= 0; k--) { 92 | flnum sum = X(k); 93 | for(int j=k+1; j < n; j++) 94 | sum -= A(k,j)*X(j); 95 | X(k) = sum/A(k,k); 96 | } 97 | return true; 98 | } 99 | 100 | } // namespace libNumerics 101 | -------------------------------------------------------------------------------- /OrsaHomography/extras/libNumerics/numerics.h: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2010 Pascal Monasse 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef NUMERICS_H 17 | #define NUMERICS_H 18 | 19 | #include "matrix.h" 20 | #include 21 | 22 | namespace libNumerics { 23 | typedef double flnum; 24 | 25 | /// Solve system AX = B. 26 | bool solveLU(const matrix& A, const vector& B, 27 | vector& X); 28 | bool solveLU(matrix A, vector& B); 29 | 30 | } // namespace libNumerics 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /OrsaHomography/extras/sift/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | PROJECT(sift) 4 | 5 | SET(SRC library.cpp library.h 6 | domain.cpp domain.h 7 | splines.cpp splines.h 8 | filter.cpp filter.h 9 | demo_lib_sift.cpp demo_lib_sift.h 10 | ) 11 | 12 | INCLUDE_DIRECTORIES(..) 13 | 14 | ADD_LIBRARY(sift ${SRC}) 15 | IF(UNIX) 16 | SET_TARGET_PROPERTIES(sift PROPERTIES 17 | COMPILE_FLAGS "-Wall -Wextra -Werror") 18 | ENDIF(UNIX) 19 | 20 | ADD_EXECUTABLE(sift_demo demo_sift.cpp) 21 | TARGET_LINK_LIBRARIES(sift_demo sift image Numerics) 22 | 23 | INSTALL(FILES CMakeLists.txt ${SRC} demo_sift.cpp DESTINATION src/extras/sift) 24 | -------------------------------------------------------------------------------- /OrsaHomography/extras/sift/domain.h: -------------------------------------------------------------------------------- 1 | // WARNING: 2 | // This file implements an algorithm possibly linked to the patent 3 | // 4 | // David Lowe "Method and apparatus for identifying scale invariant 5 | // features in an image and use of same for locating an object in an 6 | // image", U.S. Patent 6,711,293. 7 | // 8 | // This file is made available for the exclusive aim of serving as 9 | // scientific tool to verify of the soundness and 10 | // completeness of the algorithm description. Compilation, 11 | // execution and redistribution of this file may violate exclusive 12 | // patents rights in certain countries. 13 | // The situation being different for every country and changing 14 | // over time, it is your responsibility to determine which patent 15 | // rights restrictions apply to you before you compile, use, 16 | // modify, or redistribute this file. A patent lawyer is qualified 17 | // to make this determination. 18 | // If and only if they don't conflict with any patent terms, you 19 | // can benefit from the following license terms attached to this 20 | // file. 21 | // 22 | // This program is provided for scientific and educational only: 23 | // you can use and/or modify it for these purposes, but you are 24 | // not allowed to redistribute this work or derivative works in 25 | // source or executable form. A license must be obtained from the 26 | // patent right holders for any other use. 27 | 28 | #ifndef _DOMAIN_H_ 29 | #define _DOMAIN_H_ 30 | 31 | /// Apply zoom of factor z 32 | void apply_zoom(float *input, float *out, float zoom, int order, int width, int height); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /OrsaHomography/extras/sift/filter.h: -------------------------------------------------------------------------------- 1 | // WARNING: 2 | // This file implements an algorithm possibly linked to the patent 3 | // 4 | // David Lowe "Method and apparatus for identifying scale invariant 5 | // features in an image and use of same for locating an object in an 6 | // image", U.S. Patent 6,711,293. 7 | // 8 | // This file is made available for the exclusive aim of serving as 9 | // scientific tool to verify of the soundness and 10 | // completeness of the algorithm description. Compilation, 11 | // execution and redistribution of this file may violate exclusive 12 | // patents rights in certain countries. 13 | // The situation being different for every country and changing 14 | // over time, it is your responsibility to determine which patent 15 | // rights restrictions apply to you before you compile, use, 16 | // modify, or redistribute this file. A patent lawyer is qualified 17 | // to make this determination. 18 | // If and only if they don't conflict with any patent terms, you 19 | // can benefit from the following license terms attached to this 20 | // file. 21 | // 22 | // This program is provided for scientific and educational only: 23 | // you can use and/or modify it for these purposes, but you are 24 | // not allowed to redistribute this work or derivative works in 25 | // source or executable form. A license must be obtained from the 26 | // patent right holders for any other use. 27 | 28 | #ifndef _FILTER_H_ 29 | #define _FILTER_H_ 30 | 31 | /// Can be called with u=v 32 | void gaussian_convolution(float *u, float *v, int width, int height, float sigma); 33 | 34 | #endif // _FILTER_H_ 35 | 36 | -------------------------------------------------------------------------------- /OrsaHomography/extras/sift/library.h: -------------------------------------------------------------------------------- 1 | // WARNING: 2 | // This file implements an algorithm possibly linked to the patent 3 | // 4 | // David Lowe "Method and apparatus for identifying scale invariant 5 | // features in an image and use of same for locating an object in an 6 | // image", U.S. Patent 6,711,293. 7 | // 8 | // This file is made available for the exclusive aim of serving as 9 | // scientific tool to verify of the soundness and 10 | // completeness of the algorithm description. Compilation, 11 | // execution and redistribution of this file may violate exclusive 12 | // patents rights in certain countries. 13 | // The situation being different for every country and changing 14 | // over time, it is your responsibility to determine which patent 15 | // rights restrictions apply to you before you compile, use, 16 | // modify, or redistribute this file. A patent lawyer is qualified 17 | // to make this determination. 18 | // If and only if they don't conflict with any patent terms, you 19 | // can benefit from the following license terms attached to this 20 | // file. 21 | // 22 | // This program is provided for scientific and educational only: 23 | // you can use and/or modify it for these purposes, but you are 24 | // not allowed to redistribute this work or derivative works in 25 | // source or executable form. A license must be obtained from the 26 | // patent right holders for any other use. 27 | 28 | #ifndef _LIBRARY_H_ 29 | #define _LIBRARY_H_ 30 | 31 | void copy(float *u,float *v,int size); /// v = u 32 | 33 | void combine(float *u,float a,float *v,float b,float *w, int size); ///w=a*u+b*v 34 | 35 | float* gauss(int sflag,float std,int *size); /// 1D Gauss kernel 36 | 37 | void compute_gradient_orientation(float* igray, float *grad, int w, int h); 38 | 39 | void sample(float *igray, float *ogray, float factor, int w, int h); 40 | 41 | void draw_line(float *igray, int a0, int b0, int a1, int b1, 42 | float value, int width, int height); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /OrsaHomography/extras/sift/splines.h: -------------------------------------------------------------------------------- 1 | // WARNING: 2 | // This file implements an algorithm possibly linked to the patent 3 | // 4 | // David Lowe "Method and apparatus for identifying scale invariant 5 | // features in an image and use of same for locating an object in an 6 | // image", U.S. Patent 6,711,293. 7 | // 8 | // This file is made available for the exclusive aim of serving as 9 | // scientific tool to verify of the soundness and 10 | // completeness of the algorithm description. Compilation, 11 | // execution and redistribution of this file may violate exclusive 12 | // patents rights in certain countries. 13 | // The situation being different for every country and changing 14 | // over time, it is your responsibility to determine which patent 15 | // rights restrictions apply to you before you compile, use, 16 | // modify, or redistribute this file. A patent lawyer is qualified 17 | // to make this determination. 18 | // If and only if they don't conflict with any patent terms, you 19 | // can benefit from the following license terms attached to this 20 | // file. 21 | // 22 | // This program is provided for scientific and educational only: 23 | // you can use and/or modify it for these purposes, but you are 24 | // not allowed to redistribute this work or derivative works in 25 | // source or executable form. A license must be obtained from the 26 | // patent right holders for any other use. 27 | 28 | #ifndef _SPLINES_H_ 29 | #define _SPLINES_H_ 30 | 31 | void keys(float *c,float t,float a); 32 | void spline3(float *c,float t); 33 | void init_splinen(float *a,int n); 34 | void splinen(float *c,float t,float *a,int n); 35 | void finvspline(float *in,int order,float *out, int width, int height); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SRC conditioning.hpp conditioning.cpp 2 | orsa_model.hpp orsa_model.cpp 3 | homography_model.hpp homography_model.cpp 4 | fundamental_model.hpp fundamental_model.cpp) 5 | 6 | ADD_LIBRARY(Orsa ${SRC}) 7 | 8 | IF(UNIX) 9 | SET_TARGET_PROPERTIES(Orsa PROPERTIES 10 | COMPILE_FLAGS "-Wall -Wextra -Werror") 11 | ENDIF(UNIX) 12 | 13 | TARGET_LINK_LIBRARIES(Orsa Numerics) 14 | 15 | INSTALL(FILES CMakeLists.txt ${SRC} DESTINATION src/libOrsa) 16 | 17 | #---------- 18 | # UNIT TEST 19 | #---------- 20 | 21 | # UNIT TEST -> HOMOGRAPHY 22 | 23 | UNIT_TEST(homography_model "Orsa") 24 | UNIT_TEST(homography_orsa "Orsa") 25 | 26 | INSTALL(FILES homography_model_test.cpp 27 | homography_orsa_test.cpp 28 | DESTINATION src/libOrsa) 29 | 30 | ADD_SUBDIRECTORY(numeric) 31 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/conditioning.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #ifndef LIBS_MULTIVIEW_CONDITIONNING_H_ 22 | #define LIBS_MULTIVIEW_CONDITIONNING_H_ 23 | 24 | #include "extras/libNumerics/matrix.h" 25 | 26 | //-- Implementation of normalized coordinates. 27 | // Normalization improve accuracy of results and provide benefits 28 | // that make scale and coordinate origin invariant. 29 | // Two normalization algorithm are implemented : 30 | // - Normalization from image dimension to [-.5, .5] 31 | // - Normalization with zero mean and variance to 1.0 32 | // 33 | namespace orsa { 34 | typedef libNumerics::matrix Mat; 35 | 36 | // Point conditioning (compute Transformation matrix) (T must be (3,3)) : 37 | void PreconditionerFromPoints(const Mat &points, Mat *T); 38 | 39 | // Apply a given transformation to points (T must be (3,3)) : 40 | void ApplyTransformationToPoints(const Mat &points, 41 | const Mat &T, 42 | Mat *transformed_points); 43 | // 44 | // Normalize point 45 | // The implementation follows Algorithm 4.2 from Hartley-Zisserman page 109. 46 | void NormalizePoints(const Mat &points, 47 | Mat *normalized_points, 48 | Mat *T); 49 | 50 | // Point conditioning (compute Transformation matrix) 51 | void PreconditionerFromPoints(int width, int height, Mat *T); 52 | 53 | // 54 | // Normalize point 55 | // From image coordinates to [-.5, .5] 56 | void NormalizePoints(const Mat &points, 57 | Mat *normalized_points, 58 | Mat *T, int width, int height); 59 | 60 | /// Use inverse for unnormalize 61 | struct UnnormalizerI { 62 | // Denormalize the results. See Hartley-Zisserman page 109. 63 | // All matrices must be (3,3) 64 | static void Unnormalize(const Mat &T1, const Mat &T2, Mat *H); 65 | }; 66 | 67 | /// Use transpose for unnormalize 68 | struct UnnormalizerT { 69 | // Denormalize the results. See Hartley-Zisserman page 109. 70 | // All matrices must be (3,3) 71 | static void Unnormalize(const Mat &T1, const Mat &T2, Mat *H); 72 | }; 73 | 74 | } //namespace orsa 75 | 76 | #endif // LIBS_MULTIVIEW_CONDITIONNING_H_ 77 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/fundamental_model.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #ifndef FUNDAMENTAL_MODEL_H_ 22 | #define FUNDAMENTAL_MODEL_H_ 23 | 24 | #include 25 | #include "libOrsa/orsa_model.hpp" 26 | #include "extras/libNumerics/matrix.h" 27 | 28 | namespace orsa { 29 | 30 | /// Fundamental 7-point model, used for robust estimation. 31 | /// 32 | /// See page 281 of book by Hartley-Zisserman. 33 | /// The equation is \f$det(F_1 + \alpha F_2) = 0\f$. 34 | class FundamentalModel : public OrsaModel { 35 | public: 36 | FundamentalModel(const Mat &x1, int w1, int h1, 37 | const Mat &x2, int w2, int h2, 38 | bool symError=false); 39 | 40 | /// 7 points are required to compute a fundamental matrix. 41 | int SizeSample() const { return 7;} 42 | 43 | /// Up to 3 fundamental matrices are computed from a sample of 7 points. 44 | int NbModels() const { return 3;} 45 | 46 | /// Distance used to distinguish inlier/outlier is to a line 47 | virtual bool DistToPoint() const { return false; } 48 | 49 | void Fit(const std::vector &indices, std::vector *Fs) const; 50 | 51 | /// Square reprojection error for a given point through F. 52 | double Error(const Mat &F, size_t index, int* side=0) const; 53 | 54 | /// Unnormalize a given model (from normalized to image space). 55 | void Unnormalize(Model *model) const; 56 | private: 57 | bool symError_; ///< Use symmetric error or transfer error in image 2? 58 | }; 59 | 60 | } // namespace orsa 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/homography_model.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #ifndef HOMOGRAPHY_MODEL_H_ 22 | #define HOMOGRAPHY_MODEL_H_ 23 | 24 | #include 25 | #include 26 | #include "libOrsa/orsa_model.hpp" 27 | #include "extras/libNumerics/matrix.h" 28 | 29 | namespace orsa { 30 | 31 | /// Homography model used for robust estimation with ORSA algorithm. 32 | class HomographyModel : public OrsaModel { 33 | public: 34 | HomographyModel(const Mat &x1, int w1, int h1, 35 | const Mat &x2, int w2, int h2, 36 | bool symError=false); 37 | 38 | /// 4 point correspondences required to compute a homography. 39 | int SizeSample() const { return 4; } 40 | 41 | /// Only 1 homography can be estimated from a sample of 4 points. 42 | int NbModels() const { return 1; } 43 | 44 | /// Distance used to distinguish inlier/outlier is to a point 45 | virtual bool DistToPoint() const { return true; } 46 | 47 | /// Estimated homography satisfies the equation y = H x. 48 | void Fit(const std::vector &indices, std::vector *H) const; 49 | 50 | /// Square reprojection error for a given point through the model H. 51 | double Error(const Mat &H, size_t index, int* side=0) const; 52 | 53 | /// Unnormalize a given model (from normalized to image space). 54 | void Unnormalize(Model *model) const; 55 | 56 | private: 57 | bool symError_; ///< Use symmetric error or transfer error in image 2? 58 | bool IsOrientationPreserving(const std::vector &indices, 59 | const Mat& H) const; 60 | }; 61 | 62 | } // namespace orsa 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/homography_model_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #include 22 | #include "libOrsa/homography_model.hpp" 23 | #include "extras/libNumerics/matrix.h" 24 | #include "testing/testing.h" 25 | 26 | typedef libNumerics::matrix Mat; 27 | 28 | void TransformH(double x, double y, const Mat & H, double & xT, double & yT ) 29 | { 30 | Mat x1_H = Mat(3,1); 31 | x1_H(0,0) = x; x1_H(1,0) = y; x1_H(2,0) = 1.0; 32 | Mat x2h_est = H * x1_H; 33 | x2h_est /= x2h_est(2,0); // homogeneous to euclidean 34 | xT = x2h_est(0); 35 | yT = x2h_est(1); 36 | } 37 | 38 | TEST(HomographyKernelTest, Fitting) { 39 | //------------------------// 40 | //-- Unit test Objective--// 41 | //------------------------// 42 | // Given two points set linked by a known homography : 43 | // -=> Compute the homography trough sampled points 44 | // -=> Assert that estimated H is good and residuals are near 0 to a given epsilon. 45 | //-- 46 | //-- 47 | 48 | typedef libNumerics::matrix Mat; 49 | 50 | // Define a few homographies. 51 | std::vector H_gt(3, Mat::zeros(3,3)); 52 | 53 | H_gt[0] = Mat::eye(3); 54 | double matGTd1[] = { 1, 0, -4, 0, 1, 5, 0, 0, 1}; 55 | H_gt[1].read(matGTd1); 56 | double matGTd2[] = { 1, 0, 3, 0, 1, -6, 0, 0, 1}; 57 | H_gt[2].read(matGTd2); 58 | 59 | // Define a set of points. 60 | Mat x(2, 9); 61 | double points[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 62 | 0,.4,.6, 0, 1, 2, 0, 1, 2}; 63 | x.read(points); 64 | 65 | for (int i = 0; i < H_gt.size(); ++i) { 66 | 67 | bool bFound = false; 68 | // Transform points by the ground truth homography. 69 | Mat y(2,9); 70 | for(int k = 0; k < 9; ++k) 71 | { 72 | TransformH(x(0,k), x(1,k), H_gt[i], y(0,k), y(1,k) ); 73 | } 74 | 75 | orsa::HomographyModel kernel(x, 10, 10, y, 10, 10); 76 | 77 | //-- Fit a model and check re-projection error. 78 | size_t samples_[5]={0,1,2,3,4}; 79 | std::vector samples(samples_,samples_+5); 80 | for (size_t j = 4; samples.size() < x.ncol(); samples.push_back(j++)) { 81 | Mat H(3,3); 82 | if(kernel.ComputeModel(samples, &H)) 83 | { 84 | EXPECT_MATRIX_NEAR(H_gt[i], H, 5e-8); 85 | bFound = true; 86 | } 87 | } 88 | EXPECT_TRUE(bFound); 89 | } 90 | } 91 | 92 | /* ************************************************************************* */ 93 | int main() { TestResult tr; return TestRegistry::runAllTests(tr);} 94 | /* ************************************************************************* */ 95 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/homography_orsa_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #include 22 | #include 23 | #include "libOrsa/homography_model.hpp" 24 | #include "extras/libNumerics/matrix.h" 25 | #include "testing/testing.h" 26 | 27 | TEST(RobustHomographyEstimation, ORSA) { 28 | //------------------------// 29 | //-- Unit test Objective--// 30 | //------------------------// 31 | // Given two points set linked by a known homography : 32 | // -=> Set an outlier in the point dataset. 33 | // -=> Make a robust estimation powered with ORSA 34 | // -=> Check the estimated matrix and inliers indexes. 35 | //-- 36 | //-- 37 | 38 | typedef libNumerics::matrix Mat; 39 | 40 | // Define a synthetic dataset 41 | // - 15 points that are inlier, 42 | // - 1 point that is outlier. 43 | const int n = 16; 44 | Mat x1(2,n); 45 | Mat x2(2,n); 46 | Mat matGT(3,3); // Ground truth matrix. 47 | { 48 | // Defines input points 49 | double points[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 50 | 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 5}; 51 | x1.read(points); 52 | 53 | x2 = x1; 54 | for (int i = 0; i < n; ++i) { 55 | x2(0, i) += i + 2; // Multiple horizontal disparities. 56 | } 57 | 58 | // Last point set as an outlier 59 | x2(0, n - 1) = 10; 60 | x2(1, n - 1) = 10; 61 | 62 | // Setup Ground truth matrix. 63 | double matGTd[] = { 4, 1, 2, 0, 1, 0, 0, 0, 1}; 64 | matGT.read(matGTd); 65 | } 66 | 67 | 68 | // Robust homography solving : 69 | { 70 | orsa::HomographyModel kernel(x1, 6, 6, x2, 6, 6); 71 | 72 | std::vector vec_inliers; 73 | Mat homographyMat(3,3); 74 | 75 | kernel.orsa(vec_inliers, 100, NULL, &homographyMat, true); 76 | 77 | // Assert we found 15 inliers 78 | EXPECT_EQ(15, vec_inliers.size()); 79 | 80 | //-- Re-estimate Homography on all inliers. 81 | kernel.ComputeModel(vec_inliers, &homographyMat); 82 | 83 | // Compare matrix to Ground truth. 84 | EXPECT_MATRIX_NEAR(matGT, homographyMat, 1e-8); 85 | } 86 | } 87 | 88 | /* ************************************************************************* */ 89 | int main() { TestResult tr; return TestRegistry::runAllTests(tr);} 90 | /* ************************************************************************* */ 91 | 92 | -------------------------------------------------------------------------------- /OrsaHomography/libOrsa/numeric/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INSTALL(FILES CMakeLists.txt poly.h 2 | DESTINATION src/libOrsa/numeric) 3 | -------------------------------------------------------------------------------- /OrsaHomography/testing/testing.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007-2011 libmv authors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to 5 | // deal in the Software without restriction, including without limitation the 6 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | // sell copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | // IN THE SOFTWARE. 20 | 21 | #ifndef TESTING_TESTING_H_ 22 | #define TESTING_TESTING_H_ 23 | 24 | #include "extras/libNumerics/matrix.h" 25 | #include "third_party/CppUnitLite/TestHarness.h" 26 | 27 | #define EXPECT_MATRIX_NEAR(a, b, tolerance) \ 28 | do { \ 29 | bool dims_match = (a.nrow() == b.nrow()) && (a.ncol() == b.ncol()); \ 30 | CHECK_EQUAL(a.nrow(),b.nrow()); \ 31 | CHECK_EQUAL(a.ncol(),b.ncol()); \ 32 | if (dims_match) { \ 33 | for (int r = 0; r < a.nrow(); ++r) { \ 34 | for (int c = 0; c < a.ncol(); ++c) { \ 35 | DOUBLES_EQUAL(a(r, c), b(r, c), tolerance); \ 36 | } \ 37 | } \ 38 | } \ 39 | } while(false); 40 | 41 | #define EXPECT_MATRIX_NEAR_ZERO(a, tolerance) \ 42 | do { \ 43 | for (int r = 0; r < a.nrow(); ++r) { \ 44 | for (int c = 0; c < a.ncol(); ++c) { \ 45 | DOUBLES_EQUAL(0.0, a(r, c), tolerance) \ 46 | } \ 47 | } \ 48 | } while(false); 49 | 50 | #define EXPECT_MATRIX_EQ(a, b) \ 51 | do { \ 52 | bool dims_match = (a.nrow() == b.nrow()) && (a.ncol() == b.ncol()); \ 53 | CHECK_EQUAL(a.nrow(),b.nrow()); \ 54 | CHECK_EQUAL(a.ncol(),b.ncol()); \ 55 | if (dims_match) { \ 56 | for (int r = 0; r < a.nrow(); ++r) { \ 57 | for (int c = 0; c < a.ncol(); ++c) { \ 58 | CHECK_EQUAL(a(r, c), b(r, c)) \ 59 | } \ 60 | } \ 61 | } \ 62 | } while(false); 63 | 64 | #define EXPECT_NEAR(expected,actual,threshold) \ 65 | DOUBLES_EQUAL(expected,actual,threshold); 66 | 67 | #define EXPECT_TRUE(condition) \ 68 | CHECK(condition); 69 | 70 | #define EXPECT_FALSE(condition) \ 71 | CHECK(!condition); 72 | 73 | #define EXPECT_EQ(a, b) CHECK_EQUAL(a,b); 74 | 75 | #endif // TESTING_TESTING_H_ 76 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #--------------------- 2 | #Third party libraries 3 | #--------------------- 4 | 5 | ADD_SUBDIRECTORY(CppUnitLite) 6 | ADD_SUBDIRECTORY(svd) 7 | 8 | SET(INCLUDE_INSTALL_DIR src/third_party) 9 | #ADD_SUBDIRECTORY(Eigen) 10 | 11 | ADD_SUBDIRECTORY(zlib) 12 | ADD_SUBDIRECTORY(png) 13 | ADD_SUBDIRECTORY(jpeg) 14 | 15 | INSTALL(FILES CMakeLists.txt DESTINATION src/third_party) 16 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(CppUnitLite) 2 | FILE(GLOB CppUnitLite_SRC "*.h" "*.cpp") 3 | ADD_LIBRARY(CppUnitLite ${CppUnitLite_SRC}) 4 | SET_TARGET_PROPERTIES(CppUnitLite PROPERTIES LINKER_LANGUAGE CXX) 5 | 6 | INSTALL(FILES CMakeLists.txt ${CppUnitLite_SRC} DESTINATION src/third_party/CppUnitLite) 7 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/Failure.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "Failure.h" 4 | 5 | #include 6 | #include 7 | 8 | 9 | Failure::Failure (const SimpleString& theTestName, 10 | const SimpleString& theFileName, 11 | long theLineNumber, 12 | const SimpleString& theCondition) 13 | : message (theCondition), 14 | testName (theTestName), 15 | fileName (theFileName), 16 | lineNumber (theLineNumber) 17 | { 18 | } 19 | 20 | 21 | Failure::Failure (const SimpleString& theTestName, 22 | const SimpleString& theFileName, 23 | long theLineNumber, 24 | const SimpleString& expected, 25 | const SimpleString& actual) 26 | : testName (theTestName), 27 | fileName (theFileName), 28 | lineNumber (theLineNumber) 29 | { 30 | const char *part1 = "expected "; 31 | const char *part3 = " but was: "; 32 | 33 | char *stage = new char [strlen (part1) 34 | + expected.size () 35 | + strlen (part3) 36 | + actual.size () 37 | + 1]; 38 | 39 | sprintf(stage, "%s%s%s%s", 40 | part1, 41 | expected.asCharString(), 42 | part3, 43 | actual.asCharString()); 44 | 45 | message = SimpleString(stage); 46 | 47 | delete stage; 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/Failure.h: -------------------------------------------------------------------------------- 1 | 2 | /////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // FAILURE.H 5 | // 6 | // Failure is a class which holds information pertaining to a specific 7 | // test failure. The stream insertion operator is overloaded to allow easy 8 | // display. 9 | // 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | 13 | #ifndef FAILURE_H 14 | #define FAILURE_H 15 | 16 | #include "SimpleString.h" 17 | 18 | 19 | class Failure 20 | { 21 | 22 | public: 23 | Failure (const SimpleString& theTestName, 24 | const SimpleString& theFileName, 25 | long theLineNumber, 26 | const SimpleString& theCondition); 27 | 28 | Failure (const SimpleString& theTestName, 29 | const SimpleString& theFileName, 30 | long theLineNumber, 31 | const SimpleString& expected, 32 | const SimpleString& actual); 33 | 34 | SimpleString message; 35 | SimpleString testName; 36 | SimpleString fileName; 37 | long lineNumber; 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/SimpleString.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "SimpleString.h" 4 | #include 5 | #include 6 | #include 7 | 8 | SimpleString::SimpleString () 9 | : buffer(new char [1]) 10 | { 11 | buffer [0] = '\0'; 12 | } 13 | 14 | 15 | SimpleString::SimpleString (const char *otherBuffer) 16 | : buffer (new char [strlen (otherBuffer) + 1]) 17 | { 18 | strcpy (buffer, otherBuffer); 19 | } 20 | 21 | SimpleString::SimpleString (const SimpleString& other) 22 | { 23 | buffer = new char [other.size() + 1]; 24 | strcpy(buffer, other.buffer); 25 | } 26 | 27 | 28 | SimpleString SimpleString::operator= (const SimpleString& other) 29 | { 30 | delete buffer; 31 | buffer = new char [other.size() + 1]; 32 | strcpy(buffer, other.buffer); 33 | return *this; 34 | } 35 | 36 | 37 | char *SimpleString::asCharString () const 38 | { 39 | return buffer; 40 | } 41 | 42 | int SimpleString::size() const 43 | { 44 | return strlen (buffer); 45 | } 46 | 47 | SimpleString::~SimpleString () 48 | { 49 | delete [] buffer; 50 | } 51 | 52 | 53 | bool operator== (const SimpleString& left, const SimpleString& right) 54 | { 55 | return !strcmp (left.asCharString (), right.asCharString ()); 56 | } 57 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/SimpleString.h: -------------------------------------------------------------------------------- 1 | 2 | /////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // SIMPLESTRING.H 5 | // 6 | // One of the design goals of CppUnitLite is to compilation with very old C++ 7 | // compilers. For that reason, I've added a simple string class that provides 8 | // only the operations needed in CppUnitLite. 9 | // 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | #ifndef SIMPLE_STRING 13 | #define SIMPLE_STRING 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class SimpleString 20 | { 21 | friend bool operator== (const SimpleString& left, const SimpleString& right); 22 | 23 | public: 24 | SimpleString (); 25 | SimpleString (const char *value); 26 | SimpleString (const SimpleString& other); 27 | ~SimpleString (); 28 | 29 | SimpleString operator= (const SimpleString& other); 30 | 31 | char *asCharString () const; 32 | int size() const; 33 | 34 | private: 35 | char *buffer; 36 | }; 37 | 38 | template 39 | SimpleString StringFrom (const T & other) 40 | { 41 | std::ostringstream os; 42 | os << other; 43 | return SimpleString(os.str().c_str()); 44 | } 45 | template <> 46 | inline SimpleString StringFrom (const bool & value) 47 | { 48 | return SimpleString((value ? "true" : "false")); 49 | } 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/Test.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "Test.h" 4 | #include "TestRegistry.h" 5 | #include "TestResult.h" 6 | #include "Failure.h" 7 | 8 | 9 | Test::Test (const SimpleString& testName) 10 | : name_ (testName) 11 | { 12 | TestRegistry::addTest (this); 13 | } 14 | 15 | 16 | 17 | Test *Test::getNext() const 18 | { 19 | return next_; 20 | } 21 | 22 | void Test::setNext(Test *test) 23 | { 24 | next_ = test; 25 | } 26 | 27 | bool Test::check(long expected, long actual, TestResult& result, const SimpleString& fileName, long lineNumber) 28 | { 29 | if (expected == actual) 30 | return true; 31 | result.addFailure ( 32 | Failure ( 33 | name_, 34 | StringFrom (__FILE__), 35 | __LINE__, 36 | StringFrom (expected), 37 | StringFrom (actual))); 38 | 39 | return false; 40 | 41 | } 42 | 43 | 44 | bool Test::check(const SimpleString& expected, const SimpleString& actual, TestResult& result, const SimpleString& fileName, long lineNumber) 45 | { 46 | if (expected == actual) 47 | return true; 48 | result.addFailure ( 49 | Failure ( 50 | name_, 51 | StringFrom (__FILE__), 52 | __LINE__, 53 | expected, 54 | actual)); 55 | 56 | return false; 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/Test.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // TEST.H 4 | // 5 | // This file contains the Test class along with the macros which make effective 6 | // in the harness. 7 | // 8 | /////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef TEST_H 11 | #define TEST_H 12 | 13 | 14 | #include 15 | #include "SimpleString.h" 16 | 17 | class TestResult; 18 | 19 | 20 | 21 | class Test 22 | { 23 | public: 24 | Test (const SimpleString& testName); 25 | virtual ~Test() {}; 26 | 27 | virtual void run (TestResult& result) = 0; 28 | 29 | 30 | void setNext(Test *test); 31 | Test *getNext () const; 32 | 33 | protected: 34 | 35 | bool check (long expected, long actual, TestResult& result, const SimpleString& fileName, long lineNumber); 36 | bool check (const SimpleString& expected, const SimpleString& actual, TestResult& result, const SimpleString& fileName, long lineNumber); 37 | 38 | SimpleString name_; 39 | Test *next_; 40 | 41 | }; 42 | 43 | 44 | /*#define TEST(testName, testGroup)\ 45 | class testGroup##testName##Test : public Test \ 46 | { public: testGroup##testName##Test () : Test (#testName "Test") {} \ 47 | void run (TestResult& result_);} \ 48 | testGroup##testName##Instance; \ 49 | void testGroup##testName##Test::run (TestResult& result_) */ 50 | 51 | #define TEST(testGroup, testName)\ 52 | class testGroup##_##testName##_##Test : public Test \ 53 | { public:\ 54 | testGroup##_##testName##_##Test () : Test (#testName "Test") {} \ 55 | void run (TestResult& result_)\ 56 | ;} \ 57 | testGroup##_##testName##Instance; \ 58 | void testGroup##_##testName##_##Test::run (TestResult& result_) 59 | 60 | 61 | 62 | #define CHECK(condition)\ 63 | { if (!(condition)) \ 64 | { result_.addFailure (Failure (name_, __FILE__,__LINE__, #condition)); return; } } 65 | 66 | #define CHECK_EQUAL(expected,actual)\ 67 | { if ((expected) != (actual)) result_.addFailure(Failure(name_, __FILE__, __LINE__, StringFrom(expected), StringFrom(actual))); } 68 | 69 | 70 | #define LONGS_EQUAL(expected,actual)\ 71 | { long actualTemp = actual; \ 72 | long expectedTemp = expected; \ 73 | if ((expectedTemp) != (actualTemp)) \ 74 | { result_.addFailure (Failure (name_, __FILE__, __LINE__, StringFrom(expectedTemp), \ 75 | StringFrom(actualTemp))); return; } } 76 | 77 | 78 | 79 | #define DOUBLES_EQUAL(expected,actual,threshold)\ 80 | { double actualTemp = (double) actual; \ 81 | double expectedTemp = (double) expected; \ 82 | if (fabs ((expectedTemp)-(actualTemp)) > threshold) \ 83 | { result_.addFailure (Failure (name_, __FILE__, __LINE__, \ 84 | StringFrom(expectedTemp), StringFrom(actualTemp))); return; } } 85 | 86 | #define FAIL(text) \ 87 | { result_.addFailure (Failure (name_, __FILE__, __LINE__,(text))); return; } 88 | 89 | 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/TestHarness.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // TESTHARNESS.H 4 | // 5 | // The primary include file for the framework. 6 | // 7 | /////////////////////////////////////////////////////////////////////////////// 8 | 9 | #ifndef TESTHARNESS_H 10 | #define TESTHARNESS_H 11 | 12 | #include "Test.h" 13 | #include "TestResult.h" 14 | #include "Failure.h" 15 | #include "TestRegistry.h" 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/TestRegistry.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "Test.h" 4 | #include "TestResult.h" 5 | #include "TestRegistry.h" 6 | #include 7 | 8 | void TestRegistry::addTest (Test *test) 9 | { 10 | instance ().add (test); 11 | } 12 | 13 | 14 | int TestRegistry::runAllTests (TestResult& result) 15 | { 16 | return instance ().run (result); 17 | } 18 | 19 | 20 | TestRegistry& TestRegistry::instance () 21 | { 22 | static TestRegistry registry; 23 | return registry; 24 | } 25 | 26 | 27 | void TestRegistry::add (Test *test) 28 | { 29 | if (tests == 0) { 30 | tests = test; 31 | return; 32 | } 33 | 34 | test->setNext (tests); 35 | tests = test; 36 | } 37 | 38 | int TestRegistry::run (TestResult& result) 39 | { 40 | result.testsStarted (); 41 | int failureCountCounter = 0; 42 | for (Test *test = tests; test != 0; test = test->getNext ()) { 43 | std::cout<< "\n\n Launching Test : "<< typeid(*test).name() 44 | << std::endl << std::endl; 45 | test->run (result); 46 | if (failureCountCounter != result.getFailureCount()) 47 | { 48 | failureCountCounter = result.getFailureCount(); 49 | std::cout << "\n\n \t TEST -> [FAILURE]\n" << std::endl; 50 | } 51 | else 52 | { 53 | std::cout << "\n\n \t TEST -> [OK]\n" << std::endl; 54 | } 55 | } 56 | result.testsEnded (); 57 | return result.getFailureCount(); 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/TestRegistry.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // TESTREGISTRY.H 4 | // 5 | // TestRegistry is a singleton collection of all the tests to run in a system. 6 | // 7 | /////////////////////////////////////////////////////////////////////////////// 8 | 9 | #ifndef TESTREGISTRY_H 10 | #define TESTREGISTRY_H 11 | 12 | 13 | class Test; 14 | class TestResult; 15 | 16 | 17 | 18 | class TestRegistry 19 | { 20 | public: 21 | static void addTest (Test *test); 22 | static int runAllTests (TestResult& result); 23 | 24 | private: 25 | 26 | static TestRegistry& instance (); 27 | void add (Test *test); 28 | int run (TestResult& result); 29 | 30 | 31 | Test *tests; 32 | 33 | }; 34 | 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/TestResult.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "TestResult.h" 3 | #include "Failure.h" 4 | 5 | #include 6 | 7 | 8 | TestResult::TestResult () 9 | : failureCount (0) 10 | { 11 | } 12 | 13 | 14 | void TestResult::testsStarted () 15 | { 16 | } 17 | 18 | 19 | void TestResult::addFailure (const Failure& failure) 20 | { 21 | fprintf (stdout, "%s%s%s%s%ld%s%s\n", 22 | "Failure: \"", 23 | failure.message.asCharString (), 24 | "\" " , 25 | "line ", 26 | failure.lineNumber, 27 | " in ", 28 | failure.fileName.asCharString ()); 29 | 30 | failureCount++; 31 | } 32 | 33 | 34 | void TestResult::testsEnded () 35 | { 36 | fprintf (stdout, "\n---------\n[TEST SESSION RESULTS]\n---------\n"); 37 | if (failureCount > 0) 38 | fprintf (stdout, "There were %d failures\n", failureCount); 39 | else 40 | fprintf (stdout, "There were no test failures\n"); 41 | } 42 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/CppUnitLite/TestResult.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // TESTRESULT.H 4 | // 5 | // A TestResult is a collection of the history of some test runs. Right now 6 | // it just collects failures. 7 | // 8 | /////////////////////////////////////////////////////////////////////////////// 9 | 10 | 11 | 12 | #ifndef TESTRESULT_H 13 | #define TESTRESULT_H 14 | 15 | class Failure; 16 | 17 | class TestResult 18 | { 19 | public: 20 | TestResult (); 21 | virtual ~TestResult() {}; 22 | virtual void testsStarted (); 23 | virtual void addFailure (const Failure& failure); 24 | virtual void testsEnded (); 25 | 26 | int getFailureCount() {return failureCount;} 27 | 28 | private: 29 | int failureCount; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/Eigen2Support: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 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 EIGEN2SUPPORT_H 26 | #define EIGEN2SUPPORT_H 27 | 28 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) 29 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header 30 | #endif 31 | 32 | #include "src/Core/util/DisableStupidWarnings.h" 33 | 34 | namespace Eigen { 35 | 36 | /** \defgroup Eigen2Support_Module Eigen2 support module 37 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. 38 | * 39 | * To use it, define EIGEN2_SUPPORT before including any Eigen header 40 | * \code 41 | * #define EIGEN2_SUPPORT 42 | * \endcode 43 | * 44 | */ 45 | 46 | #include "src/Eigen2Support/Macros.h" 47 | #include "src/Eigen2Support/Memory.h" 48 | #include "src/Eigen2Support/Meta.h" 49 | #include "src/Eigen2Support/Lazy.h" 50 | #include "src/Eigen2Support/Cwise.h" 51 | #include "src/Eigen2Support/CwiseOperators.h" 52 | #include "src/Eigen2Support/TriangularSolver.h" 53 | #include "src/Eigen2Support/Block.h" 54 | #include "src/Eigen2Support/VectorBlock.h" 55 | #include "src/Eigen2Support/Minor.h" 56 | #include "src/Eigen2Support/MathFunctions.h" 57 | 58 | 59 | } // namespace Eigen 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | // Eigen2 used to include iostream 64 | #include 65 | 66 | #define USING_PART_OF_NAMESPACE_EIGEN \ 67 | EIGEN_USING_MATRIX_TYPEDEFS \ 68 | using Eigen::Matrix; \ 69 | using Eigen::MatrixBase; \ 70 | using Eigen::ei_random; \ 71 | using Eigen::ei_real; \ 72 | using Eigen::ei_imag; \ 73 | using Eigen::ei_conj; \ 74 | using Eigen::ei_abs; \ 75 | using Eigen::ei_abs2; \ 76 | using Eigen::ei_sqrt; \ 77 | using Eigen::ei_exp; \ 78 | using Eigen::ei_log; \ 79 | using Eigen::ei_sin; \ 80 | using Eigen::ei_cos; 81 | 82 | #endif // EIGEN2SUPPORT_H 83 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/README.ipol: -------------------------------------------------------------------------------- 1 | Project: EIGEN 2 | URL: http://eigen.tuxfamily.org/ 3 | License: GPL/LGPL 4 | Upstream version: Eigen 3.0.3 released on 06.10.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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/RegexUtils.cmake: -------------------------------------------------------------------------------- 1 | function(escape_string_as_regex _str_out _str_in) 2 | STRING(REGEX REPLACE "\\\\" "\\\\\\\\" FILETEST2 "${_str_in}") 3 | STRING(REGEX REPLACE "([.$+*?|-])" "\\\\\\1" FILETEST2 "${FILETEST2}") 4 | STRING(REGEX REPLACE "\\^" "\\\\^" FILETEST2 "${FILETEST2}") 5 | STRING(REGEX REPLACE "\\(" "\\\\(" FILETEST2 "${FILETEST2}") 6 | STRING(REGEX REPLACE "\\)" "\\\\)" FILETEST2 "${FILETEST2}") 7 | STRING(REGEX REPLACE "\\[" "\\\\[" FILETEST2 "${FILETEST2}") 8 | STRING(REGEX REPLACE "\\]" "\\\\]" FILETEST2 "${FILETEST2}") 9 | SET(${_str_out} "${FILETEST2}" PARENT_SCOPE) 10 | endfunction() 11 | 12 | function(test_escape_string_as_regex) 13 | SET(test1 "\\.^$-+*()[]?|") 14 | escape_string_as_regex(test2 "${test1}") 15 | SET(testRef "\\\\\\.\\^\\$\\-\\+\\*\\(\\)\\[\\]\\?\\|") 16 | if(NOT test2 STREQUAL testRef) 17 | message("Error in the escape_string_for_regex function : \n ${test1} was escaped as ${test2}, should be ${testRef}") 18 | endif(NOT test2 STREQUAL testRef) 19 | endfunction() 20 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | 27 | /* All the parameters defined in this file can be specialized in the 28 | * architecture specific files, and/or by the user. 29 | * More to come... */ 30 | 31 | #ifndef EIGEN_DEFAULT_SETTINGS_H 32 | #define EIGEN_DEFAULT_SETTINGS_H 33 | 34 | /** Defines the maximal loop size to enable meta unrolling of loops. 35 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 36 | * it does not correspond to the number of iterations or the number of instructions 37 | */ 38 | #ifndef EIGEN_UNROLLING_LIMIT 39 | #define EIGEN_UNROLLING_LIMIT 100 40 | #endif 41 | 42 | /** Defines the threshold between a "small" and a "large" matrix. 43 | * This threshold is mainly used to select the proper product implementation. 44 | */ 45 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 46 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 47 | #endif 48 | 49 | /** Defines the maximal width of the blocks used in the triangular product and solver 50 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 51 | */ 52 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 53 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 54 | #endif 55 | 56 | 57 | /** Defines the default number of registers available for that architecture. 58 | * Currently it must be 8 or 16. Other values will fail. 59 | */ 60 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 61 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 62 | #endif 63 | 64 | #endif // EIGEN_DEFAULT_SETTINGS_H 65 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // 2536 - type qualifiers are meaningless here 25 | // ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent 26 | // typedef that may be a reference type. 27 | // 279 - controlling expression is constant 28 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 29 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 30 | #pragma warning push 31 | #endif 32 | #pragma warning disable 2196 2536 279 33 | #elif defined __clang__ 34 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 35 | // this is really a stupid warning as it warns on compile-time expressions involving enums 36 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 37 | #pragma clang diagnostic push 38 | #endif 39 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 40 | #endif 41 | 42 | #endif // not EIGEN_WARNINGS_DISABLED 43 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 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 EIGEN_LAZY_H 26 | #define EIGEN_LAZY_H 27 | 28 | /** \deprecated it is only used by lazy() which is deprecated 29 | * 30 | * \returns an expression of *this with added flags 31 | * 32 | * Example: \include MatrixBase_marked.cpp 33 | * Output: \verbinclude MatrixBase_marked.out 34 | * 35 | * \sa class Flagged, extract(), part() 36 | */ 37 | template 38 | template 39 | inline const Flagged 40 | MatrixBase::marked() const 41 | { 42 | return derived(); 43 | } 44 | 45 | /** \deprecated use MatrixBase::noalias() 46 | * 47 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 48 | * 49 | * Example: \include MatrixBase_lazy.cpp 50 | * Output: \verbinclude MatrixBase_lazy.out 51 | * 52 | * \sa class Flagged, marked() 53 | */ 54 | template 55 | inline const Flagged 56 | MatrixBase::lazy() const 57 | { 58 | return derived(); 59 | } 60 | 61 | 62 | /** \internal 63 | * Overloaded to perform an efficient C += (A*B).lazy() */ 64 | template 65 | template 66 | Derived& MatrixBase::operator+=(const Flagged, 0, 67 | EvalBeforeAssigningBit>& other) 68 | { 69 | other._expression().derived().addTo(derived()); return derived(); 70 | } 71 | 72 | /** \internal 73 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 74 | template 75 | template 76 | Derived& MatrixBase::operator-=(const Flagged, 0, 77 | EvalBeforeAssigningBit>& other) 78 | { 79 | other._expression().derived().subTo(derived()); return derived(); 80 | } 81 | 82 | #endif // EIGEN_LAZY_H 83 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MATH_FUNCTIONS_H 26 | #define EIGEN2_MATH_FUNCTIONS_H 27 | 28 | template inline typename NumTraits::Real ei_real(const T& x) { return internal::real(x); } 29 | template inline typename NumTraits::Real ei_imag(const T& x) { return internal::imag(x); } 30 | template inline T ei_conj(const T& x) { return internal::conj(x); } 31 | template inline typename NumTraits::Real ei_abs (const T& x) { return internal::abs(x); } 32 | template inline typename NumTraits::Real ei_abs2(const T& x) { return internal::abs2(x); } 33 | template inline T ei_sqrt(const T& x) { return internal::sqrt(x); } 34 | template inline T ei_exp (const T& x) { return internal::exp(x); } 35 | template inline T ei_log (const T& x) { return internal::log(x); } 36 | template inline T ei_sin (const T& x) { return internal::sin(x); } 37 | template inline T ei_cos (const T& x) { return internal::cos(x); } 38 | template inline T ei_atan2(const T& x,const T& y) { return internal::atan2(x,y); } 39 | template inline T ei_pow (const T& x,const T& y) { return internal::pow(x,y); } 40 | template inline T ei_random () { return internal::random(); } 41 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 42 | 43 | template inline T precision () { return NumTraits::dummy_precision(); } 44 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 45 | 46 | 47 | template 48 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 49 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 50 | { 51 | return internal::isMuchSmallerThan(x, y, precision); 52 | } 53 | 54 | template 55 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 56 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 57 | { 58 | return internal::isApprox(x, y, precision); 59 | } 60 | 61 | template 62 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 63 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 64 | { 65 | return internal::isApproxOrLessThan(x, y, precision); 66 | } 67 | 68 | #endif // EIGEN2_MATH_FUNCTIONS_H 69 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MEMORY_H 26 | #define EIGEN2_MEMORY_H 27 | 28 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 29 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 30 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 31 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 32 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 33 | 34 | template inline void* ei_conditional_aligned_malloc(size_t size) 35 | { 36 | return internal::conditional_aligned_malloc(size); 37 | } 38 | template inline void ei_conditional_aligned_free(void *ptr) 39 | { 40 | internal::conditional_aligned_free(ptr); 41 | } 42 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 43 | { 44 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 45 | } 46 | 47 | template inline T* ei_aligned_new(size_t size) 48 | { 49 | return internal::aligned_new(size); 50 | } 51 | template inline void ei_aligned_delete(T *ptr, size_t size) 52 | { 53 | return internal::aligned_delete(ptr, size); 54 | } 55 | 56 | 57 | 58 | #endif // EIGEN2_MACROS_H 59 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN2_QR_H 27 | #define EIGEN2_QR_H 28 | 29 | template 30 | class QR : public HouseholderQR 31 | { 32 | public: 33 | 34 | typedef HouseholderQR Base; 35 | typedef Block MatrixRBlockType; 36 | 37 | QR() : Base() {} 38 | 39 | template 40 | explicit QR(const T& t) : Base(t) {} 41 | 42 | template 43 | bool solve(const MatrixBase& b, ResultType *result) const 44 | { 45 | *result = static_cast(this)->solve(b); 46 | return true; 47 | } 48 | 49 | MatrixType matrixQ(void) const { 50 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 51 | ret = this->householderQ() * ret; 52 | return ret; 53 | } 54 | 55 | bool isFullRank() const { 56 | return true; 57 | } 58 | 59 | const TriangularView 60 | matrixR(void) const 61 | { 62 | int cols = this->cols(); 63 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 64 | } 65 | }; 66 | 67 | /** \return the QR decomposition of \c *this. 68 | * 69 | * \sa class QR 70 | */ 71 | template 72 | const QR::PlainObject> 73 | MatrixBase::qr() const 74 | { 75 | return QR(eval()); 76 | } 77 | 78 | 79 | #endif // EIGEN2_QR_H 80 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 26 | #define EIGEN_TRIANGULAR_SOLVER2_H 27 | 28 | const unsigned int UnitDiagBit = UnitDiag; 29 | const unsigned int SelfAdjointBit = SelfAdjoint; 30 | const unsigned int UpperTriangularBit = Upper; 31 | const unsigned int LowerTriangularBit = Lower; 32 | 33 | const unsigned int UpperTriangular = Upper; 34 | const unsigned int LowerTriangular = Lower; 35 | const unsigned int UnitUpperTriangular = UnitUpper; 36 | const unsigned int UnitLowerTriangular = UnitLower; 37 | 38 | template 39 | template 40 | typename ExpressionType::PlainObject 41 | Flagged::solveTriangular(const MatrixBase& other) const 42 | { 43 | return m_matrix.template triangularView().solve(other.derived()); 44 | } 45 | 46 | template 47 | template 48 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 49 | { 50 | m_matrix.template triangularView().solveInPlace(other.derived()); 51 | } 52 | 53 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 54 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Geometry/EulerAngles.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_EULERANGLES_H 26 | #define EIGEN_EULERANGLES_H 27 | 28 | /** \geometry_module \ingroup Geometry_Module 29 | * 30 | * 31 | * \returns the Euler-angles of the rotation matrix \c *this using the convention defined by the triplet (\a a0,\a a1,\a a2) 32 | * 33 | * Each of the three parameters \a a0,\a a1,\a a2 represents the respective rotation axis as an integer in {0,1,2}. 34 | * For instance, in: 35 | * \code Vector3f ea = mat.eulerAngles(2, 0, 2); \endcode 36 | * "2" represents the z axis and "0" the x axis, etc. The returned angles are such that 37 | * we have the following equality: 38 | * \code 39 | * mat == AngleAxisf(ea[0], Vector3f::UnitZ()) 40 | * * AngleAxisf(ea[1], Vector3f::UnitX()) 41 | * * AngleAxisf(ea[2], Vector3f::UnitZ()); \endcode 42 | * This corresponds to the right-multiply conventions (with right hand side frames). 43 | */ 44 | template 45 | inline Matrix::Scalar,3,1> 46 | MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const 47 | { 48 | /* Implemented from Graphics Gems IV */ 49 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3) 50 | 51 | Matrix res; 52 | typedef Matrix Vector2; 53 | const Scalar epsilon = NumTraits::dummy_precision(); 54 | 55 | const Index odd = ((a0+1)%3 == a1) ? 0 : 1; 56 | const Index i = a0; 57 | const Index j = (a0 + 1 + odd)%3; 58 | const Index k = (a0 + 2 - odd)%3; 59 | 60 | if (a0==a2) 61 | { 62 | Scalar s = Vector2(coeff(j,i) , coeff(k,i)).norm(); 63 | res[1] = internal::atan2(s, coeff(i,i)); 64 | if (s > epsilon) 65 | { 66 | res[0] = internal::atan2(coeff(j,i), coeff(k,i)); 67 | res[2] = internal::atan2(coeff(i,j),-coeff(i,k)); 68 | } 69 | else 70 | { 71 | res[0] = Scalar(0); 72 | res[2] = (coeff(i,i)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 73 | } 74 | } 75 | else 76 | { 77 | Scalar c = Vector2(coeff(i,i) , coeff(i,j)).norm(); 78 | res[1] = internal::atan2(-coeff(i,k), c); 79 | if (c > epsilon) 80 | { 81 | res[0] = internal::atan2(coeff(j,k), coeff(k,k)); 82 | res[2] = internal::atan2(coeff(i,j), coeff(i,i)); 83 | } 84 | else 85 | { 86 | res[0] = Scalar(0); 87 | res[2] = (coeff(i,k)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 88 | } 89 | } 90 | if (!odd) 91 | res = -res; 92 | return res; 93 | } 94 | 95 | 96 | #endif // EIGEN_EULERANGLES_H 97 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 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_BLOCK_HOUSEHOLDER_H 27 | #define EIGEN_BLOCK_HOUSEHOLDER_H 28 | 29 | // This file contains some helper function to deal with block householder reflectors 30 | 31 | namespace internal { 32 | 33 | /** \internal */ 34 | template 35 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 36 | { 37 | typedef typename TriangularFactorType::Index Index; 38 | typedef typename VectorsType::Scalar Scalar; 39 | const Index nbVecs = vectors.cols(); 40 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 41 | 42 | for(Index i = 0; i < nbVecs; i++) 43 | { 44 | Index rs = vectors.rows() - i; 45 | Scalar Vii = vectors(i,i); 46 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 47 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 48 | * vectors.col(i).tail(rs); 49 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 50 | // FIXME add .noalias() once the triangular product can work inplace 51 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 52 | * triFactor.col(i).head(i); 53 | triFactor(i,i) = hCoeffs(i); 54 | } 55 | } 56 | 57 | /** \internal */ 58 | template 59 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 60 | { 61 | typedef typename MatrixType::Index Index; 62 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 63 | Index nbVecs = vectors.cols(); 64 | Matrix T(nbVecs,nbVecs); 65 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 66 | 67 | const TriangularView& V(vectors); 68 | 69 | // A -= V T V^* A 70 | Matrix tmp = V.adjoint() * mat; 72 | // FIXME add .noalias() once the triangular product can work inplace 73 | tmp = T.template triangularView().adjoint() * tmp; 74 | mat.noalias() -= V * tmp; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 80 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Sparse/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // 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_COREITERATORS_H 26 | #define EIGEN_COREITERATORS_H 27 | 28 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 29 | */ 30 | 31 | /** \class InnerIterator 32 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 33 | * 34 | * todo 35 | */ 36 | 37 | // generic version for dense matrix and expressions 38 | template class DenseBase::InnerIterator 39 | { 40 | protected: 41 | typedef typename Derived::Scalar Scalar; 42 | typedef typename Derived::Index Index; 43 | 44 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 45 | public: 46 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 47 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 48 | {} 49 | 50 | EIGEN_STRONG_INLINE Scalar value() const 51 | { 52 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 53 | : m_expression.coeff(m_inner, m_outer); 54 | } 55 | 56 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 57 | 58 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 59 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 60 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 61 | 62 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 63 | 64 | protected: 65 | const Derived& m_expression; 66 | Index m_inner; 67 | const Index m_outer; 68 | const Index m_end; 69 | }; 70 | 71 | #endif // EIGEN_COREITERATORS_H 72 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Sparse/SparseAssign.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/third_party/Eigen/src/Sparse/SparseAssign.h -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Sparse/SparseDot.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_DOT_H 26 | #define EIGEN_SPARSE_DOT_H 27 | 28 | template 29 | template 30 | typename internal::traits::Scalar 31 | SparseMatrixBase::dot(const MatrixBase& other) const 32 | { 33 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 34 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 35 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 36 | EIGEN_STATIC_ASSERT((internal::is_same::value), 37 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 38 | 39 | eigen_assert(size() == other.size()); 40 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 41 | 42 | typename Derived::InnerIterator i(derived(),0); 43 | Scalar res = 0; 44 | while (i) 45 | { 46 | res += internal::conj(i.value()) * other.coeff(i.index()); 47 | ++i; 48 | } 49 | return res; 50 | } 51 | 52 | template 53 | template 54 | typename internal::traits::Scalar 55 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 56 | { 57 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 59 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 60 | EIGEN_STATIC_ASSERT((internal::is_same::value), 61 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 62 | 63 | eigen_assert(size() == other.size()); 64 | 65 | typename Derived::InnerIterator i(derived(),0); 66 | typename OtherDerived::InnerIterator j(other.derived(),0); 67 | Scalar res = 0; 68 | while (i && j) 69 | { 70 | if (i.index()==j.index()) 71 | { 72 | res += internal::conj(i.value()) * j.value(); 73 | ++i; ++j; 74 | } 75 | else if (i.index() 84 | inline typename NumTraits::Scalar>::Real 85 | SparseMatrixBase::squaredNorm() const 86 | { 87 | return internal::real((*this).cwiseAbs2().sum()); 88 | } 89 | 90 | template 91 | inline typename NumTraits::Scalar>::Real 92 | SparseMatrixBase::norm() const 93 | { 94 | return internal::sqrt(squaredNorm()); 95 | } 96 | 97 | #endif // EIGEN_SPARSE_DOT_H 98 | -------------------------------------------------------------------------------- /OrsaHomography/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 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Sparse/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSEREDUX_H 26 | #define EIGEN_SPARSEREDUX_H 27 | 28 | template 29 | typename internal::traits::Scalar 30 | SparseMatrixBase::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | Scalar res = 0; 34 | for (Index j=0; j 41 | typename internal::traits >::Scalar 42 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 43 | { 44 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 45 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 46 | } 47 | 48 | template 49 | typename internal::traits >::Scalar 50 | SparseVector<_Scalar,_Options,_Index>::sum() const 51 | { 52 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 53 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 54 | } 55 | 56 | #endif // EIGEN_SPARSEREDUX_H 57 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/Sparse/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 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_SPARSETRANSPOSE_H 26 | #define EIGEN_SPARSETRANSPOSE_H 27 | 28 | template class TransposeImpl 29 | : public SparseMatrixBase > 30 | { 31 | typedef typename internal::remove_all::type _MatrixTypeNested; 32 | public: 33 | 34 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose) 35 | 36 | class InnerIterator; 37 | class ReverseInnerIterator; 38 | 39 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 40 | }; 41 | 42 | template class TransposeImpl::InnerIterator 43 | : public _MatrixTypeNested::InnerIterator 44 | { 45 | typedef typename _MatrixTypeNested::InnerIterator Base; 46 | public: 47 | 48 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, Index outer) 49 | : Base(trans.derived().nestedExpression(), outer) 50 | {} 51 | inline Index row() const { return Base::col(); } 52 | inline Index col() const { return Base::row(); } 53 | }; 54 | 55 | template class TransposeImpl::ReverseInnerIterator 56 | : public _MatrixTypeNested::ReverseInnerIterator 57 | { 58 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 59 | public: 60 | 61 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, Index outer) 62 | : Base(xpr.derived().nestedExpression(), outer) 63 | {} 64 | inline Index row() const { return Base::col(); } 65 | inline Index col() const { return Base::row(); } 66 | }; 67 | 68 | #endif // EIGEN_SPARSETRANSPOSE_H 69 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 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 EIGEN_MISC_SOLVE_H 26 | #define EIGEN_MISC_SOLVE_H 27 | 28 | namespace internal { 29 | 30 | /** \class solve_retval_base 31 | * 32 | */ 33 | template 34 | struct traits > 35 | { 36 | typedef typename DecompositionType::MatrixType MatrixType; 37 | typedef Matrix ReturnType; 43 | }; 44 | 45 | template struct solve_retval_base 46 | : public ReturnByValue > 47 | { 48 | typedef typename remove_all::type RhsNestedCleaned; 49 | typedef _DecompositionType DecompositionType; 50 | typedef ReturnByValue Base; 51 | typedef typename Base::Index Index; 52 | 53 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 54 | : m_dec(dec), m_rhs(rhs) 55 | {} 56 | 57 | inline Index rows() const { return m_dec.cols(); } 58 | inline Index cols() const { return m_rhs.cols(); } 59 | inline const DecompositionType& dec() const { return m_dec; } 60 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 61 | 62 | template inline void evalTo(Dest& dst) const 63 | { 64 | static_cast*>(this)->evalTo(dst); 65 | } 66 | 67 | protected: 68 | const DecompositionType& m_dec; 69 | const typename Rhs::Nested m_rhs; 70 | }; 71 | 72 | } // end namespace internal 73 | 74 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 75 | typedef typename DecompositionType::MatrixType MatrixType; \ 76 | typedef typename MatrixType::Scalar Scalar; \ 77 | typedef typename MatrixType::RealScalar RealScalar; \ 78 | typedef typename MatrixType::Index Index; \ 79 | typedef Eigen::internal::solve_retval_base Base; \ 80 | using Base::dec; \ 81 | using Base::rhs; \ 82 | using Base::rows; \ 83 | using Base::cols; \ 84 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 85 | : Base(dec, rhs) {} 86 | 87 | #endif // EIGEN_MISC_SOLVE_H 88 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | // This file is a base class plugin containing common coefficient wise functions. 27 | 28 | /** \returns an expression of the difference of \c *this and \a other 29 | * 30 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 31 | * 32 | * \sa class CwiseBinaryOp, operator-=() 33 | */ 34 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 35 | 36 | /** \returns an expression of the sum of \c *this and \a other 37 | * 38 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 39 | * 40 | * \sa class CwiseBinaryOp, operator+=() 41 | */ 42 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 43 | 44 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 45 | * 46 | * The template parameter \a CustomBinaryOp is the type of the functor 47 | * of the custom operator (see class CwiseBinaryOp for an example) 48 | * 49 | * Here is an example illustrating the use of custom functors: 50 | * \include class_CwiseBinaryOp.cpp 51 | * Output: \verbinclude class_CwiseBinaryOp.out 52 | * 53 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 54 | */ 55 | template 56 | EIGEN_STRONG_INLINE const CwiseBinaryOp 57 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 58 | { 59 | return CwiseBinaryOp(derived(), other.derived(), func); 60 | } 61 | 62 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 27 | 28 | /** \returns an expression of the coefficient-wise absolute value of \c *this 29 | * 30 | * Example: \include MatrixBase_cwiseAbs.cpp 31 | * Output: \verbinclude MatrixBase_cwiseAbs.out 32 | * 33 | * \sa cwiseAbs2() 34 | */ 35 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 36 | cwiseAbs() const { return derived(); } 37 | 38 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 39 | * 40 | * Example: \include MatrixBase_cwiseAbs2.cpp 41 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 42 | * 43 | * \sa cwiseAbs() 44 | */ 45 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 46 | cwiseAbs2() const { return derived(); } 47 | 48 | /** \returns an expression of the coefficient-wise square root of *this. 49 | * 50 | * Example: \include MatrixBase_cwiseSqrt.cpp 51 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 52 | * 53 | * \sa cwisePow(), cwiseSquare() 54 | */ 55 | inline const CwiseUnaryOp, const Derived> 56 | cwiseSqrt() const { return derived(); } 57 | 58 | /** \returns an expression of the coefficient-wise inverse of *this. 59 | * 60 | * Example: \include MatrixBase_cwiseInverse.cpp 61 | * Output: \verbinclude MatrixBase_cwiseInverse.out 62 | * 63 | * \sa cwiseProduct() 64 | */ 65 | inline const CwiseUnaryOp, const Derived> 66 | cwiseInverse() const { return derived(); } 67 | 68 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 69 | * 70 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 71 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 72 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 73 | * isMuchSmallerThan(). 74 | * 75 | * \sa cwiseEqual(const MatrixBase &) const 76 | */ 77 | inline const CwiseUnaryOp >, const Derived> 78 | cwiseEqual(const Scalar& s) const 79 | { 80 | return CwiseUnaryOp >,const Derived> 81 | (derived(), std::bind1st(std::equal_to(), s)); 82 | } 83 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(jpeg) 2 | 3 | SET(LIBJPEG_SYSDEP jmemnobs.c) 4 | 5 | SET(LIBJPEG_COMMON jaricom.c jcomapi.c jutils.c jerror.c jmemmgr.c) 6 | 7 | SET(LIBJPEG_CLIB 8 | jcapimin.c jcapistd.c jcarith.c jctrans.c jcparam.c 9 | jdatadst.c jcinit.c jcmaster.c jcmarker.c jcmainct.c 10 | jcprepct.c jccoefct.c jccolor.c jcsample.c jchuff.c 11 | jcdctmgr.c jfdctfst.c jfdctflt.c jfdctint.c 12 | ) 13 | 14 | SET(LIBJPEG_DLIB 15 | jdapimin.c jdapistd.c jdarith.c jdtrans.c jdatasrc.c 16 | jdmaster.c jdinput.c jdmarker.c jdhuff.c jdmainct.c 17 | jdcoefct.c jdpostct.c jddctmgr.c jidctfst.c jidctflt.c 18 | jidctint.c jdsample.c jdcolor.c jquant1.c jquant2.c 19 | jdmerge.c 20 | ) 21 | 22 | IF(WIN32) 23 | ADD_DEFINITIONS( -DJPEGSTATIC -D_CRT_SECURE_NO_WARNINGS) 24 | ENDIF(WIN32) 25 | 26 | FILE(GLOB LIBJPEG_H *.h ) 27 | 28 | FIND_PACKAGE(JPEG) 29 | IF(NOT JPEG_FOUND) 30 | ADD_LIBRARY(jpeg ${LIBJPEG_SYSDEP} ${LIBJPEG_COMMON} ${LIBJPEG_CLIB} ${LIBJPEG_DLIB} ${LIBJPEG_H}) 31 | ENDIF(NOT JPEG_FOUND) 32 | 33 | ## INSTALL ## 34 | SET(MISC README README.ipol) 35 | INSTALL(FILES CMakeLists.txt ${MISC} 36 | ${LIBJPEG_SYSDEP} ${LIBJPEG_COMMON} ${LIBJPEG_CLIB} ${LIBJPEG_DLIB} ${LIBJPEG_H} 37 | DESTINATION src/third_party/jpeg) 38 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/README.ipol: -------------------------------------------------------------------------------- 1 | Project: JPEG 2 | URL: http://www.ijg.org/ 3 | License: No general name, project specific, see README ("LEGAL ISSUES") 4 | Upstream version: release 8c of 16-Jan-2011. 5 | Local modifications: 6 | 7 | * Removed all files, except for *.c, *.h and license-relevant. 8 | * Created CMakeLists.txt for CMake build 9 | * Undefined the USE_MAC_MEMMGR flag in jconfig.mac 10 | * Moved jconfig.vc and jconfig.mac to jconfig_mac.h and jconfig_windows.h; made 11 | jconfig.h which redirects to the appropriate place on each platform. 12 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jcinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcinit.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains initialization logic for the JPEG compressor. 9 | * This routine is in charge of selecting the modules to be executed and 10 | * making an initialization call to each one. 11 | * 12 | * Logically, this code belongs in jcmaster.c. It's split out because 13 | * linking this routine implies linking the entire compression library. 14 | * For a transcoding-only application, we want to be able to use jcmaster.c 15 | * without linking in the whole library. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | 22 | 23 | /* 24 | * Master selection of compression modules. 25 | * This is done once at the start of processing an image. We determine 26 | * which modules will be used and give them appropriate initialization calls. 27 | */ 28 | 29 | GLOBAL(void) 30 | jinit_compress_master (j_compress_ptr cinfo) 31 | { 32 | /* Initialize master control (includes parameter checking/processing) */ 33 | jinit_c_master_control(cinfo, FALSE /* full compression */); 34 | 35 | /* Preprocessing */ 36 | if (! cinfo->raw_data_in) { 37 | jinit_color_converter(cinfo); 38 | jinit_downsampler(cinfo); 39 | jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 40 | } 41 | /* Forward DCT */ 42 | jinit_forward_dct(cinfo); 43 | /* Entropy encoding: either Huffman or arithmetic coding. */ 44 | if (cinfo->arith_code) 45 | jinit_arith_encoder(cinfo); 46 | else { 47 | jinit_huff_encoder(cinfo); 48 | } 49 | 50 | /* Need a full-image coefficient buffer in any multi-pass mode. */ 51 | jinit_c_coef_controller(cinfo, 52 | (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); 53 | jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 54 | 55 | jinit_marker_writer(cinfo); 56 | 57 | /* We can now tell the memory manager to allocate virtual arrays. */ 58 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 59 | 60 | /* Write the datastream header (SOI) immediately. 61 | * Frame and scan headers are postponed till later. 62 | * This lets application insert special markers after the SOI. 63 | */ 64 | (*cinfo->marker->write_file_header) (cinfo); 65 | } 66 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jcomapi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcomapi.c 3 | * 4 | * Copyright (C) 1994-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains application interface routines that are used for both 9 | * compression and decompression. 10 | */ 11 | 12 | #define JPEG_INTERNALS 13 | #include "jinclude.h" 14 | #include "jpeglib.h" 15 | 16 | 17 | /* 18 | * Abort processing of a JPEG compression or decompression operation, 19 | * but don't destroy the object itself. 20 | * 21 | * For this, we merely clean up all the nonpermanent memory pools. 22 | * Note that temp files (virtual arrays) are not allowed to belong to 23 | * the permanent pool, so we will be able to close all temp files here. 24 | * Closing a data source or destination, if necessary, is the application's 25 | * responsibility. 26 | */ 27 | 28 | GLOBAL(void) 29 | jpeg_abort (j_common_ptr cinfo) 30 | { 31 | int pool; 32 | 33 | /* Do nothing if called on a not-initialized or destroyed JPEG object. */ 34 | if (cinfo->mem == NULL) 35 | return; 36 | 37 | /* Releasing pools in reverse order might help avoid fragmentation 38 | * with some (brain-damaged) malloc libraries. 39 | */ 40 | for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { 41 | (*cinfo->mem->free_pool) (cinfo, pool); 42 | } 43 | 44 | /* Reset overall state for possible reuse of object */ 45 | if (cinfo->is_decompressor) { 46 | cinfo->global_state = DSTATE_START; 47 | /* Try to keep application from accessing now-deleted marker list. 48 | * A bit kludgy to do it here, but this is the most central place. 49 | */ 50 | ((j_decompress_ptr) cinfo)->marker_list = NULL; 51 | } else { 52 | cinfo->global_state = CSTATE_START; 53 | } 54 | } 55 | 56 | 57 | /* 58 | * Destruction of a JPEG object. 59 | * 60 | * Everything gets deallocated except the master jpeg_compress_struct itself 61 | * and the error manager struct. Both of these are supplied by the application 62 | * and must be freed, if necessary, by the application. (Often they are on 63 | * the stack and so don't need to be freed anyway.) 64 | * Closing a data source or destination, if necessary, is the application's 65 | * responsibility. 66 | */ 67 | 68 | GLOBAL(void) 69 | jpeg_destroy (j_common_ptr cinfo) 70 | { 71 | /* We need only tell the memory manager to release everything. */ 72 | /* NB: mem pointer is NULL if memory mgr failed to initialize. */ 73 | if (cinfo->mem != NULL) 74 | (*cinfo->mem->self_destruct) (cinfo); 75 | cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ 76 | cinfo->global_state = 0; /* mark it destroyed */ 77 | } 78 | 79 | 80 | /* 81 | * Convenience routines for allocating quantization and Huffman tables. 82 | * (Would jutils.c be a more reasonable place to put these?) 83 | */ 84 | 85 | GLOBAL(JQUANT_TBL *) 86 | jpeg_alloc_quant_table (j_common_ptr cinfo) 87 | { 88 | JQUANT_TBL *tbl; 89 | 90 | tbl = (JQUANT_TBL *) 91 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); 92 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 93 | return tbl; 94 | } 95 | 96 | 97 | GLOBAL(JHUFF_TBL *) 98 | jpeg_alloc_huff_table (j_common_ptr cinfo) 99 | { 100 | JHUFF_TBL *tbl; 101 | 102 | tbl = (JHUFF_TBL *) 103 | (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); 104 | tbl->sent_table = FALSE; /* make sure this is false in any new table */ 105 | return tbl; 106 | } 107 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jconfig.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(_MSC_VER) 3 | # include "jconfig_windows.h" 4 | #elif defined(__APPLE__) 5 | # include "jconfig_mac.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jconfig_mac.h: -------------------------------------------------------------------------------- 1 | /* jconfig.mac --- jconfig.h for CodeWarrior on Apple Macintosh */ 2 | /* see jconfig.txt for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | #ifdef JPEG_INTERNALS 19 | 20 | #undef RIGHT_SHIFT_IS_UNSIGNED 21 | 22 | #undef USE_MAC_MEMMGR /* Define this if you use jmemmac.c */ 23 | 24 | #define ALIGN_TYPE long /* Needed for 680x0 Macs */ 25 | 26 | #endif /* JPEG_INTERNALS */ 27 | 28 | #ifdef JPEG_CJPEG_DJPEG 29 | 30 | #define BMP_SUPPORTED /* BMP image file format */ 31 | #define GIF_SUPPORTED /* GIF image file format */ 32 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 33 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 34 | #define TARGA_SUPPORTED /* Targa image file format */ 35 | 36 | #define USE_CCOMMAND /* Command line reader for Macintosh */ 37 | #define TWO_FILE_COMMANDLINE /* Binary I/O thru stdin/stdout doesn't work */ 38 | 39 | #undef NEED_SIGNAL_CATCHER 40 | #undef DONT_USE_B_MODE 41 | #undef PROGRESS_REPORT /* optional */ 42 | 43 | #endif /* JPEG_CJPEG_DJPEG */ 44 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jconfig_windows.h: -------------------------------------------------------------------------------- 1 | /* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ 2 | /* see jconfig.txt for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ 15 | #undef NEED_SHORT_EXTERNAL_NAMES 16 | #undef INCOMPLETE_TYPES_BROKEN 17 | 18 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 19 | #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ 20 | typedef unsigned char boolean; 21 | #endif 22 | #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 23 | 24 | 25 | #ifdef JPEG_INTERNALS 26 | 27 | #undef RIGHT_SHIFT_IS_UNSIGNED 28 | 29 | #endif /* JPEG_INTERNALS */ 30 | 31 | #ifdef JPEG_CJPEG_DJPEG 32 | 33 | #define BMP_SUPPORTED /* BMP image file format */ 34 | #define GIF_SUPPORTED /* GIF image file format */ 35 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 36 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 37 | #define TARGA_SUPPORTED /* Targa image file format */ 38 | 39 | #define TWO_FILE_COMMANDLINE /* optional */ 40 | #define USE_SETMODE /* Microsoft has setmode() */ 41 | #undef NEED_SIGNAL_CATCHER 42 | #undef DONT_USE_B_MODE 43 | #undef PROGRESS_REPORT /* optional */ 44 | 45 | #endif /* JPEG_CJPEG_DJPEG */ 46 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jinclude.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jinclude.h 3 | * 4 | * Copyright (C) 1991-1994, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file exists to provide a single place to fix any problems with 9 | * including the wrong system include files. (Common problems are taken 10 | * care of by the standard jconfig symbols, but on really weird systems 11 | * you may have to edit this file.) 12 | * 13 | * NOTE: this file is NOT intended to be included by applications using the 14 | * JPEG library. Most applications need only include jpeglib.h. 15 | */ 16 | 17 | 18 | /* Include auto-config file to find out which system include files we need. */ 19 | 20 | #include "jconfig.h" /* auto configuration options */ 21 | #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ 22 | 23 | /* 24 | * We need the NULL macro and size_t typedef. 25 | * On an ANSI-conforming system it is sufficient to include . 26 | * Otherwise, we get them from or ; we may have to 27 | * pull in as well. 28 | * Note that the core JPEG library does not require ; 29 | * only the default error handler and data source/destination modules do. 30 | * But we must pull it in because of the references to FILE in jpeglib.h. 31 | * You can remove those references if you want to compile without . 32 | */ 33 | 34 | #ifdef HAVE_STDDEF_H 35 | #include 36 | #endif 37 | 38 | #ifdef HAVE_STDLIB_H 39 | #include 40 | #endif 41 | 42 | #ifdef NEED_SYS_TYPES_H 43 | #include 44 | #endif 45 | 46 | #include 47 | 48 | /* 49 | * We need memory copying and zeroing functions, plus strncpy(). 50 | * ANSI and System V implementations declare these in . 51 | * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). 52 | * Some systems may declare memset and memcpy in . 53 | * 54 | * NOTE: we assume the size parameters to these functions are of type size_t. 55 | * Change the casts in these macros if not! 56 | */ 57 | 58 | #ifdef NEED_BSD_STRINGS 59 | 60 | #include 61 | #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) 62 | #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) 63 | 64 | #else /* not BSD, assume ANSI/SysV string lib */ 65 | 66 | #include 67 | #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) 68 | #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) 69 | 70 | #endif 71 | 72 | /* 73 | * In ANSI C, and indeed any rational implementation, size_t is also the 74 | * type returned by sizeof(). However, it seems there are some irrational 75 | * implementations out there, in which sizeof() returns an int even though 76 | * size_t is defined as long or unsigned long. To ensure consistent results 77 | * we always use this SIZEOF() macro in place of using sizeof() directly. 78 | */ 79 | 80 | #define SIZEOF(object) ((size_t) sizeof(object)) 81 | 82 | /* 83 | * The modules that use fread() and fwrite() always invoke them through 84 | * these macros. On some systems you may need to twiddle the argument casts. 85 | * CAUTION: argument order is different from underlying functions! 86 | */ 87 | 88 | #define JFREAD(file,buf,sizeofbuf) \ 89 | ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 90 | #define JFWRITE(file,buf,sizeofbuf) \ 91 | ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) 92 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jmemnobs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jmemnobs.c 3 | * 4 | * Copyright (C) 1992-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file provides a really simple implementation of the system- 9 | * dependent portion of the JPEG memory manager. This implementation 10 | * assumes that no backing-store files are needed: all required space 11 | * can be obtained from malloc(). 12 | * This is very portable in the sense that it'll compile on almost anything, 13 | * but you'd better have lots of main memory (or virtual memory) if you want 14 | * to process big images. 15 | * Note that the max_memory_to_use option is ignored by this implementation. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | #include "jmemsys.h" /* import the system-dependent declarations */ 22 | 23 | #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ 24 | extern void * malloc JPP((size_t size)); 25 | extern void free JPP((void *ptr)); 26 | #endif 27 | 28 | 29 | /* 30 | * Memory allocation and freeing are controlled by the regular library 31 | * routines malloc() and free(). 32 | */ 33 | 34 | GLOBAL(void *) 35 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) 36 | { 37 | return (void *) malloc(sizeofobject); 38 | } 39 | 40 | GLOBAL(void) 41 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) 42 | { 43 | free(object); 44 | } 45 | 46 | 47 | /* 48 | * "Large" objects are treated the same as "small" ones. 49 | * NB: although we include FAR keywords in the routine declarations, 50 | * this file won't actually work in 80x86 small/medium model; at least, 51 | * you probably won't be able to process useful-size images in only 64KB. 52 | */ 53 | 54 | GLOBAL(void FAR *) 55 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) 56 | { 57 | return (void FAR *) malloc(sizeofobject); 58 | } 59 | 60 | GLOBAL(void) 61 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) 62 | { 63 | free(object); 64 | } 65 | 66 | 67 | /* 68 | * This routine computes the total memory space available for allocation. 69 | * Here we always say, "we got all you want bud!" 70 | */ 71 | 72 | GLOBAL(long) 73 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, 74 | long max_bytes_needed, long already_allocated) 75 | { 76 | return max_bytes_needed; 77 | } 78 | 79 | 80 | /* 81 | * Backing store (temporary file) management. 82 | * Since jpeg_mem_available always promised the moon, 83 | * this should never be called and we can just error out. 84 | */ 85 | 86 | GLOBAL(void) 87 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, 88 | long total_bytes_needed) 89 | { 90 | ERREXIT(cinfo, JERR_NO_BACKING_STORE); 91 | } 92 | 93 | 94 | /* 95 | * These routines take care of any system-dependent initialization and 96 | * cleanup required. Here, there isn't any. 97 | */ 98 | 99 | GLOBAL(long) 100 | jpeg_mem_init (j_common_ptr cinfo) 101 | { 102 | return 0; /* just set max_memory_to_use to 0 */ 103 | } 104 | 105 | GLOBAL(void) 106 | jpeg_mem_term (j_common_ptr cinfo) 107 | { 108 | /* no work */ 109 | } 110 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/jpeg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "8c 16-Jan-2011" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 2011, Thomas G. Lane, Guido Vollbeding" 15 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/png/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(png C) 2 | 3 | SET(PNG_SRCS 4 | png.h pnglibconf.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h 5 | png.c pngerror.c pngget.c 6 | pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c 7 | pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c 8 | ) 9 | 10 | IF (WIN32) 11 | ADD_DEFINITIONS(-DPNG_STATIC -D_CRT_SECURE_NO_WARNINGS) 12 | ENDIF (WIN32) 13 | 14 | FIND_PACKAGE(PNG) 15 | IF(NOT PNG_FOUND) 16 | FIND_PACKAGE(ZLIB) 17 | IF(NOT ZLIB_FOUND) 18 | SET(ZLIB_INCLUDE_DIRS ../zlib) 19 | SET(ZLIB_LIBRARIES zlib) 20 | ENDIF(NOT ZLIB_FOUND) 21 | ADD_LIBRARY(png ${PNG_SRCS}) 22 | INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) 23 | TARGET_LINK_LIBRARIES(png ${ZLIB_LIBRARIES}) 24 | ENDIF(NOT PNG_FOUND) 25 | 26 | SET(MISC LICENSE README README.ipol) 27 | INSTALL(FILES CMakeLists.txt ${MISC} ${PNG_SRCS} 28 | DESTINATION src/third_party/png) 29 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/png/README.ipol: -------------------------------------------------------------------------------- 1 | Project: libpng 2 | URL: http://www.libpng.org/pub/png/ 3 | License: Specific, see LICENSE. 4 | Upstream version: 1.5.0 - February 3, 2009 5 | Local modifications: 6 | 7 | * Removed all files, except for *.c, *.h and license-relevant. 8 | * Modified CMakeLists.txt for CMake build 9 | * Install rule in CMakeLists.txt 10 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/svd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INSTALL(FILES CMakeLists.txt eigenWrapper.hpp matConversion.hpp svd.hpp 2 | DESTINATION src/third_party/svd) 3 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/svd/matConversion.hpp: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2011 Pierre Moulon 2 | // 3 | //This program is free software: you can redistribute it and/or modify 4 | //it under the terms of the GNU General Public License as published by 5 | //the Free Software Foundation, either version 3 of the License, or 6 | //(at your option) any later version. 7 | // 8 | //This program is distributed in the hope that it will be useful, 9 | //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | //GNU General Public License for more details. 12 | // 13 | //You should have received a copy of the GNU General Public License 14 | //along with this program. If not, see . 15 | 16 | #ifndef LIBS_SVD_CONVERSION_H_ 17 | #define LIBS_SVD_CONVERSION_H_ 18 | 19 | #include 20 | #include 21 | #include "extras/libNumerics/matrix.h" 22 | 23 | namespace EigenWrapper { 24 | 25 | typedef libNumerics::matrix Mat; 26 | typedef Eigen::MatrixXd MatEigen; 27 | 28 | inline void EigenToMat(const MatEigen & matEigen, Mat & mat) 29 | { 30 | mat = Mat(matEigen.rows(), matEigen.cols()); 31 | for (int j=0; j. 15 | 16 | #ifndef LIBS_SVD_H_ 17 | #define LIBS_SVD_H_ 18 | 19 | #include 20 | #include 21 | #include "extras/libNumerics/matrix.h" 22 | #include "third_party/svd/matConversion.hpp" 23 | #include "third_party/svd/eigenWrapper.hpp" 24 | 25 | namespace SVDWrapper { 26 | 27 | typedef libNumerics::matrix Mat; 28 | typedef libNumerics::vector Vec; 29 | typedef Eigen::MatrixXd MatEigen; 30 | 31 | /// Solve the linear system Ax = 0 with ||x|| = 1.0 via SVD. 32 | /// Return true if the ratio of singular values SV(0)/SV(N-2) < dRatio. 33 | /// The return value indicates whether the solution is unique. 34 | static bool Nullspace(const Mat & A, Vec *nullspace, double dRatio=1e-5) 35 | { 36 | typedef Eigen::MatrixXd MatEigen; 37 | MatEigen AEigen, null; 38 | EigenWrapper::MatToEigen(A, AEigen); 39 | bool bOk = EigenWrapper::Nullspace(&AEigen, &null, dRatio); 40 | (*nullspace).read( null.data() ); 41 | return bOk; 42 | } 43 | 44 | /// Inverse of norm-2 condition value (ratio of extreme singular values) 45 | inline double InvCond(const Mat& A) { 46 | Eigen::MatrixXd AEigen, sing; 47 | EigenWrapper::MatToEigen(A, AEigen); 48 | EigenWrapper::SingularValues(&AEigen, &sing); 49 | return sing(A.nrow()-1)/sing(0); 50 | } 51 | 52 | /// Make rank<=2. 53 | inline void EnforceRank2_3x3(const Mat& A, Mat *ARank) 54 | { 55 | Eigen::MatrixXd MEigen, MRank2Eigen; 56 | EigenWrapper::MatToEigen(A, MEigen); 57 | EigenWrapper::EnforceRank2_3x3(MEigen, &MRank2Eigen); 58 | EigenWrapper::EigenToMat(MRank2Eigen, *ARank); 59 | } 60 | 61 | /// Save the two last nullspace vector as 3x3 matrices. 62 | /// It uses Eigen to compute the SVD decomposition. 63 | inline void Nullspace2_Remap33(const Mat &A, Mat& f1, Mat& f2) { 64 | using Eigen::Map; 65 | using namespace EigenWrapper; 66 | 67 | MatEigen f1E, f2E; 68 | MatEigen AEigen; 69 | MatToEigen(A, AEigen); 70 | Nullspace2(&AEigen, &f1E, &f2E); 71 | 72 | typedef Eigen::Matrix Mat3; 73 | typedef Eigen::Matrix RMat3; 74 | // Update f1 and f2 75 | EigenToMat(Map(f1E.data()), f1); 76 | EigenToMat(Map(f2E.data()), f2); 77 | } 78 | 79 | } // namespace SVDWrapper 80 | 81 | 82 | #endif // LIBS_SVD_H_ 83 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/OrsaHomography/third_party/zlib/ChangeLog -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/INDEX: -------------------------------------------------------------------------------- 1 | CMakeLists.txt cmake build file 2 | ChangeLog history of changes 3 | FAQ Frequently Asked Questions about zlib 4 | INDEX this file 5 | Makefile dummy Makefile that tells you to ./configure 6 | Makefile.in template for Unix Makefile 7 | README guess what 8 | configure configure script for Unix 9 | make_vms.com makefile for VMS 10 | treebuild.xml XML description of source file dependencies 11 | zconf.h.cmakein zconf.h template for cmake 12 | zconf.h.in zconf.h template for configure 13 | zlib.3 Man page for zlib 14 | zlib.3.pdf Man page in PDF format 15 | zlib.map Linux symbol information 16 | zlib.pc.in Template for pkg-config descriptor 17 | zlib2ansi perl script to convert source files for C++ compilation 18 | 19 | amiga/ makefiles for Amiga SAS C 20 | doc/ documentation for formats and algorithms 21 | msdos/ makefiles for MSDOS 22 | nintendods/ makefile for Nintendo DS 23 | old/ makefiles for various architectures and zlib documentation 24 | files that have not yet been updated for zlib 1.2.x 25 | qnx/ makefiles for QNX 26 | watcom/ makefiles for OpenWatcom 27 | win32/ makefiles for Windows 28 | 29 | zlib public header files (required for library use): 30 | zconf.h 31 | zlib.h 32 | 33 | private source files used to build the zlib library: 34 | adler32.c 35 | compress.c 36 | crc32.c 37 | crc32.h 38 | deflate.c 39 | deflate.h 40 | gzclose.c 41 | gzguts.h 42 | gzlib.c 43 | gzread.c 44 | gzwrite.c 45 | infback.c 46 | inffast.c 47 | inffast.h 48 | inffixed.h 49 | inflate.c 50 | inflate.h 51 | inftrees.c 52 | inftrees.h 53 | trees.c 54 | trees.h 55 | uncompr.c 56 | zutil.c 57 | zutil.h 58 | 59 | source files for sample programs: 60 | example.c 61 | minigzip.c 62 | See examples/README.examples for more 63 | 64 | unsupported contribution by third parties 65 | See contrib/README.contrib 66 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/README.ipol: -------------------------------------------------------------------------------- 1 | Project: zlib 2 | URL: http://www.zlib.net/ 3 | License: zlib license 4 | Upstream version: 1.2.5 5 | Local modifications: 6 | 7 | * Removed all files, except for *.c, *.h and license-relevant. 8 | * Modified CMake files in order to not install and not build examples. 9 | * Added install rule to CMakeLists.txt 10 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (Bytef*)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 79 | (sourceLen >> 25) + 13; 80 | } 81 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 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 ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010 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 | 20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 21 | enough memory, Z_BUF_ERROR if there was not enough room in the output 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. 23 | */ 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 25 | Bytef *dest; 26 | uLongf *destLen; 27 | const Bytef *source; 28 | uLong sourceLen; 29 | { 30 | z_stream stream; 31 | int err; 32 | 33 | stream.next_in = (Bytef*)source; 34 | stream.avail_in = (uInt)sourceLen; 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | 45 | err = inflateInit(&stream); 46 | if (err != Z_OK) return err; 47 | 48 | err = inflate(&stream, Z_FINISH); 49 | if (err != Z_STREAM_END) { 50 | inflateEnd(&stream); 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 52 | return Z_DATA_ERROR; 53 | return err; 54 | } 55 | *destLen = stream.total_out; 56 | 57 | err = inflateEnd(&stream); 58 | return err; 59 | } 60 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/win32/zlib.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | ; zlib data compression library 3 | 4 | EXPORTS 5 | ; basic functions 6 | zlibVersion 7 | deflate 8 | deflateEnd 9 | inflate 10 | inflateEnd 11 | ; advanced functions 12 | deflateSetDictionary 13 | deflateCopy 14 | deflateReset 15 | deflateParams 16 | deflateTune 17 | deflateBound 18 | deflatePrime 19 | deflateSetHeader 20 | inflateSetDictionary 21 | inflateSync 22 | inflateCopy 23 | inflateReset 24 | inflateReset2 25 | inflatePrime 26 | inflateMark 27 | inflateGetHeader 28 | inflateBack 29 | inflateBackEnd 30 | zlibCompileFlags 31 | ; utility functions 32 | compress 33 | compress2 34 | compressBound 35 | uncompress 36 | gzopen 37 | gzdopen 38 | gzbuffer 39 | gzsetparams 40 | gzread 41 | gzwrite 42 | gzprintf 43 | gzputs 44 | gzgets 45 | gzputc 46 | gzgetc 47 | gzungetc 48 | gzflush 49 | gzseek 50 | gzrewind 51 | gztell 52 | gzoffset 53 | gzeof 54 | gzdirect 55 | gzclose 56 | gzclose_r 57 | gzclose_w 58 | gzerror 59 | gzclearerr 60 | ; checksum functions 61 | adler32 62 | crc32 63 | adler32_combine 64 | crc32_combine 65 | ; various hacks, don't look :) 66 | deflateInit_ 67 | deflateInit2_ 68 | inflateInit_ 69 | inflateInit2_ 70 | inflateBackInit_ 71 | zError 72 | inflateSyncPoint 73 | get_crc_table 74 | inflateUndermine 75 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/win32/zlib1.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../zlib.h" 3 | 4 | #ifdef GCC_WINDRES 5 | VS_VERSION_INFO VERSIONINFO 6 | #else 7 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 8 | #endif 9 | FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 10 | PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 11 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 12 | #ifdef _DEBUG 13 | FILEFLAGS 1 14 | #else 15 | FILEFLAGS 0 16 | #endif 17 | FILEOS VOS__WINDOWS32 18 | FILETYPE VFT_DLL 19 | FILESUBTYPE 0 // not used 20 | BEGIN 21 | BLOCK "StringFileInfo" 22 | BEGIN 23 | BLOCK "040904E4" 24 | //language ID = U.S. English, char set = Windows, Multilingual 25 | BEGIN 26 | VALUE "FileDescription", "zlib data compression library\0" 27 | VALUE "FileVersion", ZLIB_VERSION "\0" 28 | VALUE "InternalName", "zlib1.dll\0" 29 | VALUE "LegalCopyright", "(C) 1995-2006 Jean-loup Gailly & Mark Adler\0" 30 | VALUE "OriginalFilename", "zlib1.dll\0" 31 | VALUE "ProductName", "zlib\0" 32 | VALUE "ProductVersion", ZLIB_VERSION "\0" 33 | VALUE "Comments", "For more information visit http://www.zlib.net/\0" 34 | END 35 | END 36 | BLOCK "VarFileInfo" 37 | BEGIN 38 | VALUE "Translation", 0x0409, 1252 39 | END 40 | END 41 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/zlib.map: -------------------------------------------------------------------------------- 1 | ZLIB_1.2.0 { 2 | global: 3 | compressBound; 4 | deflateBound; 5 | inflateBack; 6 | inflateBackEnd; 7 | inflateBackInit_; 8 | inflateCopy; 9 | local: 10 | deflate_copyright; 11 | inflate_copyright; 12 | inflate_fast; 13 | inflate_table; 14 | zcalloc; 15 | zcfree; 16 | z_errmsg; 17 | gz_error; 18 | gz_intmax; 19 | _*; 20 | }; 21 | 22 | ZLIB_1.2.0.2 { 23 | gzclearerr; 24 | gzungetc; 25 | zlibCompileFlags; 26 | } ZLIB_1.2.0; 27 | 28 | ZLIB_1.2.0.8 { 29 | deflatePrime; 30 | } ZLIB_1.2.0.2; 31 | 32 | ZLIB_1.2.2 { 33 | adler32_combine; 34 | crc32_combine; 35 | deflateSetHeader; 36 | inflateGetHeader; 37 | } ZLIB_1.2.0.8; 38 | 39 | ZLIB_1.2.2.3 { 40 | deflateTune; 41 | gzdirect; 42 | } ZLIB_1.2.2; 43 | 44 | ZLIB_1.2.2.4 { 45 | inflatePrime; 46 | } ZLIB_1.2.2.3; 47 | 48 | ZLIB_1.2.3.3 { 49 | adler32_combine64; 50 | crc32_combine64; 51 | gzopen64; 52 | gzseek64; 53 | gztell64; 54 | inflateUndermine; 55 | } ZLIB_1.2.2.4; 56 | 57 | ZLIB_1.2.3.4 { 58 | inflateReset2; 59 | inflateMark; 60 | } ZLIB_1.2.3.3; 61 | 62 | ZLIB_1.2.3.5 { 63 | gzbuffer; 64 | gzoffset; 65 | gzoffset64; 66 | gzclose_r; 67 | gzclose_w; 68 | } ZLIB_1.2.3.4; 69 | -------------------------------------------------------------------------------- /OrsaHomography/third_party/zlib/zlib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | sharedlibdir=@sharedlibdir@ 5 | includedir=@includedir@ 6 | 7 | Name: zlib 8 | Description: zlib compression library 9 | Version: @VERSION@ 10 | 11 | Requires: 12 | Libs: -L${libdir} -L${sharedlibdir} -lz 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /convert.cpp: -------------------------------------------------------------------------------- 1 | /** @Converting functions between structures of openCV and KVLD suitable structures 2 | ** @author Zhe Liu 3 | **/ 4 | 5 | /* 6 | Copyright (C) 2011-12 Zhe Liu and Pierre Moulon. 7 | All rights reserved. 8 | 9 | This file is part of the KVLD library and is made available under 10 | the terms of the BSD license (see the COPYING file). 11 | */ 12 | 13 | #include "convert.h" 14 | 15 | int Convert_image(const cv::Mat& In, Image & imag)//convert only gray scale image of opencv 16 | { 17 | unsigned char* pixelPtr = (unsigned char*) In.data; 18 | imag = Image(In.cols, In.rows); 19 | int cn=In.channels(); 20 | if (cn==1)//gray scale 21 | { 22 | for (int i = 0; i < In.rows; ++i) 23 | { 24 | for (int j = 0; j < In.cols; ++j) 25 | { 26 | imag(i,j)= pixelPtr[i*In.cols+ j]; 27 | } 28 | } 29 | }else 30 | { 31 | for (int i = 0; i < In.rows; ++i) 32 | { 33 | for (int j = 0; j < In.cols; ++j) 34 | { 35 | imag(i,j)= (float(pixelPtr[(i*In.cols+ j)*cn+0])*29+float(pixelPtr[(i*In.cols+ j)*cn+1])*150+float(pixelPtr[(i*In.cols+ j)*cn+2])*77)/255; 36 | } 37 | } 38 | 39 | } 40 | return 0; 41 | } 42 | 43 | int Convert_detectors(const std::vector& feat1,std::vector& F1){ 44 | F1.clear(); 45 | for (std::vector::const_iterator it=feat1.begin();it!=feat1.end();it++){ 46 | keypoint key; 47 | key.x=it->pt.x+0.5;// opencv 2.4.8 mark the first pixel as (0,0) which should be (0.5,0.5) precisely 48 | key.y=it->pt.y+0.5;// opencv 2.4.8 mark the first pixel as (0,0) which should be (0.5,0.5) precisely 49 | key.angle= (it->angle)*PI/180;// opencv inverse the rotation in lower version of 2.4 50 | key.scale=it->size/2; 51 | F1.push_back(key); 52 | } 53 | return 0; 54 | } 55 | 56 | int Convert_detectors(const std::vector& F1,std::vector& feat1){ 57 | feat1.clear(); 58 | for (std::vector::const_iterator it=F1.begin();it!=F1.end();it++){ 59 | cv::KeyPoint key; 60 | key.pt.x=it->x-0.5;// opencv 2.4.8 mark the first pixel as (0,0) which should be (0.5,0.5) precisely 61 | key.pt.y=it->y-0.5;// opencv 2.4.8 mark the first pixel as (0,0) which should be (0.5,0.5) precisely 62 | key.angle= (it->angle)*180/PI;// opencv inverse the rotation in lower version of 2.4 63 | key.size=it->scale*2; 64 | feat1.push_back(key); 65 | } 66 | return 0; 67 | } 68 | 69 | int Convert_matches(const std::vector& matches, std::vector& matchesPair){ 70 | for (std::vector::const_iterator it=matches.begin();it!=matches.end();it++) 71 | matchesPair.push_back(Pair(it->queryIdx,it->trainIdx)); 72 | return 0; 73 | } 74 | 75 | int read_detectors(const std::string& filename , std::vector& feat){ 76 | std::ifstream file(filename.c_str()); 77 | if (!file.is_open()){ 78 | std::cout<<"error in reading detector files"<>size; 83 | for (int i=0; i& matches){ 92 | std::ifstream file(filename.c_str()); 93 | if (!file.is_open()){ 94 | std::cout<<"error in reading matches files"<>size; 99 | for (int i=0; i>l>>r; 102 | cv::DMatch m(l,r,0); 103 | matches.push_back(m); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /convert.h: -------------------------------------------------------------------------------- 1 | /** @Converting functions between structures of openCV and KVLD suitable structures 2 | ** @author Zhe Liu 3 | **/ 4 | 5 | /* 6 | Copyright (C) 2011-12 Zhe Liu and Pierre Moulon. 7 | All rights reserved. 8 | 9 | This file is part of the KVLD library and is made available under 10 | the terms of the BSD license (see the COPYING file). 11 | */ 12 | #ifndef CONVERT_H 13 | #define CONVERT_H 14 | #include 15 | #include "opencv2/opencv.hpp" 16 | #include "opencv2/highgui/highgui.hpp" 17 | #include "opencv2/imgproc/imgproc.hpp" 18 | 19 | 20 | //#include "demo/libImage/image.hpp" 21 | 22 | #include "kvld/algorithm.h" 23 | 24 | typedef std::pair Pair; 25 | 26 | int Convert_image(const cv::Mat& In, Image & imag);//convert only gray scale image of opencv 27 | 28 | int Convert_detectors(const std::vector& feat1,std::vector& F1);//convert openCV detectors to KVLD suitable detectors 29 | int Convert_detectors(const std::vector& F1,std::vector& feat1); 30 | 31 | int Convert_matches(const std::vector& matches, std::vector& matchesPair); 32 | 33 | int read_detectors(const std::string& filename , std::vector& feat);//reading openCV style detectors 34 | 35 | 36 | int read_matches(const std::string& filename , std::vector& matches);//reading openCV style matches 37 | 38 | #endif //CONVERT_H -------------------------------------------------------------------------------- /demo_image/IMG_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_0.jpg -------------------------------------------------------------------------------- /demo_image/IMG_0bis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_0bis.jpg -------------------------------------------------------------------------------- /demo_image/IMG_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_1.jpg -------------------------------------------------------------------------------- /demo_image/IMG_1bis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_1bis.jpg -------------------------------------------------------------------------------- /demo_image/IMG_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_2.jpg -------------------------------------------------------------------------------- /demo_image/IMG_2bis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_2bis.jpg -------------------------------------------------------------------------------- /demo_image/IMG_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_3.jpg -------------------------------------------------------------------------------- /demo_image/IMG_3bis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_3bis.jpg -------------------------------------------------------------------------------- /demo_image/IMG_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_4.jpg -------------------------------------------------------------------------------- /demo_image/IMG_4bis.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_image/IMG_4bis.jpg -------------------------------------------------------------------------------- /demo_output/IMG_2_initial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_output/IMG_2_initial.png -------------------------------------------------------------------------------- /demo_output/IMG_2_kvld_filtered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zhe-LIU-Imagine/KVLD/77eb60c50a911c2c4bd9dc770ba8cce1cf33f6f2/demo_output/IMG_2_kvld_filtered.png -------------------------------------------------------------------------------- /demo_output/IMG_2_matrix.txt: -------------------------------------------------------------------------------- 1 | [-2.287803357725599e-10, 3.083304491166219e-07, -0.000443744940546581; 2 | -2.06784749371379e-12, -2.115267713476132e-09, -0.00175789161708767; 3 | -8.120561723334863e-07, 0.001101603090373882, 1] -------------------------------------------------------------------------------- /demo_output/readme.txt: -------------------------------------------------------------------------------- 1 | This is the folder to store KVLD output result -------------------------------------------------------------------------------- /kvld/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(ProjectName kvld) 2 | 3 | INCLUDE_DIRECTORIES( 4 | ../OrsaHomography/ 5 | ../OrsaHomography/demo/libImage 6 | ) 7 | 8 | IF(UNIX) 9 | #support of ARRAY 10 | SET(CMAKE_CXX_FLAGS "-std=c++0x") 11 | ENDIF(UNIX) 12 | 13 | ADD_LIBRARY(kvld kvld.cpp kvld.h algorithm.cpp algorithm.h image.hpp matrix.cpp matrix.h match.h) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /kvld/algorithm.cpp: -------------------------------------------------------------------------------- 1 | /** @basic structures implementation 2 | ** @author Zhe Liu 3 | **/ 4 | 5 | /* 6 | Copyright (C) 2011-12 Zhe Liu and Pierre Moulon. 7 | All rights reserved. 8 | 9 | This file is part of the KVLD library and is made available under 10 | the terms of the BSD license (see the COPYING file). 11 | */ 12 | 13 | #include "algorithm.h" 14 | 15 | //template 16 | IntegralImages::IntegralImages(const Image& I){ 17 | map.Resize(I.Width()+1,I.Height()+1); 18 | map.fill(0); 19 | for (int y=0;y& I,int a,const float p, const float ratio){ 26 | float range=ratio*sqrt(float(3*I.Height()*I.Width())/(p*a*PI)); 27 | std::cout<<"range ="<& vec_matchings, 33 | const std::vector& vec_inliers, 34 | libNumerics::matrix& F, bool homography) { 35 | double l2=0, linf=0; 36 | 37 | if (homography){ 38 | std::vector::const_iterator it=vec_inliers.begin(); 39 | for(; it!=vec_inliers.end(); ++it) { 40 | const Match& m=vec_matchings[*it]; 41 | Matrix x(3,1); 42 | x(0)=m.x1; 43 | x(1)=m.y1; 44 | x(2)=1.0; 45 | x = F*x; 46 | x /= x(2); 47 | double e = (m.x2-x(0))*(m.x2-x(0)) + (m.y2-x(1))*(m.y2-x(1)); 48 | l2 += e; 49 | if(linf < e) 50 | linf = e; 51 | } 52 | }else{ 53 | std::vector::const_iterator it=vec_inliers.begin(); 54 | 55 | for(; it!=vec_inliers.end(); ++it) { 56 | const Match& m=vec_matchings[*it]; 57 | double a = F(0,0) * m.x1 + F(0,1) * m.y1 + F(0,2); 58 | double b = F(1,0) * m.x1 + F(1,1) * m.y1 + F(1,2); 59 | double c = F(2,0) * m.x1 + F(2,1) * m.y1 + F(2,2); 60 | double d = a*m.x2 + b*m.y2 + c; 61 | // double e = (d*d) / (a*a + b*b); 62 | double e = (d*d) / (a*a + b*b); 63 | l2 += e; 64 | if(linf < e) 65 | linf = e; 66 | } 67 | } 68 | std::cout << "Average/max error: " 69 | << sqrt(l2/vec_inliers.size()) << "/" 70 | << sqrt(linf) <>point.x>>point.y>>point.scale>>point.angle; 87 | //for(int i=0;i<128;i++) { 88 | // in>>point.vec[i]; 89 | //} 90 | return in; 91 | } 92 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | KVLD Library 2 | Zhe Liu and Pierre Moulon 3 | 4 | ABOUT 5 | The KVLD open source library implements the Kth virtual line descriptor matching method introduced in the paper with minor modifications: 6 | 7 | Z,Liu and R,Marlet. Virtual Line Descriptor and Semi-Local Matching Method for Reliable Feature Correspondence in BMVC 2012 8 | 9 | KVLD is distributed under the BSD license (see the COPYING file). 10 | 11 | PERFORMANCE WARMING: 12 | 1. Some Linux setup may suffer performance degradation, one way to test is to use provided image pair 2, the algorithm should generate 358 matches. The best way is to compare result under windows. 13 | 2. If you use openCV library, please download the last version from GitHub, for openCV of version earlier than 2.4, descriptors' orientation may be reversed! (Bug in openCV 2.3) An easy way to test is to process an image with its rotated projection. 14 | 3. We use integral image instead of Gaussian blurring process to calculate gradients, which is less discriminant but is easier and faster in practice 15 | 16 | INSTALLING 17 | This implementation is on C++ and depends on openCV library, whose installation guild is available online. You will need Cmake 2.6 or later to compile the program. 18 | However the kvld library is independent of openCV, and if you develop your own applications using kvld, please 19 | *include folders as OrsaHomography and kvld 20 | *modify the CMakeLists.txt file to remove openCV library (see CMakeLists.txt) 21 | *include kvld in your code by adding #include "kvld/kvld.h" 22 | 23 | FOLDERS: 24 | Kvld: containing all KVLD algorithm, some structures depend on 25 | OrsaHomography library, so please include both of them to make KVLD running. 26 | OrsaHomography: containing ORSA algorithm implemented by Pierre Moulon. It also offers basic structures for KVLD algorithm. 27 | demo_image: some illustrating pairs of images for different applications. 28 | demo_output: results of demos are sent here, including 29 | (? means the index) 30 | * IMG_?_Detectors1: detectors in the first image 31 | * IMG_?_Detectors2: detectors in the second image 32 | * IMG_?_initial_matches: input matches of KVLD(pairs of indices) 33 | * IMG_?_kvld_matches: output matches of KVLD(pairs of indices) 34 | * IMG_?_kvld_filtered: visual output matches of KVLD 35 | * IMG_?_initial: visual input matches of KVLD 36 | * (optional)IMG_?_matrix: fundametal or homography matrix 37 | 38 | APPLICATIONS 39 | 40 | NOTE: two images shold have the same width to be illustrated, otherwise, please desactivate the illustration part. 41 | 42 | The code contains three main applications (KVLD_Deformable, KVLD_Calibrate and KVLD_Interface). They come with demonstration using images in demo_image folder. All the outputs are sent to the demo_output folder. 43 | 44 | KVLD_Deformable: 45 | To establish correspondence of points in a deformable object, KVLD can efficiently retrieve correct matches among a large number of false matches. 46 | 47 | KVLD_Calibration: 48 | For image calibration, KVLD generates filtered matches, then ORSA (Ransac variant) estimate homography or fundamental matrix using those (less contaminated) matches. 49 | 50 | KVLD_Interface: 51 | This allow you to feed KVLD with your own detectors and initial matches with the original images and let KVLD generates filtered matches. You need to provide the following three files. 52 | * IMG_?_Detectors1: detectors in the first image 53 | * IMG_?_Detectors2: detectors in the second image 54 | * IMG_?_initial_matches: input matches of KVLD(pairs of indices) 55 | 56 | For more information, please contact zhe.liu@enpc.fr 57 | 58 | 59 | 60 | --------------------------------------------------------------------------------