/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // Intel License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000, Intel Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of Intel Corporation may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ /*______________________________________________________________________________________*/ /* */ /* Test functions for the Eigen Objects functions group */ /*______________________________________________________________________________________*/ #include "cvtest.h" static int _cvCalcCovarMatrix_8u32fR_q( int nObjects, uchar** objects, int objStep, float* avg, int avgStep, CvSize size, float* covarMatrix ) { int i, j; if ( nObjects < 2 ) return CV_BADFACTOR_ERR; if ( size.width > objStep || 4*size.width > avgStep || size.height < 1) return CV_BADSIZE_ERR; if ( objects == NULL || avg == NULL || covarMatrix == NULL ) return CV_NULLPTR_ERR; avgStep /= 4; for(i=0; i ax ) { Amax /= n; do /* while (ind) */ { int p, q; float *V1 = V, *A1 = A; ind = 0; for(p=0; p ax ) */ for(i=0, k=0; i objStep || 4*size.width > eigStep || 4*size.width > avgStep || size.height < 1) return CV_BADSIZE_ERR; if ( objects == NULL || eigObjs == NULL || eigVals == NULL || avg == NULL || nEigObjs == NULL || eps == NULL ) return CV_NULLPTR_ERR; for( i=0; i objStep || 4*size.width > eigStep || 4*size.width > avgStep || size.height < 1) return -1.0e30f; if ( obj == NULL || eigObj == NULL || avg == NULL ) return -1.0e30f; eigStep /= 4; avgStep /= 4; for(i = 0; i < size.height; i++, obj += objStep, eigObj += eigStep, avg += avgStep) for(k = 0; k < size.width; k++) w += eigObj[k]*( (float)obj[k] - avg[k] ); return w; } /*______________________________________________________________________________________*/ int _cvEigenDecomposite_8u32fR_q( uchar* obj, int objStep, int nEigObjs, float** eigObjs, int eigStep, float* avg, int avgStep, CvSize size, float* coeffs ) { int i; if ( nEigObjs < 2 ) return CV_BADFACTOR_ERR; if ( size.width > objStep || 4*size.width > eigStep || 4*size.width > avgStep || size.height < 1) return CV_BADSIZE_ERR; if ( obj == NULL || eigObjs == NULL || coeffs == NULL || avg == NULL) return CV_NULLPTR_ERR; for(i=0; i avgStep || 4*size.width > eigStep || size.height < 1) return CV_BADSIZE_ERR; if ( rest == NULL || eigens == NULL || avg == NULL || coeffs == NULL ) return CV_NULLPTR_ERR; eigStep /= 4; avgStep /= 4; for(i = 0; i < size.height; i++, rest+=restStep, avg+=avgStep) { int ij = i*eigStep; for(j = 0; j < size.width; j++, ij++) { float w = avg[j]; for(k=0; k255.499f ? 255.499f : w; rest[j] = (uchar)cvRound( w ); } } return CV_NO_ERR; } /*______________________________________________________________________________________*/ /* << End of file >> */