📄 cxcore reference manual.mht
字号:
<P>
<DL>
<DT>mat
<DD>Double pointer to the array. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvReleaseMatND">cvReleaseMatND</A>=20
decrements the array data reference counter and releases the array =
header:</P><PRE> if( *mat )
cvDecRefData( *mat );
cvFree( (void**)mat );
</PRE>
<P></P>
<HR>
<H3><A name=3Ddecl_cvInitMatNDHeader>InitMatNDHeader</A></H3>
<P class=3DBlurb>Initializes multi-dimensional array =
header</P><PRE>CvMatND* cvInitMatNDHeader( CvMatND* mat, int dims, const =
int* sizes, int type, void* data=3DNULL );
</PRE>
<P>
<DL>
<DT>mat
<DD>Pointer to the array header to be initialized.=20
<DT>dims
<DD>Number of array dimensions.=20
<DT>sizes
<DD>Array of dimension sizes.=20
<DT>type
<DD>Type of array elements. The same as for CvMat=20
<DT>data
<DD>Optional data pointer assigned to the matrix header. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvInitMatNDHeader">cvInitMatNDHeader</A> =
initializes <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND">CvMatND</A>=20
structure allocated by the user. </P>
<HR>
<H3><A name=3Ddecl_cvCloneMatND>CloneMatND</A></H3>
<P class=3DBlurb>Creates full copy of multi-dimensional =
array</P><PRE>CvMatND* cvCloneMatND( const CvMatND* mat );
</PRE>
<P>
<DL>
<DT>mat
<DD>Input array. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvCloneMatND">cvCloneMatND</A>=20
creates a copy of input array and returns pointer to it. </P>
<HR>
<H3><A name=3Ddecl_cvDecRefData>DecRefData</A></H3>
<P class=3DBlurb>Decrements array data reference counter</P><PRE>void =
cvDecRefData( CvArr* arr );
</PRE>
<P>
<DL>
<DT>arr
<DD>array header. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvDecRefData">cvDecRefData</A>=20
decrements <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND">CvMatND</A>=20
data reference counter if the reference counter pointer is not NULL and=20
deallocates the data if the counter reaches zero. In the current =
implementation=20
the reference counter is not NULL only if the data was allocated using =
<A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvCreateData">cvCreateData</A>=20
function, in other cases such as:<BR>external data was assigned to the =
header=20
using <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvSetData">cvSetData</A><BR>the=20
matrix header presents a part of a larger matrix or image<BR>the matrix =
header=20
was converted from image or n-dimensional matrix header<BR><BR>the =
reference=20
counter is set to NULL and thus it is not decremented. Whenever the data =
is=20
deallocated or not, the data pointer and reference counter pointers are =
cleared=20
by the function. </P>
<HR>
<H3><A name=3Ddecl_cvIncRefData>IncRefData</A></H3>
<P class=3DBlurb>Increments array data reference counter</P><PRE>int =
cvIncRefData( CvArr* arr );
</PRE>
<P>
<DL>
<DT>arr
<DD>array header. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvIncRefData">cvIncRefData</A>=20
increments <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND">CvMatND</A>=20
data reference counter and returns the new counter value if the =
reference=20
counter pointer is not NULL, otherwise it returns zero. </P>
<HR>
<H3><A name=3Ddecl_cvCreateData>CreateData</A></H3>
<P class=3DBlurb>Allocates array data</P><PRE>void cvCreateData( CvArr* =
arr );
</PRE>
<P>
<DL>
<DT>arr
<DD>Array header. </DD></DL>
<P></P>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvCreateData">cvCreateData</A>=20
allocates image, matrix or multi-dimensional array data. Note that in =
case of=20
matrix types OpenCV allocation functions are used and in case of =
IplImage they=20
are used too unless <CODE>CV_TURN_ON_IPL_COMPATIBILITY</CODE> was =
called. In the=20
latter case IPL functions are used to allocate the data </P>
<HR>
<H3><A name=3Ddecl_cvReleaseData>ReleaseData</A></H3>
<P class=3DBlurb>Releases array data</P><PRE>void cvReleaseData( CvArr* =
arr );
</PRE>
<P>
<DL>
<DT>arr
<DD>Array header </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvReleaseData">cvReleaseData</A>=20
releases the array data. In case of <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND">CvMatND</A>=20
it simply calls cvDecRefData(), that is the function can not deallocate =
external=20
data. See also the note to <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvCreateData">cvCreateData</A>.=20
</P>
<HR>
<H3><A name=3Ddecl_cvSetData>SetData</A></H3>
<P class=3DBlurb>Assigns user data to the array header</P><PRE>void =
cvSetData( CvArr* arr, void* data, int step );
</PRE>
<P>
<DL>
<DT>arr
<DD>Array header.=20
<DT>data
<DD>User data.=20
<DT>step
<DD>Full row length in bytes. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvSetData">cvSetData</A>=20
assigns user data to the array header. Header should be initialized =
before using=20
cvCreate*Header, cvInit*Header or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvMat">cvMat</A>=20
(in case of matrix) function. </P>
<HR>
<H3><A name=3Ddecl_cvGetRawData>GetRawData</A></H3>
<P class=3DBlurb>Retrieves low-level information about the =
array</P><PRE>void cvGetRawData( const CvArr* arr, uchar** data,
int* step=3DNULL, CvSize* roi_size=3DNULL );
</PRE>
<P>
<DL>
<DT>arr
<DD>Array header.=20
<DT>data
<DD>Output pointer to the whole image origin or ROI origin if ROI is =
set.=20
<DT>step
<DD>Output full row length in bytes.=20
<DT>roi_size
<DD>Output ROI size. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGetRawData">cvGetRawData</A>=20
fills output variables with low-level information about the array data. =
All=20
output parameters are optional, so some of the pointers may be set to=20
<CODE>NULL</CODE>. If the array is <CODE>IplImage</CODE> with ROI set,=20
parameters of ROI are returned. </P>
<P>The following example shows how to get access to array elements using =
this=20
function.</P>
<P><FONT color=3Dblue size=3D4>Using GetRawData to calculate absolute =
value of=20
elements of a single-channel floating-point array.</FONT> <PRE> =
float* data;
int step;
CvSize size;
int x, y;
cvGetRawData( array, (uchar**)&data, &step, &size );
step /=3D sizeof(data[0]);
for( y =3D 0; y < size.height; y++, data +=3D step )
for( x =3D 0; x < size.width; x++ )
data[x] =3D (float)fabs(data[x]);
</PRE>
<P></P>
<HR>
<H3><A name=3Ddecl_cvGetMat>GetMat</A></H3>
<P class=3DBlurb>Returns matrix header for arbitrary =
array</P><PRE>CvMat* cvGetMat( const CvArr* arr, CvMat* header, int* =
coi=3DNULL, int allowND=3D0 );
</PRE>
<P>
<DL>
<DT>arr
<DD>Input array.=20
<DT>header
<DD>Pointer to <A=20
=
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
structure used as a temporary buffer.=20
<DT>coi
<DD>Optional output parameter for storing COI.=20
<DT>allowND
<DD>If non-zero, the function accepts multi-dimensional dense arrays=20
(CvMatND*) and returns 2D (if CvMatND has two dimensions) or 1D matrix =
(when=20
CvMatND has 1 dimension or more than 2 dimensions). The array must be=20
continuous. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGetMat">cvGetMat</A>=20
returns matrix header for the input array that can be matrix - <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>,=20
image - <CODE>IplImage</CODE> or multi-dimensional dense array - <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND*">CvMatND*</A>=20
(latter case is allowed only if <CODE>allowND !=3D 0</CODE>) . In the =
case of=20
matrix the function simply returns the input pointer. In the case of=20
<CODE>IplImage*</CODE> or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMatND*">CvMatND*</A>=20
it initializes <CODE>header</CODE> structure with parameters of the =
current=20
image ROI and returns pointer to this temporary structure. Because COI =
is not=20
supported by <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>,=20
it is returned separately.=20
<P>The function provides an easy way to handle both types of array -=20
<CODE>IplImage</CODE> and <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
-, using the same code. Reverse transform from <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
to <CODE>IplImage</CODE> can be done using <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGetImage">cvGetImage</A>=20
function. </P>
<P>Input array must have underlying data allocated or attached, =
otherwise the=20
function fails. </P>If the input array is <CODE>IplImage</CODE> with =
planar data=20
layout and COI set, the function returns pointer to the selected plane =
and COI =3D=20
0. It enables per-plane processing of multi-channel images with planar =
data=20
layout using OpenCV functions.
<P></P>
<HR>
<H3><A name=3Ddecl_cvGetImage>GetImage</A></H3>
<P class=3DBlurb>Returns image header for arbitrary =
array</P><PRE>IplImage* cvGetImage( const CvArr* arr, IplImage* =
image_header );
</PRE>
<P>
<DL>
<DT>arr
<DD>Input array.=20
<DT>image_header
<DD>Pointer to <CODE>IplImage</CODE> structure used as a temporary =
buffer.=20
</DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGetImage">cvGetImage</A>=20
returns image header for the input array that can be matrix - <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat*">CvMat*</A>,=20
or image - <CODE>IplImage*</CODE>. In the case of image the function =
simply=20
returns the input pointer. In the case of <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat*">CvMat*</A>=20
it initializes <CODE>image_header</CODE> structure with parameters of =
the input=20
matrix. Note that if we transform <CODE>IplImage</CODE> to <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_CvMat">CvMat</A>=20
and then transform CvMat back to IplImage, we can get different headers =
if the=20
ROI is set, and thus some IPL functions that calculate image stride from =
its=20
width and align may fail on the resultant image.</P>
<HR>
<H3><A name=3Ddecl_cvCreateSparseMat>CreateSparseMat</A></H3>
<P class=3DBlurb>Creates sparse array</P><PRE>CvSparseMat* =
cvCreateSparseMat( int dims, const int* sizes, int type );
</PRE>
<P>
<DL>
<DT>dims
<DD>Number of array dimensions. As opposite to the dense matrix, the =
number of=20
dimensions is practically unlimited (up to 2<SUP>16</SUP>).=20
<DT>sizes
<DD>Array of dimension sizes.=20
<DT>type
<DD>Type of array elements. The same as for CvMat </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvCreateSparseMat">cvCreateSparseMat</A> =
allocates multi-dimensional sparse array. Initially the array contain no =
elements, that is <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGet*D">cvGet*D</A>=20
or <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvGetReal*D">cvGetReal*D</A>=20
return zero for every index</P>
<HR>
<H3><A name=3Ddecl_cvReleaseSparseMat>ReleaseSparseMat</A></H3>
<P class=3DBlurb>Deallocates sparse array</P><PRE>void =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -