Skip to content

Commit

Permalink
Merge branch 'develop_type_alias' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	src/openMVG/matching_image_collection/F_ACRobust.hpp
  • Loading branch information
pmoulon committed Dec 26, 2016
2 parents 9b52bfd + b462f86 commit eddc651
Show file tree
Hide file tree
Showing 64 changed files with 973 additions and 925 deletions.
31 changes: 14 additions & 17 deletions docs/sphinx/rst/openMVG/features/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ features

This module provides generic container for features and associated descriptors.

Features
Features
=============

Provide basic structure and IO to store Point based features.
Expand All @@ -17,49 +17,46 @@ Classes to store point characteristics:
* :class:`SIOPointFeature`
* Store the position, orientation and scale of a feature (x,y,s,o).

Descriptors
Descriptors
=============

Provide basic structure and IO for descriptor data.

* :class:`template <typename T, std::size_t N> class Descriptor`.
* Store N value(s) of type T as contiguous memory.

.. code-block:: c++
.. code-block:: c++

// SIFT like descriptor
typedef Descriptor<float, 128> siftDescriptorData;
using siftDescriptorData Descriptor<float, 128>;

// SURF like descriptor
typedef Descriptor<float, 64> surfDescriptorData;
using surfDescriptorData = Descriptor<float, 64>;

// Binary descriptor (128 bits)
typedef Descritpor<std::bitset<128>,1> binaryDescriptor_bitset;
using binaryDescriptor_bitset = Descriptor<std::bitset<128>,1> binaryDescriptor_bitset;
// or using unsigned chars
typedef Descriptor<unsigned char, 128/sizeof(unsigned char)> binaryDescriptor_uchar;
using binaryDescriptor_uchar = Descriptor<unsigned char, 128/sizeof(unsigned char)>;


KeypointSet
KeypointSet
=============

Store a collection of features and their associated descriptors: :class:`template<typename FeaturesT, typename DescriptorsT> class KeypointSet`. Basic IO is provided.

.. code-block:: c++
.. code-block:: c++

// Define SIFT Keypoints:

// Define the SIFT descriptor [128 floating point value]
typedef Descriptor<float, 128> DescriptorT;
using Descriptor<float, 128> DescriptorT;

// Use SIFT compatible features (scale, orientation and position)
typedef SIOPointFeature FeatureT;
using FeatureT = SIOPointFeature;

// Describe what a collection of local feature is for a given image:
typedef std::vector<FeatureT> FeatsT;
typedef std::vector<DescriptorT > DescsT;
using FeatsT = std::vector<FeatureT>;
using DescsT = std::vector<DescriptorT>;

// Link features and their descriptors as a collection:
typedef KeypointSet<FeatsT, DescsT > KeypointSetT;



using KeypointSetT = KeypointSet<FeatsT, DescsT>;
5 changes: 2 additions & 3 deletions src/openMVG/cameras/Camera_Intrinsics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ struct IntrinsicBase : public Clonable<IntrinsicBase>
const Vec3 X = pose( pt3D ); // apply pose
if ( this->have_disto() ) // apply disto & intrinsics
{
return this->cam2ima( this->add_disto( X.head<2>() / X( 2 ) ) );
return this->cam2ima( this->add_disto( X.hnormalized() ) );
}
else // apply intrinsics
{
return this->cam2ima( X.head<2>() / X( 2 ) );
return this->cam2ima( X.hnormalized() );
}
}

Expand Down Expand Up @@ -290,4 +290,3 @@ inline double AngleBetweenRay(
} // namespace openMVG

#endif // #ifndef OPENMVG_CAMERA_INTRINSICS_H

