Ask Your Question

Revision history [back]

I met the same issue, too. In my case, there is a bug to convert vector< vector < Point3f > > to InputArrayOfArrays. You may run the following sample code to check it in your system.

using namespace std;
using namespace cv;

/** @function main */
int main( void )
{   
    vector<Point3f> objectPoints_tmp(54);
    objectPoints_tmp.clear();

    for( int i = 0; i < 9; ++i )
        for( int j = 0; j < 6; ++j )
            objectPoints_tmp.push_back(Point3f(j*50, i*50, 0.0f));

    vector<vector<Point3f> > objectPoints(7, objectPoints_tmp); 
    InputArrayOfArrays OBJPOINT = objectPoints; std::cout << (int) OBJPOINT.total() << std::endl;  

    for( int i = 0; i < 7; ++i )
        std::cout << OBJPOINT.getMat(i).checkVector(3, CV_32F) << std::endl;  

    waitKey(0);
    return 0;
}

Normally, it should print out

7
54
54
54
54
54
54
54

In my NG case, it prints out random numbers.

I guess that the opencv lib is not fit with my system(win7 x64 + vs2012). After rebuild opencv myself, it may work now. You may google keyword "Win7x64 VS2012 OpenCV CMake TBB".