Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error in OpenCV 3.4.0

reconstruction(master)$ g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz In file included from /usr/local/include/opencv2/core.hpp:56:0, from /usr/local/include/opencv2/sfm/conditioning.hpp:39, from /usr/local/include/opencv2/sfm.hpp:39, from example_sfm.cpp:3: /usr/local/include/opencv2/core/traits.hpp: In instantiation of ‘struct cv::traits::Type<std::__cxx11::basic_string<char> >’: /usr/local/include/opencv2/core/mat.inl.hpp:85:32: required from ‘cv::_InputArray::_InputArray(const std::vector<_Tp>&) [with _Tp = std::__cxx11::basic_string<char>]’ example_sfm.cpp:66:86: required from here /usr/local/include/opencv2/core/traits.hpp:366:8: error: ‘type’ is not a member of ‘cv::DataType<std::__cxx11::basic_string<char> >’ { enum { value = DataType<t>::type }; }; ^ reconstruction(master)$ pkg-config --modversion opencv 3.4.0

Please let me know the solution for this error.

click to hide/show revision 2
None

updated 2017-12-25 04:07:10 -0600

berak gravatar image

Error in OpenCV 3.4.0

reconstruction(master)$ g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz In file included from /usr/local/include/opencv2/core.hpp:56:0, from /usr/local/include/opencv2/sfm/conditioning.hpp:39, from /usr/local/include/opencv2/sfm.hpp:39, from example_sfm.cpp:3: /usr/local/include/opencv2/core/traits.hpp: In instantiation of ‘struct cv::traits::Type<std::__cxx11::basic_string<char> >’: /usr/local/include/opencv2/core/mat.inl.hpp:85:32: required from ‘cv::_InputArray::_InputArray(const std::vector<_Tp>&) [with _Tp = std::__cxx11::basic_string<char>]’ example_sfm.cpp:66:86: required from here /usr/local/include/opencv2/core/traits.hpp:366:8: error: ‘type’ is not a member of ‘cv::DataType<std::__cxx11::basic_string<char> >’ { enum { value = DataType<t>::type }; }; ^ reconstruction(master)$ pkg-config --modversion opencv 3.4.0

Please let me know the solution for this error.

click to hide/show revision 3
None

updated 2017-12-25 04:07:56 -0600

berak gravatar image

Error in OpenCV 3.4.0


reconstruction(master)$ g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz
    In file included from /usr/local/include/opencv2/core.hpp:56:0,
                     from /usr/local/include/opencv2/sfm/conditioning.hpp:39,
                     from /usr/local/include/opencv2/sfm.hpp:39,
                     from example_sfm.cpp:3:
    /usr/local/include/opencv2/core/traits.hpp: In instantiation of ‘struct cv::traits::Type<std::__cxx11::basic_string<char> >’:
    /usr/local/include/opencv2/core/mat.inl.hpp:85:32:   required from ‘cv::_InputArray::_InputArray(const std::vector<_Tp>&) [with _Tp = std::__cxx11::basic_string<char>]’
    example_sfm.cpp:66:86:   required from here
    /usr/local/include/opencv2/core/traits.hpp:366:8: **/usr/local/include/opencv2/core/traits.hpp:366:8: error: ‘type’ is not a member of ‘cv::DataType<std::__cxx11::basic_string<char> >’ >’**
     { enum { value = DataType<t>::type DataType<T>::type }; };
            ^
    reconstruction(master)$ pkg-config --modversion opencv
    3.4.0

3.4.0

Please let me know the solution for this error.

Error in OpenCV 3.4.0


reconstruction(master)$ g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz
    In file included from /usr/local/include/opencv2/core.hpp:56:0,
                     from /usr/local/include/opencv2/sfm/conditioning.hpp:39,
                     from /usr/local/include/opencv2/sfm.hpp:39,
                     from example_sfm.cpp:3:
    /usr/local/include/opencv2/core/traits.hpp: In instantiation of ‘struct cv::traits::Type<std::__cxx11::basic_string<char> >’:
    /usr/local/include/opencv2/core/mat.inl.hpp:85:32:   required from ‘cv::_InputArray::_InputArray(const std::vector<_Tp>&) [with _Tp = std::__cxx11::basic_string<char>]’
    example_sfm.cpp:66:86:   required from here
    **/usr/local/include/opencv2/core/traits.hpp:366:8: error: ‘type’ is not a member of ‘cv::DataType<std::__cxx11::basic_string<char> >’**
     { enum { value = DataType<T>::type }; };
            ^
    reconstruction(master)$ pkg-config --modversion opencv
    3.4.0

