Update to 2.0.0 tree from current Fremantle build
[opencv] / doc / FAQ.tex
1 \chapter{FAQ}
2 \section{First Section}
3 \subsection{Initialization}
4
5 \subsubsection*{CreateImage}
6 \addcontentsline{toc}{subsubsection}{CreateImage} 
7
8 Creates header and \textsf{allocates} data
9
10 \begin{shaded}
11 \begin{verbatim}
12 IplImage* cvCreateImage( CvSize size,
13                          int depth,
14                          int channels );
15 \end{verbatim}
16 \end{shaded}
17
18 \begin{description}
19 \item[\texttt{size}] Image width and height
20 \item[\texttt{depth}] Bit depth of image elements.  Can be one of:
21 \begin{description}
22 \item[IPL\_DEPTH\_8U] unsigned 8-bit integers
23 \item[IPL\_DEPTH\_8S] signed 8-bit integers
24 \item[IPL\_DEPTH\_16U] unsigned 16-bit integers
25 \item[IPL\_DEPTH\_16S] signed 16-bit integers
26 \item[IPL\_DEPTH\_32S] signed 32-bit integers
27 \item[IPL\_DEPTH\_32F] single precision floating-point numbers
28 \item[IPL\_DEPTH\_64F] double precision floating-point numbers
29 \end{description}
30 \item[\texttt{channels}] Number of channels per element(pixel). Can be 1, 2, 3 or 4. The channels are interleaved, for example the usual data layout of a color image is:
31 \begin{lstlisting}
32 b0 g0 r0 b1 g1 r1 ...
33 \end{lstlisting}
34 Although in general IPL image format can store non-interleaved images as well and some of OpenCV can process it, this function can create interleaved images only.
35
36 \end{description}
37
38 The function cvCreateImage creates the header and allocates data as in the method of~\cite{author_conf_year}.  This call is a shortened form of 
39 \begin{lstlisting}
40 header = cvCreateImageHeader(size,depth,channels);
41 cvCreateData(header);
42 \end{lstlisting}