Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with push_back

    #include <ctype.h>
#include <stdlib.h>
#include <iostream>
#include <exception>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include "opencv2/imgproc.hpp"
#include <opencv2/imgproc/imgproc.hpp>

#include <opencv2/calib3d/calib3d.hpp>


using namespace std;

int main(int argc,char **argv)
{

int c;
bool rvalue=false; 
bool cvalue=false;
bool svalue=false; 
bool vvalue=false;
bool fvalue=false; 
int rows,cols;
float size;
std::string video, fichero;

while ((c = getopt (argc, argv, "r:c:s:v:f:")) != -1) {
    switch (c) {


        case 'r':
            rvalue=true;
            rows = atoi(optarg);
        break;

        case 'c':
            cvalue=true;
            cols= atoi(optarg);
        break;

        case 's':
            svalue=true;
            size= atoi(optarg);
        break;

        case 'v':
            vvalue=true;
            video = optarg;
        break;

        case 'f':
            fvalue=true;
            fichero= optarg;
        break;

        case '?':
            cout<<"flag desconocia"<<endl;
            cout<<"./calibrate [-r <int>=0] [-c <int>=0] [-s <float>=0] <video entrada> <fichero_destino> "<<endl;
            exit(-1);
        break;
    }
    }

if
(rvalue==false) 
    {
        std::cerr << "Introduzca un valor de rows(filas)." <<std::endl;
    } 
if(cvalue==false) 
{
    std::cerr << "Introduzca un valor de cols(columnas)."<< std::endl;
} 

if (svalue==false)
{
    std::cerr << "Introduzca un size(tamaño)."<< std::endl;
}

if (vvalue==false)
{
    std::cerr << "Introduzca un video para procesar." <<std::endl;
}

if (fvalue==false)
{
    std::cerr << "Introduzca un fichero de destino. " <<std::endl;
    }

if (rvalue==true and cvalue==true and svalue==true and vvalue==true and fvalue==true)
    {

int posicion=4,i=0;
bool capturado=false;
cv::VideoCapture cap;
cap.open(video); //abrimos el video
cv::Mat frame;
std::vector <cv::Mat> total_img;//Aqui guardaremos todas las imagenes procesadas al pulsar p.
    cv::Mat img,gray_img;
    std::vector <std::vector <cv::Point2f> > imagePoints(50); //Vector donde iremos almacenando los diveros corners de las imagenes, los obtenemos en la funcion findChessboardCorners.
    std::vector<std::vector<cv::Vec3f> > arrayObjectPoints(50); //Vector donde almacenaremos todos los objectPoints.(Valores 2d convertidos a 3d)
    std::vector<cv::Point3f> objectPoints;
    size_t j=0;

if (!cap.isOpened())
    std::cerr << "Error al abrir video." << std::endl;


cap >> frame;

while (!frame.empty()) //para recorrer el video
{

    cv::namedWindow("Frame");
    cv::moveWindow("Frame",50,500);



    cv::imshow("Frame",frame);

    int tecla = cv::waitKey(50) & 0xFF;

    if (tecla==112)
        {


                if ( cv::findChessboardCorners(frame,cv::Size(5,4),imagePoints[j],cv::CALIB_CB_NORMALIZE_IMAGE)==true ) 
                { 

                    cv::cvtColor(frame, gray_img, CV_BGR2GRAY);

                    total_img.push_back(frame);

                    cv::cornerSubPix(gray_img,imagePoints[j],cv::Size(5,4),cv::Size(-1,-1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));

                    cv::drawChessboardCorners(gray_img,cv::Size(5,6),imagePoints[j],true);

                    cv::imshow("Refinada",gray_img);//muestro la imagen refinada con las conexiones entre cuadrados del tablero.

                    capturado=true;
                    j++;
                }
                else
                    std::cerr << "Tablero no encontrado." << std::endl;


            }   



    if (tecla==27 and total_img.size()>0 )
        {   
            //calibrateCamera(arrayObjectPoints,imagePoints, cv::Size(640,480), InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) )
        }

    if (tecla==102)
        cap >> frame;

    if (tecla==32 and capturado==true)
    {
        //Aqui calculo los objectPoints
        for (int t=0; t<6; ++t)
        {
            for (int e=0; e<5; ++e)
            {
                objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
            }
        }

        //Aqui calculamos cada objectPoints para cada imagen procesada.
        for (int n=0; n<total_img.size(); n++)
        {
            arrayObjectPoints[n].push_back( objectPoints );
        }


        capturado=false;
    }

}

cap.release();
}










}

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make Scanning dependencies of target prueba [ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char)’: /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::vec<float, 3=""> >::push_back(std::vector<cv::point3_<float> >&)’ arrayObjectPoints[n].push_back( objectPoints ); ^ In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0, from /usr/local/include/opencv2/core/types.hpp:53, from /usr/local/include/opencv2/core.hpp:58, from /usr/local/include/opencv2/core/core.hpp:48, from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8: /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3="">; _Alloc = std::allocator<cv::vec<float, 3=""> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3="">] push_back(const value_type& __x) ^ /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3="">&}’ CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o' make[2]: [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1 CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all' make[1]: [CMakeFiles/prueba.dir/all] Error 2 Makefile:83: fallo en las instrucciones para el objetivo 'all' make: * [all] Error 2 i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$

Problem with push_back

    #include <ctype.h>
#include <stdlib.h>
#include <iostream>
#include <exception>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include "opencv2/imgproc.hpp"
#include <opencv2/imgproc/imgproc.hpp>

#include <opencv2/calib3d/calib3d.hpp>


using namespace std;

int main(int argc,char **argv)
{

int c;
bool rvalue=false; 
bool cvalue=false;
bool svalue=false; 
bool vvalue=false;
bool fvalue=false; 
int rows,cols;
float size;
std::string video, fichero;

while ((c = getopt (argc, argv, "r:c:s:v:f:")) != -1) {
    switch (c) {


        case 'r':
            rvalue=true;
            rows = atoi(optarg);
        break;

        case 'c':
            cvalue=true;
            cols= atoi(optarg);
        break;

        case 's':
            svalue=true;
            size= atoi(optarg);
        break;

        case 'v':
            vvalue=true;
            video = optarg;
        break;

        case 'f':
            fvalue=true;
            fichero= optarg;
        break;

        case '?':
            cout<<"flag desconocia"<<endl;
            cout<<"./calibrate [-r <int>=0] [-c <int>=0] [-s <float>=0] <video entrada> <fichero_destino> "<<endl;
            exit(-1);
        break;
    }
    }

if
(rvalue==false) 
    {
        std::cerr << "Introduzca un valor de rows(filas)." <<std::endl;
    } 
if(cvalue==false) 
{
    std::cerr << "Introduzca un valor de cols(columnas)."<< std::endl;
} 

if (svalue==false)
{
    std::cerr << "Introduzca un size(tamaño)."<< std::endl;
}

if (vvalue==false)
{
    std::cerr << "Introduzca un video para procesar." <<std::endl;
}

if (fvalue==false)
{
    std::cerr << "Introduzca un fichero de destino. " <<std::endl;
    }

if (rvalue==true and cvalue==true and svalue==true and vvalue==true and fvalue==true)
    {

int posicion=4,i=0;
bool capturado=false;
cv::VideoCapture cap;
cap.open(video); //abrimos el video
cv::Mat frame;
std::vector <cv::Mat> total_img;//Aqui guardaremos todas las imagenes procesadas al pulsar p.
    cv::Mat img,gray_img;
    std::vector <std::vector <cv::Point2f> > imagePoints(50); //Vector donde iremos almacenando los diveros corners de las imagenes, los obtenemos en la funcion findChessboardCorners.
    std::vector<std::vector<cv::Vec3f> > arrayObjectPoints(50); //Vector donde almacenaremos todos los objectPoints.(Valores 2d convertidos a 3d)
    std::vector<cv::Point3f> objectPoints;
    size_t j=0;

if (!cap.isOpened())
    std::cerr << "Error al abrir video." << std::endl;


cap >> frame;

while (!frame.empty()) //para recorrer el video
{

    cv::namedWindow("Frame");
    cv::moveWindow("Frame",50,500);



    cv::imshow("Frame",frame);

    int tecla = cv::waitKey(50) & 0xFF;

    if (tecla==112)
        {


                if ( cv::findChessboardCorners(frame,cv::Size(5,4),imagePoints[j],cv::CALIB_CB_NORMALIZE_IMAGE)==true ) 
                { 

                    cv::cvtColor(frame, gray_img, CV_BGR2GRAY);

                    total_img.push_back(frame);

                    cv::cornerSubPix(gray_img,imagePoints[j],cv::Size(5,4),cv::Size(-1,-1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));

                    cv::drawChessboardCorners(gray_img,cv::Size(5,6),imagePoints[j],true);

                    cv::imshow("Refinada",gray_img);//muestro la imagen refinada con las conexiones entre cuadrados del tablero.

                    capturado=true;
                    j++;
                }
                else
                    std::cerr << "Tablero no encontrado." << std::endl;


            }   



    

if (tecla==27 and total_img.size()>0 ) {
//calibrateCamera(arrayObjectPoints,imagePoints, cv::Size(640,480), InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) ) } }

 if (tecla==102)
cap >> frame;
if (tecla==32 and capturado==true)
{
//Aqui calculo los objectPoints
for (int t=0; t<6; ++t)
{
for (int e=0; e<5; ++e)
{
objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
}
}
//Aqui calculamos cada objectPoints para cada imagen procesada.
for (int n=0; n<total_img.size(); n++)
{
arrayObjectPoints[n].push_back( objectPoints );
}
capturado=false;
}
}
cap.release();
}
}

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make Scanning dependencies of target prueba [ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char)’: /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::vec<float, 3=""> >::push_back(std::vector<cv::point3_<float> >&)’ arrayObjectPoints[n].push_back( objectPoints ); ^ In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0, from /usr/local/include/opencv2/core/types.hpp:53, from /usr/local/include/opencv2/core.hpp:58, from /usr/local/include/opencv2/core/core.hpp:48, from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8: /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3="">; _Alloc = std::allocator<cv::vec<float, 3=""> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3="">] push_back(const value_type& __x) ^ /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3="">&}’ CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o' make[2]: [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1 CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all' make[1]: [CMakeFiles/prueba.dir/all] Error 2 Makefile:83: fallo en las instrucciones para el objetivo 'all' make: * [all] Error 2 i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ 5$

