살군의 보조기억 장치

Another memory device…

OpenCV Data Type 정리

leave a comment »

Opencv 의 기본 데이터 타입이 자꾸 햇갈려서 정리한다. 기본적으로는 아래와 같다.

  • CV_8U : 8-bit unsigned integer: uchar ( 0..255 )
  • CV_8S : 8-bit signed integer: schar ( -128..127 )
  • CV_16U : 16-bit unsigned integer: ushort ( 0..65535 )
  • CV_16S : 16-bit signed integer: short ( -32768..32767 )
  • CV_32S : 32-bit signed integer: int ( -2147483648..2147483647 )
  • CV_32F : 32-bit floating-point number: float ( -FLT_MAX..FLT_MAX, INF, NAN )
  • CV_64F : 64-bit floating-point number: double ( -DBL_MAX..DBL_MAX, INF, NAN )

그치만 실제로 사용하는 것은 멀티채널의 배열을 정의하는 경우가 많으므로, 아래와 같이 사용하는 경우가 많다.

Multi-channel (n-channel) types can be specified using the following options:

  • CV_8UC1 … CV_64FC4 constants (for a number of channels from 1 to 4)
  • CV_8UC(n) … CV_64FC(n) or CV_MAKETYPE(CV_8U, n) … CV_MAKETYPE(CV_64F, n) macros when the number of channels is more than 4 or unknown at the compilation time.
Note: CV_32FC1 == CV_32F, CV_32FC2 == CV_32FC(2) == CV_MAKETYPE(CV_32F, 2), and CV_MAKETYPE(depth, n) == ((x&7)<<3) + (n-1). This means that the constant type is formed from the depth, taking the lowest 3 bits, and the number of channels minus 1, taking the next log2(CV_CN_MAX) bits.
참고
Advertisements

Written by gomiski

2014/03/11 at 8:37 am

Posted in C++, General, Lecture, opencv

Tagged with , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: