📄 opencv image processing and computer vision reference manual.mht
字号:
<DD>Coordinates of the 4 corresponding quadrangle vertices in the =
destination=20
image.=20
<DT>map_matrix
<DD>Pointer to the destination 3=A1=C13 matrix. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvWarpPerspectiveQMatrix">cvWarpPerspectiveQM=
atrix</A>=20
calculates matrix of perspective transform such =
that:</P><PRE>(t<SUB>i</SUB>x'<SUB>i</SUB>,t<SUB>i</SUB>y'<SUB>i</SUB>,t<=
SUB>i</SUB>)<SUP>T</SUP>=3Dmatrix•(x<SUB>i</SUB>,y<SUB>i</SUB>,1)<S=
UP>T</SUP>
</PRE>
<P>where <CODE>dst(i)=3D(x'<SUB>i</SUB>,y'<SUB>i</SUB>),=20
src(i)=3D(x<SUB>i</SUB>,y<SUB>i</SUB>), i=3D0..3</CODE>.</P>
<HR>
<H2><A name=3Dcv_imgproc_morphology>Morphological Operations</A></H2>
<HR>
<H3><A=20
name=3Ddecl_cvCreateStructuringElementEx>CreateStructuringElementEx</A></=
H3>
<P class=3DBlurb>Creates structuring element</P><PRE>IplConvKernel* =
cvCreateStructuringElementEx( int cols, int rows, int anchor_x, int =
anchor_y,
int shape, int* =
values=3DNULL );
</PRE>
<P>
<DL>
<DT>cols
<DD>Number of columns in the structuring element.=20
<DT>rows
<DD>Number of rows in the structuring element.=20
<DT>anchor_x
<DD>Relative horizontal offset of the anchor point.=20
<DT>anchor_y
<DD>Relative vertical offset of the anchor point.=20
<DT>shape
<DD>Shape of the structuring element; may have the following values:=20
<UL>
<LI><CODE>CV_SHAPE_RECT</CODE>, a rectangular element;=20
<LI><CODE>CV_SHAPE_CROSS</CODE>, a cross-shaped element;=20
<LI><CODE>CV_SHAPE_ELLIPSE</CODE>, an elliptic element;=20
<LI><CODE>CV_SHAPE_CUSTOM</CODE>, a user-defined element. In this =
case the=20
parameter <CODE>values</CODE> specifies the mask, that is, which =
neighbors=20
of the pixel must be considered. </LI></UL>
<DT>values
<DD>Pointer to the structuring element data, a plane array, =
representing=20
row-by-row scanning of the element matrix. Non-zero values indicate =
points=20
that belong to the element. If the pointer is <CODE>NULL</CODE>, then =
all=20
values are considered non-zero, that is, the element is of a =
rectangular=20
shape. This parameter is considered only if the shape is=20
<CODE>CV_SHAPE_CUSTOM</CODE> . </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cv CreateStructuringElementEx">cv=20
CreateStructuringElementEx</A> allocates and fills the structure=20
<CODE>IplConvKernel</CODE>, which can be used as a structuring element =
in the=20
morphological operations.</P>
<HR>
<H3><A =
name=3Ddecl_cvReleaseStructuringElement>ReleaseStructuringElement</A></H3=
>
<P class=3DBlurb>Deletes structuring element</P><PRE>void =
cvReleaseStructuringElement( IplConvKernel** element );
</PRE>
<P>
<DL>
<DT>element
<DD>Pointer to the deleted structuring element. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvReleaseStructuringElement">cvReleaseStructu=
ringElement</A>=20
releases the structure <CODE>IplConvKernel</CODE> that is no longer =
needed. If=20
<CODE>*element</CODE> is <CODE>NULL</CODE>, the function has no =
effect.</P>
<HR>
<H3><A name=3Ddecl_cvErode>Erode</A></H3>
<P class=3DBlurb>Erodes image by using arbitrary structuring =
element</P><PRE>void cvErode( const CvArr* src, CvArr* dst, =
IplConvKernel* element=3DNULL, int iterations=3D1 );
</PRE>
<P>
<DL>
<DT>src
<DD>Source image.=20
<DT>dst
<DD>Destination image.=20
<DT>element
<DD>Structuring element used for erosion. If it is <CODE>NULL</CODE>, =
a 3=A1=C13=20
rectangular structuring element is used.=20
<DT>iterations
<DD>Number of times erosion is applied. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvErode">cvErode</A>=20
erodes the source image using the specified structuring element that =
determines=20
the shape of a pixel neighborhood over which the minimum is =
taken:</P><PRE>dst=3Derode(src,element): dst(x,y)=3Dmin<SUB>((x',y') in =
element)</SUB>)</SUB>src(x+x',y+y')
</PRE>
<P>The function supports the in-place mode. Erosion can be applied =
several=20
(<CODE>iterations</CODE>) times. In case of color image each channel is=20
processed independently.</P>
<HR>
<H3><A name=3Ddecl_cvDilate>Dilate</A></H3>
<P class=3DBlurb>Dilates image by using arbitrary structuring =
element</P><PRE>void cvDilate( const CvArr* src, CvArr* dst, =
IplConvKernel* element=3DNULL, int iterations=3D1 );
</PRE>
<P>
<DL>
<DT>src
<DD>Source image.=20
<DT>dst
<DD>Destination image.=20
<DT>element
<DD>Structuring element used for erosion. If it is <CODE>NULL</CODE>, =
a 3=A1=C13=20
rectangular structuring element is used.=20
<DT>iterations
<DD>Number of times erosion is applied. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvDilate">cvDilate</A>=20
dilates the source image using the specified structuring element that =
determines=20
the shape of a pixel neighborhood over which the maximum is =
taken:</P><PRE>dst=3Ddilate(src,element): dst(x,y)=3Dmax<SUB>((x',y') =
in element)</SUB>)</SUB>src(x+x',y+y')
</PRE>
<P>The function supports the in-place mode. Dilation can be applied =
several=20
(<CODE>iterations</CODE>) times. In case of color image each channel is=20
processed independently.</P>
<HR>
<H3><A name=3Ddecl_cvMorphologyEx>MorphologyEx</A></H3>
<P class=3DBlurb>Performs advanced morphological =
transformations</P><PRE>void cvMorphologyEx( const CvArr* src, CvArr* =
dst, CvArr* temp,
IplConvKernel* element, int operation, int =
iterations=3D1 );
</PRE>
<P>
<DL>
<DT>src
<DD>Source image.=20
<DT>dst
<DD>Destination image.=20
<DT>temp
<DD>Temporary image, required in some cases.=20
<DT>element
<DD>Structuring element.=20
<DT>operation
<DD>Type of morphological operation, one =
of:<BR><CODE>CV_MOP_OPEN</CODE> -=20
opening<BR><CODE>CV_MOP_CLOSE</CODE> - =
closing<BR><CODE>CV_MOP_GRADIENT</CODE>=20
- morphological gradient<BR><CODE>CV_MOP_TOPHAT</CODE> - "top=20
hat"<BR><CODE>CV_MOP_BLACKHAT</CODE> - "black hat"<BR>
<DT>iterations
<DD>Number of times erosion and dilation are applied. </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvMorphologyEx">cvMorphologyEx</A>=20
can perform advanced morphological transformations using erosion and =
dilation as=20
basic operations.</P><PRE>Opening:
dst=3Dopen(src,element)=3Ddilate(erode(src,element),element)
Closing:
dst=3Dclose(src,element)=3Derode(dilate(src,element),element)
Morphological gradient:
dst=3Dmorph_grad(src,element)=3Ddilate(src,element)-erode(src,element)
"Top hat":
dst=3Dtophat(src,element)=3Dsrc-open(src,element)
"Black hat":
dst=3Dblackhat(src,element)=3Dclose(src,element)-src
</PRE>
<P>The temporary image <CODE>temp</CODE> is required for morphological =
gradient=20
and, in case of in-place operation, for "top hat" and "black hat". </P>
<HR>
<H2><A name=3Dcv_imgproc_filters>Filters and Color Conversion</A></H2>
<HR>
<H3><A name=3Ddecl_cvSmooth>Smooth</A></H3>
<P class=3DBlurb>Smooths the image in one of several ways</P><PRE>void =
cvSmooth( const CvArr* src, CvArr* dst,
int smoothtype=3DCV_GAUSSIAN,
int param1=3D3, int param2=3D0, double param3=3D0 );
</PRE>
<P>
<DL>
<DT>src
<DD>The source image.=20
<DT>dst
<DD>The destination image.=20
<DT>smoothtype
<DD>Type of the smoothing:
<UL>
<LI>CV_BLUR_NO_SCALE (simple blur with no scaling) - summation over =
a pixel=20
<CODE>param1</CODE>=A1=C1<CODE>param2</CODE> neighborhood. If the =
neighborhood=20
size may vary, one may precompute integral image with <A=20
=
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvIntegral">cvIntegral</A>=20
function.=20
<LI>CV_BLUR (simple blur) - summation over a pixel=20
<CODE>param1</CODE>=A1=C1<CODE>param2</CODE> neighborhood with =
subsequent scaling=20
by 1/(<CODE>param1</CODE>•<CODE>param2</CODE>).=20
<LI>CV_GAUSSIAN (gaussian blur) - convolving image with=20
<CODE>param1</CODE>=A1=C1<CODE>param2</CODE> Gaussian kernel.=20
<LI>CV_MEDIAN (median blur) - finding median of=20
<CODE>param1</CODE>=A1=C1<CODE>param1</CODE> neighborhood (i.e. the =
neighborhood=20
is square).=20
<LI>CV_BILATERAL (bilateral filter) - applying bilateral 3x3 =
filtering with=20
color sigma=3D<CODE>param1</CODE> and space =
sigma=3D<CODE>param2</CODE>.=20
Information about bilateral filtering can be found at <A=20
=
href=3D"http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral=
_Filtering.html">http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/=
Bilateral_Filtering.html</A>=20
</LI></UL>
<DT>param1
<DD>The first parameter of smoothing operation.=20
<DT>param2
<DD>The second parameter of smoothing operation. In case of simple=20
scaled/non-scaled and Gaussian blur if <CODE>param2</CODE> is zero, it =
is set=20
to <CODE>param1</CODE>.=20
<DT>param3
<DD>In case of Gaussian parameter this parameter may specify Gaussian =
sigma=20
(standard deviation). If it is zero, it is calculated from the kernel=20
size:<BR><PRE> sigma =3D (n/2 - 1)*0.3 + 0.8, where =
n=3Dparam1 for horizontal kernel,
n=3Dparam2 for vertical =
kernel.
</PRE>Using standard sigma for small kernels (3=A1=C13 to =
7=A1=C17) gives=20
better speed. If <CODE>param3</CODE> is not zero, while =
<CODE>param1</CODE>=20
and <CODE>param2</CODE> are zeros, the kernel size is calculated from =
the=20
sigma (to provide accurate enough operation). </DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvSmooth">cvSmooth</A>=20
smooths image using one of several methods. Every of the methods has =
some=20
features and restrictions listed below</P>
<P>Blur with no scaling works with single-channel images only and =
supports=20
accumulation of 8-bit to 16-bit format (similar to <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvSobel">cvSobel</A>=20
and <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvLaplace">cvLaplace</A>)=20
and 32-bit floating point to 32-bit floating-point format.</P>
<P>Simple blur and Gaussian blur support 1- or 3-channel, 8-bit and =
32-bit=20
floating point images. These two methods can process images =
in-place.</P>
<P>Median and bilateral filters work with 1- or 3-channel 8-bit images =
and can=20
not process images in-place.</P>
<HR>
<H3><A name=3Ddecl_cvFilter2D>Filter2D</A></H3>
<P class=3DBlurb>Convolves the image with the kernel</P><PRE>void =
cvFilter2D( const CvArr* src, CvArr* dst,
const CvMat* kernel,
CvPoint anchor=3DcvPoint(-1,-1));
#define cvConvolve2D cvFilter2D
</PRE>
<P>
<DL>
<DT>src
<DD>The source image.=20
<DT>dst
<DD>The destination image.=20
<DT>kernel
<DD>Convolution kernel, single-channel floating point matrix. If you =
want to=20
apply different kernels to different channels, split the image using =
<A=20
=
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cxcore.htm#decl_cvSplit">cvSplit</A>=20
into separate color planes and process them individually.=20
<DT>anchor
<DD>The anchor of the kernel that indicates the relative position of a =
filtered point within the kernel. The anchor shoud lie within the =
kernel. The=20
special default value (-1,-1) means that it is at the kernel center.=20
<UL></UL></DD></DL>
<P>The function <A=20
href=3D"http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_doc=
s/ref/opencvref_cv.htm#decl_cvFilter2D">cvFilter2D</A>=20
applies arbitrary linear filter to the image. In-place operation is =
supported.=20
When the aperture is partially outside the image, the function =
interpolates=20
outlier pixel values from the nearest pixels that is inside the image. =
</P>
<HR>
<H3><A name=3Ddecl_cvIntegral>Integral</A></H3>
<P class=3DBlurb>Calculates integral images</P><PRE>void cvIntegral( =
const CvArr* image, CvArr* sum, CvArr* sqsum=3DNULL, CvArr* =
tilted_sum=3DNULL );
</PRE>
<P>
<DL>
<DT>image
<DD>The source image, <CODE>W</CODE>=A1=C1<CODE>H</CODE>, =
single-channel, 8-bit, or=20
floating-point (32f or 64f).=20
<DT>sum
<DD>The integral image, <CODE>W+1</CODE>=A1=C1<CODE>H+1</CODE>, =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -