Rate This Document
Findability
Accuracy
Completeness
Readability

t

Usage

Performs matrix transposition to swap the rows and columns of a matrix. It is used for various transformations in image processing, such as rotation and feature extraction.

Interface

1
Mat Mat::t() const;

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;

int main() {
    // Create a 3x3 matrix.
    Mat mat = (Mat_<int>(3, 3) << 1, 2, 3,
                                  4, 5, 6,
                                  7, 8, 9);

    std::cout << "Original matrix:\n" << mat << std::endl;

    // Perform transposition.
    Mat transposed = mat.t();

    std::cout << "Matrix after transposition:\n" << transposed << std::endl;

    return 0;
}