2 changes: 1 addition & 1 deletion src/openMVG/cameras/Camera_Pinhole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace cameras
*/
class Pinhole_Intrinsic : public IntrinsicBase
{
typedef Pinhole_Intrinsic class_type;
using class_type = Pinhole_Intrinsic;

protected:

Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/cameras/Camera_Pinhole_Brown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace cameras
*/
class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
{
typedef Pinhole_Intrinsic_Brown_T2 class_type;
using class_type = Pinhole_Intrinsic_Brown_T2;

protected:

Expand Down
4 changes: 2 additions & 2 deletions src/openMVG/cameras/Camera_Pinhole_Fisheye.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace cameras
*/
class Pinhole_Intrinsic_Fisheye : public Pinhole_Intrinsic
{
typedef Pinhole_Intrinsic_Fisheye class_type;
using class_type = Pinhole_Intrinsic_Fisheye;

protected:

Expand Down Expand Up @@ -56,7 +56,7 @@ class Pinhole_Intrinsic_Fisheye : public Pinhole_Intrinsic
{
params_ = {k1, k2, k3, k4};
}

~Pinhole_Intrinsic_Fisheye() override = default;

/**
Expand Down
5 changes: 2 additions & 3 deletions src/openMVG/cameras/Camera_Pinhole_Radial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ double bisection_Radius_Solve(
*/
class Pinhole_Intrinsic_Radial_K1 : public Pinhole_Intrinsic
{
typedef Pinhole_Intrinsic_Radial_K1 class_type;
using class_type = Pinhole_Intrinsic_Radial_K1;

protected:
/// center of distortion is applied by the Intrinsics class
Expand Down Expand Up @@ -292,7 +292,7 @@ class Pinhole_Intrinsic_Radial_K1 : public Pinhole_Intrinsic
*/
class Pinhole_Intrinsic_Radial_K3 : public Pinhole_Intrinsic
{
typedef Pinhole_Intrinsic_Radial_K3 class_type;
using class_type = Pinhole_Intrinsic_Radial_K3;

protected:
// center of distortion is applied by the Intrinsics class
Expand Down Expand Up @@ -519,4 +519,3 @@ CEREAL_REGISTER_TYPE_WITH_NAME(openMVG::cameras::Pinhole_Intrinsic_Radial_K3, "p
CEREAL_REGISTER_POLYMORPHIC_RELATION(openMVG::cameras::IntrinsicBase, openMVG::cameras::Pinhole_Intrinsic_Radial_K3);

#endif // #ifndef OPENMVG_CAMERA_PINHOLE_RADIAL_K_HPP

8 changes: 4 additions & 4 deletions src/openMVG/features/descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Descriptor : public Eigen::Matrix<T, N, 1>
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
typedef T bin_type;
typedef std::size_t size_type;
using bin_type = T;
using size_type = std::size_t;

/// Compile-time length of the descriptor
static const std::size_t static_size = N;
Expand Down Expand Up @@ -161,7 +161,7 @@ inline bool loadDescsFromBinFile(
const std::string & sfileNameDescs,
DescriptorsT & vec_desc)
{
typedef typename DescriptorsT::value_type VALUE;
using VALUE = typename DescriptorsT::value_type;

vec_desc.clear();
std::ifstream fileIn(sfileNameDescs.c_str(), std::ios::in | std::ios::binary);
Expand All @@ -187,7 +187,7 @@ inline bool saveDescsToBinFile(
const std::string & sfileNameDescs,
DescriptorsT & vec_desc)
{
typedef typename DescriptorsT::value_type VALUE;
using VALUE = typename DescriptorsT::value_type;

std::ofstream file(sfileNameDescs.c_str(), std::ios::out | std::ios::binary);
if (!file.is_open())
Expand Down
6 changes: 3 additions & 3 deletions src/openMVG/features/fast/fast_detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "third_party/fast/fast.h"
#include "openMVG/image/image_container.hpp"
#include <type_traits>

//
// Bibliography
Expand Down Expand Up @@ -51,8 +52,8 @@ class FastCornerDetector
std::vector<PointFeature> & regions
)
{
typedef xy* (*FastDetectorCall)(
const unsigned char *, int, int, int, int, int *);
using FastDetectorCall =
xy* (*) (const unsigned char *, int, int, int, int, int *);

FastDetectorCall detector = nullptr;
if (size_ == 9) detector = fast9_detect_nonmax;
Expand Down Expand Up @@ -81,4 +82,3 @@ class FastCornerDetector

} // features
} // namespace openMVG

4 changes: 2 additions & 2 deletions src/openMVG/features/feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PointFeature {
Vec2f coords_; // (x, y).
};

typedef std::vector<PointFeature> PointFeatures;
using PointFeatures = std::vector<PointFeature>;

//with overloaded operators:
inline std::ostream& operator<<(std::ostream& out, const PointFeature& obj)
Expand Down Expand Up @@ -267,7 +267,7 @@ void PointsToMat(
MatT & m)
{
m.resize(2, vec_feats.size());
typedef typename FeaturesT::value_type ValueT; // Container type
using ValueT = typename FeaturesT::value_type; // Container type

size_t i = 0;
for( typename FeaturesT::const_iterator iter = vec_feats.begin();
Expand Down
8 changes: 4 additions & 4 deletions src/openMVG/features/keypointSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ namespace features {
/// Association storage of associated feature and descriptor for a given image.
/// Load, save, R/W accessor operation.
///
/// typedef vector<SIOPointFeature> featsT;
/// typedef vector<Descriptor<uchar,128> > descsT;
/// using vector<SIOPointFeature> featsT;
/// using vector<Descriptor<uchar,128> > descsT;
/// KeypointSet< featsT, descsT > kpSet;
template<typename FeaturesT, typename DescriptorsT>
class KeypointSet {
public:
// Alias to stored Feature and Descriptor type
typedef typename FeaturesT::value_type FeatureT;
typedef typename DescriptorsT::value_type DescriptorT;
using FeatureT = typename FeaturesT::value_type;
using DescriptorT = typename DescriptorsT::value_type;

/// Read from files the feats and their corresponding descriptors.
bool loadFromFile(
Expand Down
20 changes: 10 additions & 10 deletions src/openMVG/features/regions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ class Scalar_Regions : public Regions
{
public:

//-- Typedef
//-- Type alias
//--

/// Region type
typedef FeatT FeatureT;
using FeatureT = FeatT;
/// Region descriptor
typedef Descriptor<T, L> DescriptorT;
using DescriptorT = Descriptor<T, L>;

/// Container for multiple regions
typedef std::vector<FeatureT> FeatsT;
using FeatsT = std::vector<FeatureT>;
/// Container for multiple regions description
typedef std::vector<DescriptorT > DescsT;
using DescsT = std::vector<DescriptorT >;

//-- Class functions
//--
Expand Down Expand Up @@ -197,18 +197,18 @@ class Binary_Regions : public Regions
{
public:

//-- Typedef
//-- Type alias
//--

/// Region
typedef FeatT FeatureT;
using FeatureT = FeatT;
/// Description of a region
typedef Descriptor<unsigned char, L> DescriptorT;
using DescriptorT = Descriptor<unsigned char, L>;

/// Container for multiple regions
typedef std::vector<FeatureT> FeatsT;
using FeatsT = std::vector<FeatureT>;
/// Container for multiple region descriptions
typedef std::vector<DescriptorT > DescsT;
using DescsT = std::vector<DescriptorT >;

//-- Class functions
//--
Expand Down
8 changes: 4 additions & 4 deletions src/openMVG/features/regions_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace openMVG {
namespace features {

/// Define the classic SIFT Keypoint
typedef Scalar_Regions<SIOPointFeature,unsigned char,128> SIFT_Regions;
using SIFT_Regions = Scalar_Regions<SIOPointFeature,unsigned char,128>;

/// Define the AKAZE Keypoint (with a float descriptor)
typedef Scalar_Regions<SIOPointFeature,float,64> AKAZE_Float_Regions;
using AKAZE_Float_Regions = Scalar_Regions<SIOPointFeature,float,64>;
/// Define the AKAZE Keypoint (with a LIOP descriptor)
typedef Scalar_Regions<SIOPointFeature,unsigned char,144> AKAZE_Liop_Regions;
using AKAZE_Liop_Regions = Scalar_Regions<SIOPointFeature,unsigned char,144>;
/// Define the AKAZE Keypoint (with a binary descriptor saved in an uchar array)
typedef Binary_Regions<SIOPointFeature,64> AKAZE_Binary_Regions;
using AKAZE_Binary_Regions = Binary_Regions<SIOPointFeature,64>;

} // namespace features
} // namespace openMVG
Expand Down
4 changes: 2 additions & 2 deletions src/openMVG/geometry/half_space_intersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ namespace halfPlane
{

/// Define the Half_plane equation (abcd coefficients)
typedef Eigen::Hyperplane<double, 3> Half_plane;
using Half_plane = Eigen::Hyperplane<double, 3>;

/// Define a collection of Half_plane
typedef std::vector<Half_plane> Half_planes;
using Half_planes = std::vector<Half_plane>;


/**
Expand Down
18 changes: 9 additions & 9 deletions src/openMVG/image/image_convolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void ImageConvolution( const Image & img , const Mat & kernel , Image & out )

assert( kernel_width % 2 != 0 && kernel_height % 2 != 0 ) ;

typedef typename Image::Tpixel pix_t ;
typedef typename Accumulator< pix_t >::Type acc_pix_t ;
using pix_t = typename Image::Tpixel;
using acc_pix_t = typename Accumulator< pix_t >::Type;

out.resize( img.Width() , img.Height() ) ;

Expand Down Expand Up @@ -81,7 +81,7 @@ void ImageConvolution( const Image & img , const Mat & kernel , Image & out )
template< typename ImageTypeIn , typename ImageTypeOut, typename Kernel >
void ImageHorizontalConvolution( const ImageTypeIn & img , const Kernel & kernel , ImageTypeOut & out )
{
typedef typename ImageTypeIn::Tpixel pix_t ;
using pix_t = typename ImageTypeIn::Tpixel;

const int rows ( img.rows() );
const int cols ( img.cols() );
Expand Down Expand Up @@ -125,7 +125,7 @@ void ImageHorizontalConvolution( const ImageTypeIn & img , const Kernel & kernel
template< typename ImageTypeIn , typename ImageTypeOut, typename Kernel >
void ImageVerticalConvolution( const ImageTypeIn & img , const Kernel & kernel , ImageTypeOut & out )
{
typedef typename ImageTypeIn::Tpixel pix_t ;
using pix_t = typename ImageTypeIn::Tpixel;

const int kernel_width = kernel.size() ;
const int half_kernel_width = kernel_width / 2 ;
Expand Down Expand Up @@ -178,8 +178,8 @@ void ImageSeparableConvolution( const ImageType & img ,
ImageType & out )
{
// Cast the Kernel to the appropriate type
typedef typename ImageType::Tpixel pix_t;
typedef Eigen::Matrix<typename Accumulator<pix_t>::Type, Eigen::Dynamic, 1> VecKernel;
using pix_t = typename ImageType::Tpixel;
using VecKernel = Eigen::Matrix<typename Accumulator<pix_t>::Type, Eigen::Dynamic, 1>;
const VecKernel horiz_k_cast = horiz_k.template cast< typename Accumulator<pix_t>::Type >();
const VecKernel vert_k_cast = vert_k.template cast< typename Accumulator<pix_t>::Type >();

Expand All @@ -188,7 +188,7 @@ void ImageSeparableConvolution( const ImageType & img ,
ImageVerticalConvolution( tmp , vert_k_cast , out ) ;
}

typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> RowMatrixXf;
using RowMatrixXf = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;

/// Specialization for Float based image (for arbitrary sized kernel)
inline void SeparableConvolution2d( const RowMatrixXf& image,
Expand Down Expand Up @@ -279,8 +279,8 @@ void ImageSeparableConvolution( const Image<float> & img ,
Image<float> & out )
{
// Cast the Kernel to the appropriate type
typedef Image<float>::Tpixel pix_t;
typedef Eigen::Matrix<typename openMVG::Accumulator<pix_t>::Type, Eigen::Dynamic, 1> VecKernel;
using pix_t = Image<float>::Tpixel;
using VecKernel = Eigen::Matrix<typename openMVG::Accumulator<pix_t>::Type, Eigen::Dynamic, 1>;
const VecKernel horiz_k_cast = horiz_k.template cast< typename openMVG::Accumulator<pix_t>::Type >();
const VecKernel vert_k_cast = vert_k.template cast< typename openMVG::Accumulator<pix_t>::Type >();

Expand Down
Loading

0 comments on commit eddc651

Please sign in to comment.