Problem with push_back

if (tecla==27 and total_img.size()>0 ) {
//calibrateCamera(arrayObjectPoints,imagePoints, cv::Size(640,480), InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) ) }

    if (tecla==102)
        cap >> frame;

    if (tecla==32 and capturado==true)
    {
        //Aqui calculo los objectPoints
        for (int t=0; t<6; ++t)
        {
            for (int e=0; e<5; ++e)
            {
                objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
            }
        }

        //Aqui calculamos cada objectPoints para cada imagen procesada.
        for (int n=0; n<total_img.size(); n++)
        {
            arrayObjectPoints[n].push_back( objectPoints );
        }


        capturado=false;
    }

}

cap.release();
}










}

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make Scanning dependencies of target prueba [ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char)’: /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::vec<float, 3=""> >::push_back(std::vector<cv::point3_<float> >&)’ arrayObjectPoints[n].push_back( objectPoints ); ^ In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0, from /usr/local/include/opencv2/core/types.hpp:53, from /usr/local/include/opencv2/core.hpp:58, from /usr/local/include/opencv2/core/core.hpp:48, from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8: /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3="">; _Alloc = std::allocator<cv::vec<float, 3=""> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3="">] push_back(const value_type& __x) ^ /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3="">&}’ CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o' make[2]: [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1 CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all' make[1]: [CMakeFiles/prueba.dir/all] Error 2 Makefile:83: fallo en las instrucciones para el objetivo 'all' make: * [all] Error 2 i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$

Problem with push_back

if (tecla==27 and total_img.size()>0 ) {
//calibrateCamera(arrayObjectPoints,imagePoints, cv::Size(640,480), InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria=TermCriteria( TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) ) }
(tecla==102) cap >> frame;

    if (tecla==102)
        cap >> frame;

    if (tecla==32 and capturado==true)
    {
        //Aqui calculo los objectPoints
        for (int t=0; t<6; ++t)
        {
            for (int e=0; e<5; ++e)
            {
                objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
            }
        }

        //Aqui calculamos cada objectPoints para cada imagen procesada.
        for (int n=0; n<total_img.size(); n++)
        {
            arrayObjectPoints[n].push_back( objectPoints );
        }


        capturado=false;
    }

}

cap.release();
}










}

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make Scanning dependencies of target prueba [ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char)’: /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::vec<float, 3=""> >::push_back(std::vector<cv::point3_<float> >&)’ arrayObjectPoints[n].push_back( objectPoints ); ^ In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0, from /usr/local/include/opencv2/core/types.hpp:53, from /usr/local/include/opencv2/core.hpp:58, from /usr/local/include/opencv2/core/core.hpp:48, from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8: /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3="">; _Alloc = std::allocator<cv::vec<float, 3=""> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3="">] push_back(const value_type& __x) ^ /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3="">&}’ CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o' make[2]: [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1 CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all' make[1]: [CMakeFiles/prueba.dir/all] Error 2 Makefile:83: fallo en las instrucciones para el objetivo 'all' make: * [all] Error 2 i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$

click to hide/show revision 5
None

updated 2017-12-19 16:57:57 -0600

berak gravatar image

Problem with push_back

if (tecla==102) cap >> frame;

  if (tecla==32 and capturado==true)
     {
         //Aqui calculo los objectPoints
         for (int t=0; t<6; ++t)
         {
             for (int e=0; e<5; ++e)
             {
                 objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
             }
         }

         //Aqui calculamos cada objectPoints para cada imagen procesada.
         for (int n=0; n<total_img.size(); n++)
         {
             arrayObjectPoints[n].push_back( objectPoints );
         }


         capturado=false;
     }

 }

 cap.release();
 }

  }

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make Scanning dependencies of target prueba prueba

[ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o
/home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char)’:
char**)’:
/home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::vec<float, 3=""> >::push_back(std::vector<cv::point3_<float> ‘std::vector<cv::Vec<float, 3> >::push_back(std::vector<cv::Point3_<float> >&)’
     arrayObjectPoints[n].push_back( objectPoints );
                                                  ^
In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0,
                 from /usr/local/include/opencv2/core/types.hpp:53,
                 from /usr/local/include/opencv2/core.hpp:58,
                 from /usr/local/include/opencv2/core/core.hpp:48,
                 from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8:
/usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3="">; 3>; _Alloc = std::allocator<cv::vec<float, 3=""> std::allocator<cv::Vec<float, 3> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3="">]
3>]
       push_back(const value_type& __x)
       ^
/usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota:   no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::point3_<float> ‘std::vector<cv::Point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3="">&}’
3>&}’
CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o'
make[2]:  *** [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1
CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all'
make[1]:  *** [CMakeFiles/prueba.dir/all] Error 2
Makefile:83: fallo en las instrucciones para el objetivo 'all'
make: * *** [all] Error 2
i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$

5$
click to hide/show revision 6
None

updated 2017-12-19 16:58:57 -0600

berak gravatar image

Problem with push_back

if (tecla==102) cap >> frame;

        if (tecla==32 and capturado==true)
        {
            //Aqui calculo los objectPoints
            for (int t=0; t<6; ++t)
            {
                for (int e=0; e<5; ++e)
                {
                    objectPoints.push_back(cv::Point3f(e*0.04,t*0.04,0));
                }
            }

            //Aqui calculamos cada objectPoints para cada imagen procesada.
            for (int n=0; n<total_img.size(); n++)
            {
                arrayObjectPoints[n].push_back( objectPoints );
            }


            capturado=false;
        }

    }

    cap.release();
    }

    }

This is my code. The problem is, where do push_back in line arrayObjectPoints[n].push_back( objectPoints ); The error is this.

i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$ make
Scanning dependencies of target prueba

prueba
[ 50%] Building CXX object CMakeFiles/prueba.dir/prueba.cpp.o
/home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp: En la función ‘int main(int, char**)’:
/home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:175:50: error: no se encontró una función coincidente para la llamada a ‘std::vector<cv::Vec<float, 3> >::push_back(std::vector<cv::Point3_<float> >&)’
arrayObjectPoints[n].push_back( objectPoints );
^
In file included from /usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/vector:64:0,
from /usr/local/include/opencv2/core/types.hpp:53,
from /usr/local/include/opencv2/core.hpp:58,
from /usr/local/include/opencv2/core/core.hpp:48,
from /home/i32romer/Desktop/FSIV/Practica 5/prueba.cpp:8:
/usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: candidate: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = cv::Vec<float, 3>; _Alloc = std::allocator<cv::Vec<float, 3> >; std::vector<_Tp, _Alloc>::value_type = cv::Vec<float, 3>]
push_back(const value_type& __x)
^
/usr/local/opt/gcc-5.3.0-32/include/c++/5.3.0/bits/stl_vector.h:913:7: nota: no hay una conversión conocida para el argumento 1 de ‘std::vector<cv::Point3_<float> >’ a ‘const value_type& {aka const cv::Vec<float, 3>&}’
CMakeFiles/prueba.dir/build.make:62: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/prueba.cpp.o'
make[2]: *** [CMakeFiles/prueba.dir/prueba.cpp.o] Error 1
CMakeFiles/Makefile2:67: fallo en las instrucciones para el objetivo 'CMakeFiles/prueba.dir/all'
make[1]: *** [CMakeFiles/prueba.dir/all] Error 2
Makefile:83: fallo en las instrucciones para el objetivo 'all'
make: *** [all] Error 2
i32romer@BIBSL016:~/Desktop/FSIV/Practica 5$