Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between cv::Mat::t () and cv::transpose()

What is the difference in opencv between these two transposes?

Using cv::Mat::t():

cv::Mat a;
a = a.t();

Using cv::transpose():

cv::Mat a;
cv::transpose(a,a);

I'm interested in particular about efficiency.

like image 553
justHelloWorld Avatar asked Apr 09 '17 18:04

justHelloWorld


People also ask

What is a CV :: mat?

In OpenCV the main matrix class is called Mat and is contained in the OpenCV-namespace cv. This matrix is not templated but nevertheless can contain different data types. These are indicated by a certain type-number. Additionally, OpenCV provides a templated class called Mat_, which is derived from Mat.

What is mat type in OpenCV?

The Mat class of OpenCV library is used to store the values of an image. It represents an n-dimensional array and is used to store image data of grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms, etc.

What does MAT mean in C++?

Mat is basically a class with two data parts : the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for ...

What is CV_64F?

That is, image of type CV_64FC1 is simple grayscale image and has only 1 channel: image[i, j] = 0.5. while image of type CV_64FC3 is colored image with 3 channels: image[i, j] = (0.5, 0.3, 0.7) (in C++ you can check individual pixels as image.at<double>(i, j) ) CV_64F is the same as CV_64FC1 .


1 Answers

There's no difference. Here's the code for cv::Mat::t() from opencv/modules/core/src/matop.cpp:

MatExpr MatExpr::t() const
{
    MatExpr e;
    op->transpose(*this, e);
    return e;
}

So cv::Mat::t() just calls cv::transpose().

like image 194
beaker Avatar answered Oct 02 '22 13:10

beaker