testbug.cpp

Simone Gasparini, 2012-07-15 11:47 pm

Download (751 Bytes)

 
1
2
#include <opencv2/core/core.hpp>
3
#include <iostream>
4
#include <time.h>
5
6
7
#define SIZE 10
8
using namespace std;
9
using namespace cv;
10
11
/*
12
 * 
13
 */
14
int main( int argc, char** argv )
15
{
16
        srand( (unsigned)time( NULL ) );
17
        vector<Point2f> test;
18
        test.reserve( SIZE );
19
        //fill it with random data
20
        for( size_t i = 0; i < SIZE; ++i)
21
        {
22
                test.push_back( Point2f( rand() %10, rand()%10 ));
23
        }
24
25
        cout << "Original Data [x0 y0; x1 y1...]" << endl;
26
        cout << test << endl;
27
28
        cout << "Current (wrong) solution  \n[x0 y0 x1 y2... x(N/2) y(N/2);\nx(N/2 + 1) y(N/2 + 1) .... x(N) y(N)]" << endl;
29
        cout << Mat(test).reshape(1,2) << endl;
30
31
        cout << "Proposed solution \n[x0 x1... x(N);\ny0 y1 ....  y(N)]" << endl;
32
        cout << Mat(test).reshape( 1, SIZE ).t();
33
34
        return 0;
35
}
36