├── .gitignore ├── ACF ├── ACFDetector.cpp ├── ACFDetector.h ├── ACFFeaturePyramid.cpp ├── ACFFeaturePyramid.h ├── Channel.cpp ├── Channel.h ├── ChannelFeatures.cpp ├── ChannelFeatures.h ├── ColorChannel.cpp ├── ColorChannel.h ├── CombinationFramework.cpp ├── Convert.cpp ├── DetectionList.cpp ├── DetectionList.h ├── DetectorManager.cpp ├── DetectorManager.h ├── Eigen │ ├── Array │ ├── CMakeLists.txt │ ├── Cholesky │ ├── CholmodSupport │ ├── Core │ ├── Dense │ ├── Eigen │ ├── Eigen2Support │ ├── Eigenvalues │ ├── Geometry │ ├── Householder │ ├── IterativeLinearSolvers │ ├── Jacobi │ ├── LU │ ├── LeastSquares │ ├── OrderingMethods │ ├── PaStiXSupport │ ├── PardisoSupport │ ├── QR │ ├── QtAlignedMalloc │ ├── SVD │ ├── Sparse │ ├── SparseCholesky │ ├── SparseCore │ ├── StdDeque │ ├── StdList │ ├── StdVector │ ├── SuperLUSupport │ ├── UmfPackSupport │ └── src │ │ ├── CMakeLists.txt │ │ ├── Cholesky │ │ ├── CMakeLists.txt │ │ ├── LDLT.h │ │ ├── LLT.h │ │ └── LLT_MKL.h │ │ ├── CholmodSupport │ │ ├── CMakeLists.txt │ │ └── CholmodSupport.h │ │ ├── Core │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── Assign_MKL.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── CMakeLists.txt │ │ ├── CommaInitializer.h │ │ ├── CwiseBinaryOp.h │ │ ├── CwiseNullaryOp.h │ │ ├── CwiseUnaryOp.h │ │ ├── CwiseUnaryView.h │ │ ├── DenseBase.h │ │ ├── DenseCoeffsBase.h │ │ ├── DenseStorage.h │ │ ├── Diagonal.h │ │ ├── DiagonalMatrix.h │ │ ├── DiagonalProduct.h │ │ ├── Dot.h │ │ ├── EigenBase.h │ │ ├── Flagged.h │ │ ├── ForceAlignedAccess.h │ │ ├── Functors.h │ │ ├── Fuzzy.h │ │ ├── GeneralProduct.h │ │ ├── GenericPacketMath.h │ │ ├── GlobalFunctions.h │ │ ├── IO.h │ │ ├── Map.h │ │ ├── MapBase.h │ │ ├── MathFunctions.h │ │ ├── Matrix.h │ │ ├── MatrixBase.h │ │ ├── NestByValue.h │ │ ├── NoAlias.h │ │ ├── NumTraits.h │ │ ├── PermutationMatrix.h │ │ ├── PlainObjectBase.h │ │ ├── Product.h │ │ ├── ProductBase.h │ │ ├── Random.h │ │ ├── Redux.h │ │ ├── Replicate.h │ │ ├── ReturnByValue.h │ │ ├── Reverse.h │ │ ├── Select.h │ │ ├── SelfAdjointView.h │ │ ├── SelfCwiseBinaryOp.h │ │ ├── SolveTriangular.h │ │ ├── StableNorm.h │ │ ├── Stride.h │ │ ├── Swap.h │ │ ├── Transpose.h │ │ ├── Transpositions.h │ │ ├── TriangularMatrix.h │ │ ├── VectorBlock.h │ │ ├── VectorwiseOp.h │ │ ├── Visitor.h │ │ ├── arch │ │ │ ├── AltiVec │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Default │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Settings.h │ │ │ ├── NEON │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ └── SSE │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── products │ │ │ ├── CMakeLists.txt │ │ │ ├── CoeffBasedProduct.h │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── GeneralMatrixMatrix.h │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ ├── GeneralMatrixMatrixTriangular_MKL.h │ │ │ ├── GeneralMatrixMatrix_MKL.h │ │ │ ├── GeneralMatrixVector.h │ │ │ ├── GeneralMatrixVector_MKL.h │ │ │ ├── Parallelizer.h │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ ├── SelfadjointMatrixMatrix_MKL.h │ │ │ ├── SelfadjointMatrixVector.h │ │ │ ├── SelfadjointMatrixVector_MKL.h │ │ │ ├── SelfadjointProduct.h │ │ │ ├── SelfadjointRank2Update.h │ │ │ ├── TriangularMatrixMatrix.h │ │ │ ├── TriangularMatrixMatrix_MKL.h │ │ │ ├── TriangularMatrixVector.h │ │ │ ├── TriangularMatrixVector_MKL.h │ │ │ ├── TriangularSolverMatrix.h │ │ │ ├── TriangularSolverMatrix_MKL.h │ │ │ └── TriangularSolverVector.h │ │ └── util │ │ │ ├── BlasUtil.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── MKL_support.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── NonMPL2.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── StaticAssert.h │ │ │ └── XprHelper.h │ │ ├── Eigen2Support │ │ ├── Block.h │ │ ├── CMakeLists.txt │ │ ├── Cwise.h │ │ ├── CwiseOperators.h │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── All.h │ │ │ ├── AngleAxis.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Hyperplane.h │ │ │ ├── ParametrizedLine.h │ │ │ ├── Quaternion.h │ │ │ ├── Rotation2D.h │ │ │ ├── RotationBase.h │ │ │ ├── Scaling.h │ │ │ ├── Transform.h │ │ │ └── Translation.h │ │ ├── LU.h │ │ ├── Lazy.h │ │ ├── LeastSquares.h │ │ ├── Macros.h │ │ ├── MathFunctions.h │ │ ├── Memory.h │ │ ├── Meta.h │ │ ├── Minor.h │ │ ├── QR.h │ │ ├── SVD.h │ │ ├── TriangularSolver.h │ │ └── VectorBlock.h │ │ ├── Eigenvalues │ │ ├── CMakeLists.txt │ │ ├── ComplexEigenSolver.h │ │ ├── ComplexSchur.h │ │ ├── ComplexSchur_MKL.h │ │ ├── EigenSolver.h │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ ├── HessenbergDecomposition.h │ │ ├── MatrixBaseEigenvalues.h │ │ ├── RealSchur.h │ │ ├── RealSchur_MKL.h │ │ ├── SelfAdjointEigenSolver.h │ │ ├── SelfAdjointEigenSolver_MKL.h │ │ └── Tridiagonalization.h │ │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── AngleAxis.h │ │ ├── CMakeLists.txt │ │ ├── EulerAngles.h │ │ ├── Homogeneous.h │ │ ├── Hyperplane.h │ │ ├── OrthoMethods.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ ├── Translation.h │ │ ├── Umeyama.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── CMakeLists.txt │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── IterativeLinearSolvers │ │ ├── BasicPreconditioners.h │ │ ├── BiCGSTAB.h │ │ ├── CMakeLists.txt │ │ ├── ConjugateGradient.h │ │ ├── IncompleteLUT.h │ │ └── IterativeSolverBase.h │ │ ├── Jacobi │ │ ├── CMakeLists.txt │ │ └── Jacobi.h │ │ ├── LU │ │ ├── CMakeLists.txt │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── Inverse.h │ │ ├── PartialPivLU.h │ │ ├── PartialPivLU_MKL.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Inverse_SSE.h │ │ ├── OrderingMethods │ │ ├── Amd.h │ │ └── CMakeLists.txt │ │ ├── PaStiXSupport │ │ ├── CMakeLists.txt │ │ └── PaStiXSupport.h │ │ ├── PardisoSupport │ │ ├── CMakeLists.txt │ │ └── PardisoSupport.h │ │ ├── QR │ │ ├── CMakeLists.txt │ │ ├── ColPivHouseholderQR.h │ │ ├── ColPivHouseholderQR_MKL.h │ │ ├── FullPivHouseholderQR.h │ │ ├── HouseholderQR.h │ │ └── HouseholderQR_MKL.h │ │ ├── SVD │ │ ├── CMakeLists.txt │ │ ├── JacobiSVD.h │ │ ├── JacobiSVD_MKL.h │ │ └── UpperBidiagonalization.h │ │ ├── SparseCholesky │ │ ├── CMakeLists.txt │ │ └── SimplicialCholesky.h │ │ ├── SparseCore │ │ ├── AmbiVector.h │ │ ├── CMakeLists.txt │ │ ├── CompressedStorage.h │ │ ├── ConservativeSparseSparseProduct.h │ │ ├── CoreIterators.h │ │ ├── MappedSparseMatrix.h │ │ ├── SparseAssign.h │ │ ├── SparseBlock.h │ │ ├── SparseCwiseBinaryOp.h │ │ ├── SparseCwiseUnaryOp.h │ │ ├── SparseDenseProduct.h │ │ ├── SparseDiagonalProduct.h │ │ ├── SparseDot.h │ │ ├── SparseFuzzy.h │ │ ├── SparseMatrix.h │ │ ├── SparseMatrixBase.h │ │ ├── SparsePermutation.h │ │ ├── SparseProduct.h │ │ ├── SparseRedux.h │ │ ├── SparseSelfAdjointView.h │ │ ├── SparseSparseProductWithPruning.h │ │ ├── SparseTranspose.h │ │ ├── SparseTriangularView.h │ │ ├── SparseUtil.h │ │ ├── SparseVector.h │ │ ├── SparseView.h │ │ └── TriangularSolver.h │ │ ├── StlSupport │ │ ├── CMakeLists.txt │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── SuperLUSupport │ │ ├── CMakeLists.txt │ │ └── SuperLUSupport.h │ │ ├── UmfPackSupport │ │ ├── CMakeLists.txt │ │ └── UmfPackSupport.h │ │ ├── misc │ │ ├── CMakeLists.txt │ │ ├── Image.h │ │ ├── Kernel.h │ │ ├── Solve.h │ │ ├── SparseSolve.h │ │ └── blas.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CMakeLists.txt │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── MatrixCwiseBinaryOps.h │ │ └── MatrixCwiseUnaryOps.h ├── FileWriter.cpp ├── FileWriter.h ├── FrameFromCamera.cpp ├── FrameFromCamera.h ├── FrameFromDirectory.cpp ├── FrameFromDirectory.h ├── FrameFromVideo.cpp ├── FrameFromVideo.h ├── FrameProducer.cpp ├── FrameProducer.h ├── Functions.h ├── GradHistChannel.cpp ├── GradHistChannel.h ├── GradMagChannel.cpp ├── GradMagChannel.h ├── Image.hpp ├── LoadChannels.cpp ├── LoadChannels.hpp ├── LoadChannels2.cpp ├── NonMaximumSuppression.cpp ├── NonMaximumSuppression.h ├── ScaleSpacePyramid.cpp ├── ScaleSpacePyramid.h ├── channelOld.cpp ├── channellist.h ├── channelold.h ├── convConst.cpp ├── detection.cpp ├── detection.h ├── detector.cpp ├── detector.h ├── detectormodel.cpp ├── detectormodel.h ├── feature.cpp ├── feature.h ├── featurelayer.cpp ├── featurelayer.h ├── filelocator.cpp ├── filelocator.h ├── gradientMex.cpp ├── imPadMex.hpp ├── imResampleMex.hpp ├── nms.cpp ├── nms.h ├── rapidxml-1.13 │ ├── license.txt │ ├── manual.html │ ├── rapidxml.hpp │ ├── rapidxml_iterators.hpp │ ├── rapidxml_print.hpp │ └── rapidxml_utils.hpp ├── rgbConvertMex.hpp ├── sse.hpp ├── timer.h ├── wrappers.cpp └── wrappers.hpp ├── CMakeLists.txt ├── Config ├── INRIA_ACF.xml └── my_det.xml ├── README.md └── license.txt /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | detection.xml 3 | *.jpg 4 | *.png 5 | ped_det_acf_crop 6 | ._* 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /ACF/ACFDetector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACFDetector.h 3 | * 4 | * Created on: Jan 16, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef ACFDETECTOR_H_ 9 | #define ACFDETECTOR_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "detection.h" 18 | 19 | #include "rapidxml-1.13/rapidxml.hpp" 20 | #include "rapidxml-1.13/rapidxml_print.hpp" 21 | 22 | #include "ChannelFeatures.h" 23 | 24 | #include "DetectionList.h" 25 | #include "detector.h" 26 | 27 | using namespace rapidxml; 28 | 29 | class ACFDetector : public Detector { 30 | public: 31 | ACFDetector() 32 | { 33 | modifyCascade(-0.01); 34 | 35 | ReadModel("Config/INRIA_ACF.xml"); 36 | } 37 | virtual ~ACFDetector(); 38 | 39 | std::vector Detect(const ChannelFeatures* features) const; 40 | 41 | int getShrinking() const 42 | { 43 | return this->shrinking; 44 | } 45 | 46 | void modifyCascade(float score) 47 | { 48 | for (int s = 0; s < this->Values.size(); s++) { 49 | for (int l = 0; l < this->Values[s].size(); l++) { 50 | this->Values[s][l] += score; 51 | } 52 | } 53 | } 54 | 55 | ACFDetector(std::string modelfile); 56 | 57 | DetectionList applyDetector(const cv::Mat& Frame) const; 58 | 59 | private: 60 | void getChild(const ChannelFeatures* features, int& k0, int& k, int c, int r, int s, int channelwidth, int channelheight, int modelwidth, int modelheight) const; 61 | 62 | void setWidth(float w) 63 | { 64 | this->modelwidth = w; 65 | } 66 | 67 | void setHeight(float h) 68 | { 69 | this->modelheight = h; 70 | } 71 | 72 | void setWidthPad(float w) 73 | { 74 | this->modelwidthpad = w; 75 | } 76 | 77 | void setHeightPad(float h) 78 | { 79 | this->modelheightpad = h; 80 | } 81 | 82 | void ReadModel(std::string modelfile); 83 | 84 | //! holds indeces to follow through a stage evaluation, normally these are the same in every stage since these represent the decision stump tree 85 | std::vector > Child; 86 | 87 | //! holds indeces to follow through a stage evaluation, normally these are the same in every stage since these represent the decision stump tree 88 | std::vector > depth; 89 | 90 | //! holds the indeces of the features to use, no longer used when features are inside the model 91 | std::vector > Fid; 92 | 93 | //! The thresholds that should be reached for each feature 94 | std::vector > Thresholds; 95 | 96 | //! stores the values to be added/subtracted at the end of a stage (dependent on the leaf reached) 97 | std::vector > Values; 98 | 99 | float modelwidth, modelheight; 100 | float modelwidthpad, modelheightpad; 101 | int shrinking; 102 | int ModelDepth; 103 | }; 104 | 105 | #endif /* ACFDETECTOR_H_ */ 106 | -------------------------------------------------------------------------------- /ACF/ACFFeaturePyramid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACFFeaturePyramid.h 3 | * 4 | * Created on: Feb 3, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef ACFFEATUREPYRAMID_H_ 9 | #define ACFFEATUREPYRAMID_H_ 10 | 11 | #include "ChannelFeatures.h" 12 | #include "ACFDetector.h" 13 | 14 | class ACFFeaturePyramid { 15 | public: 16 | ACFFeaturePyramid(const cv::Mat& Image, int scalesPerOct, cv::Size minSize, const ACFDetector& ADet); 17 | 18 | // Constructor for single scale 19 | ACFFeaturePyramid(const cv::Mat& Image, float sc, cv::Size minSize, const ACFDetector& ADet); 20 | 21 | virtual ~ACFFeaturePyramid(); 22 | 23 | int getAmount() 24 | { 25 | return this->Layers.size(); 26 | } 27 | 28 | ChannelFeatures* getLayer(int L) 29 | { 30 | if (L < this->Layers.size()) { 31 | return this->Layers[L]; 32 | } 33 | else { 34 | std::cerr << "Requesting unknown layer ..." << std::endl; 35 | exit(1); 36 | } 37 | } 38 | 39 | float getScale(int L) 40 | { 41 | return this->scales[L]; 42 | } 43 | 44 | protected: 45 | std::vector Layers; 46 | 47 | // amount of scales in each octave (so between halving each image dimension ) 48 | int scalesPerOct; 49 | 50 | // Minimum size an image can have (size of the model) 51 | cv::Size minSize; 52 | 53 | // Amount of layer is approximate for each real calculated one, normaly one per octave is correctly calculated 54 | int approxAmount; 55 | 56 | std::vector scales; 57 | }; 58 | 59 | #endif /* ACFFEATUREPYRAMID_H_ */ 60 | -------------------------------------------------------------------------------- /ACF/Channel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Channel.cpp 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #include "Channel.h" 9 | #include 10 | 11 | Channel::Channel() 12 | : data(NULL) 13 | , width(0) 14 | , height(0) 15 | , nChns(0) 16 | { 17 | } 18 | 19 | Channel::~Channel() 20 | { 21 | /* 22 | if(data){ 23 | free(data); 24 | data = NULL; //avoids an error on double free 25 | } 26 | */ 27 | } 28 | 29 | void Channel::setChanneldata(float* data, int width, int height, int nChns) 30 | { 31 | if (data) { 32 | this->data = data; 33 | this->width = width; 34 | this->height = height; 35 | this->nChns = nChns; 36 | } 37 | } 38 | 39 | void Channel::PrintChanneldata() const 40 | { 41 | 42 | for (int c = 0; c < this->nChns; c++) { 43 | for (int y = 0; y < this->height; y++) { 44 | for (int x = 0; x < this->width; x++) { 45 | std::cout << data[this->height * this->width * c + x * this->height + y] << " "; 46 | } 47 | std::cout << std::endl; 48 | } 49 | std::cout << "press key for next channel ... " << std::endl; 50 | 51 | std::cin.ignore(); 52 | } 53 | } 54 | 55 | void Channel::PrintChanneldata(int w, int h) const 56 | { 57 | 58 | for (int c = 0; c < this->nChns; c++) { 59 | for (int y = 0; y < h; y++) { 60 | for (int x = 0; x < w; x++) { 61 | std::cout << data[this->height * this->width * c + x * this->height + y] << " "; 62 | } 63 | std::cout << std::endl; 64 | } 65 | std::cout << "press key for next channel ... " << std::endl; 66 | 67 | std::cin.ignore(); 68 | } 69 | } 70 | 71 | int Channel::getWidth() const 72 | { 73 | return this->width; 74 | } 75 | 76 | int Channel::getHeight() const 77 | { 78 | return this->height; 79 | } 80 | int Channel::getnChns() const 81 | { 82 | return this->nChns; 83 | } 84 | 85 | float* Channel::getData() const 86 | { 87 | return this->data; 88 | } 89 | -------------------------------------------------------------------------------- /ACF/Channel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Channel.h 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef CHANNEL_H_ 9 | #define CHANNEL_H_ 10 | 11 | #include 12 | 13 | class Channel { 14 | public: 15 | Channel(); 16 | virtual ~Channel(); 17 | void PrintChanneldata() const; 18 | void PrintChanneldata(int w, int h) const; 19 | int getWidth() const; 20 | int getHeight() const; 21 | int getnChns() const; 22 | float* getData() const; 23 | 24 | float getLambda() 25 | { 26 | return 0.0; 27 | } 28 | 29 | protected: 30 | void setChanneldata(float* data, int width, int height, int nChns); 31 | 32 | private: 33 | int width; 34 | int height; 35 | int nChns; 36 | float* data; 37 | }; 38 | 39 | #endif /* CHANNEL_H_ */ 40 | -------------------------------------------------------------------------------- /ACF/ChannelFeatures.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ChannelFeatures.cpp 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #include "ChannelFeatures.h" 9 | #include 10 | 11 | float ChannelFeatures::getFeatureValue(int channel, int location) const 12 | { 13 | if (channel >= this->getnChannels() || location >= this->Channelheight * this->Channelwidth) { 14 | std::cerr << "Requesting feature from out of range!!" << std::endl; 15 | std::cerr << "channel: " << channel << std::endl; 16 | std::cerr << "location: " << location << std::endl; 17 | exit(1); 18 | } 19 | 20 | return this->Features[channel][location]; 21 | } 22 | 23 | //Crop the image on a multiple of "clip" 24 | cv::Mat clipImage(const cv::Mat& Im, int clip) 25 | { 26 | //Clip the image on a multiple of the shrinking-factor 27 | int overX = Im.cols % clip; 28 | int overY = Im.rows % clip; 29 | cv::Rect ROI(0, 0, Im.cols - overX, Im.rows - overY); 30 | 31 | return Im(ROI).clone(); 32 | } 33 | 34 | //Calculate the features based on a default configuration 35 | ChannelFeatures::ChannelFeatures(const cv::Mat& Image, int shrinking) 36 | { 37 | 38 | cv::Mat clippedImage = clipImage(Image, shrinking); 39 | // std::cout << "Clipped size: " << clippedImage.cols << "x" << clippedImage.rows << std::endl; 40 | 41 | //Set correct destination width-height 42 | this->Channelheight = clippedImage.rows / shrinking; //as been default calculated by gradhistogram ... 43 | this->Channelwidth = clippedImage.cols / shrinking; // " 44 | 45 | // Create the Channels 46 | ColorChannel LUV(clippedImage); 47 | 48 | // LUV.PrintChanneldata(10,10); 49 | 50 | GradMagChannel GMag(LUV); 51 | GradHistChannel GHC(GMag); 52 | 53 | //The addChannelFeatures-function will resize the channels when necessary 54 | this->addChannelFeatures(LUV); 55 | this->addChannelFeatures(GMag); 56 | this->addChannelFeatures(GHC); 57 | 58 | // Smooth the channels -> we should only smooth after approximation (if smoothing is necessary) 59 | // this->SmoothChannels(); 60 | } 61 | 62 | ChannelFeatures::~ChannelFeatures() 63 | { 64 | // free the features 65 | for (int c = 0; c < this->Features.size(); c++) { 66 | free(Features[c]); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ACF/ChannelFeatures.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ChannelFeatures.h 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef CHANNELFEATURES_H_ 9 | #define CHANNELFEATURES_H_ 10 | 11 | #include 12 | #include 13 | 14 | //OpenCV headers 15 | #include "opencv2/imgproc/imgproc.hpp" 16 | #include "opencv2/objdetect/objdetect.hpp" 17 | #include "opencv2/gpu/gpu.hpp" 18 | #include "opencv2/highgui/highgui.hpp" 19 | 20 | // Channel-classes 21 | #include "ColorChannel.h" 22 | #include "GradMagChannel.h" 23 | #include "GradHistChannel.h" 24 | 25 | /* 26 | * This class will be used to generate the features. By hiding the implementation details of the channels, 27 | * we can avoid having memory-leaks due to users who are not familiar with the channel-functions (which are 28 | * build around malloc's/calloc's and free's) 29 | */ 30 | class ChannelFeatures { 31 | public: 32 | ChannelFeatures(const cv::Mat& Image, int shrinking); 33 | ChannelFeatures* ApproxChannel(const cv::Mat& Image, int shrinking, float scaleN, float scaleR); 34 | virtual ~ChannelFeatures(); 35 | 36 | void printFeatures(int index) const 37 | { 38 | 39 | for (int y = 0; y < Channelheight; y++) { 40 | for (int x = 0; x < Channelwidth; x++) { 41 | std::cout << Features[index][x * Channelheight + y] << " "; 42 | } 43 | std::cout << std::endl; 44 | } 45 | } 46 | 47 | int getChannelWidth() const 48 | { 49 | return this->Channelwidth; 50 | } 51 | 52 | int getChannelHeight() const 53 | { 54 | return this->Channelheight; 55 | } 56 | 57 | int getnChannels() const 58 | { 59 | return this->Features.size(); 60 | } 61 | 62 | float getFeatureValue(int channel, int location) const; 63 | 64 | void SmoothChannels(); 65 | 66 | private: 67 | ChannelFeatures(int width, int height, std::vector F) 68 | : Channelwidth(width) 69 | , Channelheight(height) 70 | { 71 | this->Features = F; 72 | } //only used in approximation 73 | 74 | void addChannelFeatures(Channel& ch); 75 | 76 | std::vector Features; 77 | int Channelwidth, Channelheight; 78 | }; 79 | 80 | #endif /* CHANNELFEATURES_H_ */ 81 | -------------------------------------------------------------------------------- /ACF/ColorChannel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ColorChannel.h 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef COLORCHANNEL_H_ 9 | #define COLORCHANNEL_H_ 10 | 11 | #include 12 | #include "Channel.h" 13 | 14 | #include "opencv2/imgproc/imgproc.hpp" 15 | #include "opencv2/objdetect/objdetect.hpp" 16 | #include "opencv2/gpu/gpu.hpp" 17 | #include "opencv2/highgui/highgui.hpp" 18 | 19 | float* Convert_ToMatlab(const cv::Mat& image, float scale); 20 | 21 | class ColorChannel : public Channel { 22 | public: 23 | ColorChannel(const cv::Mat& Image); 24 | virtual ~ColorChannel(); 25 | 26 | static float getLambda() 27 | { 28 | return 0.0; 29 | } 30 | 31 | private: 32 | void setColorSpace(std::string cspace) 33 | { 34 | if (cspace == "luv") { 35 | this->colorSpace = cspace; 36 | } 37 | else { 38 | std::cerr << "Unknown colorspace!!" << std::endl; 39 | } 40 | } 41 | std::string colorSpace; 42 | }; 43 | 44 | #endif /* COLORCHANNEL_H_ */ 45 | -------------------------------------------------------------------------------- /ACF/CombinationFramework.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Name : CombinationFramework.cpp 3 | // Author : F. De Smedt @ EAVISE 4 | // Version : 5 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 6 | // Description : Source for the default application 7 | //============================================================================ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | // for input possibilities 16 | #include "FrameFromDirectory.h" 17 | #include "FrameFromCamera.h" 18 | #include "FrameFromVideo.h" 19 | 20 | // detection includes 21 | //#include "src/detection.h" 22 | #include "DetectionList.h" 23 | #include "NonMaximumSuppression.h" 24 | 25 | #include "DetectorManager.h" 26 | 27 | #include "FileWriter.h" 28 | #include "iostream" 29 | #include "timer.h" 30 | // namespaces 31 | using namespace std; 32 | using namespace cv; 33 | string buf; 34 | 35 | inline string to_string(int value) 36 | { 37 | int i = 30; 38 | buf = ""; 39 | for (; value && i; --i, value /= 10) 40 | buf = "0123456789"[value % 10] + buf; 41 | return buf; 42 | } 43 | 44 | int main(int argc, char** argv) 45 | { 46 | 47 | // Initialise the input 48 | FrameProducer* FP = new FrameFromDirectory(argv[1]); 49 | FileWriter* FW; 50 | DetectorManager DM; 51 | 52 | NonMaximumSuppression NMS; 53 | // Open the file for result writing 54 | FW = new FileWriter("detection.xml"); 55 | 56 | string output(argv[2]); 57 | output += "/"; 58 | 59 | int cnt = 0; 60 | while (!FP->isend()) { 61 | // retrieve frame 62 | cv::Mat Frame = FP->giveFrame(); 63 | 64 | cnt++; 65 | // Timer t; t.start(); 66 | //perform detection 67 | DetectionList DL = DM.applyDetector(Frame); 68 | 69 | //NMS 70 | DetectionList NMax = NMS.dollarNMS(DL); 71 | 72 | cout<getFilename()); 75 | 76 | // Draw the detections and show them 77 | NMax.Draw(Frame, output, cnt); 78 | cv::imshow("Frame", Frame); 79 | 80 | cv::waitKey(0); 81 | } 82 | 83 | delete FP; 84 | 85 | delete FW; 86 | return EXIT_SUCCESS; 87 | } 88 | -------------------------------------------------------------------------------- /ACF/Convert.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | float* Convert_ToMatlab(const cv::Mat& image, float scale) 8 | { 9 | int channels = image.channels(); 10 | int width = image.cols; 11 | int height = image.rows; 12 | 13 | float* Image_data = (float*)malloc(sizeof(float) * channels * width * height); 14 | 15 | for (int x = 0; x < width; x++) { 16 | for (int y = 0; y < height; y++) { 17 | if (channels == 3) { 18 | cv::Vec3f intensity = image.at(y, x); 19 | float blue = intensity.val[2] * scale; 20 | float green = intensity.val[1] * scale; 21 | float red = intensity.val[0] * scale; 22 | Image_data[0 * width * height + x * height + y] = red; 23 | Image_data[1 * width * height + x * height + y] = green; 24 | Image_data[2 * width * height + x * height + y] = blue; 25 | } 26 | else if (channels == 1) { 27 | float intensity = image.at(y, x); 28 | Image_data[x * height + y] = intensity * scale; 29 | } 30 | else { 31 | std::cout << "Other as 3 or 1 channels not yet supported!!! so " << channels << "is NOT ok" << std::endl; 32 | } 33 | } 34 | } 35 | 36 | return Image_data; 37 | } 38 | 39 | cv::Mat Convert_ToOCV(float* data, int channels, int width, int height, float scale) 40 | { 41 | 42 | cv::Mat Image; 43 | if (channels == 3) 44 | Image.create(height, width, CV_32FC3); 45 | else { 46 | if (channels == 1) { 47 | Image.create(height, width, CV_32FC1); 48 | } 49 | else { 50 | std::cout << "In converting to OCV is only 1 and 3 supported!!" << std::endl; 51 | exit(1); 52 | } 53 | } 54 | 55 | if (channels == 3) { 56 | exit(3); 57 | } 58 | else { 59 | for (int x = 0; x < width; x++) { 60 | for (int y = 0; y < height; y++) { 61 | Image.at(y, x) = data[x * height + y]; 62 | } 63 | } 64 | } 65 | 66 | return Image; 67 | } 68 | -------------------------------------------------------------------------------- /ACF/DetectionList.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "DetectionList.h" 7 | 8 | DetectionList::DetectionList() 9 | { 10 | } 11 | 12 | DetectionList::~DetectionList() 13 | { 14 | // delete the detections from the list 15 | for (int d = 0; d < this->Ds.size(); d++) { 16 | delete Ds[d]; 17 | } 18 | } 19 | 20 | void DetectionList::addDetection(float x, float y, float w, float h, float score, cv::Scalar C) 21 | { 22 | Detection* D = new Detection(x, y, w, h, score); 23 | D->setColor(C); 24 | this->Ds.push_back(D); 25 | } 26 | 27 | void DetectionList::addDetection(float x, float y, float w, float h, float score) 28 | { 29 | Detection* D = new Detection(x, y, w, h, score); 30 | D->setColor(cv::Scalar(255, 0, 0)); 31 | this->Ds.push_back(D); 32 | } 33 | -------------------------------------------------------------------------------- /ACF/DetectorManager.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "DetectorManager.h" 7 | 8 | DetectorManager::DetectorManager() 9 | { 10 | 11 | // uncomment to use Combinator detector 12 | // Det = new Combinator(); 13 | 14 | // uncomment to use DPM detector first version 15 | // Det = new DPMDetectorOld(); 16 | 17 | // uncomment to use new DPM detector. 18 | // Det = new DPMDetector(); 19 | 20 | // uncomment to use ICF detector 21 | // Det = new ChnFtrsDetector(); 22 | 23 | // uncomment to use ICF detector 24 | Det = new ACFDetector(); 25 | 26 | // HOG detector 27 | // Det = new HOGDetector(); 28 | } 29 | 30 | DetectorManager::~DetectorManager() 31 | { 32 | // cleanly delete the created detector 33 | delete Det; 34 | } 35 | 36 | DetectionList DetectorManager::applyDetector(cv::Mat& Frame) 37 | { 38 | // forward the detection request to the detector 39 | return Det->applyDetector(Frame); 40 | } 41 | -------------------------------------------------------------------------------- /ACF/DetectorManager.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef DETECTORMANAGER_H_ 7 | #define DETECTORMANAGER_H_ 8 | 9 | #include "ACFDetector.h" 10 | 11 | /* 12 | * This is a broker-class to hide the handling of detector creation, removal, ... 13 | */ 14 | 15 | class DetectorManager { 16 | public: 17 | DetectorManager(); 18 | virtual ~DetectorManager(); 19 | 20 | DetectionList applyDetector(cv::Mat& Frame); 21 | 22 | private: 23 | Detector* Det; 24 | }; 25 | 26 | #endif /* DETECTORMANAGER_H_ */ 27 | -------------------------------------------------------------------------------- /ACF/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 | -------------------------------------------------------------------------------- /ACF/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup Cholesky_Module Cholesky module 9 | * 10 | * 11 | * 12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 13 | * Those decompositions are accessible via the following MatrixBase methods: 14 | * - MatrixBase::llt(), 15 | * - MatrixBase::ldlt() 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | */ 21 | 22 | #include "src/misc/Solve.h" 23 | #include "src/Cholesky/LLT.h" 24 | #include "src/Cholesky/LDLT.h" 25 | #ifdef EIGEN_USE_LAPACKE 26 | #include "src/Cholesky/LLT_MKL.h" 27 | #endif 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_CHOLESKY_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | -------------------------------------------------------------------------------- /ACF/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 2 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup CholmodSupport_Module CholmodSupport module 14 | * 15 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 16 | * It provides the two following main factorization classes: 17 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 18 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 19 | * 20 | * For the sake of completeness, this module also propose the two following classes: 21 | * - class CholmodSimplicialLLT 22 | * - class CholmodSimplicialLDLT 23 | * Note that these classes does not bring any particular advantage compared to the built-in 24 | * SimplicialLLT and SimplicialLDLT factorization classes. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 31 | * The dependencies depend on how cholmod has been compiled. 32 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/misc/Solve.h" 37 | #include "src/misc/SparseSolve.h" 38 | 39 | #include "src/CholmodSupport/CholmodSupport.h" 40 | 41 | 42 | #include "src/Core/util/ReenableStupidWarnings.h" 43 | 44 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 45 | 46 | -------------------------------------------------------------------------------- /ACF/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /ACF/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /ACF/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 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2SUPPORT_H 11 | #define EIGEN2SUPPORT_H 12 | 13 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) 14 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header 15 | #endif 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup Eigen2Support_Module Eigen2 support module 21 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. 22 | * 23 | * To use it, define EIGEN2_SUPPORT before including any Eigen header 24 | * \code 25 | * #define EIGEN2_SUPPORT 26 | * \endcode 27 | * 28 | */ 29 | 30 | #include "src/Eigen2Support/Macros.h" 31 | #include "src/Eigen2Support/Memory.h" 32 | #include "src/Eigen2Support/Meta.h" 33 | #include "src/Eigen2Support/Lazy.h" 34 | #include "src/Eigen2Support/Cwise.h" 35 | #include "src/Eigen2Support/CwiseOperators.h" 36 | #include "src/Eigen2Support/TriangularSolver.h" 37 | #include "src/Eigen2Support/Block.h" 38 | #include "src/Eigen2Support/VectorBlock.h" 39 | #include "src/Eigen2Support/Minor.h" 40 | #include "src/Eigen2Support/MathFunctions.h" 41 | 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | // Eigen2 used to include iostream 46 | #include 47 | 48 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ 49 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \ 50 | using Eigen::Vector##SizeSuffix##TypeSuffix; \ 51 | using Eigen::RowVector##SizeSuffix##TypeSuffix; 52 | 53 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ 54 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ 55 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ 56 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ 57 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ 58 | 59 | #define EIGEN_USING_MATRIX_TYPEDEFS \ 60 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ 61 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ 62 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ 63 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ 64 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) 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 | -------------------------------------------------------------------------------- /ACF/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 | #include "Geometry" 13 | 14 | /** \defgroup Eigenvalues_Module Eigenvalues module 15 | * 16 | * 17 | * 18 | * This module mainly provides various eigenvalue solvers. 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::eigenvalues(), 21 | * - MatrixBase::operatorNorm() 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigenvalues/Tridiagonalization.h" 29 | #include "src/Eigenvalues/RealSchur.h" 30 | #include "src/Eigenvalues/EigenSolver.h" 31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/HessenbergDecomposition.h" 34 | #include "src/Eigenvalues/ComplexSchur.h" 35 | #include "src/Eigenvalues/ComplexEigenSolver.h" 36 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 37 | #ifdef EIGEN_USE_LAPACKE 38 | #include "src/Eigenvalues/RealSchur_MKL.h" 39 | #include "src/Eigenvalues/ComplexSchur_MKL.h" 40 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_EIGENVALUES_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup Geometry_Module Geometry module 17 | * 18 | * 19 | * 20 | * This module provides support for: 21 | * - fixed-size homogeneous transformations 22 | * - translation, scaling, 2D and 3D rotations 23 | * - quaternions 24 | * - \ref MatrixBase::cross() "cross product" 25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 26 | * - some linear components: parametrized-lines and hyperplanes 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #include "src/Geometry/OrthoMethods.h" 34 | #include "src/Geometry/EulerAngles.h" 35 | 36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 37 | #include "src/Geometry/Homogeneous.h" 38 | #include "src/Geometry/RotationBase.h" 39 | #include "src/Geometry/Rotation2D.h" 40 | #include "src/Geometry/Quaternion.h" 41 | #include "src/Geometry/AngleAxis.h" 42 | #include "src/Geometry/Transform.h" 43 | #include "src/Geometry/Translation.h" 44 | #include "src/Geometry/Scaling.h" 45 | #include "src/Geometry/Hyperplane.h" 46 | #include "src/Geometry/ParametrizedLine.h" 47 | #include "src/Geometry/AlignedBox.h" 48 | #include "src/Geometry/Umeyama.h" 49 | 50 | #if defined EIGEN_VECTORIZE_SSE 51 | #include "src/Geometry/arch/Geometry_SSE.h" 52 | #endif 53 | #endif 54 | 55 | #ifdef EIGEN2_SUPPORT 56 | #include "src/Eigen2Support/Geometry/All.h" 57 | #endif 58 | 59 | #include "src/Core/util/ReenableStupidWarnings.h" 60 | 61 | #endif // EIGEN_GEOMETRY_MODULE_H 62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 63 | 64 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup Householder_Module Householder module 9 | * This module provides Householder transformations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | */ 15 | 16 | #include "src/Householder/Householder.h" 17 | #include "src/Householder/HouseholderSequence.h" 18 | #include "src/Householder/BlockHouseholder.h" 19 | 20 | #include "src/Core/util/ReenableStupidWarnings.h" 21 | 22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 24 | -------------------------------------------------------------------------------- /ACF/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 2 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | 7 | #include "src/Core/util/DisableStupidWarnings.h" 8 | 9 | /** \ingroup Sparse_modules 10 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 11 | * 12 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 13 | * Those solvers are accessible via the following classes: 14 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 15 | * - BiCGSTAB for general square matrices. 16 | * 17 | * These iterative solvers are associated with some preconditioners: 18 | * - IdentityPreconditioner - not really useful 19 | * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices. 20 | * - IncompleteILUT - incomplete LU factorization with dual thresholding 21 | * 22 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 33 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 34 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 35 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 36 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 41 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup Jacobi_Module Jacobi module 9 | * This module provides Jacobi and Givens rotations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | * 15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 16 | * - MatrixBase::applyOnTheLeft() 17 | * - MatrixBase::applyOnTheRight(). 18 | */ 19 | 20 | #include "src/Jacobi/Jacobi.h" 21 | 22 | #include "src/Core/util/ReenableStupidWarnings.h" 23 | 24 | #endif // EIGEN_JACOBI_MODULE_H 25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 26 | 27 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup LU_Module LU module 9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 10 | * This module defines the following MatrixBase methods: 11 | * - MatrixBase::inverse() 12 | * - MatrixBase::determinant() 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/misc/Solve.h" 20 | #include "src/misc/Kernel.h" 21 | #include "src/misc/Image.h" 22 | #include "src/LU/FullPivLU.h" 23 | #include "src/LU/PartialPivLU.h" 24 | #ifdef EIGEN_USE_LAPACKE 25 | #include "src/LU/PartialPivLU_MKL.h" 26 | #endif 27 | #include "src/LU/Determinant.h" 28 | #include "src/LU/Inverse.h" 29 | 30 | #if defined EIGEN_VECTORIZE_SSE 31 | #include "src/LU/arch/Inverse_SSE.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/LU.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_LU_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup LeastSquares_Module LeastSquares module 19 | * This module provides linear regression and related features. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/Eigen2Support/LeastSquares.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN2_SUPPORT 31 | 32 | #endif // EIGEN_REGRESSION_MODULE_H 33 | -------------------------------------------------------------------------------- /ACF/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 2 | #define EIGEN_ORDERINGMETHODS_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \ingroup Sparse_modules 9 | * \defgroup OrderingMethods_Module OrderingMethods module 10 | * 11 | * This module is currently for internal use only. 12 | * 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/OrderingMethods/Amd.h" 20 | 21 | #include "src/Core/util/ReenableStupidWarnings.h" 22 | 23 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 24 | -------------------------------------------------------------------------------- /ACF/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 2 | #define EIGEN_PASTIXSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | extern "C" { 10 | #include 11 | #include 12 | } 13 | 14 | #ifdef complex 15 | #undef complex 16 | #endif 17 | 18 | /** \ingroup Support_modules 19 | * \defgroup PaStiXSupport_Module PaStiXSupport module 20 | * 21 | * This module provides an interface to the PaSTiX library. 22 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 23 | * It provides the two following main factorization classes: 24 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 25 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 26 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 33 | * The dependencies depend on how PaSTiX has been compiled. 34 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 35 | * 36 | */ 37 | 38 | #include "src/misc/Solve.h" 39 | #include "src/misc/SparseSolve.h" 40 | 41 | #include "src/PaStiXSupport/PaStiXSupport.h" 42 | 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 47 | -------------------------------------------------------------------------------- /ACF/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #define EIGEN_PARDISOSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup PardisoSupport_Module PardisoSupport module 14 | * 15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 23 | * 24 | */ 25 | 26 | #include "src/PardisoSupport/PardisoSupport.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 31 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup QR_Module QR module 13 | * 14 | * 15 | * 16 | * This module provides various QR decompositions 17 | * This module also provides some MatrixBase methods, including: 18 | * - MatrixBase::qr(), 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/QR/HouseholderQR.h" 27 | #include "src/QR/FullPivHouseholderQR.h" 28 | #include "src/QR/ColPivHouseholderQR.h" 29 | #ifdef EIGEN_USE_LAPACKE 30 | #include "src/QR/HouseholderQR_MKL.h" 31 | #include "src/QR/ColPivHouseholderQR_MKL.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/QR.h" 36 | #endif 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 | -------------------------------------------------------------------------------- /ACF/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 | -------------------------------------------------------------------------------- /ACF/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 | /** \defgroup SVD_Module SVD module 11 | * 12 | * 13 | * 14 | * This module provides SVD decomposition for matrices (both real and complex). 15 | * This decomposition is accessible via the following MatrixBase method: 16 | * - MatrixBase::jacobiSvd() 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/SVD/JacobiSVD.h" 25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 26 | #include "src/SVD/JacobiSVD_MKL.h" 27 | #endif 28 | #include "src/SVD/UpperBidiagonalization.h" 29 | 30 | #ifdef EIGEN2_SUPPORT 31 | #include "src/Eigen2Support/SVD.h" 32 | #endif 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_SVD_MODULE_H 37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 38 | -------------------------------------------------------------------------------- /ACF/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | /** \defgroup Sparse_modules Sparse modules 5 | * 6 | * Meta-module including all related modules: 7 | * - SparseCore 8 | * - OrderingMethods 9 | * - SparseCholesky 10 | * - IterativeLinearSolvers 11 | * 12 | * \code 13 | * #include 14 | * \endcode 15 | */ 16 | 17 | #include "SparseCore" 18 | #include "OrderingMethods" 19 | #include "SparseCholesky" 20 | #include "IterativeLinearSolvers" 21 | 22 | #endif // EIGEN_SPARSE_MODULE_H 23 | 24 | -------------------------------------------------------------------------------- /ACF/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 2 | #define EIGEN_SPARSECHOLESKY_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \ingroup Sparse_modules 9 | * \defgroup SparseCholesky_Module SparseCholesky module 10 | * 11 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 12 | * Those decompositions are accessible via the following classes: 13 | * - SimplicialLLt, 14 | * - SimplicialLDLt 15 | * 16 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/misc/SparseSolve.h" 25 | 26 | #include "src/SparseCholesky/SimplicialCholesky.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 31 | -------------------------------------------------------------------------------- /ACF/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECORE_MODULE_H 2 | #define EIGEN_SPARSECORE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** \ingroup Sparse_modules 15 | * \defgroup SparseCore_Module SparseCore module 16 | * 17 | * This module provides a sparse matrix representation, and basic associatd matrix manipulations 18 | * and operations. 19 | * 20 | * See the \ref TutorialSparse "Sparse tutorial" 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * This module depends on: Core. 27 | */ 28 | 29 | namespace Eigen { 30 | 31 | /** The type used to identify a general sparse storage. */ 32 | struct Sparse {}; 33 | 34 | } 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/CompressedStorage.h" 39 | #include "src/SparseCore/AmbiVector.h" 40 | #include "src/SparseCore/SparseMatrix.h" 41 | #include "src/SparseCore/MappedSparseMatrix.h" 42 | #include "src/SparseCore/SparseVector.h" 43 | #include "src/SparseCore/CoreIterators.h" 44 | #include "src/SparseCore/SparseBlock.h" 45 | #include "src/SparseCore/SparseTranspose.h" 46 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 47 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 48 | #include "src/SparseCore/SparseDot.h" 49 | #include "src/SparseCore/SparsePermutation.h" 50 | #include "src/SparseCore/SparseAssign.h" 51 | #include "src/SparseCore/SparseRedux.h" 52 | #include "src/SparseCore/SparseFuzzy.h" 53 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 54 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 55 | #include "src/SparseCore/SparseProduct.h" 56 | #include "src/SparseCore/SparseDenseProduct.h" 57 | #include "src/SparseCore/SparseDiagonalProduct.h" 58 | #include "src/SparseCore/SparseTriangularView.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/TriangularSolver.h" 61 | #include "src/SparseCore/SparseView.h" 62 | 63 | #include "src/Core/util/ReenableStupidWarnings.h" 64 | 65 | #endif // EIGEN_SPARSECORE_MODULE_H 66 | 67 | -------------------------------------------------------------------------------- /ACF/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /ACF/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /ACF/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /ACF/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #ifdef EMPTY 9 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 10 | #endif 11 | 12 | typedef int int_t; 13 | #include 14 | #include 15 | #include 16 | 17 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 18 | // so we remove it in favor of a SUPERLU_EMPTY token. 19 | // If EMPTY was already defined then we don't undef it. 20 | 21 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 22 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 23 | #elif defined(EMPTY) 24 | # undef EMPTY 25 | #endif 26 | 27 | #define SUPERLU_EMPTY (-1) 28 | 29 | namespace Eigen { struct SluMatrix; } 30 | 31 | /** \ingroup Support_modules 32 | * \defgroup SuperLUSupport_Module SuperLUSupport module 33 | * 34 | * This module provides an interface to the SuperLU library. 35 | * It provides the following factorization class: 36 | * - class SuperLU: a supernodal sequential LU factorization. 37 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 38 | * 39 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 40 | * 41 | * \code 42 | * #include 43 | * \endcode 44 | * 45 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 46 | * The dependencies depend on how superlu has been compiled. 47 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 48 | * 49 | */ 50 | 51 | #include "src/misc/Solve.h" 52 | #include "src/misc/SparseSolve.h" 53 | 54 | #include "src/SuperLUSupport/SuperLUSupport.h" 55 | 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 60 | -------------------------------------------------------------------------------- /ACF/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup UmfPackSupport_Module UmfPackSupport module 14 | * 15 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 16 | * It provides the following factorization class: 17 | * - class UmfPackLU: a multifrontal sequential LU factorization. 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | * 23 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 24 | * The dependencies depend on how umfpack has been compiled. 25 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 26 | * 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/UmfPackSupport/UmfPackSupport.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /ACF/Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/CholmodSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_CholmodSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/ReturnByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // Copyright (C) 2009-2010 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_RETURNBYVALUE_H 12 | #define EIGEN_RETURNBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class ReturnByValue 17 | * \ingroup Core_Module 18 | * 19 | */ 20 | 21 | namespace internal { 22 | 23 | template 24 | struct traits > 25 | : public traits::ReturnType> 26 | { 27 | enum { 28 | // We're disabling the DirectAccess because e.g. the constructor of 29 | // the Block-with-DirectAccess expression requires to have a coeffRef method. 30 | // Also, we don't want to have to implement the stride stuff. 31 | Flags = (traits::ReturnType>::Flags 32 | | EvalBeforeNestingBit) & ~DirectAccessBit 33 | }; 34 | }; 35 | 36 | /* The ReturnByValue object doesn't even have a coeff() method. 37 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. 38 | * So internal::nested always gives the plain return matrix type. 39 | * 40 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? 41 | */ 42 | template 43 | struct nested, n, PlainObject> 44 | { 45 | typedef typename traits::ReturnType type; 46 | }; 47 | 48 | } // end namespace internal 49 | 50 | template class ReturnByValue 51 | : public internal::dense_xpr_base< ReturnByValue >::type 52 | { 53 | public: 54 | typedef typename internal::traits::ReturnType ReturnType; 55 | 56 | typedef typename internal::dense_xpr_base::type Base; 57 | EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) 58 | 59 | template 60 | inline void evalTo(Dest& dst) const 61 | { static_cast(this)->evalTo(dst); } 62 | inline Index rows() const { return static_cast(this)->rows(); } 63 | inline Index cols() const { return static_cast(this)->cols(); } 64 | 65 | #ifndef EIGEN_PARSED_BY_DOXYGEN 66 | #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT 67 | class Unusable{ 68 | Unusable(const Unusable&) {} 69 | Unusable& operator=(const Unusable&) {return *this;} 70 | }; 71 | const Unusable& coeff(Index) const { return *reinterpret_cast(this); } 72 | const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } 73 | Unusable& coeffRef(Index) { return *reinterpret_cast(this); } 74 | Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } 75 | #endif 76 | }; 77 | 78 | template 79 | template 80 | Derived& DenseBase::operator=(const ReturnByValue& other) 81 | { 82 | other.evalTo(derived()); 83 | return derived(); 84 | } 85 | 86 | } // end namespace Eigen 87 | 88 | #endif // EIGEN_RETURNBYVALUE_H 89 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // typedef that may be a reference type. 25 | // 279 - controlling expression is constant 26 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 27 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 28 | #pragma warning push 29 | #endif 30 | #pragma warning disable 2196 279 31 | #elif defined __clang__ 32 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 33 | // this is really a stupid warning as it warns on compile-time expressions involving enums 34 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 35 | #pragma clang diagnostic push 36 | #endif 37 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 38 | #endif 39 | 40 | #endif // not EIGEN_WARNINGS_DISABLED 41 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H 116 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LAZY_H 11 | #define EIGEN_LAZY_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated it is only used by lazy() which is deprecated 16 | * 17 | * \returns an expression of *this with added flags 18 | * 19 | * Example: \include MatrixBase_marked.cpp 20 | * Output: \verbinclude MatrixBase_marked.out 21 | * 22 | * \sa class Flagged, extract(), part() 23 | */ 24 | template 25 | template 26 | inline const Flagged 27 | MatrixBase::marked() const 28 | { 29 | return derived(); 30 | } 31 | 32 | /** \deprecated use MatrixBase::noalias() 33 | * 34 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 35 | * 36 | * Example: \include MatrixBase_lazy.cpp 37 | * Output: \verbinclude MatrixBase_lazy.out 38 | * 39 | * \sa class Flagged, marked() 40 | */ 41 | template 42 | inline const Flagged 43 | MatrixBase::lazy() const 44 | { 45 | return derived(); 46 | } 47 | 48 | 49 | /** \internal 50 | * Overloaded to perform an efficient C += (A*B).lazy() */ 51 | template 52 | template 53 | Derived& MatrixBase::operator+=(const Flagged, 0, 54 | EvalBeforeAssigningBit>& other) 55 | { 56 | other._expression().derived().addTo(derived()); return derived(); 57 | } 58 | 59 | /** \internal 60 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 61 | template 62 | template 63 | Derived& MatrixBase::operator-=(const Flagged, 0, 64 | EvalBeforeAssigningBit>& other) 65 | { 66 | other._expression().derived().subTo(derived()); return derived(); 67 | } 68 | 69 | } // end namespace Eigen 70 | 71 | #endif // EIGEN_LAZY_H 72 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MATH_FUNCTIONS_H 11 | #define EIGEN2_MATH_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | template inline typename NumTraits::Real ei_real(const T& x) { return internal::real(x); } 16 | template inline typename NumTraits::Real ei_imag(const T& x) { return internal::imag(x); } 17 | template inline T ei_conj(const T& x) { return internal::conj(x); } 18 | template inline typename NumTraits::Real ei_abs (const T& x) { return internal::abs(x); } 19 | template inline typename NumTraits::Real ei_abs2(const T& x) { return internal::abs2(x); } 20 | template inline T ei_sqrt(const T& x) { return internal::sqrt(x); } 21 | template inline T ei_exp (const T& x) { return internal::exp(x); } 22 | template inline T ei_log (const T& x) { return internal::log(x); } 23 | template inline T ei_sin (const T& x) { return internal::sin(x); } 24 | template inline T ei_cos (const T& x) { return internal::cos(x); } 25 | template inline T ei_atan2(const T& x,const T& y) { return internal::atan2(x,y); } 26 | template inline T ei_pow (const T& x,const T& y) { return internal::pow(x,y); } 27 | template inline T ei_random () { return internal::random(); } 28 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 29 | 30 | template inline T precision () { return NumTraits::dummy_precision(); } 31 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 32 | 33 | 34 | template 35 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 36 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 37 | { 38 | return internal::isMuchSmallerThan(x, y, precision); 39 | } 40 | 41 | template 42 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 43 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 44 | { 45 | return internal::isApprox(x, y, precision); 46 | } 47 | 48 | template 49 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 50 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 51 | { 52 | return internal::isApproxOrLessThan(x, y, precision); 53 | } 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN2_MATH_FUNCTIONS_H 58 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MEMORY_H 11 | #define EIGEN2_MEMORY_H 12 | 13 | namespace Eigen { 14 | 15 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 16 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 17 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 18 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 19 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 20 | 21 | template inline void* ei_conditional_aligned_malloc(size_t size) 22 | { 23 | return internal::conditional_aligned_malloc(size); 24 | } 25 | template inline void ei_conditional_aligned_free(void *ptr) 26 | { 27 | internal::conditional_aligned_free(ptr); 28 | } 29 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 30 | { 31 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 32 | } 33 | 34 | template inline T* ei_aligned_new(size_t size) 35 | { 36 | return internal::aligned_new(size); 37 | } 38 | template inline void ei_aligned_delete(T *ptr, size_t size) 39 | { 40 | return internal::aligned_delete(ptr, size); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN2_MACROS_H 46 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/Meta.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_META_H 11 | #define EIGEN2_META_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | struct ei_traits : internal::traits 17 | {}; 18 | 19 | struct ei_meta_true { enum { ret = 1 }; }; 20 | struct ei_meta_false { enum { ret = 0 }; }; 21 | 22 | template 23 | struct ei_meta_if { typedef Then ret; }; 24 | 25 | template 26 | struct ei_meta_if { typedef Else ret; }; 27 | 28 | template struct ei_is_same_type { enum { ret = 0 }; }; 29 | template struct ei_is_same_type { enum { ret = 1 }; }; 30 | 31 | template struct ei_unref { typedef T type; }; 32 | template struct ei_unref { typedef T type; }; 33 | 34 | template struct ei_unpointer { typedef T type; }; 35 | template struct ei_unpointer { typedef T type; }; 36 | template struct ei_unpointer { typedef T type; }; 37 | 38 | template struct ei_unconst { typedef T type; }; 39 | template struct ei_unconst { typedef T type; }; 40 | template struct ei_unconst { typedef T & type; }; 41 | template struct ei_unconst { typedef T * type; }; 42 | 43 | template struct ei_cleantype { typedef T type; }; 44 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 45 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 46 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 47 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 48 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 49 | 50 | /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. 51 | * Usage example: \code ei_meta_sqrt<1023>::ret \endcode 52 | */ 53 | template Y))) > 57 | // use ?: instead of || just to shut up a stupid gcc 4.3 warning 58 | class ei_meta_sqrt 59 | { 60 | enum { 61 | MidX = (InfX+SupX)/2, 62 | TakeInf = MidX*MidX > Y ? 1 : 0, 63 | NewInf = int(TakeInf) ? InfX : int(MidX), 64 | NewSup = int(TakeInf) ? int(MidX) : SupX 65 | }; 66 | public: 67 | enum { ret = ei_meta_sqrt::ret }; 68 | }; 69 | 70 | template 71 | class ei_meta_sqrt { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; }; 72 | 73 | } // end namespace Eigen 74 | 75 | #endif // EIGEN2_META_H 76 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_QR_H 12 | #define EIGEN2_QR_H 13 | 14 | namespace Eigen { 15 | 16 | template 17 | class QR : public HouseholderQR 18 | { 19 | public: 20 | 21 | typedef HouseholderQR Base; 22 | typedef Block MatrixRBlockType; 23 | 24 | QR() : Base() {} 25 | 26 | template 27 | explicit QR(const T& t) : Base(t) {} 28 | 29 | template 30 | bool solve(const MatrixBase& b, ResultType *result) const 31 | { 32 | *result = static_cast(this)->solve(b); 33 | return true; 34 | } 35 | 36 | MatrixType matrixQ(void) const { 37 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 38 | ret = this->householderQ() * ret; 39 | return ret; 40 | } 41 | 42 | bool isFullRank() const { 43 | return true; 44 | } 45 | 46 | const TriangularView 47 | matrixR(void) const 48 | { 49 | int cols = this->cols(); 50 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 51 | } 52 | }; 53 | 54 | /** \return the QR decomposition of \c *this. 55 | * 56 | * \sa class QR 57 | */ 58 | template 59 | const QR::PlainObject> 60 | MatrixBase::qr() const 61 | { 62 | return QR(eval()); 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN2_QR_H 68 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 11 | #define EIGEN_TRIANGULAR_SOLVER2_H 12 | 13 | namespace Eigen { 14 | 15 | const unsigned int UnitDiagBit = UnitDiag; 16 | const unsigned int SelfAdjointBit = SelfAdjoint; 17 | const unsigned int UpperTriangularBit = Upper; 18 | const unsigned int LowerTriangularBit = Lower; 19 | 20 | const unsigned int UpperTriangular = Upper; 21 | const unsigned int LowerTriangular = Lower; 22 | const unsigned int UnitUpperTriangular = UnitUpper; 23 | const unsigned int UnitLowerTriangular = UnitLower; 24 | 25 | template 26 | template 27 | typename ExpressionType::PlainObject 28 | Flagged::solveTriangular(const MatrixBase& other) const 29 | { 30 | return m_matrix.template triangularView().solve(other.derived()); 31 | } 32 | 33 | template 34 | template 35 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 36 | { 37 | m_matrix.template triangularView().solveInPlace(other.derived()); 38 | } 39 | 40 | } // end namespace Eigen 41 | 42 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 43 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigen2Support/VectorBlock.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_VECTORBLOCK_H 12 | #define EIGEN2_VECTORBLOCK_H 13 | 14 | namespace Eigen { 15 | 16 | /** \deprecated use DenseMase::head(Index) */ 17 | template 18 | inline VectorBlock 19 | MatrixBase::start(Index size) 20 | { 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 22 | return VectorBlock(derived(), 0, size); 23 | } 24 | 25 | /** \deprecated use DenseMase::head(Index) */ 26 | template 27 | inline const VectorBlock 28 | MatrixBase::start(Index size) const 29 | { 30 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 31 | return VectorBlock(derived(), 0, size); 32 | } 33 | 34 | /** \deprecated use DenseMase::tail(Index) */ 35 | template 36 | inline VectorBlock 37 | MatrixBase::end(Index size) 38 | { 39 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 40 | return VectorBlock(derived(), this->size() - size, size); 41 | } 42 | 43 | /** \deprecated use DenseMase::tail(Index) */ 44 | template 45 | inline const VectorBlock 46 | MatrixBase::end(Index size) const 47 | { 48 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 49 | return VectorBlock(derived(), this->size() - size, size); 50 | } 51 | 52 | /** \deprecated use DenseMase::head() */ 53 | template 54 | template 55 | inline VectorBlock 56 | MatrixBase::start() 57 | { 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 59 | return VectorBlock(derived(), 0); 60 | } 61 | 62 | /** \deprecated use DenseMase::head() */ 63 | template 64 | template 65 | inline const VectorBlock 66 | MatrixBase::start() const 67 | { 68 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 69 | return VectorBlock(derived(), 0); 70 | } 71 | 72 | /** \deprecated use DenseMase::tail() */ 73 | template 74 | template 75 | inline VectorBlock 76 | MatrixBase::end() 77 | { 78 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 79 | return VectorBlock(derived(), size() - Size); 80 | } 81 | 82 | /** \deprecated use DenseMase::tail() */ 83 | template 84 | template 85 | inline const VectorBlock 86 | MatrixBase::end() const 87 | { 88 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 89 | return VectorBlock(derived(), size() - Size); 90 | } 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN2_VECTORBLOCK_H 95 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Geometry/EulerAngles.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_EULERANGLES_H 11 | #define EIGEN_EULERANGLES_H 12 | 13 | namespace Eigen { 14 | 15 | /** \geometry_module \ingroup Geometry_Module 16 | * 17 | * 18 | * \returns the Euler-angles of the rotation matrix \c *this using the convention defined by the triplet (\a a0,\a a1,\a a2) 19 | * 20 | * Each of the three parameters \a a0,\a a1,\a a2 represents the respective rotation axis as an integer in {0,1,2}. 21 | * For instance, in: 22 | * \code Vector3f ea = mat.eulerAngles(2, 0, 2); \endcode 23 | * "2" represents the z axis and "0" the x axis, etc. The returned angles are such that 24 | * we have the following equality: 25 | * \code 26 | * mat == AngleAxisf(ea[0], Vector3f::UnitZ()) 27 | * * AngleAxisf(ea[1], Vector3f::UnitX()) 28 | * * AngleAxisf(ea[2], Vector3f::UnitZ()); \endcode 29 | * This corresponds to the right-multiply conventions (with right hand side frames). 30 | */ 31 | template 32 | inline Matrix::Scalar,3,1> 33 | MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const 34 | { 35 | /* Implemented from Graphics Gems IV */ 36 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3) 37 | 38 | Matrix res; 39 | typedef Matrix Vector2; 40 | const Scalar epsilon = NumTraits::dummy_precision(); 41 | 42 | const Index odd = ((a0+1)%3 == a1) ? 0 : 1; 43 | const Index i = a0; 44 | const Index j = (a0 + 1 + odd)%3; 45 | const Index k = (a0 + 2 - odd)%3; 46 | 47 | if (a0==a2) 48 | { 49 | Scalar s = Vector2(coeff(j,i) , coeff(k,i)).norm(); 50 | res[1] = internal::atan2(s, coeff(i,i)); 51 | if (s > epsilon) 52 | { 53 | res[0] = internal::atan2(coeff(j,i), coeff(k,i)); 54 | res[2] = internal::atan2(coeff(i,j),-coeff(i,k)); 55 | } 56 | else 57 | { 58 | res[0] = Scalar(0); 59 | res[2] = (coeff(i,i)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 60 | } 61 | } 62 | else 63 | { 64 | Scalar c = Vector2(coeff(i,i) , coeff(i,j)).norm(); 65 | res[1] = internal::atan2(-coeff(i,k), c); 66 | if (c > epsilon) 67 | { 68 | res[0] = internal::atan2(coeff(j,k), coeff(k,k)); 69 | res[2] = internal::atan2(coeff(i,j), coeff(i,i)); 70 | } 71 | else 72 | { 73 | res[0] = Scalar(0); 74 | res[2] = (coeff(i,k)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 75 | } 76 | } 77 | if (!odd) 78 | res = -res; 79 | return res; 80 | } 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_EULERANGLES_H 85 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 | #define EIGEN_BLOCK_HOUSEHOLDER_H 13 | 14 | // This file contains some helper function to deal with block householder reflectors 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | /** \internal */ 21 | template 22 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 23 | { 24 | typedef typename TriangularFactorType::Index Index; 25 | typedef typename VectorsType::Scalar Scalar; 26 | const Index nbVecs = vectors.cols(); 27 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 28 | 29 | for(Index i = 0; i < nbVecs; i++) 30 | { 31 | Index rs = vectors.rows() - i; 32 | Scalar Vii = vectors(i,i); 33 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 34 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 35 | * vectors.col(i).tail(rs); 36 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 37 | // FIXME add .noalias() once the triangular product can work inplace 38 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 39 | * triFactor.col(i).head(i); 40 | triFactor(i,i) = hCoeffs(i); 41 | } 42 | } 43 | 44 | /** \internal */ 45 | template 46 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 47 | { 48 | typedef typename MatrixType::Index Index; 49 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 50 | Index nbVecs = vectors.cols(); 51 | Matrix T(nbVecs,nbVecs); 52 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 53 | 54 | const TriangularView& V(vectors); 55 | 56 | // A -= V T V^* A 57 | Matrix tmp = V.adjoint() * mat; 59 | // FIXME add .noalias() once the triangular product can work inplace 60 | tmp = T.template triangularView().adjoint() * tmp; 61 | mat.noalias() -= V * tmp; 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 69 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/IterativeLinearSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeLinearSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeLinearSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/IterativeLinearSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /ACF/Eigen/src/LU/Determinant.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_DETERMINANT_H 11 | #define EIGEN_DETERMINANT_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template 18 | inline const typename Derived::Scalar bruteforce_det3_helper 19 | (const MatrixBase& matrix, int a, int b, int c) 20 | { 21 | return matrix.coeff(0,a) 22 | * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); 23 | } 24 | 25 | template 26 | const typename Derived::Scalar bruteforce_det4_helper 27 | (const MatrixBase& matrix, int j, int k, int m, int n) 28 | { 29 | return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1)) 30 | * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3)); 31 | } 32 | 33 | template struct determinant_impl 36 | { 37 | static inline typename traits::Scalar run(const Derived& m) 38 | { 39 | if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) 40 | return typename traits::Scalar(1); 41 | return m.partialPivLu().determinant(); 42 | } 43 | }; 44 | 45 | template struct determinant_impl 46 | { 47 | static inline typename traits::Scalar run(const Derived& m) 48 | { 49 | return m.coeff(0,0); 50 | } 51 | }; 52 | 53 | template struct determinant_impl 54 | { 55 | static inline typename traits::Scalar run(const Derived& m) 56 | { 57 | return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); 58 | } 59 | }; 60 | 61 | template struct determinant_impl 62 | { 63 | static inline typename traits::Scalar run(const Derived& m) 64 | { 65 | return bruteforce_det3_helper(m,0,1,2) 66 | - bruteforce_det3_helper(m,1,0,2) 67 | + bruteforce_det3_helper(m,2,0,1); 68 | } 69 | }; 70 | 71 | template struct determinant_impl 72 | { 73 | static typename traits::Scalar run(const Derived& m) 74 | { 75 | // trick by Martin Costabel to compute 4x4 det with only 30 muls 76 | return bruteforce_det4_helper(m,0,1,2,3) 77 | - bruteforce_det4_helper(m,0,2,1,3) 78 | + bruteforce_det4_helper(m,0,3,1,2) 79 | + bruteforce_det4_helper(m,1,2,0,3) 80 | - bruteforce_det4_helper(m,1,3,0,2) 81 | + bruteforce_det4_helper(m,2,3,0,1); 82 | } 83 | }; 84 | 85 | } // end namespace internal 86 | 87 | /** \lu_module 88 | * 89 | * \returns the determinant of this matrix 90 | */ 91 | template 92 | inline typename internal::traits::Scalar MatrixBase::determinant() const 93 | { 94 | assert(rows() == cols()); 95 | typedef typename internal::nested::type Nested; 96 | return internal::determinant_impl::type>::run(derived()); 97 | } 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_DETERMINANT_H 102 | -------------------------------------------------------------------------------- /ACF/Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/OrderingMethods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_OrderingMethods_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_OrderingMethods_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/OrderingMethods COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/PaStiXSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PastixSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PastixSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PaStiXSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/PardisoSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PardisoSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PardisoSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PardisoSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/QR/HouseholderQR_MKL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to Intel(R) MKL 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_MKL_H 35 | #define EIGEN_QR_MKL_H 36 | 37 | #include "Eigen/src/Core/util/MKL_support.h" 38 | 39 | namespace Eigen { 40 | 41 | namespace internal { 42 | 43 | /** \internal Specialization for the data types supported by MKL */ 44 | 45 | #define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 46 | template \ 47 | void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \ 48 | typename MatrixQR::Index maxBlockSize=32, \ 49 | EIGTYPE* tempData = 0) \ 50 | { \ 51 | lapack_int m = mat.rows(); \ 52 | lapack_int n = mat.cols(); \ 53 | lapack_int lda = mat.outerStride(); \ 54 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 55 | LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \ 56 | hCoeffs.adjointInPlace(); \ 57 | \ 58 | } 59 | 60 | EIGEN_MKL_QR_NOPIV(double, double, d) 61 | EIGEN_MKL_QR_NOPIV(float, float, s) 62 | EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z) 63 | EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c) 64 | 65 | } // end namespace internal 66 | 67 | } // end namespace Eigen 68 | 69 | #endif // EIGEN_QR_MKL_H 70 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCore_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCore_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCore COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseAssign.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forwchen/acf/d3dc642dcce1b51043f3a54b9d74ca3eec0c1783/ACF/Eigen/src/SparseCore/SparseAssign.h -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseDot.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_DOT_H 11 | #define EIGEN_SPARSE_DOT_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | typename internal::traits::Scalar 18 | SparseMatrixBase::dot(const MatrixBase& other) const 19 | { 20 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 22 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 23 | EIGEN_STATIC_ASSERT((internal::is_same::value), 24 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 25 | 26 | eigen_assert(size() == other.size()); 27 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 28 | 29 | typename Derived::InnerIterator i(derived(),0); 30 | Scalar res(0); 31 | while (i) 32 | { 33 | res += internal::conj(i.value()) * other.coeff(i.index()); 34 | ++i; 35 | } 36 | return res; 37 | } 38 | 39 | template 40 | template 41 | typename internal::traits::Scalar 42 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 43 | { 44 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 45 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 46 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 47 | EIGEN_STATIC_ASSERT((internal::is_same::value), 48 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 49 | 50 | eigen_assert(size() == other.size()); 51 | 52 | typedef typename Derived::Nested Nested; 53 | typedef typename OtherDerived::Nested OtherNested; 54 | typedef typename internal::remove_all::type NestedCleaned; 55 | typedef typename internal::remove_all::type OtherNestedCleaned; 56 | 57 | const Nested nthis(derived()); 58 | const OtherNested nother(other.derived()); 59 | 60 | typename NestedCleaned::InnerIterator i(nthis,0); 61 | typename OtherNestedCleaned::InnerIterator j(nother,0); 62 | Scalar res(0); 63 | while (i && j) 64 | { 65 | if (i.index()==j.index()) 66 | { 67 | res += internal::conj(i.value()) * j.value(); 68 | ++i; ++j; 69 | } 70 | else if (i.index() 79 | inline typename NumTraits::Scalar>::Real 80 | SparseMatrixBase::squaredNorm() const 81 | { 82 | return internal::real((*this).cwiseAbs2().sum()); 83 | } 84 | 85 | template 86 | inline typename NumTraits::Scalar>::Real 87 | SparseMatrixBase::norm() const 88 | { 89 | return internal::sqrt(squaredNorm()); 90 | } 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN_SPARSE_DOT_H 95 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | for (Index j=0; j 28 | typename internal::traits >::Scalar 29 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 30 | { 31 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 32 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 33 | } 34 | 35 | template 36 | typename internal::traits >::Scalar 37 | SparseVector<_Scalar,_Options,_Index>::sum() const 38 | { 39 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 40 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN_SPARSEREDUX_H 46 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class TransposeImpl 16 | : public SparseMatrixBase > 17 | { 18 | typedef typename internal::remove_all::type _MatrixTypeNested; 19 | public: 20 | 21 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose) 22 | 23 | class InnerIterator; 24 | class ReverseInnerIterator; 25 | 26 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 27 | }; 28 | 29 | // NOTE: VC10 trigger an ICE if don't put typename TransposeImpl:: in front of Index, 30 | // a typedef typename TransposeImpl::Index Index; 31 | // does not fix the issue. 32 | // An alternative is to define the nested class in the parent class itself. 33 | template class TransposeImpl::InnerIterator 34 | : public _MatrixTypeNested::InnerIterator 35 | { 36 | typedef typename _MatrixTypeNested::InnerIterator Base; 37 | public: 38 | 39 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl::Index outer) 40 | : Base(trans.derived().nestedExpression(), outer) 41 | {} 42 | inline typename TransposeImpl::Index row() const { return Base::col(); } 43 | inline typename TransposeImpl::Index col() const { return Base::row(); } 44 | }; 45 | 46 | template class TransposeImpl::ReverseInnerIterator 47 | : public _MatrixTypeNested::ReverseInnerIterator 48 | { 49 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 50 | public: 51 | 52 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl::Index outer) 53 | : Base(xpr.derived().nestedExpression(), outer) 54 | {} 55 | inline typename TransposeImpl::Index row() const { return Base::col(); } 56 | inline typename TransposeImpl::Index col() const { return Base::row(); } 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_SPARSETRANSPOSE_H 62 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SparseCore/SparseView.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Gael Guennebaud 5 | // Copyright (C) 2010 Daniel Lowengrub 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSEVIEW_H 12 | #define EIGEN_SPARSEVIEW_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | struct traits > : traits 20 | { 21 | typedef int Index; 22 | typedef Sparse StorageKind; 23 | enum { 24 | Flags = int(traits::Flags) & (RowMajorBit) 25 | }; 26 | }; 27 | 28 | } // end namespace internal 29 | 30 | template 31 | class SparseView : public SparseMatrixBase > 32 | { 33 | typedef typename MatrixType::Nested MatrixTypeNested; 34 | typedef typename internal::remove_all::type _MatrixTypeNested; 35 | public: 36 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) 37 | 38 | SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0), 39 | typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) : 40 | m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} 41 | 42 | class InnerIterator; 43 | 44 | inline Index rows() const { return m_matrix.rows(); } 45 | inline Index cols() const { return m_matrix.cols(); } 46 | 47 | inline Index innerSize() const { return m_matrix.innerSize(); } 48 | inline Index outerSize() const { return m_matrix.outerSize(); } 49 | 50 | protected: 51 | MatrixTypeNested m_matrix; 52 | Scalar m_reference; 53 | typename NumTraits::Real m_epsilon; 54 | }; 55 | 56 | template 57 | class SparseView::InnerIterator : public _MatrixTypeNested::InnerIterator 58 | { 59 | public: 60 | typedef typename _MatrixTypeNested::InnerIterator IterBase; 61 | InnerIterator(const SparseView& view, Index outer) : 62 | IterBase(view.m_matrix, outer), m_view(view) 63 | { 64 | incrementToNonZero(); 65 | } 66 | 67 | EIGEN_STRONG_INLINE InnerIterator& operator++() 68 | { 69 | IterBase::operator++(); 70 | incrementToNonZero(); 71 | return *this; 72 | } 73 | 74 | using IterBase::value; 75 | 76 | protected: 77 | const SparseView& m_view; 78 | 79 | private: 80 | void incrementToNonZero() 81 | { 82 | while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon)) 83 | { 84 | IterBase::operator++(); 85 | } 86 | } 87 | }; 88 | 89 | template 90 | const SparseView MatrixBase::sparseView(const Scalar& m_reference, 91 | typename NumTraits::Real m_epsilon) const 92 | { 93 | return SparseView(derived(), m_reference, m_epsilon); 94 | } 95 | 96 | } // end namespace Eigen 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /ACF/Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef size_t size_type; 26 | typedef ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #ifdef _MSC_VER 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | typename Eigen::internal::conditional< \ 56 | Eigen::internal::is_arithmetic::value, \ 57 | T, \ 58 | Eigen::internal::workaround_msvc_stl_support \ 59 | >::type 60 | 61 | namespace internal { 62 | template struct workaround_msvc_stl_support : public T 63 | { 64 | inline workaround_msvc_stl_support() : T() {} 65 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 66 | inline operator T& () { return *static_cast(this); } 67 | inline operator const T& () const { return *static_cast(this); } 68 | template 69 | inline T& operator=(const OtherT& other) 70 | { T::operator=(other); return *this; } 71 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 72 | { T::operator=(other); return *this; } 73 | }; 74 | } 75 | 76 | #else 77 | 78 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 79 | 80 | #endif 81 | 82 | } 83 | 84 | #endif // EIGEN_STL_DETAILS_H 85 | -------------------------------------------------------------------------------- /ACF/Eigen/src/SuperLUSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SuperLUSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SuperLUSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SuperLUSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/UmfPackSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_UmfPackSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_UmfPackSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/UmfPackSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class image_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 27 | // dimension is the number of rows of the original matrix 28 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 29 | MatrixType::Options, 30 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 31 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 32 | > ReturnType; 33 | }; 34 | 35 | template struct image_retval_base 36 | : public ReturnByValue > 37 | { 38 | typedef _DecompositionType DecompositionType; 39 | typedef typename DecompositionType::MatrixType MatrixType; 40 | typedef ReturnByValue Base; 41 | typedef typename Base::Index Index; 42 | 43 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 44 | : m_dec(dec), m_rank(dec.rank()), 45 | m_cols(m_rank == 0 ? 1 : m_rank), 46 | m_originalMatrix(originalMatrix) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.rows(); } 50 | inline Index cols() const { return m_cols; } 51 | inline Index rank() const { return m_rank; } 52 | inline const DecompositionType& dec() const { return m_dec; } 53 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | const MatrixType& m_originalMatrix; 64 | }; 65 | 66 | } // end namespace internal 67 | 68 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 69 | typedef typename DecompositionType::MatrixType MatrixType; \ 70 | typedef typename MatrixType::Scalar Scalar; \ 71 | typedef typename MatrixType::RealScalar RealScalar; \ 72 | typedef typename MatrixType::Index Index; \ 73 | typedef Eigen::internal::image_retval_base Base; \ 74 | using Base::dec; \ 75 | using Base::originalMatrix; \ 76 | using Base::rank; \ 77 | using Base::rows; \ 78 | using Base::cols; \ 79 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 80 | : Base(dec, originalMatrix) {} 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MISC_IMAGE_H 85 | -------------------------------------------------------------------------------- /ACF/Eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class kernel_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 27 | // is the number of cols of the original matrix 28 | // so that the product "matrix * kernel = zero" makes sense 29 | Dynamic, // we don't know at compile-time the dimension of the kernel 30 | MatrixType::Options, 31 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 32 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 33 | // whose dimension is the number of columns of the original matrix 34 | > ReturnType; 35 | }; 36 | 37 | template struct kernel_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef _DecompositionType DecompositionType; 41 | typedef ReturnByValue Base; 42 | typedef typename Base::Index Index; 43 | 44 | kernel_retval_base(const DecompositionType& dec) 45 | : m_dec(dec), 46 | m_rank(dec.rank()), 47 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 48 | {} 49 | 50 | inline Index rows() const { return m_dec.cols(); } 51 | inline Index cols() const { return m_cols; } 52 | inline Index rank() const { return m_rank; } 53 | inline const DecompositionType& dec() const { return m_dec; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef typename MatrixType::Index Index; \ 72 | typedef Eigen::internal::kernel_retval_base Base; \ 73 | using Base::dec; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_MISC_KERNEL_H 82 | -------------------------------------------------------------------------------- /ACF/Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_SOLVE_H 11 | #define EIGEN_MISC_SOLVE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class solve_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix ReturnType; 30 | }; 31 | 32 | template struct solve_retval_base 33 | : public ReturnByValue > 34 | { 35 | typedef typename remove_all::type RhsNestedCleaned; 36 | typedef _DecompositionType DecompositionType; 37 | typedef ReturnByValue Base; 38 | typedef typename Base::Index Index; 39 | 40 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 41 | : m_dec(dec), m_rhs(rhs) 42 | {} 43 | 44 | inline Index rows() const { return m_dec.cols(); } 45 | inline Index cols() const { return m_rhs.cols(); } 46 | inline const DecompositionType& dec() const { return m_dec; } 47 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 48 | 49 | template inline void evalTo(Dest& dst) const 50 | { 51 | static_cast*>(this)->evalTo(dst); 52 | } 53 | 54 | protected: 55 | const DecompositionType& m_dec; 56 | typename Rhs::Nested m_rhs; 57 | }; 58 | 59 | } // end namespace internal 60 | 61 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 62 | typedef typename DecompositionType::MatrixType MatrixType; \ 63 | typedef typename MatrixType::Scalar Scalar; \ 64 | typedef typename MatrixType::RealScalar RealScalar; \ 65 | typedef typename MatrixType::Index Index; \ 66 | typedef Eigen::internal::solve_retval_base Base; \ 67 | using Base::dec; \ 68 | using Base::rhs; \ 69 | using Base::rows; \ 70 | using Base::cols; \ 71 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 72 | : Base(dec, rhs) {} 73 | 74 | } // end namespace Eigen 75 | 76 | #endif // EIGEN_MISC_SOLVE_H 77 | -------------------------------------------------------------------------------- /ACF/Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /ACF/Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing common coefficient wise functions. 12 | 13 | /** \returns an expression of the difference of \c *this and \a other 14 | * 15 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 | * 17 | * \sa class CwiseBinaryOp, operator-=() 18 | */ 19 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 | 21 | /** \returns an expression of the sum of \c *this and \a other 22 | * 23 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 | * 25 | * \sa class CwiseBinaryOp, operator+=() 26 | */ 27 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 | 29 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 | * 31 | * The template parameter \a CustomBinaryOp is the type of the functor 32 | * of the custom operator (see class CwiseBinaryOp for an example) 33 | * 34 | * Here is an example illustrating the use of custom functors: 35 | * \include class_CwiseBinaryOp.cpp 36 | * Output: \verbinclude class_CwiseBinaryOp.out 37 | * 38 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 | */ 40 | template 41 | EIGEN_STRONG_INLINE const CwiseBinaryOp 42 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43 | { 44 | return CwiseBinaryOp(derived(), other.derived(), func); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /ACF/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 12 | 13 | /** \returns an expression of the coefficient-wise absolute value of \c *this 14 | * 15 | * Example: \include MatrixBase_cwiseAbs.cpp 16 | * Output: \verbinclude MatrixBase_cwiseAbs.out 17 | * 18 | * \sa cwiseAbs2() 19 | */ 20 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 21 | cwiseAbs() const { return derived(); } 22 | 23 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 24 | * 25 | * Example: \include MatrixBase_cwiseAbs2.cpp 26 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 27 | * 28 | * \sa cwiseAbs() 29 | */ 30 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 31 | cwiseAbs2() const { return derived(); } 32 | 33 | /** \returns an expression of the coefficient-wise square root of *this. 34 | * 35 | * Example: \include MatrixBase_cwiseSqrt.cpp 36 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 37 | * 38 | * \sa cwisePow(), cwiseSquare() 39 | */ 40 | inline const CwiseUnaryOp, const Derived> 41 | cwiseSqrt() const { return derived(); } 42 | 43 | /** \returns an expression of the coefficient-wise inverse of *this. 44 | * 45 | * Example: \include MatrixBase_cwiseInverse.cpp 46 | * Output: \verbinclude MatrixBase_cwiseInverse.out 47 | * 48 | * \sa cwiseProduct() 49 | */ 50 | inline const CwiseUnaryOp, const Derived> 51 | cwiseInverse() const { return derived(); } 52 | 53 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 54 | * 55 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 56 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 57 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 58 | * isMuchSmallerThan(). 59 | * 60 | * \sa cwiseEqual(const MatrixBase &) const 61 | */ 62 | inline const CwiseUnaryOp >, const Derived> 63 | cwiseEqual(const Scalar& s) const 64 | { 65 | return CwiseUnaryOp >,const Derived> 66 | (derived(), std::bind1st(std::equal_to(), s)); 67 | } 68 | -------------------------------------------------------------------------------- /ACF/FileWriter.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "FileWriter.h" 7 | 8 | using namespace std; 9 | 10 | typedef std::string str; // string 11 | const str e0 = ">\n"; 12 | const str e1 = "/>\n"; 13 | 14 | template 15 | str attr(const str& key, const T& value, const str unit = "") 16 | { 17 | std::stringstream ss; 18 | ss << key << "=\"" << value << unit << "\" "; 19 | return ss.str(); 20 | } 21 | str st(const str& name) 22 | { 23 | return "\t<" + name + " "; 24 | } 25 | str ed(const str& name) 26 | { 27 | return "\n"; 28 | } 29 | 30 | /*! 31 | \author F. De Smedt 32 | \date 2014 33 | */ 34 | FileWriter::FileWriter(std::string filename) 35 | { 36 | /*Open the file*/ 37 | m_file.open(filename.c_str()); 38 | 39 | /*Write header of file*/ 40 | /* 41 | m_file << "" << std::endl; 42 | m_file << "" << std::endl; 43 | */ 44 | xml << "\n"; 45 | xml << st("dataset") << attr("name", "campus") << e0; 46 | first = true; 47 | pframe = -1; 48 | } 49 | 50 | void FileWriter::writeDetection(int frameID, Detection* det) 51 | { 52 | 53 | if (frameID != pframe) { 54 | if (!first) { 55 | xml << ed("objectlist") << ed("frame"); 56 | } 57 | if (first) 58 | first = false; 59 | xml << st("frame") << attr("number", frameID) << e0; 60 | xml << st("objectlist") << e0; 61 | } 62 | 63 | if (det != NULL) { 64 | xml << st("object") << attr("confidence", det->getScore()) << e0; 65 | xml << st("box") 66 | << attr("h", det->getHeight()) 67 | << attr("w", det->getWidth()) 68 | << attr("xc", det->getX() + det->getWidth() / 2) 69 | << attr("yc", det->getY() + det->getHeight() / 2) << e1; 70 | xml << ed("object"); 71 | } 72 | pframe = frameID; 73 | } 74 | 75 | FileWriter::~FileWriter() 76 | { 77 | xml << ed("objectlist") << ed("frame"); 78 | xml << ed("dataset"); 79 | 80 | m_file << xml.str(); 81 | m_file.close(); 82 | } 83 | -------------------------------------------------------------------------------- /ACF/FileWriter.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef __H_FILEWRITER 7 | #define __H_FILEWRITER 8 | 9 | #include "detection.h" 10 | #include 11 | #include 12 | #include 13 | 14 | /*! 15 | This class is used to write detections to a file. 16 | */ 17 | 18 | class FileWriter { 19 | 20 | public: 21 | /*! Initialise the file to write to*/ 22 | FileWriter(std::string filename); 23 | /*! 24 | Write the detections one by one to the file. It is important that these come image per image 25 | */ 26 | void writeDetection(int frameID, Detection* det); 27 | 28 | /*! 29 | Destruct the object. This means closing the file 30 | */ 31 | ~FileWriter(); 32 | 33 | private: 34 | std::ofstream m_file; 35 | std::stringstream xml; 36 | bool first; 37 | int pframe; 38 | }; 39 | #endif 40 | -------------------------------------------------------------------------------- /ACF/FrameFromCamera.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "FrameFromCamera.h" 7 | 8 | FrameFromCamera::FrameFromCamera() 9 | { 10 | cap.open(0); 11 | 12 | if (!cap.isOpened()) { 13 | std::cerr << "Failed to open capture device" << std::endl; 14 | exit(2); 15 | } 16 | } 17 | 18 | FrameFromCamera::~FrameFromCamera() 19 | { 20 | } 21 | 22 | cv::Mat FrameFromCamera::giveFrame() 23 | { 24 | cv::Mat frame; 25 | 26 | // keep hoping to receive a frame 27 | do { 28 | cap >> frame; 29 | std::cout << "." << std::endl; 30 | } while (frame.empty()); 31 | 32 | return frame; 33 | } 34 | 35 | bool FrameFromCamera::isend() 36 | { 37 | return false; 38 | } 39 | -------------------------------------------------------------------------------- /ACF/FrameFromCamera.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FRAMEFROMCAMERA_H_ 7 | #define FRAMEFROMCAMERA_H_ 8 | 9 | #include "FrameProducer.h" 10 | #include 11 | 12 | class FrameFromCamera : public FrameProducer { 13 | public: 14 | FrameFromCamera(); 15 | virtual ~FrameFromCamera(); 16 | 17 | cv::Mat giveFrame(); 18 | bool isend(); 19 | 20 | std::string getFilename() 21 | { 22 | return "camera"; 23 | } 24 | 25 | private: 26 | cv::VideoCapture cap; 27 | }; 28 | 29 | #endif /* FRAMEFROMCAMERA_H_ */ 30 | -------------------------------------------------------------------------------- /ACF/FrameFromDirectory.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "filelocator.h" 7 | #include "FrameFromDirectory.h" 8 | 9 | FrameFromDirectory::FrameFromDirectory() 10 | { 11 | FileLocator FL; 12 | // Open the local directory to seach for files 13 | Files = FL.listFile(".", ".jpg"); 14 | std::cout << "We have " << Files.size() << " files to process" << std::endl; 15 | start = 0; 16 | end = Files.size(); 17 | position = start; 18 | } 19 | 20 | FrameFromDirectory::FrameFromDirectory(std::string directory) 21 | { 22 | FileLocator FL; 23 | Files = FL.listFile(directory, ".jpg"); 24 | start = 0; 25 | end = Files.size(); 26 | position = start; 27 | } 28 | 29 | FrameFromDirectory::~FrameFromDirectory() 30 | { 31 | } 32 | 33 | cv::Mat FrameFromDirectory::giveFrame() 34 | { 35 | std::cout << "Giving file " << position << "/" << Files.size() << "\t" << Files[position] << std::endl; 36 | cv::Mat Frame = cv::imread(Files[position++]); 37 | 38 | return Frame; 39 | } 40 | 41 | cv::Mat FrameFromDirectory::giveFrame(int index) 42 | { 43 | //std::cout << "Giving file " << position << "/" << Files.size() << "\t" << Files[index]<< std::endl; 44 | cv::Mat Frame = cv::imread(Files[index]); 45 | 46 | return Frame; 47 | } 48 | 49 | bool FrameFromDirectory::isend() 50 | { 51 | return (position >= Files.size()) || (position >= end); 52 | } 53 | -------------------------------------------------------------------------------- /ACF/FrameFromDirectory.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FRAMEFROMDIRECTORY_H_ 7 | #define FRAMEFROMDIRECTORY_H_ 8 | 9 | #include "FrameProducer.h" 10 | 11 | class FrameFromDirectory : public FrameProducer { 12 | public: 13 | FrameFromDirectory(); 14 | FrameFromDirectory(std::string directory); 15 | virtual ~FrameFromDirectory(); 16 | cv::Mat giveFrame(); 17 | cv::Mat giveFrame(int f); 18 | bool isend(); 19 | 20 | int getNumFiles() 21 | { 22 | return Files.size(); 23 | } 24 | 25 | std::string getFilename() 26 | { 27 | return Files[position - 1]; 28 | } 29 | 30 | std::string getFilename(int index) 31 | { 32 | return Files[index]; 33 | } 34 | 35 | private: 36 | int start, end, position; 37 | std::vector Files; 38 | }; 39 | 40 | #endif /* FRAMEFROMDIRECTORY_H_ */ 41 | -------------------------------------------------------------------------------- /ACF/FrameFromVideo.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "FrameFromVideo.h" 7 | 8 | FrameFromVideo::FrameFromVideo() 9 | : cap(cv::VideoCapture("Video.avi")) 10 | { 11 | } 12 | 13 | FrameFromVideo::~FrameFromVideo() 14 | { 15 | } 16 | 17 | cv::Mat FrameFromVideo::giveFrame() 18 | { 19 | cv::Mat frame; 20 | 21 | if (cap.get(CV_CAP_PROP_POS_FRAMES) < cap.get(CV_CAP_PROP_FRAME_COUNT)) { 22 | cap >> frame; 23 | } 24 | 25 | return frame; 26 | } 27 | 28 | bool FrameFromVideo::isend() 29 | { 30 | return cap.get(CV_CAP_PROP_POS_FRAMES) >= cap.get(CV_CAP_PROP_FRAME_COUNT); 31 | } 32 | -------------------------------------------------------------------------------- /ACF/FrameFromVideo.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FRAMEFROMVIDEO_H_ 7 | #define FRAMEFROMVIDEO_H_ 8 | 9 | #include "FrameProducer.h" 10 | 11 | class FrameFromVideo : public FrameProducer { 12 | public: 13 | FrameFromVideo(); 14 | virtual ~FrameFromVideo(); 15 | 16 | cv::Mat giveFrame(); 17 | bool isend(); 18 | 19 | std::string getFilename() 20 | { 21 | return "video"; 22 | } 23 | 24 | private: 25 | cv::VideoCapture cap; 26 | }; 27 | 28 | #endif /* FRAMEFROMVIDEO_H_ */ 29 | -------------------------------------------------------------------------------- /ACF/FrameProducer.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "FrameProducer.h" 7 | 8 | FrameProducer::FrameProducer() 9 | { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | FrameProducer::~FrameProducer() 14 | { 15 | // TODO Auto-generated destructor stub 16 | } 17 | -------------------------------------------------------------------------------- /ACF/FrameProducer.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FRAMEPRODUCER_H_ 7 | #define FRAMEPRODUCER_H_ 8 | 9 | //OpenCV headers 10 | #include "opencv2/imgproc/imgproc.hpp" 11 | #include "opencv2/objdetect/objdetect.hpp" 12 | #include "opencv2/gpu/gpu.hpp" 13 | #include "opencv2/highgui/highgui.hpp" 14 | #include 15 | 16 | // Class to inherit from by classes that return a frame (from directory, camera, network, ...) 17 | class FrameProducer { 18 | public: 19 | FrameProducer(); 20 | virtual ~FrameProducer(); 21 | 22 | virtual cv::Mat giveFrame() = 0; 23 | virtual std::string getFilename() = 0; 24 | 25 | virtual bool isend() = 0; 26 | 27 | private: 28 | }; 29 | 30 | #endif /* FRAMEPRODUCER_H_ */ 31 | -------------------------------------------------------------------------------- /ACF/Functions.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef _H_FUNC 7 | #define _H_FUNC 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | // Some general functions which are not yet added to the separate classes 16 | 17 | float* Convert_ToMatlab(const cv::Mat& image, float scale); 18 | 19 | cv::Mat Convert_ToOCV(float* data, int channels, int width, int height, float scale); 20 | void fhog(float* M, float* O, float* H, int h, int w, int binSize, int nOrients, int softBin, float clip); 21 | void convTri(float* I, float* O, int h, int w, int d, int r, int s); 22 | void convTri1(float* I, float* O, int h, int w, int d, float p, int s); 23 | 24 | void grad2(float* I, float* Gx, float* Gy, int h, int w, int d); 25 | void gradMag(float* I, float* M, float* O, int h, int w, int d, bool full); 26 | void gradHist(float* M, float* O, float* H, int h, int w, 27 | int bin, int nOrients, int softBin, bool full); 28 | void hog(float* M, float* O, float* H, int h, int w, int binSize, 29 | int nOrients, int softBin, bool full, float clip); 30 | void gradMagNorm(float* M, float* S, int h, int w, float norm); 31 | #endif 32 | -------------------------------------------------------------------------------- /ACF/GradHistChannel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GradHistChannel.cpp 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #include "GradHistChannel.h" 9 | 10 | GradHistChannel::~GradHistChannel() 11 | { 12 | // TODO Auto-generated destructor stub 13 | } 14 | -------------------------------------------------------------------------------- /ACF/GradHistChannel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GradHistChannel.h 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef GRADHISTCHANNEL_H_ 9 | #define GRADHISTCHANNEL_H_ 10 | 11 | #include "Channel.h" 12 | #include "GradMagChannel.h" 13 | 14 | class GradHistChannel : public Channel { 15 | public: 16 | GradHistChannel(const GradMagChannel& GMC); 17 | virtual ~GradHistChannel(); 18 | 19 | static float getLambda() 20 | { 21 | return 0.1158; 22 | } 23 | 24 | private: 25 | float* histogram; 26 | }; 27 | 28 | #endif /* GRADHISTCHANNEL_H_ */ 29 | -------------------------------------------------------------------------------- /ACF/GradMagChannel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * GradMagChannel.cpp 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | //#include "imResampleMex.hpp" 8 | //#include "rgbConvertMex.hpp" 9 | 10 | #include "GradMagChannel.h" 11 | #include "Functions.h" 12 | 13 | GradMagChannel::~GradMagChannel() 14 | { 15 | //free(mag); 16 | //mag = NULL; //avoids an error on double free 17 | free(orientation); 18 | } 19 | 20 | float* GradMagChannel::getMagnitude() const 21 | { 22 | return this->mag; 23 | } 24 | 25 | float* GradMagChannel::getOrientation() const 26 | { 27 | return this->orientation; 28 | } 29 | -------------------------------------------------------------------------------- /ACF/GradMagChannel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GradMagChannel.h 3 | * 4 | * Created on: Jan 15, 2015 5 | * Author: fds 6 | */ 7 | 8 | #ifndef GRADMAGCHANNEL_H_ 9 | #define GRADMAGCHANNEL_H_ 10 | 11 | #include "Channel.h" 12 | #include "ColorChannel.h" 13 | 14 | class GradMagChannel : public Channel { 15 | public: 16 | GradMagChannel(const ColorChannel& CC); 17 | virtual ~GradMagChannel(); 18 | 19 | float* getMagnitude() const; 20 | float* getOrientation() const; 21 | 22 | static float getLambda() 23 | { 24 | return 0.1158; 25 | } 26 | 27 | private: 28 | float* mag; 29 | float* orientation; 30 | }; 31 | 32 | #endif /* GRADMAGCHANNEL_H_ */ 33 | -------------------------------------------------------------------------------- /ACF/Image.hpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef IMAGE_HPP_ 7 | #define IMAGE_HPP_ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | /*! 17 | class around an image to hold extra information about the image 18 | */ 19 | class Image { 20 | public: 21 | Image(std::string path); 22 | 23 | Image(const cv::Mat image) 24 | : m_image(image) 25 | { 26 | //this->m_image = image.clone(); 27 | this->m_name = "Camera Image"; 28 | } 29 | 30 | const cv::Mat getImage() const; 31 | std::string getPath() const; 32 | int getWidth() const 33 | { 34 | return this->m_image.cols; 35 | } 36 | int getHeight() const 37 | { 38 | return this->m_image.rows; 39 | } 40 | 41 | private: 42 | std::string m_name; 43 | const cv::Mat m_image; 44 | }; 45 | 46 | #endif /* IMAGE_HPP_ */ 47 | -------------------------------------------------------------------------------- /ACF/LoadChannels.hpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef _H_LOADCHANS 7 | #define _H_LOADCHANS 8 | 9 | #include 10 | #include 11 | #include "imPadMex.hpp" 12 | 13 | #include "Functions.h" 14 | #include "wrappers.hpp" 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "channelold.h" 25 | 26 | class LUVChannel : public ChannelOld { 27 | public: 28 | LUVChannel() 29 | : ChannelOld(3) 30 | { 31 | this->setName("luv"); 32 | } 33 | void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking); 34 | }; 35 | 36 | class HSVChannel : public ChannelOld { 37 | public: 38 | HSVChannel() 39 | : ChannelOld(3) 40 | { 41 | this->setName("hsv"); 42 | } 43 | void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking); 44 | }; 45 | 46 | class GrayChannel : public ChannelOld { 47 | public: 48 | GrayChannel() 49 | : ChannelOld(1) 50 | { 51 | this->setName("gray"); 52 | } 53 | void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking); 54 | }; 55 | 56 | class GradMagChannelOld : public ChannelOld { 57 | public: 58 | GradMagChannelOld() 59 | : ChannelOld(2) 60 | { 61 | this->setName("gradmag"); 62 | this->m_dependencies.push_back("luv"); 63 | } 64 | void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking); 65 | }; 66 | 67 | class HogChannel : public ChannelOld { 68 | public: 69 | HogChannel() 70 | : ChannelOld(6) 71 | { 72 | this->setName("hog"); 73 | this->m_dependencies.push_back("gradmag"); 74 | } 75 | void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking); 76 | }; 77 | 78 | std::vector LoadChannels(std::vector Names); 79 | std::vector getFeaturesFromChannels(std::vector Chans, cv::Mat& image, int shrinking); 80 | #endif 81 | -------------------------------------------------------------------------------- /ACF/NonMaximumSuppression.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "NonMaximumSuppression.h" 7 | 8 | NonMaximumSuppression::NonMaximumSuppression() 9 | { 10 | } 11 | 12 | NonMaximumSuppression::~NonMaximumSuppression() 13 | { 14 | } 15 | 16 | DetectionList NonMaximumSuppression::standardNMS(const DetectionList& DL) 17 | { 18 | 19 | DetectionList DL2; 20 | DL2.path = ""; 21 | DL2.Ds = nms(DL.Ds, 0.4); 22 | 23 | return DL2; 24 | } 25 | 26 | bool sortDetFunc(Detection* i, Detection* j) 27 | { 28 | return (i->getScore() > j->getScore()); 29 | } 30 | 31 | DetectionList NonMaximumSuppression::dollarNMS(const DetectionList& DL) 32 | { 33 | DetectionList DL2; 34 | float overlap = 0.65; 35 | 36 | std::vector FDs; 37 | std::vector Ds = DL.Ds; 38 | 39 | std::sort(Ds.begin(), Ds.end(), sortDetFunc); 40 | 41 | int n = Ds.size(); 42 | std::vector kp(n, true); 43 | std::vector as(n); 44 | 45 | //calculate areas for each detection 46 | for (int i = 0; i < n; i++) { 47 | as[i] = Ds[i]->getWidth() * Ds[i]->getHeight(); 48 | } 49 | 50 | for (int i = 0; i < n; i++) { 51 | if (kp[i] == false) { //greedy pruning 52 | continue; 53 | } 54 | 55 | for (int j = i + 1; j < n; j++) { 56 | if (kp[j] == false) { //greedy pruning 57 | continue; 58 | } 59 | 60 | float iw = std::min(Ds[i]->getX() + Ds[i]->getWidth(), Ds[j]->getX() + Ds[j]->getWidth()) - std::max(Ds[i]->getX(), Ds[j]->getX()); 61 | float ih = std::min(Ds[i]->getY() + Ds[i]->getHeight(), Ds[j]->getY() + Ds[j]->getHeight()) - std::max(Ds[i]->getY(), Ds[j]->getY()); 62 | if (iw <= 0 || ih <= 0) { 63 | continue; 64 | } 65 | //area of intersection 66 | float o = iw * ih; 67 | 68 | float u = std::min(as[i], as[j]); 69 | if (o / u > overlap) { 70 | kp[j] = false; 71 | } 72 | } 73 | } 74 | 75 | for (int i = 0; i < n; i++) { 76 | if (kp[i] == true) { 77 | FDs.push_back(new Detection(Ds[i])); 78 | } 79 | } 80 | 81 | DL2.Ds = FDs; 82 | 83 | return DL2; 84 | } 85 | -------------------------------------------------------------------------------- /ACF/NonMaximumSuppression.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef NONMAXIMUMSUPPRESSION_H_ 7 | #define NONMAXIMUMSUPPRESSION_H_ 8 | 9 | #include "DetectionList.h" 10 | #include "nms.h" 11 | #include 12 | 13 | class NonMaximumSuppression { 14 | 15 | public: 16 | NonMaximumSuppression(); 17 | virtual ~NonMaximumSuppression(); 18 | 19 | DetectionList standardNMS(const DetectionList& DL); 20 | DetectionList dollarNMS(const DetectionList& DL); 21 | }; 22 | 23 | #endif /* NONMAXIMUMSUPPRESSION_H_ */ 24 | -------------------------------------------------------------------------------- /ACF/ScaleSpacePyramid.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "ScaleSpacePyramid.h" 7 | 8 | float getScale(cv::Mat& Orimage, cv::Mat& image) 9 | { 10 | return std::min((float)image.cols / Orimage.cols, (float)image.rows / Orimage.rows); 11 | } 12 | 13 | ScaleSpacePyramid::ScaleSpacePyramid(const cv::Mat& image2, float rescaleratio, cv::Size modelSize, float Upscale) 14 | { 15 | int smallestWidth = modelSize.width; 16 | int smallestHeight = modelSize.height; 17 | cv::Mat image = image2.clone(); 18 | cv::Mat orImage = image.clone(); 19 | 20 | float scale = 1; 21 | int layer = 0; 22 | 23 | while (image.cols > smallestWidth && image.rows > smallestHeight) { 24 | cv::Mat R; 25 | this->scales.push_back(1 / pow(rescaleratio, (layer))); 26 | cv::Size sz = cv::Size(cvRound(orImage.cols * (Upscale / pow(rescaleratio, (layer)))), orImage.rows * (Upscale / pow(rescaleratio, (layer)))); 27 | layer++; 28 | cv::resize(orImage, image, sz); 29 | 30 | this->Images.push_back(image.clone()); 31 | } 32 | } 33 | 34 | ScaleSpacePyramid::~ScaleSpacePyramid() 35 | { 36 | } 37 | -------------------------------------------------------------------------------- /ACF/ScaleSpacePyramid.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef SCALESPACEPYRAMID_H_ 7 | #define SCALESPACEPYRAMID_H_ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | class ScaleSpacePyramid { 17 | private: 18 | std::vector Images; 19 | std::vector scales; 20 | 21 | public: 22 | ScaleSpacePyramid(const cv::Mat& image, float rescaleratio, cv::Size modelSize, float Upscale = 1.0); 23 | 24 | virtual ~ScaleSpacePyramid(); 25 | 26 | cv::Mat getImage(int Layer) 27 | { 28 | if (Layer < this->getNumLayers()) 29 | return this->Images[Layer]; 30 | else 31 | return cv::Mat(); 32 | } 33 | 34 | float getLayerScale(int Layer) 35 | { 36 | if (Layer < this->getNumLayers()) 37 | return this->scales[Layer]; 38 | else 39 | return 1; 40 | } 41 | 42 | int getNumLayers() 43 | { 44 | return this->Images.size(); 45 | } 46 | }; 47 | 48 | #endif /* SCALESPACEPYRAMID_H_ */ 49 | -------------------------------------------------------------------------------- /ACF/channellist.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef __H_CHANLIST 7 | #define __H_CHANLIST 8 | 9 | #include 10 | #include 11 | 12 | #include "channelold.h" 13 | #include "LoadChannels.hpp" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | /*! 20 | ChannelList is a wrapper for the channels. This wrapper tries to ensure memoryleak-free code by allocating and deallocating memory for the end-user 21 | */ 22 | 23 | class ChannelList { 24 | public: 25 | ChannelList(std::vector names) 26 | { 27 | m_channels = LoadChannels(names); 28 | } 29 | 30 | ChannelList() 31 | { 32 | } 33 | 34 | void FillChannels(std::vector names) 35 | { 36 | 37 | freeChannels(); //make sure channels is empty 38 | m_channels = LoadChannels(names); 39 | } 40 | 41 | void freeChannels() 42 | { 43 | for (int i = 0; i < m_channels.size(); i++) 44 | delete m_channels[i]; 45 | m_channels.clear(); 46 | } 47 | 48 | ~ChannelList() 49 | { 50 | freeChannels(); 51 | } 52 | 53 | /*! 54 | Calculate the features => This should become a member function of the detector 55 | \author F. De Smedt 56 | \date 2014 57 | 58 | */ 59 | std::vector getFeaturesFromChannels(const cv::Mat& image, int shrinking = 1) 60 | { 61 | std::vector Features; 62 | std::vector FeatTemp; 63 | std::vector FeatOriginal; //used if shrinking is on 64 | FeatTemp.clear(); 65 | 66 | if (image.channels() != 3) { 67 | std::cout << "Amount of channels in image is NOT ok, we expect a 3-channel image as input!" << std::endl; 68 | exit(3); 69 | } 70 | 71 | /*Convert to double image ...*/ 72 | cv::Mat II_RGB, II_Conv; 73 | cv::cvtColor(image, II_RGB, CV_BGR2RGB); 74 | 75 | II_RGB.convertTo(II_Conv, CV_32FC3, 1 / 255.0); 76 | 77 | for (int c = 0; c < m_channels.size(); c++) { 78 | m_channels[c]->getFeatOfChannel(II_Conv, FeatTemp, FeatOriginal, shrinking); 79 | } 80 | 81 | for (int c = 0; c < FeatTemp.size(); c++) { 82 | 83 | std::vector F; 84 | cv::split(FeatTemp[c], F); 85 | std::copy(F.begin(), F.end(), back_inserter(Features)); 86 | } 87 | 88 | return Features; 89 | } 90 | 91 | private: 92 | std::vector m_channels; 93 | }; 94 | #endif 95 | -------------------------------------------------------------------------------- /ACF/channelold.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef CHANNEL_H 7 | #define CHANNEL_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "feature.h" 17 | 18 | #define CHNFTRS 0 19 | #define CONVOLUTION 1 20 | 21 | /*! 22 | \brief The base class for channels (used in ChnFtrs-based detectors) 23 | 24 | This is the base class which describes a channel. When a new channel has to be defined, just inherit from this class and fill in the virtual functions and maybe the GiveScore-function (when you want to deviate from default sum-feature, such as the layer or size of a model). 25 | */ 26 | 27 | class ChannelOld { 28 | private: 29 | //! number of image-channels 30 | int m_numchans; 31 | //! The name of this channel 32 | std::string m_name; 33 | 34 | protected: 35 | /*! 36 | Set the name of the channel. This name is used for dependencies 37 | */ 38 | void setName(std::string name); 39 | 40 | public: 41 | //! The constructor initialises the channel with the number of image-channels 42 | ChannelOld(const int numChans) 43 | : m_numchans(numChans) 44 | { 45 | } 46 | //! returns the name of the channel 47 | std::string getName(); 48 | 49 | float giveScore(const Feature& F, const cv::Mat& Image, int offsetX, int offsetY, int shrinking, int offset, int method = CHNFTRS); 50 | 51 | /*! 52 | Calculate the features of an image using this channel. This functions will be overloaded by each child 53 | \param image The image to calculate features of 54 | \param Feat A vector where the resulting FeatureImage will be added to. By passing the features by using a vector by reference allows to reuse channel features that are calculated ealier 55 | \param FeatOriginal This vector is the same as the Feat vector, bu has the original format of the resulting images (before shrinking) 56 | \param shrinking The amount of shrinking used. Not implemented yet 57 | */ 58 | virtual void getFeatOfChannel(const cv::Mat& image, std::vector& Feat, std::vector& FeatOriginal, int shrinking) = 0; 59 | 60 | //! return the amount of channels-images this channel will generate 61 | int getChannelAmount(); 62 | 63 | //! A string that names the dependencies of this channel 64 | std::vector m_dependencies; 65 | //! This vector holds the index of the dependencies in the vector of feature-images. 66 | std::vector m_dependencies_index; 67 | }; 68 | 69 | #endif // CHANNEL_H 70 | -------------------------------------------------------------------------------- /ACF/detection.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "detection.h" 7 | /*! 8 | \file The implementation of functions used to work with the detection class 9 | 10 | */ 11 | 12 | /*! 13 | \brief Helper function to sort detections 14 | 15 | This is a helper function to sort detections based on the score they have 16 | \param a a pointer to a detection 17 | \param b a pointer to an other detection 18 | \return 1 of the score of a is higher, 0 otherwise 19 | 20 | */ 21 | bool compareByScore(const Detection* a, const Detection* b) 22 | { 23 | return a->getScore() > b->getScore(); //sort from high to low 24 | } 25 | 26 | Detection::Detection(const Detection& D) 27 | { 28 | this->m_x = D.getX(); 29 | this->m_y = D.getY(); 30 | this->m_width = D.getWidth(); 31 | this->m_height = D.getHeight(); 32 | this->m_filename = D.getFilename(); 33 | this->m_color = D.getColor(); 34 | this->m_modelName = D.getModelName(); 35 | this->m_level = D.getLevel(); 36 | this->m_score = D.getScore(); 37 | } 38 | 39 | /*! 40 | \brief Sort the detections based on score 41 | 42 | This function sorts the detection based on score they have. The compareByScore function is used here to evaluate which score is higher. 43 | 44 | \author F. De Smedt 45 | \date 2014 46 | */ 47 | void SortDetections(std::vector& Dets) 48 | { 49 | std::sort(Dets.begin(), Dets.end(), compareByScore); 50 | } 51 | 52 | /*! \brief Detection constructor 53 | 54 | The constructor of the Detection-class. Nothing has to be done at construction time 55 | 56 | \author F. De Smedt 57 | \date 2014 58 | */ 59 | Detection::Detection() 60 | { 61 | } 62 | 63 | float Detection::getX() const 64 | { 65 | return this->m_x; 66 | } 67 | float Detection::getY() const 68 | { 69 | return this->m_y; 70 | } 71 | float Detection::getWidth() const 72 | { 73 | return this->m_width; 74 | } 75 | float Detection::getHeight() const 76 | { 77 | return this->m_height; 78 | } 79 | float Detection::getScore() const 80 | { 81 | return this->m_score; 82 | } 83 | std::string Detection::getFilename() const 84 | { 85 | return this->m_filename; 86 | } 87 | cv::Scalar Detection::getColor() const 88 | { 89 | return this->m_color; 90 | } 91 | std::string Detection::getModelName() const 92 | { 93 | return this->m_modelName; 94 | } 95 | int Detection::getLevel() const 96 | { 97 | return this->m_level; 98 | } 99 | void Detection::setX(float x) 100 | { 101 | this->m_x = x; 102 | } 103 | void Detection::setY(float y) 104 | { 105 | this->m_y = y; 106 | } 107 | void Detection::setWidth(float width) 108 | { 109 | this->m_width = width; 110 | } 111 | void Detection::setHeight(float height) 112 | { 113 | this->m_height = height; 114 | } 115 | void Detection::setScore(float score) 116 | { 117 | this->m_score = score; 118 | } 119 | void Detection::setFilename(std::string filename) 120 | { 121 | this->m_filename = filename; 122 | } 123 | 124 | void Detection::setColor(cv::Scalar color) 125 | { 126 | this->m_color = color; 127 | } 128 | void Detection::setModelName(std::string modelname) 129 | { 130 | this->m_modelName = modelname; 131 | } 132 | -------------------------------------------------------------------------------- /ACF/detection.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef DETECTION_H 7 | #define DETECTION_H 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /*! 15 | \file Declaration of the Detection class 16 | */ 17 | 18 | /*! 19 | This class represents a detection. It can also be used for annotations. This class forms the input and output for our detection/training-software. By making this format detector-independend we simplify the switching between different detectors 20 | */ 21 | 22 | class Detection { 23 | public: 24 | Detection(); 25 | Detection(float x, float y, float width, float height, float score) 26 | { 27 | this->setX(x); 28 | this->setY(y); 29 | this->setWidth(width); 30 | this->setHeight(height); 31 | this->setScore(score); 32 | } 33 | 34 | Detection(float x, float y, float width, float height, float score, std::string name) 35 | { 36 | this->setX(x); 37 | this->setY(y); 38 | this->setWidth(width); 39 | this->setHeight(height); 40 | this->setScore(score); 41 | this->setModelName(name); 42 | } 43 | 44 | Detection(Detection* D) 45 | { 46 | this->setX(D->getX()); 47 | this->setY(D->getY()); 48 | this->setWidth(D->getWidth()); 49 | this->setHeight(D->getHeight()); 50 | this->setScore(D->getScore()); 51 | this->setColor(D->getColor()); 52 | } 53 | 54 | float getX() const; 55 | float getY() const; 56 | float getWidth() const; 57 | float getHeight() const; 58 | float getScore() const; 59 | std::string getFilename() const; 60 | cv::Scalar getColor() const; 61 | 62 | std::string getModelName() const; 63 | int getLevel() const; 64 | 65 | void setX(float x); 66 | 67 | void setY(float y); 68 | 69 | void setWidth(float width); 70 | 71 | void setHeight(float height); 72 | 73 | void setScore(float score); 74 | 75 | void setFilename(std::string filename); 76 | 77 | void setColor(cv::Scalar color); 78 | 79 | void setModelName(std::string modelname); 80 | 81 | void resize(float factor) 82 | { 83 | this->setX(this->getX() / factor); 84 | this->setY(this->getY() / factor); 85 | this->setWidth(this->getWidth() / factor); 86 | this->setHeight(this->getHeight() / factor); 87 | } 88 | 89 | Detection(const Detection& D); 90 | 91 | private: 92 | float m_x, m_y, m_width, m_height; 93 | float m_score; 94 | std::string m_filename; 95 | cv::Scalar m_color; 96 | std::string m_modelName; 97 | int m_level; 98 | }; 99 | 100 | bool compareByScore(const Detection* a, const Detection* b); 101 | void SortDetections(std::vector& Dets); 102 | 103 | #endif // DETECTION_H 104 | -------------------------------------------------------------------------------- /ACF/detector.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "detector.h" 7 | /*! \file The implementation of the Detector-class 8 | 9 | */ 10 | 11 | /*! Constructor of the Detector class 12 | 13 | This implementation of the constructor of the Detector class. Since Detector is a base class for other detectors, nothing specific has to be performed here. 14 | \author F. De Smedt 15 | \date 2014 16 | */ 17 | Detector::Detector() 18 | { 19 | this->mean = 0; 20 | this->std = 1; 21 | this->confidence = 1; 22 | this->complementarity = 1; 23 | } 24 | -------------------------------------------------------------------------------- /ACF/detector.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef DETECTOR_H 7 | #define DETECTOR_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "detection.h" 14 | //#include "channel.h" 15 | 16 | #include "detectormodel.h" 17 | 18 | #include "DetectionList.h" 19 | 20 | //#include "boost/program_options.hpp" 21 | //#include "Image.hpp" 22 | 23 | /*! 24 | The base class of a detector. 25 | */ 26 | class Detector { 27 | private: 28 | protected: 29 | std::string m_name; 30 | float mean; 31 | float std; 32 | float confidence; 33 | float complementarity; 34 | 35 | public: 36 | /*!Constructor for a detector. Not realy used since Detector forms a base class for other detector classes*/ 37 | Detector(); 38 | 39 | ~Detector() {} 40 | 41 | float getConfidence() const 42 | { 43 | return this->confidence; 44 | } 45 | float getComplementarity() const 46 | { 47 | return this->complementarity; 48 | } 49 | 50 | float getMean() 51 | { 52 | return this->mean; 53 | } 54 | 55 | float getStd() 56 | { 57 | return this->std; 58 | } 59 | 60 | virtual DetectionList applyDetector(const cv::Mat& Frame) const = 0; 61 | }; 62 | #endif // DETECTOR_H 63 | -------------------------------------------------------------------------------- /ACF/detectormodel.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "detectormodel.h" 7 | /*! 8 | \file The implementation of the member functions for the DetectorModel class 9 | 10 | 11 | */ 12 | 13 | /*! 14 | \brief Constructor for the DetectorModel class 15 | 16 | In this DetectorModel-constructor, only the size of the model is set. This forms the base for detector-specific models 17 | */ 18 | DetectorModel::DetectorModel(int width, int height) 19 | : m_width(width) 20 | , m_height(height) 21 | , mean_value(0) 22 | , standard_deviation(1) 23 | { 24 | } 25 | 26 | int DetectorModel::getWidth() const 27 | { 28 | return this->m_width; 29 | } 30 | 31 | int DetectorModel::getHeight() const 32 | { 33 | return this->m_height; 34 | } 35 | 36 | std::string DetectorModel::getModelName() const 37 | { 38 | return this->m_name; 39 | } 40 | 41 | cv::Scalar DetectorModel::getModelColor() const 42 | { 43 | return this->m_color; 44 | } 45 | 46 | void DetectorModel::setWidth(int w) 47 | { 48 | this->m_width = w; 49 | } 50 | 51 | void DetectorModel::setHeight(int h) 52 | { 53 | this->m_height = h; 54 | } 55 | 56 | void DetectorModel::setColor(cv::Scalar color) 57 | { 58 | this->m_color = color; 59 | } 60 | -------------------------------------------------------------------------------- /ACF/detectormodel.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef DETECTORMODEL_H 7 | #define DETECTORMODEL_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "detection.h" 18 | //#include "featurelayer.h" 19 | 20 | /*! 21 | The base-class of a model for a detector. Currently the models between DPM and ChnFtrs are very different, but in the future these should become more alike. 22 | */ 23 | 24 | class DetectorModel { 25 | public: 26 | /*! 27 | Initialisation of the DetectorModel. Setting height and width of the model 28 | */ 29 | DetectorModel(int width, int height); 30 | 31 | /*! 32 | Get the model width 33 | */ 34 | int getWidth() const; 35 | 36 | /*! 37 | Get the model height 38 | */ 39 | int getHeight() const; 40 | 41 | /*! 42 | Get the model name 43 | */ 44 | std::string getModelName() const; 45 | /*! 46 | Get the color of the model for drawing model-specifics such as detections/scores/... 47 | */ 48 | cv::Scalar getModelColor() const; 49 | 50 | /*! 51 | Setting the width of the model 52 | */ 53 | void setWidth(int w); 54 | /*! 55 | setting the height of the model 56 | */ 57 | void setHeight(int h); 58 | 59 | /*! 60 | Set the color of the model 61 | */ 62 | void setColor(cv::Scalar color); 63 | /*! 64 | Apply the model on the features of an image. This function has to be overloaded by child classes. 65 | */ 66 | // virtual std::vector applyModel(FeatureLayer *FeatLay, int offsetX, int offsetY,float ScaleFactorX, float ScaleFactorY, bool Soft, float threshold, int padding=0) = 0; 67 | 68 | protected: 69 | //! Width of the model 70 | int m_width; 71 | //! Height of the model 72 | int m_height; 73 | //! Color for the model-specific drawing results 74 | cv::Scalar m_color; 75 | //! Name of the model 76 | std::string m_name; 77 | 78 | void setMean(float m) 79 | { 80 | this->mean_value = m; 81 | } 82 | void setSTD(float s) 83 | { 84 | this->standard_deviation = s; 85 | } 86 | float getMean() 87 | { 88 | return this->mean_value; 89 | } 90 | float getSTD() 91 | { 92 | return this->standard_deviation; 93 | } 94 | 95 | float normaliseScore(float score) 96 | { 97 | return (score - this->getMean()) / (this->getSTD()); 98 | } 99 | 100 | private: 101 | float mean_value; 102 | float standard_deviation; 103 | }; 104 | 105 | #endif // DETECTORMODEL_H 106 | -------------------------------------------------------------------------------- /ACF/feature.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "feature.h" 7 | 8 | Feature::Feature() 9 | { 10 | } 11 | 12 | void Feature::setX(int x) 13 | { 14 | this->m_x = x; 15 | } 16 | void Feature::setY(int y) 17 | { 18 | this->m_y = y; 19 | } 20 | void Feature::setWidth(int width) 21 | { 22 | this->m_width = width; 23 | } 24 | void Feature::setHeight(int height) 25 | { 26 | this->m_height = height; 27 | } 28 | 29 | void Feature::setChannel(int channel) 30 | { 31 | this->m_channel = channel; 32 | } 33 | 34 | int Feature::getX() const 35 | { 36 | return m_x; 37 | } 38 | int Feature::getY() const 39 | { 40 | return m_y; 41 | } 42 | int Feature::getWidth() const 43 | { 44 | return m_width; 45 | } 46 | int Feature::getHeight() const 47 | { 48 | return m_height; 49 | } 50 | 51 | //void setChannel(channel *ch){this->chan = ch;} 52 | int Feature::getChannel() const 53 | { 54 | return this->m_channel; 55 | } 56 | -------------------------------------------------------------------------------- /ACF/feature.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FEATURE_H 7 | #define FEATURE_H 8 | 9 | /*! 10 | The feature class represent one single feature, which is basically a square in a specific channel. 11 | */ 12 | class Feature { 13 | private: 14 | int m_x, m_y, m_width, m_height; 15 | int m_channel; 16 | 17 | public: 18 | Feature(); 19 | void setX(int x); 20 | void setY(int y); 21 | void setWidth(int width); 22 | void setHeight(int height); 23 | void setChannel(int channel); 24 | 25 | int getX() const; 26 | int getY() const; 27 | int getWidth() const; 28 | int getHeight() const; 29 | int getChannel() const; 30 | }; 31 | 32 | #endif // FEATURE_H 33 | -------------------------------------------------------------------------------- /ACF/featurelayer.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "featurelayer.h" 7 | 8 | /*! 9 | \file member-function implementations of FeatureLayer-class 10 | 11 | */ 12 | 13 | /*! 14 | The constructor for a feature layer. 15 | 16 | */ 17 | FeatureLayer::FeatureLayer() 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /ACF/featurelayer.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FEATURELAYER_H 7 | #define FEATURELAYER_H 8 | 9 | #include 10 | #include 11 | #include "opencv2/imgproc/imgproc.hpp" 12 | #include "opencv2/objdetect/objdetect.hpp" 13 | #include "opencv2/highgui/highgui.hpp" 14 | 15 | /*! 16 | The base class for a feature layer. Just like the DetectorModel-class we have the issue that ChnFtrs and DPM featurelayers are not alike yet, which makes this class not yet that useable 17 | */ 18 | 19 | class FeatureLayer { 20 | public: 21 | FeatureLayer(); 22 | std::vector FeatLayers; 23 | }; 24 | 25 | #endif // FEATURELAYER_H 26 | -------------------------------------------------------------------------------- /ACF/filelocator.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include "filelocator.h" 7 | 8 | using namespace std; 9 | 10 | /*! \file implementations to read files from disk 11 | 12 | */ 13 | 14 | /*! 15 | \brief compare strings to order them 16 | 17 | This is a helper function to sort the filenames (or strings). 18 | 19 | */ 20 | bool compareNoCase(string first, string second) 21 | { 22 | int i = 0; 23 | while ((i < first.length()) && (i < second.length())) { 24 | if (tolower(first[i]) < tolower(second[i])) 25 | return true; 26 | else if (tolower(first[i]) > tolower(second[i])) 27 | return false; 28 | i++; 29 | } 30 | 31 | if (first.length() < second.length()) 32 | return true; 33 | else 34 | return false; 35 | } 36 | 37 | /*! 38 | Constructor for the FileLocator class, nothing special to be done 39 | 40 | */ 41 | FileLocator::FileLocator() 42 | { 43 | } 44 | 45 | /*! 46 | \brief Function to generate a list of filenames based on the path and an extention 47 | 48 | This function will look on the path location and return all the filenames ending on the extention as a vector. 49 | \param path The path to search for files, an ending / should be ignored 50 | \param extension The extention of the files to be search for, included the dot (eg. ".png", ".jpg") 51 | 52 | */ 53 | vector FileLocator::listFile(string path, string extension) 54 | { 55 | /*The vector to return*/ 56 | vector files; 57 | DIR* pDIR; 58 | struct dirent* entry; 59 | /*Open the directory*/ 60 | if (pDIR = opendir(path.c_str())) { 61 | while (entry = readdir(pDIR)) { 62 | /*look if the filename matches,exclude the . and ..*/ 63 | if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0 && strcmp(entry->d_name + strlen(entry->d_name) - strlen(extension.c_str()), extension.c_str()) == 0) { 64 | if (path[strlen(path.c_str()) - 1] == '/') 65 | files.push_back(string(path) + string(entry->d_name)); 66 | else 67 | files.push_back(string(path) + string("/") + string(entry->d_name)); 68 | } 69 | } 70 | /*close the direcory*/ 71 | closedir(pDIR); 72 | } 73 | //sort the filenames based on their alphabeticac order 74 | std::sort(files.begin(), files.end(), compareNoCase); 75 | 76 | /*return the vector with filenames*/ 77 | return files; 78 | } 79 | -------------------------------------------------------------------------------- /ACF/filelocator.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #ifndef FILELOCATOR_H 7 | #define FILELOCATOR_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | /*! 21 | This class is used to read filenames of images (or other files) from disk based on the extention they have. Note, these are not the actual files but the filenames, which could be passed to an actual fileread-function. For platform independency the functionality could be changed to boost-based libraries 22 | */ 23 | class FileLocator { 24 | public: 25 | FileLocator(); 26 | vector listFile(string path, string extension); 27 | 28 | private: 29 | }; 30 | 31 | #endif // FILELOCATOR_H 32 | -------------------------------------------------------------------------------- /ACF/nms.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "nms.h" 11 | 12 | using namespace std; 13 | 14 | /*! 15 | A general compare function to compare elements based on the score. Used as a helper-function to sort the elements (in this case detections). 16 | 17 | */ 18 | bool CompareFunction(nmsHelperStruct a, nmsHelperStruct b) 19 | { 20 | return (a.score < b.score); 21 | } 22 | 23 | /*! \brief NMS-function for limiting the detections in Dets by limiting the allowed overlap. 24 | 25 | This function performs non-maximum supression. It will order the detections and remove overlapping detections (the amount of allowed overlap is restricted by overlap argument) with a lower score. 26 | A limited allowed overlap forms a problem in situations where occlusion is common 27 | \param Dets A vector of detections to restruct 28 | \param overlap The amount of allowed overlap 29 | \return A vector of detections which holds to the overlap-rules 30 | 31 | */ 32 | vector nms(vector Dets, float overlap) 33 | { 34 | 35 | vector pick; 36 | vector suppress; 37 | float area[Dets.size()]; 38 | 39 | if (Dets.size() == 0) { 40 | pick.clear(); 41 | } 42 | else { 43 | 44 | vector Temp; 45 | nmsHelperStruct tijd; 46 | 47 | for (int i = 0; i < Dets.size(); i++) { 48 | area[i] = (Dets[i]->getWidth()) * (Dets[i]->getHeight()); 49 | tijd.score = Dets[i]->getScore(); 50 | tijd.index = i; 51 | Temp.push_back(tijd); 52 | } 53 | 54 | sort(Temp.begin(), Temp.end(), CompareFunction); 55 | 56 | pick.clear(); 57 | while (Temp.size() != 0) { 58 | int last = Temp.size() - 1; 59 | int i = Temp[last].index; 60 | 61 | /// Make real copy 62 | Detection* DD = new Detection(*(Dets[i])); 63 | pick.push_back(DD); //make real copy ... 64 | 65 | suppress.clear(); 66 | suppress.push_back(last); 67 | for (int pos = 0; pos < last; pos++) { 68 | int j = Temp[pos].index; 69 | float xx1 = max(Dets[i]->getX(), Dets[j]->getX()); 70 | float yy1 = max(Dets[i]->getY(), Dets[j]->getY()); 71 | float xx2 = min(Dets[i]->getX() + Dets[i]->getWidth(), Dets[j]->getX() + Dets[j]->getWidth()); 72 | float yy2 = min(Dets[i]->getY() + Dets[i]->getHeight(), Dets[j]->getY() + Dets[j]->getHeight()); 73 | float w = xx2 - xx1 + 1; 74 | float h = yy2 - yy1 + 1; 75 | 76 | if (w > 0 && h > 0) { 77 | //compute overlap 78 | float o = w * h / area[j]; 79 | if (o > overlap) { 80 | suppress.push_back(pos); 81 | } 82 | } 83 | } 84 | 85 | sort(suppress.begin(), suppress.end()); 86 | for (int W = 0; W < suppress.size(); W++) { 87 | Temp.erase(Temp.begin() + suppress[W] - W); 88 | } 89 | } 90 | } 91 | 92 | return pick; 93 | } 94 | -------------------------------------------------------------------------------- /ACF/nms.h: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Author : F. De Smedt @ EAVISE 3 | // Copyright : This code is written for the publication of "Open Framework for Combined Pedestrian detection". This code is for research and educational purposes only. For a different license, please contact the contributors directly. More information about the license can be fount in license.txt 4 | //============================================================================ 5 | 6 | #include 7 | #include 8 | #include "detection.h" 9 | 10 | #ifndef __H_NMS 11 | #define __H_NMS 12 | 13 | /*! 14 | After detection, detections that have to much overlap should be pruned and only the best detections (which should represent the actual object found) will be kept 15 | */ 16 | struct nmsHelperStruct { 17 | float score; 18 | int index; 19 | }; 20 | 21 | /*! 22 | Perform non-maximum-suppression. 23 | \param Dets A vector of pointers to detections which could possible overlap. 24 | \param overlap The amount of overlap that is allowed between detections 25 | \return A vector of pointers to detections which do not overlap more than the overlap parameter 26 | */ 27 | std::vector nms(std::vector Dets, float overlap); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /ACF/rapidxml-1.13/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /ACF/sse.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Piotr's Image&Video Toolbox Version 3.23 3 | * Copyright 2013 Piotr Dollar & Ron Appel. [pdollar-at-caltech.edu] 4 | * Please email me if you find bugs, or have suggestions or questions! 5 | * Licensed under the Simplified BSD License [see external/bsd.txt] 6 | *******************************************************************************/ 7 | #ifndef _SSE_HPP_ 8 | #define _SSE_HPP_ 9 | #include // SSE2:, SSE3:, SSE4: 10 | 11 | #define RETf inline __m128 12 | #define RETi inline __m128i 13 | 14 | // set, load and store values 15 | RETf SET(const float& x) { return _mm_set1_ps(x); } 16 | RETf SET(float x, float y, float z, float w) { return _mm_set_ps(x, y, z, w); } 17 | RETi SET(const int& x) { return _mm_set1_epi32(x); } 18 | RETf LD(const float& x) { return _mm_load_ps(&x); } 19 | RETf LDu(const float& x) { return _mm_loadu_ps(&x); } 20 | RETf STR(float& x, const __m128 y) 21 | { 22 | _mm_store_ps(&x, y); 23 | return y; 24 | } 25 | RETf STR1(float& x, const __m128 y) 26 | { 27 | _mm_store_ss(&x, y); 28 | return y; 29 | } 30 | RETf STRu(float& x, const __m128 y) 31 | { 32 | _mm_storeu_ps(&x, y); 33 | return y; 34 | } 35 | RETf STR(float& x, const float y) { return STR(x, SET(y)); } 36 | 37 | // arithmetic operators 38 | RETi ADD(const __m128i x, const __m128i y) { return _mm_add_epi32(x, y); } 39 | RETf ADD(const __m128 x, const __m128 y) { return _mm_add_ps(x, y); } 40 | RETf ADD(const __m128 x, const __m128 y, const __m128 z) 41 | { 42 | return ADD(ADD(x, y), z); 43 | } 44 | RETf ADD(const __m128 a, const __m128 b, const __m128 c, const __m128& d) 45 | { 46 | return ADD(ADD(ADD(a, b), c), d); 47 | } 48 | RETf SUB(const __m128 x, const __m128 y) { return _mm_sub_ps(x, y); } 49 | RETf MUL(const __m128 x, const __m128 y) { return _mm_mul_ps(x, y); } 50 | RETf MUL(const __m128 x, const float y) { return MUL(x, SET(y)); } 51 | RETf MUL(const float x, const __m128 y) { return MUL(SET(x), y); } 52 | RETf INC(__m128& x, const __m128 y) { return x = ADD(x, y); } 53 | RETf INC(float& x, const __m128 y) 54 | { 55 | __m128 t = ADD(LD(x), y); 56 | return STR(x, t); 57 | } 58 | RETf DEC(__m128& x, const __m128 y) { return x = SUB(x, y); } 59 | RETf DEC(float& x, const __m128 y) 60 | { 61 | __m128 t = SUB(LD(x), y); 62 | return STR(x, t); 63 | } 64 | RETf MIN(const __m128 x, const __m128 y) { return _mm_min_ps(x, y); } 65 | RETf RCP(const __m128 x) { return _mm_rcp_ps(x); } 66 | RETf RCPSQRT(const __m128 x) { return _mm_rsqrt_ps(x); } 67 | 68 | // logical operators 69 | RETf AND(const __m128 x, const __m128 y) { return _mm_and_ps(x, y); } 70 | RETi AND(const __m128i x, const __m128i y) { return _mm_and_si128(x, y); } 71 | RETf ANDNOT(const __m128 x, const __m128 y) { return _mm_andnot_ps(x, y); } 72 | RETf OR(const __m128 x, const __m128 y) { return _mm_or_ps(x, y); } 73 | RETf XOR(const __m128 x, const __m128 y) { return _mm_xor_ps(x, y); } 74 | 75 | // comparison operators 76 | RETf CMPGT(const __m128 x, const __m128 y) { return _mm_cmpgt_ps(x, y); } 77 | RETf CMPLT(const __m128 x, const __m128 y) { return _mm_cmplt_ps(x, y); } 78 | RETi CMPGT(const __m128i x, const __m128i y) { return _mm_cmpgt_epi32(x, y); } 79 | RETi CMPLT(const __m128i x, const __m128i y) { return _mm_cmplt_epi32(x, y); } 80 | 81 | // conversion operators 82 | RETf CVT(const __m128i x) { return _mm_cvtepi32_ps(x); } 83 | RETi CVT(const __m128 x) { return _mm_cvttps_epi32(x); } 84 | 85 | #undef RETf 86 | #undef RETi 87 | #endif 88 | -------------------------------------------------------------------------------- /ACF/timer.h: -------------------------------------------------------------------------------- 1 | #include "chrono" 2 | using namespace std::chrono; 3 | 4 | class Timer { 5 | high_resolution_clock::time_point t1, t2; 6 | duration time_span; 7 | 8 | public: 9 | Timer() {} 10 | void start() 11 | { 12 | t1 = high_resolution_clock::now(); 13 | } 14 | 15 | double count() 16 | { 17 | t2 = high_resolution_clock::now(); 18 | time_span = duration_cast >(t2 - t1); 19 | return time_span.count(); 20 | } 21 | 22 | ~Timer() {} 23 | }; -------------------------------------------------------------------------------- /ACF/wrappers.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Piotr's Image&Video Toolbox Version 3.00 3 | * Copyright 2012 Piotr Dollar. [pdollar-at-caltech.edu] 4 | * Please email me if you find bugs, or have suggestions or questions! 5 | * Licensed under the Simplified BSD License [see external/bsd.txt] 6 | *******************************************************************************/ 7 | #ifndef _WRAPPERS_HPP_ 8 | #define _WRAPPERS_HPP_ 9 | 10 | #include 11 | #include 12 | 13 | #ifdef MATLAB_MEX_FILE 14 | 15 | // wrapper functions if compiling from Matlab 16 | #include "mex.h" 17 | inline void wrError(const char* errormsg) 18 | { 19 | mexErrMsgTxt(errormsg); 20 | } 21 | inline void* wrCalloc(size_t num, size_t size) 22 | { 23 | return mxCalloc(num, size); 24 | } 25 | inline void* wrMalloc(size_t size) 26 | { 27 | return mxMalloc(size); 28 | } 29 | inline void wrFree(void* ptr) 30 | { 31 | mxFree(ptr); 32 | } 33 | 34 | #else 35 | 36 | // wrapper functions if compiling from C/C++ 37 | inline void wrError(const char* errormsg) 38 | { 39 | throw errormsg; 40 | } 41 | inline void* wrCalloc(size_t num, size_t size) 42 | { 43 | return calloc(num, size); 44 | } 45 | inline void* wrMalloc(size_t size) 46 | { 47 | return malloc(size); 48 | } 49 | inline void wrFree(void* ptr) 50 | { 51 | free(ptr); 52 | } 53 | 54 | #endif 55 | 56 | // platform independent aligned memory allocation (see also alFree) 57 | void* alMalloc(size_t size, int alignment) 58 | { 59 | const size_t pSize = sizeof(void *), a = alignment - 1; 60 | void* raw = wrMalloc(size + a + pSize); 61 | void* aligned = (void*)(((size_t)raw + pSize + a) & ~a); 62 | *(void**)((size_t)aligned - pSize) = raw; 63 | return aligned; 64 | } 65 | 66 | // platform independent alignned memory de-allocation (see also alMalloc) 67 | void alFree(void* aligned) 68 | { 69 | void* raw = *(void**)((char*)aligned - sizeof(void*)); 70 | wrFree(raw); 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /ACF/wrappers.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Piotr's Image&Video Toolbox Version 3.00 3 | * Copyright 2012 Piotr Dollar. [pdollar-at-caltech.edu] 4 | * Please email me if you find bugs, or have suggestions or questions! 5 | * Licensed under the Simplified BSD License [see external/bsd.txt] 6 | *******************************************************************************/ 7 | #ifndef _WRAPPERS_HPP_ 8 | #define _WRAPPERS_HPP_ 9 | 10 | #include 11 | #include 12 | 13 | // wrapper functions if compiling from C/C++ 14 | inline void wrError(const char* errormsg) { throw errormsg; } 15 | inline void* wrCalloc(size_t num, size_t size) { return calloc(num, size); } 16 | inline void* wrMalloc(size_t size) { return malloc(size); } 17 | inline void wrFree(void* ptr) { free(ptr); } 18 | 19 | // platform independent aligned memory allocation (see also alFree) 20 | void* alMalloc(size_t size, int alignment); // platform independent alignned memory de-allocation (see also alMalloc) 21 | void alFree(void* aligned); 22 | #endif 23 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | PROJECT(ped_acf) 3 | 4 | 5 | Find_package(OpenCV 2.0 REQUIRED) 6 | 7 | set(OPT_CXX_FLAGS "-O3 -fopenmp -funroll-loops -march=native -mtune=native --fast-math -mfpmath=sse -msse3") 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -DNDEBUG ${OPT_CXX_FLAGS}") 9 | 10 | FILE(GLOB SRC 11 | "ACF/*.h" 12 | "ACF/*.cpp" 13 | "ACF/*.hpp") 14 | 15 | 16 | include_directories( 17 | ${OpenCV_INCLUDE_DIRS} 18 | ) 19 | 20 | add_executable(${PROJECT_NAME} ${SRC}) 21 | 22 | target_link_libraries( ${PROJECT_NAME} 23 | ${OpenCV_LIBRARIES} 24 | ) 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [NOTE] 2 | 3 | This repo is a part of: https://bitbucket.org/fdesmedt/openframework/overview 4 | 5 | I made some modifications to it for my own use. 6 | And I used it a long time ago, **code for training the model is lost** ... 7 | 8 | ## [Usage] 9 | Compile with the standard cmake and make procedure. 10 | 11 | Detect person in image and crop them using: 12 | 13 | ./ped_acf path/to/image/dir output/path 14 | 15 | The arguments must be directories, not individual files. 16 | 17 | Results will be shown on the screen, cropped and saved in the output path, as well as written to the detections.xml file. 18 | 19 | ## [Citations] 20 | * Open Framework for combined pedestrian detection 21 | F. De Smedt and T. Goedemé, VISAPP 2015, Berlin 22 | 23 | * On-board real-time tracking of pedestrians on a UAV 24 | F. De Smedt, D. Hulens and T. Goedemé, EVW 2015, Boston, USA 25 | 26 | ## [Common Bugs] 27 | You may need to replace cv::vector with std::vector if using OpenCV 3. 28 | 29 | It may also be necessary to add "using namespace std;" into the gpu.hpp file inside OpenCV. 30 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | In short: only for research, this license is not OSI approved nor GPL 2 | compatible. 3 | 4 | Copyright (c) 2015, EAVISE - KU Leuven 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the KU Leuven nor the 18 | names of its contributors may be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | * The source code and the binaries created using them can only be used 22 | for scientific research and education purposes. Any commercial use of 23 | this software is prohibited. For a different license, 24 | please contact the contributors directly. 25 | 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 28 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL KU Leuven BE LIABLE FOR ANY 31 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | The original version of this code can be found at 39 | https://bitbucket.org/fdesmedt/openframework 40 | 41 | --------------------------------------------------------------------------------