我很困惑OpenCV Mat元素類型。這是從文檔:OpenCV Mat元素類型及其大小
There is a limited fixed set of primitive data types the library can operate on.
That is, array elements should have one of the following types:
8-bit unsigned integer (uchar)
8-bit signed integer (schar)
16-bit unsigned integer (ushort)
16-bit signed integer (short)
32-bit signed integer (int)
32-bit floating-point number (float)
64-bit floating-point number (double)
...
For these basic types, the following enumeration is applied:
enum { CV_8U=0, CV_8S=1, CV_16U=2, CV_16S=3, CV_32S=4, CV_32F=5, CV_64F=6 };
據瞭解,C++標準沒有定義以字節爲單位基本類型的大小,所以他們是如何使用這樣的假設?我應該指望什麼類型的CV_32S,它是int32_t還是int?
類型在OpenCV中是很容易理解。 CV_numbitsType。所以CV_16S是一個16位長的有符號整數。 – 2013-03-06 11:03:23
那麼爲什麼他們在文檔(int,float等)中爲它們使用這樣的名稱,而(例如)int可以是64位而不是32位? – lizarisk 2013-03-06 11:14:35
我真的不知道底層結構,但是當您使用類型CV_32S創建一個墊子時: 'Mat myMat(10,10,CV_32S);' 您可以用 'myMat.at(1,1) = 1;' –
sfotiadis
2013-03-06 11:20:49