├── 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