📄 opencvref_cvaux.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html><head>
<link rel="STYLESHEET" href="opencvref.css" charset="ISO-8859-1" type="text/css">
<title>OpenCV: Experimental and Obsolete Functionality</title>
</head><body>
<h1>Experimental and Obsolete Functionality Reference</h1>
<p>
The functionality resides in cvaux library. To use it in your application, place
#include "cvaux.h" in your source files and:<ul>
<li>In case of Win32 link the app against cvaux.lib that is import library for cvaux.dll
<li>In case of Linux use -lcvaux compiler option
</ul></p>
<hr><p><ul>
<li><a href="#aux_stereo">Stereo Correspondence Functions</a>
<ul>
<li><a href="#decl_cvFindStereoCorrespondence">FindStereoCorrespondence</a>
</ul>
<li><a href="#aux_viewmorphing">View Morphing Functions</a>
<ul>
<li><a href="#decl_cvMakeScanlines">MakeScanlines</a>
<li><a href="#decl_cvPreWarpImage">PreWarpImage</a>
<li><a href="#decl_cvFindRuns">FindRuns</a>
<li><a href="#decl_cvDynamicCorrespondMulti">DynamicCorrespondMulti</a>
<li><a href="#decl_cvMakeAlphaScanlines">MakeAlphaScanlines</a>
<li><a href="#decl_cvMorphEpilinesMulti">MorphEpilinesMulti</a>
<li><a href="#decl_cvPostWarpImage">PostWarpImage</a>
<li><a href="#decl_cvDeleteMoire">DeleteMoire</a>
</ul>
<li><a href="#aux_3dTracking">3D Tracking Functions</a>
<ul>
<li><a href="#decl_cv3dTrackerCalibrateCameras">3dTrackerCalibrateCameras</a>
<li><a href="#decl_cv3dTrackerLocateObjects">3dTrackerLocateObjects</a>
</ul>
<li><a href="#aux_pca">Eigen Objects (PCA) Functions</a>
<ul>
<li><a href="#decl_cvCalcCovarMatrixEx">CalcCovarMatrixEx</a>
<li><a href="#decl_cvCalcEigenObjects">CalcEigenObjects</a>
<li><a href="#decl_cvCalcDecompCoeff">CalcDecompCoeff</a>
<li><a href="#decl_cvEigenDecomposite">EigenDecomposite</a>
<li><a href="#decl_cvEigenProjection">EigenProjection</a>
</ul>
<li><a href="#aux_hmm">Embedded Hidden Markov Models Functions</a>
<ul>
<li><a href="#decl_CvHMM">HMM</a>
<li><a href="#decl_CvImgObsInfo">ImgObsInfo</a>
<li><a href="#decl_cvCreate2DHMM">Create2DHMM</a>
<li><a href="#decl_cvRelease2DHMM">Release2DHMM</a>
<li><a href="#decl_cvCreateObsInfo">CreateObsInfo</a>
<li><a href="#decl_cvReleaseObsInfo">ReleaseObsInfo</a>
<li><a href="#decl_cvImgToObs_DCT">ImgToObs_DCT</a>
<li><a href="#decl_cvUniformImgSegm">UniformImgSegm</a>
<li><a href="#decl_cvInitMixSegm">InitMixSegm</a>
<li><a href="#decl_cvEstimateHMMStateParams">EstimateHMMStateParams</a>
<li><a href="#decl_cvEstimateTransProb">EstimateTransProb</a>
<li><a href="#decl_cvEstimateObsProb">EstimateObsProb</a>
<li><a href="#decl_cvEViterbi">EViterbi</a>
<li><a href="#decl_cvMixSegmL2">MixSegmL2</a>
</ul>
</ul></p>
<hr><h2><a name="aux_stereo">Stereo Correspondence Functions</a></h2>
<hr><h3><a name="decl_cvFindStereoCorrespondence">FindStereoCorrespondence</a></h3>
<p class="Blurb">Calculates disparity for stereo-pair</p>
<pre>
cvFindStereoCorrespondence(
const CvArr* leftImage, const CvArr* rightImage,
int mode, CvArr* depthImage,
int maxDisparity,
double param1, double param2, double param3,
double param4, double param5 );
</pre><p><dl>
<dt>leftImage<dd>Left image of stereo pair, rectified grayscale 8-bit image
<dt>rightImage<dd>Right image of stereo pair, rectified grayscale 8-bit image
<dt>mode<dd>Algorithm used to find a disparity (now only CV_DISPARITY_BIRCHFIELD is supported)
<dt>depthImage<dd>Destination depth image, grayscale 8-bit image that codes the scaled disparity,
so that the zero disparity (corresponding to the points that are very far from the cameras)
maps to 0, maximum disparity maps to 255.
<dt>maxDisparity<dd>Maximum possible disparity. The closer the objects to the cameras, the larger value should be specified here.
Too big values slow down the process significantly.
<dt>param1, param2, param3, param4, param5<dd> - parameters of algorithm.
For example, param1 is the constant occlusion penalty,
param2 is the constant match reward, param3 defines a highly reliable region
(set of contiguous pixels whose reliability is at least param3),
param4 defines a moderately reliable region, param5 defines a slightly reliable region.
If some parameter is omitted default value is used.
In Birchfield's algorithm param1 = 25, param2 = 5, param3 = 12, param4 = 15, param5 = 25
(These values have been taken from
"Depth Discontinuities by Pixel-to-Pixel Stereo" Stanford University Technical Report STAN-CS-TR-96-1573, July 1996.)
</dl></p><p>
The function <code>cvFindStereoCorrespondence</code> calculates disparity map
for two rectified grayscale images.
<p>Example. Calculating disparity for pair of 8-bit color images</h4>
<pre>
/*---------------------------------------------------------------------------------*/
IplImage* srcLeft = cvLoadImage("left.jpg",1);
IplImage* srcRight = cvLoadImage("right.jpg",1);
IplImage* leftImage = cvCreateImage(cvGetSize(srcLeft), IPL_DEPTH_8U, 1);
IplImage* rightImage = cvCreateImage(cvGetSize(srcRight), IPL_DEPTH_8U, 1);
IplImage* depthImage = cvCreateImage(cvGetSize(srcRight), IPL_DEPTH_8U, 1);
cvCvtColor(srcLeft, leftImage, CV_BGR2GRAY);
cvCvtColor(srcRight, rightImage, CV_BGR2GRAY);
cvFindStereoCorrespondence( leftImage, rightImage, CV_DISPARITY_BIRCHFIELD, depthImage, 50, 15, 3, 6, 8, 15 );
/*---------------------------------------------------------------------------------*/
</pre>
<p>And here is the example stereo pair that can be used to test the example</p>
<p>
<img src="pics/left.jpg">
<img src="pics/right.jpg">
</p>
<hr><h2><a name="aux_viewmorphing">View Morphing Functions</a></h2>
<hr><h3><a name="decl_cvMakeScanlines">MakeScanlines</a></h3>
<p class="Blurb">Calculates scanlines coordinates for two cameras by fundamental matrix</p>
<pre>
void cvMakeScanlines( const CvMatrix3* matrix, CvSize img_size, int* scanlines1,
int* scanlines2, int* lengths1, int* lengths2, int* line_count );
</pre><p><dl>
<dt>matrix<dd>Fundamental matrix.
<dt>imgSize<dd>Size of the image.
<dt>scanlines1<dd>Pointer to the array of calculated scanlines of the first image.
<dt>scanlines2<dd>Pointer to the array of calculated scanlines of the second image.
<dt>lengths1<dd>Pointer to the array of calculated lengths (in pixels) of the first image
scanlines.
<dt>lengths2<dd>Pointer to the array of calculated lengths (in pixels) of the second image
scanlines.
<dt>line_count<dd>Pointer to the variable that stores the number of scanlines.
</dl></p><p>
The function <code>cvMakeScanlines</code> finds coordinates of scanlines for two images.
<p>
This function returns the number of scanlines. The function does nothing except
calculating the number of scanlines if the pointers <code>scanlines1</code> or <code>scanlines2</code> are
equal to zero.
</p>
</p><hr><h3><a name="decl_cvPreWarpImage">PreWarpImage</a></h3>
<p class="Blurb">Rectifies image</p>
<pre>
void cvPreWarpImage( int line_count, IplImage* img, uchar* dst,
int* dst_nums, int* scanlines );
</pre><p><dl>
<dt>line_count<dd>Number of scanlines for the image.
<dt>img<dd>Image to prewarp.
<dt>dst<dd>Data to store for the prewarp image.
<dt>dst_nums<dd>Pointer to the array of lengths of scanlines.
<dt>scanlines<dd>Pointer to the array of coordinates of scanlines.
</dl></p><p>
The function <code>cvPreWarpImage</code> rectifies the image so that the scanlines in the
rectified image are horizontal. The output buffer of size
<code>max(width,height)*line_count*3</code> must be allocated before calling the function.
</p><hr><h3><a name="decl_cvFindRuns">FindRuns</a></h3>
<p class="Blurb">Retrieves scanlines from rectified image and breaks them down into runs</p>
<pre>
void cvFindRuns( int line_count, uchar* prewarp1, uchar* prewarp2,
int* line_lengths1, int* line_lengths2,
int* runs1, int* runs2,
int* num_runs1, int* num_runs2 );
</pre><p><dl>
<dt>line_count<dd>Number of the scanlines.
<dt>prewarp1<dd>Prewarp data of the first image.
<dt>prewarp2<dd>Prewarp data of the second image.
<dt>line_lengths1<dd>Array of lengths of scanlines in the first image.
<dt>line_lengths2<dd>Array of lengths of scanlines in the second image.
<dt>runs1<dd>Array of runs in each scanline in the first image.
<dt>runs2<dd>Array of runs in each scanline in the second image.
<dt>num_runs1<dd>Array of numbers of runs in each scanline in the first image.
<dt>num_runs2<dd>Array of numbers of runs in each scanline in the second image.
</dl></p><p>
The function <code>cvFindRuns</code> retrieves scanlines from the rectified image and breaks
each scanline down into several runs, that is, series of pixels of almost the
same brightness.
</p><hr><h3><a name="decl_cvDynamicCorrespondMulti">DynamicCorrespondMulti</a></h3>
<p class="Blurb">Finds correspondence between two sets of runs of two warped images</p>
<pre>
void cvDynamicCorrespondMulti( int line_count, int* first, int* first_runs,
int* second, int* second_runs,
int* first_corr, int* second_corr );
</pre><p><dl>
<dt>line_count<dd>Number of scanlines.
<dt>first<dd>Array of runs of the first image.
<dt>first_runs<dd>Array of numbers of runs in each scanline of the first image.
<dt>second<dd>Array of runs of the second image.
<dt>second_runs<dd>Array of numbers of runs in each scanline of the second image.
<dt>first_corr<dd>Pointer to the array of correspondence information found for the first
runs.
<dt>second_corr<dd>Pointer to the array of correspondence information found for the
second runs.
</dl></p><p>
The function <code>cvDynamicCorrespondMulti</code> finds correspondence between two sets of
runs of two images. Memory must be allocated before calling this function.
Memory size for one array of correspondence information is
<div><code>max( width,height )* numscanlines*3*sizeof ( int )</code> .
</p><hr><h3><a name="decl_cvMakeAlphaScanlines">MakeAlphaScanlines</a></h3>
<p class="Blurb">Calculates coordinates of scanlines of image from virtual camera</p>
<pre>
void cvMakeAlphaScanlines( int* scanlines1, int* scanlines2,
int* scanlinesA, int* lengths,
int line_count, float alpha );
</pre><p><dl>
<dt>scanlines1<dd>Pointer to the array of the first scanlines.
<dt>scanlines2<dd>Pointer to the array of the second scanlines.
<dt>scanlinesA<dd>Pointer to the array of the scanlines found in the virtual image.
<dt>lengths<dd>Pointer to the array of lengths of the scanlines found in the virtual
image.
<dt>line_count<dd>Number of scanlines.
<dt>alpha<dd>Position of virtual camera <code>(0.0 - 1.0)</code> .
</dl></p><p>
The function <code>cvMakeAlphaScanlines</code> finds coordinates of scanlines for the virtual
camera with the given camera position.
<p>
Memory must be allocated before calling this function. Memory size for the array
of correspondence runs is <code>numscanlines*2*4*sizeof(int)</code> . Memory size for the
array of the scanline lengths is <code>numscanlines*2*4*sizeof(int)</code> .
</p>
</p><hr><h3><a name="decl_cvMorphEpilinesMulti">MorphEpilinesMulti</a></h3>
<p class="Blurb">Morphs two pre-warped images using information about stereo correspondence</p>
<pre>
void cvMorphEpilinesMulti( int line_count, uchar* first_pix, int* first_num,
uchar* second_pix, int* second_num,
uchar* dst_pix, int* dst_num,
float alpha, int* first, int* first_runs,
int* second, int* second_runs,
int* first_corr, int* second_corr );
</pre><p><dl>
<dt>line_count<dd>Number of scanlines in the prewarp image.
<dt>first_pix<dd>Pointer to the first prewarp image.
<dt>first_num<dd>Pointer to the array of numbers of points in each scanline in the first
image.
<dt>second_pix<dd>Pointer to the second prewarp image.
<dt>second_num<dd>Pointer to the array of numbers of points in each scanline in the
second image.
<dt>dst_pix<dd>Pointer to the resulting morphed warped image.
<dt>dst_num<dd>Pointer to the array of numbers of points in each line.
<dt>alpha<dd>Virtual camera position <code>(0.0 - 1.0)</code> .
<dt>first<dd>First sequence of runs.
<dt>first_runs<dd>Pointer to the number of runs in each scanline in the first image.
<dt>second<dd>Second sequence of runs.
<dt>second_runs<dd>Pointer to the number of runs in each scanline in the second image.
<dt>first_corr<dd>Pointer to the array of correspondence information found for the first
runs.
<dt>second_corr<dd>Pointer to the array of correspondence information found for the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -