Ask Your Question

Revision history [back]

to understand your question i tried the code below and output is normal. if you show your code we can test it and try to explain why your transposed mat has 1x2N rows.

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main( int, char** argv )
{
    vector<Point> points;

    points.push_back(Point(0,1));
    points.push_back(Point(2,3));
    points.push_back(Point(4,5));
    points.push_back(Point(6,7));
    points.push_back(Point(8,9));

    Mat m = Mat(points);

    cout << "rows : " << m.rows << endl;
    cout << "cols : " << m.cols << endl;

    cout << m << endl;

    Mat transposed = m.t();

    cout << "transposed rows : " << transposed.rows << endl;
    cout << "transposed cols : " << transposed.cols << endl;

    cout << transposed << endl;

}

output:

rows : 5
cols : 1
[0, 1;
 2, 3;
 4, 5;
 6, 7;
 8, 9]
transposed rows : 1
transposed cols : 5
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]