Update for NON BOOST libraries

This commit is contained in:
edgarriba 2014-08-05 14:47:06 +02:00
parent 16e750dd37
commit 23785faf02
3 changed files with 47 additions and 23 deletions

View File

@ -1,12 +1,16 @@
cmake_minimum_required(VERSION 2.8)
project( PNP_DEMO )
find_package( Boost REQUIRED )
ADD_DEFINITIONS(
-std=c++11
-std=c++0x
# Other flags
)
find_package( OpenCV REQUIRED )
include_directories(
$(PNP_DEMO_SOURCE_DIR)/include
${Boost_INCLUDE_DIR}
${OpenCV_INCLUDE_DIRS}
)
@ -23,6 +27,19 @@ pnp_registration
src/RobustMatcher.cpp
)
add_executable(
pnp_verification
src/main_verification.cpp
src/CsvReader.cpp
src/CsvWriter.cpp
src/ModelRegistration.cpp
src/Mesh.cpp
src/Model.cpp
src/PnPProblem.cpp
src/Utils.cpp
src/RobustMatcher.cpp
)
add_executable(
pnp_detection
src/main_detection.cpp
@ -36,5 +53,12 @@ pnp_detection
src/RobustMatcher.cpp
)
target_link_libraries( pnp_registration ${Boost_LIBRARIES} ${OpenCV_LIBS} )
target_link_libraries( pnp_detection ${Boost_LIBRARIES} ${OpenCV_LIBS} )
add_executable(
pnp_test
src/test_pnp.cpp
)
target_link_libraries( pnp_registration ${OpenCV_LIBS} )
target_link_libraries( pnp_verification ${OpenCV_LIBS} )
target_link_libraries( pnp_detection ${OpenCV_LIBS} )
target_link_libraries( pnp_test ${OpenCV_LIBS} )

View File

@ -1,4 +1,4 @@
#include <boost/lexical_cast.hpp>
#include <string>
#include "CsvReader.h"
/** The default constructor of the CSV reader Class */
@ -28,8 +28,8 @@ std::string line, tmp_str, n;
{
getline(liness, tmp_str, _separator);
getline(liness, n);
if(tmp_str == "vertex") num_vertex = boost::lexical_cast< int >(n);
if(tmp_str == "face") num_triangles = boost::lexical_cast< int >(n);
if(tmp_str == "vertex") num_vertex = std::stoi(n);
if(tmp_str == "face") num_triangles = std::stoi(n);
}
if(tmp_str == "end_header") end_header = true;
}
@ -46,9 +46,9 @@ std::string line, tmp_str, n;
getline(liness, z);
cv::Point3f tmp_p;
tmp_p.x = boost::lexical_cast< float >(x);
tmp_p.y = boost::lexical_cast< float >(y);
tmp_p.z = boost::lexical_cast< float >(z);
tmp_p.x = std::stof(x);
tmp_p.y = std::stof(y);
tmp_p.z = std::stof(z);
list_vertex.push_back(tmp_p);
count++;
@ -68,9 +68,9 @@ std::string line, tmp_str, n;
getline(liness, id2);
std::vector<int> tmp_triangle(3);
tmp_triangle[0] = boost::lexical_cast< int >(id0);
tmp_triangle[1] = boost::lexical_cast< int >(id1);
tmp_triangle[2] = boost::lexical_cast< int >(id2);
tmp_triangle[0] = std::stoi(id0);
tmp_triangle[1] = std::stoi(id1);
tmp_triangle[2] = std::stoi(id2);
list_triangles.push_back(tmp_triangle);
count++;

View File

@ -1,4 +1,4 @@
#include <boost/lexical_cast.hpp>
#include <string>
#include "CsvWriter.h"
CsvWriter::CsvWriter(const std::string &path, const std::string &separator){
@ -17,9 +17,9 @@ void CsvWriter::writeXYZ(const std::vector<cv::Point3f> &list_points3d)
std::string x, y, z;
for(unsigned int i = 0; i < list_points3d.size(); ++i)
{
x = boost::lexical_cast< std::string >(list_points3d[i].x);
y = boost::lexical_cast< std::string >(list_points3d[i].y);
z = boost::lexical_cast< std::string >(list_points3d[i].z);
x = std::to_string(list_points3d[i].x);
y = std::to_string(list_points3d[i].y);
z = std::to_string(list_points3d[i].z);
_file << x << _separator << y << _separator << z << std::endl;
}
@ -31,18 +31,18 @@ void CsvWriter::writeUVXYZ(const std::vector<cv::Point3f> &list_points3d, const
std::string u, v, x, y, z, descriptor_str;
for(int i = 0; i < list_points3d.size(); ++i)
{
u = boost::lexical_cast< std::string >(list_points2d[i].x);
v = boost::lexical_cast< std::string >(list_points2d[i].y);
x = boost::lexical_cast< std::string >(list_points3d[i].x);
y = boost::lexical_cast< std::string >(list_points3d[i].y);
z = boost::lexical_cast< std::string >(list_points3d[i].z);
u = std::to_string(list_points2d[i].x);
v = std::to_string(list_points2d[i].y);
x = std::to_string(list_points3d[i].x);
y = std::to_string(list_points3d[i].y);
z = std::to_string(list_points3d[i].z);
_file << u << _separator << v << _separator << x << _separator << y << _separator << z;
for(int j = 0; j < 32; ++j)
{
std::cout << descriptors.at<float>(i,j) << std::endl;
descriptor_str = boost::lexical_cast< std::string >(descriptors.at<float>(i,j));
descriptor_str = std::to_string(descriptors.at<float>(i,j));
_file << _separator << descriptor_str;
}
_file << std::endl;