1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
10 // Intel License Agreement
11 // For Open Source Computer Vision Library
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
19 // * Redistribution's of source code must retain the above copyright notice,
20 // this list of conditions and the following disclaimer.
22 // * Redistribution's in binary form must reproduce the above copyright notice,
23 // this list of conditions and the following disclaimer in the documentation
24 // and/or other materials provided with the distribution.
26 // * The name of Intel Corporation may not be used to endorse or promote products
27 // derived from this software without specific prior written permission.
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
45 /*----------------------- Internal ViewMorphing Functions ------------------------------*/
47 /*======================================================================================*/
49 typedef struct CvMatrix4
56 /* Scanline section. Find coordinates by fundamental matrix */
58 /* Epsilon and real zero */
60 //#define REAL_ZERO(x) ( (x) < EPSILON && (x) > -EPSILON)
61 #define REAL_ZERO(x) ( (x) < 1e-8 && (x) > -1e-8)
63 #define SIGN(x) ( (x)<0 ? -1:((x)>0?1:0 ) )
65 CvStatus icvMakeScanlinesLengths( int* scanlines,
69 /*=============================== PreWarp section ======================================*/
71 CvStatus icvFindRunsInOneImage(
72 int numLines, /* number of scanlines */
73 uchar* prewarp, /* prewarp image */
74 int* line_lens, /* line lengths in pixels */
75 int* runs, /* result runs */
78 /*================================ Morphing section ====================================*/
80 CvStatus icvMorphEpilines8uC3( uchar* first_pix, /* raster epiline from the first image */
81 uchar* second_pix, /* raster epiline from the second image */
82 uchar* dst_pix, /* raster epiline from the destination image */
83 /* (it's an output parameter) */
84 float alpha, /* relative position of camera */
85 int* first, /* first sequence of runs */
86 int first_runs, /* it's length */
87 int* second, /* second sequence of runs */
89 int* first_corr, /* correspond information for the 1st seq */
91 int dst_len); /* correspond information for the 2nd seq */
93 /*========================== Dynamic correspond section ================================*/
95 CvStatus icvDynamicCorrespond( int* first, /* first sequence of runs */
96 /* s0|w0|s1|w1|...|s(n-1)|w(n-1)|sn */
97 int first_runs, /* number of runs */
98 int* second, /* second sequence of runs */
100 int* first_corr, /* s0'|e0'|s1'|e1'|... */
103 /*============================= PostWarp Functions =====================================*/
105 CvStatus icvFetchLine8uC3R(
106 uchar* src, int src_step,
107 uchar* dst, int* dst_num,
112 CvStatus icvDrawLine8uC3R(
113 uchar* src, int src_num,
114 uchar* dst, int dst_step,
120 /*============================== Fundamental Matrix Functions ==========================*/
121 CvStatus icvPoint7( int* points1,
127 CvStatus icvCubic( double a2, double a1,
128 double a0, double* squares );
130 double icvDet( double* M );
131 double icvMinor( double* M, int x, int y );
134 icvGaussMxN( double *A, double *B, int M, int N, double **solutions );
137 icvGetCoef( double *f1, double *f2, double *a2, double *a1, double *a0 );
139 /*================================= Scanlines Functions ================================*/
141 CvStatus icvGetCoefficient( CvMatrix3* matrix,
147 CvStatus icvGetCoefficientDefault( CvMatrix3* matrix,
153 CvStatus icvGetCoefficientStereo( CvMatrix3* matrix,
162 CvStatus icvGetCoefficientOrto( CvMatrix3* matrix,
169 CvStatus icvGetCrossEpilineFrame( CvSize imgSize,
177 CvStatus icvBuildScanlineLeftStereo(
187 CvStatus icvBuildScanlineRightStereo(
197 CvStatus icvGetStartEnd1(
201 float* r_start_end );
203 CvStatus icvGetStartEnd2(
207 float* r_start_end );
209 CvStatus icvGetStartEnd3(
213 float* r_start_end );
215 CvStatus icvGetStartEnd4(
219 float* r_start_end );
221 CvStatus icvBuildScanlineLeft(
230 CvStatus icvBuildScanlineRight(
240 /*=================================== LMedS Functions ==================================*/
247 CvStatus icvLMedS( int* points1,
250 CvMatrix3* fundamentalMatrix );
254 CvStatus icvFindFundamentalMatrix(
261 void icvChoose7( int* ml, int* mr,
265 double icvMedian( int* ml, int* mr,
266 int num, double* F );
268 int icvBoltingPoints( int* ml, int* mr,
270 double Mj, int* *new_ml,
271 int* *new_mr, int* new_num);
273 CvStatus icvPoints8( int* ml, int* mr,
274 int num, double* F );
276 CvStatus icvRank2Constraint( double* F );
278 CvStatus icvSort( double* array, int length );
280 double icvAnalyticPoints8( double* A,
281 int num, double* F );
283 int icvSingularValueDecomposition( int M,
294 /*======================================================================================*/