Skip to content

Commit

Permalink
Minor modifications. auto_ptr replaced by unique_ptr, add some inline…
Browse files Browse the repository at this point in the history
… function.
  • Loading branch information
pmoulon committed Dec 9, 2015
1 parent ce0850d commit 878b1c8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/openMVG/cameras/Camera_Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ enum EINTRINSIC
};

// Return if the camera type is a valid enum
static bool isValid(EINTRINSIC eintrinsic)
static inline bool isValid(EINTRINSIC eintrinsic)
{
return eintrinsic > PINHOLE_CAMERA_START && eintrinsic < PINHOLE_CAMERA_END;
}

static bool isPinhole(EINTRINSIC eintrinsic)
static inline bool isPinhole(EINTRINSIC eintrinsic)
{
return eintrinsic > PINHOLE_CAMERA_START && eintrinsic < PINHOLE_CAMERA_END;
}
Expand Down
1 change: 0 additions & 1 deletion src/openMVG/features/akaze/msurf_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace features {
Real cx = - static_cast<Real>( 0.5 ) , cy = static_cast<Real>( 0.5 ) ;

// Set the descriptor size and the sample and pattern sizes
const int dsize = 64;
const int sample_step = 5;
const int pattern_size = 12;

Expand Down
14 changes: 7 additions & 7 deletions src/openMVG/image/image_converter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ void rgb2Float( const ImageIn& imaIn,
// Float to RGB ( unsigned char or int )
//--------------------------------------------------------------------------


static void convertFloatToInt(
const RGBfColor& valIn,
RGBColor& valOut,
float factor = 255.f)
static inline
void convertFloatToInt
(
const RGBfColor& valIn,
RGBColor& valOut,
float factor = 255.f
)
{
for( int channel = 0; channel < 3; ++channel )
valOut(channel) = (int)(valIn(channel) * factor);
}


//template<typename ImageOut>
static void rgbFloat2rgbInt(
const Image< RGBfColor >& imaIn,
Image< RGBColor > *imaOut,
Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/matching/indMatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct IndMatch
IndexT _i, _j; // Left, right index
};

static std::ostream& operator<<(std::ostream & out, const IndMatch & obj) {
static inline std::ostream& operator<<(std::ostream & out, const IndMatch & obj) {
return out << obj._i << " " << obj._j;
}

Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/sfm/sfm_landmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ typedef Hash_Map<IndexT, Observation> Observations;
/// Define a landmark (a 3D point, with it's 2d observations)
struct Landmark
{
Observations obs;
Vec3 X;
Observations obs;

// Serialization
template <class Archive>
Expand Down
11 changes: 6 additions & 5 deletions src/openMVG/tracks/tracks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ using namespace lemon;
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <map>
#include <memory>

namespace openMVG {

Expand Down Expand Up @@ -96,8 +97,8 @@ struct TracksBuilder

lemon::ListDigraph _graph; //Graph container to create the node
MapNodeToIndex _map_nodeToIndex; //Node to index map
std::auto_ptr<IndexMap> _index;
std::auto_ptr<UnionFindObject> _tracksUF;
std::unique_ptr<IndexMap> _index;
std::unique_ptr<UnionFindObject> _tracksUF;

const UnionFindObject & getUnionFindEnum() const {return *_tracksUF; }
const MapNodeToIndex & getReverseMap() const {return _map_nodeToIndex;}
Expand Down Expand Up @@ -144,8 +145,8 @@ struct TracksBuilder
_map_nodeToIndex.sort();

// Add the element of myset to the UnionFind insert method.
_index = std::auto_ptr<IndexMap>( new IndexMap(_graph) );
_tracksUF = std::auto_ptr<UnionFindObject>( new UnionFindObject(*_index));
_index = std::unique_ptr<IndexMap>( new IndexMap(_graph) );
_tracksUF = std::unique_ptr<UnionFindObject>( new UnionFindObject(*_index));
for (ListDigraph::NodeIt it(_graph); it != INVALID; ++it) {
_tracksUF->insert(it);
}
Expand Down
4 changes: 3 additions & 1 deletion src/software/SfM/main_evalQuality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ int main(int argc, char **argv)
if (map_Cam_gt.size() != sfm_data.GetPoses().size())
{
std::cerr << std::endl
<< "There is missing camera in the loaded scene." << std::endl;
<< "There is missing camera in the loaded scene." << "\n"
<< "#GT poses: " << map_Cam_gt.size() << "\n"
<< "#Scene poses: " << sfm_data.GetPoses().size() << std::endl;
return EXIT_FAILURE;
}

Expand Down
8 changes: 4 additions & 4 deletions src/software/colorHarmonize/main_ColHarmonize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <cstdlib>
#include <memory>

#include "software/colorHarmonize/colorHarmonizeEngineGlobal.hpp"

#include "third_party/cmdLine/cmdLine.h"
#include "third_party/stlplus3/filesystemSimplified/file_system.hpp"
#include "openMVG/system/timer.hpp"

#include <cstdlib>
#include <memory>

using namespace openMVG;

int main( int argc, char **argv )
Expand Down Expand Up @@ -71,7 +71,7 @@ int main( int argc, char **argv )
openMVG::system::Timer timer;

sMatchesDir = stlplus::folder_part(sMatchesFile);
std::auto_ptr<ColorHarmonizationEngineGlobal> m_colorHarmonizeEngine(
std::unique_ptr<ColorHarmonizationEngineGlobal> m_colorHarmonizeEngine(
new ColorHarmonizationEngineGlobal(sSfM_Data_Filename,
sMatchesDir,
sMatchesFile,
Expand Down

0 comments on commit 878b1c8

Please sign in to comment.