Please let me know the solution for this error.

Source Code : example_sfm.cpp https://github.com/alyssaq/reconstruction/blob/master/example_sfm.cpp

define CERES_FOUND true

include <opencv2 sfm.hpp="">

include <opencv2 viz.hpp="">

include <opencv2 calib3d.hpp="">

include <opencv2 core.hpp="">

include <iostream>

include <fstream>

include <string>

include <iomanip>

using namespace std; using namespace cv; using namespace cv::sfm;

static void help() { cout << "\n------------------------------------------------------------------------------------\n" << " This program shows the multiview reconstruction capabilities in the \n" << " OpenCV Structure From Motion (SFM) module.\n" << " It reconstruct a scene from a set of 2D images \n" << " Usage:\n" << " example_sfm_scene_reconstruction <path_to_file> <f> <cx> <cy>\n" << " where: path_to_file is the file absolute path into your system which contains\n" << " the list of images to use for reconstruction. \n" << " f is the focal lenght in pixels. \n" << " cx is the image principal point x coordinates in pixels. \n" << " cy is the image principal point y coordinates in pixels. \n" << "------------------------------------------------------------------------------------\n\n" << endl; } int getdir(const string _filename, vector<string> &files) { ifstream myfile(_filename.c_str()); if (!myfile.is_open()) { cout << "Unable to read file: " << _filename << endl; exit(0); } else {; size_t found = _filename.find_last_of("/\"); string line_str, path_to_file = _filename.substr(0, found); while ( getline(myfile, line_str) ) { cout << line_str << endl; files.push_back(line_str); } } return 1; } int main(int argc, char* argv[]) { // Read input parameters if ( argc != 5 ) { help(); exit(0); } // Parse the image paths vector<string> images_paths; getdir( argv[1], images_paths ); // Build instrinsics float f = atof(argv[2]), cx = atof(argv[3]), cy = atof(argv[4]); Matx33d K = Matx33d( f, 0, cx, 0, f, cy, 0, 0, 1); bool is_projective = true; vector<mat> Rs_est, ts_est, points3d_estimated; sfm::reconstruct(images_paths, Rs_est, ts_est, K, points3d_estimated, is_projective);

// Print output cout << "\n----------------------------\n" << endl; cout << "Reconstruction: " << endl; cout << "============================" << endl; cout << "Estimated 3D points: " << points3d_estimated.size() << endl; cout << "Estimated cameras: " << Rs_est.size() << endl; cout << "Refined intrinsics: " << endl << K << endl << endl; cout << "3D Visualization: " << endl; cout << "============================" << endl; viz::Viz3d window("Coordinate Frame"); window.setWindowSize(Size(500,500)); window.setWindowPosition(Point(150,150)); window.setBackgroundColor(); // black by default // Create the pointcloud cout << "Recovering points ... ";

// recover estimated points3d ofstream points_file; cv::MatIterator_<double> mat_it; points_file.open("points.txt"); points_file.precision(std::numeric_limits<double>::digits10); for (int i = 0; i < points3d_estimated.size(); ++i) { std::cout << points3d_estimated[i] << std::endl; for(mat_it = points3d_estimated[i].begin<double>(); mat_it != points3d_estimated[i].end<double>(); mat_it++){ points_file << *mat_it << " "; } points_file << "\n"; } cout << "Done. Points saved to points.txt" << endl; points_file.close();

return 0; }

Error in OpenCV 3.4.0


reconstruction(master)$ g++ example_sfm.cpp -I /usr/include/eigen3/ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L /usr/local/share/OpenCV/3rdparty/lib/ -L/usr/local/lib/ -L /usr/include/eigen3/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_optflow -lopencv_sfm -lopencv_viz
    In file included from /usr/local/include/opencv2/core.hpp:56:0,
                     from /usr/local/include/opencv2/sfm/conditioning.hpp:39,
                     from /usr/local/include/opencv2/sfm.hpp:39,
                     from example_sfm.cpp:3:
    /usr/local/include/opencv2/core/traits.hpp: In instantiation of ‘struct cv::traits::Type<std::__cxx11::basic_string<char> >’:
    /usr/local/include/opencv2/core/mat.inl.hpp:85:32:   required from ‘cv::_InputArray::_InputArray(const std::vector<_Tp>&) [with _Tp = std::__cxx11::basic_string<char>]’
    example_sfm.cpp:66:86:   required from here
    **/usr/local/include/opencv2/core/traits.hpp:366:8: error: ‘type’ is not a member of ‘cv::DataType<std::__cxx11::basic_string<char> >’**
     { enum { value = DataType<T>::type }; };
            ^
    reconstruction(master)$ pkg-config --modversion opencv
    3.4.0

Please let me know the solution for this error.

Source Code : example_sfm.cpp https://github.com/alyssaq/reconstruction/blob/master/example_sfm.cpp

define
#define CERES_FOUND true

include <opencv2 sfm.hpp="">

include <opencv2 viz.hpp="">

include <opencv2 calib3d.hpp="">

include <opencv2 core.hpp="">

include <iostream>

include <fstream>

include <string>

include <iomanip>

true #include <opencv2/sfm.hpp> #include <opencv2/viz.hpp> #include <opencv2/calib3d.hpp> #include <opencv2/core.hpp> #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; using namespace cv; using namespace cv::sfm;

cv::sfm; static void help() { cout << "\n------------------------------------------------------------------------------------\n" << " This program shows the multiview reconstruction capabilities in the \n" << " OpenCV Structure From Motion (SFM) module.\n" << " It reconstruct a scene from a set of 2D images \n" << " Usage:\n" << " example_sfm_scene_reconstruction <path_to_file> <f> <cx> <cy>\n" << " where: path_to_file is the file absolute path into your system which contains\n" << " the list of images to use for reconstruction. \n" << " f is the focal lenght in pixels. \n" << " cx is the image principal point x coordinates in pixels. \n" << " cy is the image principal point y coordinates in pixels. \n" << "------------------------------------------------------------------------------------\n\n" << endl; } int getdir(const string _filename, vector<string> &files) { ifstream myfile(_filename.c_str()); if (!myfile.is_open()) { cout << "Unable to read file: " << _filename << endl; exit(0); } else {; size_t found = _filename.find_last_of("/\"); _filename.find_last_of("/\\"); string line_str, path_to_file = _filename.substr(0, found); while ( getline(myfile, line_str) ) { cout << line_str << endl; files.push_back(line_str); } } return 1; } int main(int argc, char* argv[]) { // Read input parameters if ( argc != 5 ) { help(); exit(0); } // Parse the image paths vector<string> images_paths; getdir( argv[1], images_paths ); // Build instrinsics float f = atof(argv[2]), cx = atof(argv[3]), cy = atof(argv[4]); Matx33d K = Matx33d( f, 0, cx, 0, f, cy, 0, 0, 1); bool is_projective = true; vector<mat> vector<Mat> Rs_est, ts_est, points3d_estimated; sfm::reconstruct(images_paths, Rs_est, ts_est, K, points3d_estimated, is_projective);

is_projective); // Print output cout << "\n----------------------------\n" << endl; cout << "Reconstruction: " << endl; cout << "============================" << endl; cout << "Estimated 3D points: " << points3d_estimated.size() << endl; cout << "Estimated cameras: " << Rs_est.size() << endl; cout << "Refined intrinsics: " << endl << K << endl << endl; cout << "3D Visualization: " << endl; cout << "============================" << endl; viz::Viz3d window("Coordinate Frame"); window.setWindowSize(Size(500,500)); window.setWindowPosition(Point(150,150)); window.setBackgroundColor(); // black by default // Create the pointcloud cout << "Recovering points ... ";

"; // recover estimated points3d ofstream points_file; cv::MatIterator_<double> mat_it; points_file.open("points.txt"); points_file.precision(std::numeric_limits<double>::digits10); for (int i = 0; i < points3d_estimated.size(); ++i) { std::cout << points3d_estimated[i] << std::endl; for(mat_it = points3d_estimated[i].begin<double>(); mat_it != points3d_estimated[i].end<double>(); mat_it++){ points_file << *mat_it << " "; } points_file << "\n"; } cout << "Done. Points saved to points.txt" << endl; points_file.close();

points_file.close(); return 0; }

}