Skip to content

Commit

Permalink
Merge branch 'code_cleanup' of https://github.com/rperrot/openMVG int…
Browse files Browse the repository at this point in the history
…o rperrot-code_cleanup

- Fix merging conflicts

Conflicts:
	src/openMVG/cameras/Camera_IO.hpp
	src/openMVG/cameras/Camera_Intrinsics.hpp
	src/openMVG/cameras/Camera_Pinhole.hpp
	src/openMVG/cameras/Camera_Pinhole_Brown.hpp
	src/openMVG/cameras/Camera_Pinhole_Fisheye.hpp
	src/openMVG/cameras/Camera_Pinhole_Radial.hpp
	src/openMVG/exif/exif_IO_EasyExif.hpp
	src/openMVG/features/descriptor.hpp
	src/openMVG/features/regions.hpp
	src/openMVG/geometry/Similarity3.hpp
	src/openMVG/geometry/half_space_intersection.hpp
	src/openMVG/graph/connectedComponent.hpp
	src/openMVG/graph/graph_builder.hpp
	src/openMVG/graph/triplet_finder.hpp
	src/openMVG/image/image_container.hpp
	src/openMVG/image/image_converter.hpp
	src/openMVG/image/image_convolution_base.hpp
	src/openMVG/image/image_diffusion.hpp
	src/openMVG/image/image_io.hpp
	src/openMVG/image/image_warping.hpp
	src/openMVG/matching/indMatchDecoratorXY.hpp
	src/openMVG/matching/regions_matcher.hpp
	src/openMVG/multiview/translation_averaging_solver.hpp
	src/openMVG/robust_estimation/rand_sampling.hpp
	src/openMVG/robust_estimation/robust_estimator_Ransac.hpp
	src/openMVG/sfm/sfm_data_BA.hpp
	src/openMVG/sfm/sfm_data_BA_ceres.hpp
	src/openMVG/sfm/sfm_data_filters.hpp
	src/openMVG/sfm/sfm_data_io_ply.hpp
	src/openMVG/tracks/tracks.hpp
	src/openMVG/types.hpp
  • Loading branch information
pmoulon committed Apr 20, 2016
2 parents 81a52a1 + 6ca1c9c commit 16f3195
Show file tree
Hide file tree
Showing 83 changed files with 501 additions and 482 deletions.
8 changes: 4 additions & 4 deletions src/openMVG/cameras/Camera_IO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static bool save(
std::ofstream file( scameraFile.c_str(), std::ios::out | std::ios::binary );
file.write( ( const char* )PMat.data(), ( std::streamsize )( 3 * 4 )*sizeof( double ) );

bool bOk = ( !file.fail() );
const bool bOk = ( !file.fail() );
file.close();
return bOk;
}
Expand Down Expand Up @@ -69,9 +69,9 @@ static bool load(
<< "' for reading" << std::endl;
return false;
}
val.resize( 12 );
in.read( ( char* )&val[0], ( std::streamsize )12 * sizeof( double ) );
if ( in.fail() )
val.resize(12);
in.read(reinterpret_cast<char*>(&val[0]),(std::streamsize)12*sizeof(double));
if (in.fail())
{
val.clear();
}
Expand Down
10 changes: 3 additions & 7 deletions src/openMVG/cameras/Camera_Intrinsics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <cereal/cereal.hpp> // Serialization

#include <vector>

namespace openMVG
{
Expand Down Expand Up @@ -56,7 +55,7 @@ struct IntrinsicBase : public Clonable<IntrinsicBase>
/**
* @brief Destructor
*/
virtual ~IntrinsicBase() {}
virtual ~IntrinsicBase() = default;

/**
* @brief Get width of the image
Expand Down Expand Up @@ -118,7 +117,6 @@ struct IntrinsicBase : public Clonable<IntrinsicBase>
// Virtual members
// --

/// Tell from which type the embed camera is
/**
* @brief Tell from which type the embed camera is
* @return Corresponding intrinsic
Expand Down Expand Up @@ -251,10 +249,8 @@ struct IntrinsicBase : public Clonable<IntrinsicBase>
stl::hash_combine( seed, w_ );
stl::hash_combine( seed, h_ );
const std::vector<double> params = this->getParams();
for ( size_t i = 0; i < params.size(); ++i )
{
stl::hash_combine( seed, params[i] );
}
for ( const auto & param : params )
stl::hash_combine( seed , param );
return seed;
}
};
Expand Down
37 changes: 19 additions & 18 deletions src/openMVG/cameras/Camera_Pinhole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "openMVG/numeric/numeric.h"
#include "openMVG/cameras/Camera_Common.hpp"
#include "openMVG/cameras/Camera_Intrinsics.hpp"
#include "openMVG/geometry/pose3.hpp"

#include <vector>
Expand Down Expand Up @@ -63,13 +64,13 @@ class Pinhole_Intrinsic : public IntrinsicBase
/**
* @brief Destructor
*/
virtual ~Pinhole_Intrinsic() {}
virtual ~Pinhole_Intrinsic() override = default;

/**
* @brief Get type of the intrinsic
* @retval PINHOLE_CAMERA
*/
virtual EINTRINSIC getType() const
EINTRINSIC getType() const override
{
return PINHOLE_CAMERA;
}
Expand All @@ -78,7 +79,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Get the intrinsic matrix
* @return 3x3 intrinsic matrix
*/
const Mat3& K() const
const Mat3& K() const
{
return K_;
}
Expand Down Expand Up @@ -116,7 +117,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Get bearing vector of a point given an image coordinate
* @return bearing vector
*/
virtual Vec3 operator () ( const Vec2& p ) const
Vec3 operator () ( const Vec2& p ) const override
{
Vec3 p3( p( 0 ), p( 1 ), 1.0 );
return ( Kinv_ * p3 ).normalized();
Expand All @@ -127,7 +128,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Camera plane point
* @return Point on image plane
*/
virtual Vec2 cam2ima( const Vec2& p ) const
Vec2 cam2ima( const Vec2& p ) const override
{
return focal() * p + principal_point();
}
Expand All @@ -137,7 +138,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Image plane point
* @return camera plane point
*/
virtual Vec2 ima2cam( const Vec2& p ) const
Vec2 ima2cam( const Vec2& p ) const override
{
return ( p - principal_point() ) / focal();
}
Expand All @@ -146,7 +147,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Does the camera model handle a distortion field?
* @retval false if intrinsic does not hold distortion
*/
virtual bool have_disto() const
bool have_disto() const override
{
return false;
}
Expand All @@ -156,7 +157,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Point before distortion computation (in normalized camera frame)
* @return point with distortion
*/
virtual Vec2 add_disto( const Vec2& p ) const
Vec2 add_disto( const Vec2& p ) const override
{
return p;
}
Expand All @@ -166,7 +167,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Point with distortion
* @return Point without distortion
*/
virtual Vec2 remove_disto( const Vec2& p ) const
Vec2 remove_disto( const Vec2& p ) const override
{
return p;
}
Expand All @@ -176,7 +177,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param value Error in image plane
* @return error of passing from the image plane to the camera plane
*/
virtual double imagePlane_toCameraPlaneError( double value ) const
double imagePlane_toCameraPlaneError( double value ) const
{
return value / focal();
}
Expand All @@ -186,7 +187,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param pose Extrinsic matrix
* @return Concatenation of intrinsic matrix and extrinsic matrix
*/
virtual Mat34 get_projective_equivalent( const geometry::Pose3 & pose ) const
Mat34 get_projective_equivalent( const geometry::Pose3 & pose ) const
{
Mat34 P;
P_From_KRt( K(), pose.rotation(), pose.translation(), &P );
Expand All @@ -198,7 +199,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Data wrapper for non linear optimization (get data)
* @return vector of parameter of this intrinsic
*/
virtual std::vector<double> getParams() const
std::vector<double> getParams() const override
{
const std::vector<double> params = {K_( 0, 0 ), K_( 0, 2 ), K_( 1, 2 )};
return params;
Expand All @@ -211,7 +212,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @retval true if update is correct
* @retval false if there was an error during update
*/
virtual bool updateFromParams( const std::vector<double> & params )
bool updateFromParams(const std::vector<double> & params) override
{
if ( params.size() == 3 )
{
Expand All @@ -228,9 +229,9 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Return the list of parameter indexes that must be held constant
* @param parametrization The given parametrization
*/
virtual std::vector<int> subsetParameterization
std::vector<int> subsetParameterization
(
const Intrinsic_Parameter_Type & parametrization) const
const Intrinsic_Parameter_Type & parametrization) const override
{
std::vector<int> constant_index;
const int param = static_cast<int>(parametrization);
Expand All @@ -253,7 +254,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Input distorted pixel
* @return Point without distortion
*/
virtual Vec2 get_ud_pixel( const Vec2& p ) const
Vec2 get_ud_pixel( const Vec2& p ) const override
{
return p;
}
Expand All @@ -263,7 +264,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @param p Input pixel
* @return Distorted pixel
*/
virtual Vec2 get_d_pixel( const Vec2& p ) const
Vec2 get_d_pixel( const Vec2& p ) const override
{
return p;
}
Expand Down Expand Up @@ -301,7 +302,7 @@ class Pinhole_Intrinsic : public IntrinsicBase
* @brief Clone the object
* @return A clone (copy of the stored object)
*/
virtual IntrinsicBase * clone( void ) const
IntrinsicBase * clone( void ) const override
{
return new class_type( *this );
}
Expand Down
18 changes: 9 additions & 9 deletions src/openMVG/cameras/Camera_Pinhole_Brown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @brief Get type of the intrinsic
* @retval PINHOLE_CAMERA_BROWN
*/
EINTRINSIC getType() const
EINTRINSIC getType() const override
{
return PINHOLE_CAMERA_BROWN;
}
Expand All @@ -70,7 +70,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @brief Does the camera model handle a distortion field?
* @retval true
*/
virtual bool have_disto() const
virtual bool have_disto() const override
{
return true;
}
Expand All @@ -80,7 +80,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @param p Point before distortion computation (in normalized camera frame)
* @return point with distortion
*/
virtual Vec2 add_disto( const Vec2 & p ) const
virtual Vec2 add_disto( const Vec2 & p ) const override
{
return ( p + distoFunction( params_, p ) );
}
Expand All @@ -93,7 +93,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* Heikkila J (2000) Geometric Camera Calibration Using Circular Control Points.
* IEEE Trans. Pattern Anal. Mach. Intell., 22:1066-1077
*/
virtual Vec2 remove_disto( const Vec2 & p ) const
virtual Vec2 remove_disto( const Vec2 & p ) const override
{
const double epsilon = 1e-8; //criteria to stop the iteration
Vec2 p_u = p;
Expand All @@ -110,7 +110,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @brief Data wrapper for non linear optimization (get data)
* @return vector of parameter of this intrinsic
*/
virtual std::vector<double> getParams() const
virtual std::vector<double> getParams() const override
{
std::vector<double> params = Pinhole_Intrinsic::getParams();
params.push_back( params_[0] );
Expand All @@ -127,7 +127,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @retval true if update is correct
* @retval false if there was an error during update
*/
virtual bool updateFromParams( const std::vector<double> & params )
virtual bool updateFromParams( const std::vector<double> & params ) override
{
if ( params.size() == 8 )
{
Expand All @@ -150,7 +150,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
*/
virtual std::vector<int> subsetParameterization
(
const Intrinsic_Parameter_Type & parametrization) const
const Intrinsic_Parameter_Type & parametrization) const override
{
std::vector<int> constant_index;
const int param = static_cast<int>(parametrization);
Expand Down Expand Up @@ -182,7 +182,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @param p Input distorted pixel
* @return Point without distortion
*/
virtual Vec2 get_ud_pixel( const Vec2& p ) const
virtual Vec2 get_ud_pixel( const Vec2& p ) const override
{
return cam2ima( remove_disto( ima2cam( p ) ) );
}
Expand Down Expand Up @@ -223,7 +223,7 @@ class Pinhole_Intrinsic_Brown_T2 : public Pinhole_Intrinsic
* @brief Clone the object
* @return A clone (copy of the stored object)
*/
virtual IntrinsicBase * clone( void ) const
virtual IntrinsicBase * clone( void ) const override
{
return new class_type( *this );
}
Expand Down
Loading

0 comments on commit 16f3195

Please sign in to comment.