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 CV_INLINE int icvGetColor(uchar* valueRGB);
73 CvStatus icvFindRunsInOneImage(
74 int numLines, /* number of scanlines */
75 uchar* prewarp, /* prewarp image */
76 int* line_lens, /* line lengths in pixels */
77 int* runs, /* result runs */
80 /*================================ Morphing section ====================================*/
82 CvStatus icvMorphEpilines8uC3( uchar* first_pix, /* raster epiline from the first image */
83 uchar* second_pix, /* raster epiline from the second image */
84 uchar* dst_pix, /* raster epiline from the destination image */
85 /* (it's an output parameter) */
86 float alpha, /* relative position of camera */
87 int* first, /* first sequence of runs */
88 int first_runs, /* it's length */
89 int* second, /* second sequence of runs */
91 int* first_corr, /* correspond information for the 1st seq */
93 int dst_len); /* correspond information for the 2nd seq */
95 /*========================== Dynamic correspond section ================================*/
97 CvStatus icvDynamicCorrespond( int* first, /* first sequence of runs */
98 /* s0|w0|s1|w1|...|s(n-1)|w(n-1)|sn */
99 int first_runs, /* number of runs */
100 int* second, /* second sequence of runs */
102 int* first_corr, /* s0'|e0'|s1'|e1'|... */
105 /*============================= PostWarp Functions =====================================*/
107 CvStatus icvFetchLine8uC3R(
108 uchar* src, int src_step,
109 uchar* dst, int* dst_num,
114 CvStatus icvDrawLine8uC3R(
115 uchar* src, int src_num,
116 uchar* dst, int dst_step,
122 /*============================== Fundamental Matrix Functions ==========================*/
123 CvStatus icvPoint7( int* points1,
129 CvStatus icvCubic( double a2, double a1,
130 double a0, double* squares );
132 double icvDet( double* M );
133 double icvMinor( double* M, int x, int y );
136 icvGaussMxN( double *A, double *B, int M, int N, double **solutions );
139 icvGetCoef( double *f1, double *f2, double *a2, double *a1, double *a0 );
141 /*================================= Scanlines Functions ================================*/
143 CvStatus icvGetCoefficient( CvMatrix3* matrix,
149 CvStatus icvGetCoefficientDefault( CvMatrix3* matrix,
155 CvStatus icvGetCoefficientStereo( CvMatrix3* matrix,
164 CvStatus icvGetCoefficientOrto( CvMatrix3* matrix,
171 CvStatus icvGetCrossEpilineFrame( CvSize imgSize,
179 CvStatus icvBuildScanlineLeftStereo(
189 CvStatus icvBuildScanlineRightStereo(
199 CvStatus icvGetStartEnd1(
203 float* r_start_end );
205 CvStatus icvGetStartEnd2(
209 float* r_start_end );
211 CvStatus icvGetStartEnd3(
215 float* r_start_end );
217 CvStatus icvGetStartEnd4(
221 float* r_start_end );
223 CvStatus icvBuildScanlineLeft(
232 CvStatus icvBuildScanlineRight(
242 /*=================================== LMedS Functions ==================================*/
249 CvStatus icvLMedS( int* points1,
252 CvMatrix3* fundamentalMatrix );
256 CvStatus icvFindFundamentalMatrix(
263 void icvChoose7( int* ml, int* mr,
267 double icvMedian( int* ml, int* mr,
268 int num, double* F );
270 int icvBoltingPoints( int* ml, int* mr,
272 double Mj, int* *new_ml,
273 int* *new_mr, int* new_num);
275 CvStatus icvPoints8( int* ml, int* mr,
276 int num, double* F );
278 CvStatus icvRank2Constraint( double* F );
280 CvStatus icvSort( double* array, int length );
282 double icvAnalyticPoints8( double* A,
283 int num, double* F );
285 int icvSingularValueDecomposition( int M,
296 /*======================================================================================*/