[Opencv] cv :: Mat public member functions (Public Member Func)

Public Member Func

channels()

Mat matrix elements have a number of channels.

depth()

It used to measure the accuracy of each channel in each pixel, but regardless of the number of channels of the image itself.
The larger the depth value, the higher accuracy.
Mat.depth () obtained is a number from 0 to 6, different numbers of bits representing the corresponding relationship is as follows:

enum {CV_8U = 0, CV_8S = 1, CV_16U = 2, CV_16S = 3, CV_32S = 4, CV_32F = 5, CV_64F = 6}

Wherein the meaning of U is unsigned, S denotes signed, i.e. signed and unsigned.

elemSize ()

elem is an abbreviation element (element), data indicating the size of each element of the matrix, if the data type Mat is CV_8UC1, then elemSize = 1; if it is CV_8UC3 or CV_8SC3, then elemSize = 3; if CV_16UC3 or CV_16SC3, then elemSize = 6; i.e. of elemsize is 8 bits (one byte), as a unit, and the number of channels multiplied by an integer multiple of 8 bits;

elemSize1()

elemSize plus a "1" constitutes elemSize1 this attribute, the element 1 may be considered to be within the meaning of a passage, so that the split from the easily explains the naming of this property: Mat represents a matrix each element of a single channel data size in bytes as a unit, so there are:

eleSize1==elemSize/channels;

rowRange()

Create a new matrix header for the specified row span, desirable range specified line elements.

colRange()

Create a new matrix header for the specified column span, desirable elements of the specified column range.

zeros()

ones()

empty()

at()

isContinuous()

Analyzing the image memory are continuous.

clone()

m1 = m0.clone (); // completely copied to the m0 m1 while m0 copy all the data in, and copies of the matrix is ​​continuous.

copyTo()

m0.copyTo (m1); // the content copied to the m0 m1, if it is necessary to reassign m1 (equivalent to m1 = m0.clone ()).
m0.copyTo (m1, mask); // will m0, the mask data is copied to the indicated in m1.

convertTo()

m0.convertTo (m1, type, scale, offset); // convert m0 type of elements in class (CV_32F etc.), the zoom scale for scale, offset offset written in m1.

setTo ()

m0.setTo (s, mask); m0 value of all elements in the set S //; If a mask, only the non-zero elements in the mask set.

reshape()

m0.reshape (chan, rows); // change the actual shape of the two-dimensional matrix, without copying the data; if chan or rows of 0 indicates no change.

push_back()

m0.push_back (s); // for mx1 matrix expansion, and s is inserted at the end of a single value.
m0.push_back (m1); // for the mxn matrix of k rows extend, and copied to the rows m1; size m1 is kxn.

pop_back()

m0.pop_back (n); // m0 is removed from the tail of n rows, where n is 1 by default.

locateROI()

m0.locateROI (size, offset); // rewrites the size m0 size, if m0 rewritten becomes larger matrix, the starting point for cv :: Pointoffset point.

adjustROI()

m0.adjustROI (t, b, l, r); // add t, b, l, r pixels are vertically and horizontally to m0.

total()

m0.total (); // calculate all the number of array elements, the channel is not considered.

isContinuous()

m0.isContinuous (); // if not all of the clearance packed rows m0 memory space, it returns true.

elementSize()

m0.elementSize (); // m0 matrix Returns size in bytes of each element (e.g., channel 3 returns a float type matrix 12).

elementSize1()

m0.elementSize1 (); // Returns m0 matrix element of each sub-byte size (e.g., channel 3 returns a float 4 matrix).

type()

Mat type matrix, with the matrix type and channel number information element, named type format CV_ (digits) + (data type) + (number of channels).
m0.type (); // return valid type identifier (e.g. CV_32FC3) m0 elements.

depth()

m0.depth (); // return valid type identifier (e.g. CV_32F) m0 single channel element.

channels()

m0.channels (); // returns the number of channel elements m0.

size()

m0.size (); // to cv :: Size Returns the size of the object to m0.

empty()

m0.empty (); // if no elements in the array (e.g. m0.total = 0 or m0.data = NULL) return true.


references

[. 1] cv :: Mat Class Reference
[2] OpenCV3 cv :: Mat class member functions Explanation
[. 3] opencv2: summary article cv :: Mat class
[. 4] OpenCV- matrix data type conversion :: ConvertTo CV
[. 5] on Opencv Mat appreciated attribute matrix data, size, depth, elemSize, step , etc.

发布了599 篇原创文章 · 获赞 856 · 访问量 184万+

Guess you like

Origin blog.csdn.net/JNingWei/article/details/104807262