]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
no message
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 18 Aug 2004 14:49:23 +0000 (14:49 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 18 Aug 2004 14:49:23 +0000 (14:49 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@38 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

35 files changed:
opencv/tests/cv/src/Makefile.am
opencv/tests/cv/src/Makefile.in [deleted file]
opencv/tests/cv/src/aaccum.cpp
opencv/tests/cv/src/aadaptthresh.cpp
opencv/tests/cv/src/aapproxpoly.cpp
opencv/tests/cv/src/acamshift.cpp
opencv/tests/cv/src/acanny.cpp
opencv/tests/cv/src/achesscorners.cpp
opencv/tests/cv/src/acontourmoments.cpp
opencv/tests/cv/src/acontours.cpp
opencv/tests/cv/src/acreatecontourtree.cpp
opencv/tests/cv/src/adistancetransform.cpp
opencv/tests/cv/src/adrawing_regress.cpp
opencv/tests/cv/src/aeigenobjects.cpp
opencv/tests/cv/src/aeigenobjects.inc
opencv/tests/cv/src/afloodfill.cpp
opencv/tests/cv/src/aimage.cpp
opencv/tests/cv/src/akmeans.cpp
opencv/tests/cv/src/amoments.cpp
opencv/tests/cv/src/amotseg.cpp
opencv/tests/cv/src/aoptflowhs.cpp
opencv/tests/cv/src/aposit.cpp
opencv/tests/cv/src/apyrsegmentation.cpp
opencv/tests/cv/src/asnakes.cpp
opencv/tests/cv/src/atemplmatch.cpp
opencv/tests/cv/src/athresh.cpp
opencv/tests/cv/src/cvtest.h
opencv/tests/cv/src/tsysa.cpp
opencv/tests/cxts/Makefile.am [new file with mode: 0644]
opencv/tests/cxts/_cxts.h [new file with mode: 0644]
opencv/tests/cxts/cxts.cpp [new file with mode: 0644]
opencv/tests/cxts/cxts.h [new file with mode: 0644]
opencv/tests/cxts/cxts_arrtest.cpp [new file with mode: 0644]
opencv/tests/cxts/cxts_math.cpp [new file with mode: 0644]
opencv/tests/cxts/precomp.cpp [new file with mode: 0644]

index a37677a7968a7c72f4c4e885bb9eb184a75efa8c..a75e5285e78891f62f29a925a7d02653821922bd 100644 (file)
@@ -1,41 +1,35 @@
 noinst_PROGRAMS = cvtest
 
-cvtest_SOURCES= \
-aabsdiff.cpp            adistancetransform.cpp   amatchcontourtrees.cpp  apyramids.cpp        \
-aaccum.cpp              adrawing.cpp             amathutils.cpp          apyrsegmentation.cpp \
-aadaptthresh.cpp        adrawing_regress.cpp     amatrix2.cpp            asamplers.cpp        \
-aapproxpoly.cpp         aeigenobjects.cpp        amatrix.cpp             asequence.cpp        \
-aarithm.cpp             aemd.cpp                 ameanshift.cpp          asnakes.cpp          \
-aarrayiterator.cpp      aerrhandle.cpp           amemorytest.cpp         asobel.cpp           \
-abackproject.cpp        afitellipse.cpp          aminarearect.cpp        astoragearray.cpp    \
-acalccontrasthist.cpp   afitlines.cpp            amineval.cpp            asubdivisions.cpp    \
-acalculate.cpp          afloodfill8.cpp          amoments.cpp            asvd.cpp             \
-acameracalibration.cpp  afloodfill.cpp           amorphology.cpp         atemplmatch.cpp      \
-acamshift.cpp           amotiontemplates.cpp     athresh.cpp                                  \
-acanny.cpp              ahaar.cpp                amotseg.cpp             atree.cpp            \
-achesscorners.cpp       ahistogram.cpp           anodeiterator.cpp       atreeiterator.cpp    \
-acondens.cpp            ahistograms.cpp          anorm.cpp               ats.cpp              \
-acontourcollection.cpp  ahmmobs.cpp              anormmask.cpp           aundistort.cpp       \
-acontourmoments.cpp     ahoughtransform.cpp      aoperations.cpp         canny.cpp            \
-acontours.cpp           aimage.cpp               aoptflowhs.cpp          cvtest.cpp           \
-acontoursmatch.cpp      aimagestatistics.cpp     aoptflowlk.cpp          tsysa.cpp            \
-aconvert.cpp            akalman.cpp              aoptflowpyrlk.cpp       ucontours.cpp        \
-aconvhull.cpp           akmeans.cpp              apixelaccess.cpp        ugraphics.cpp        \
-acorner.cpp             alogic.cpp               aposit.cpp              uiplutils.cpp        \
-acreatecontourtree.cpp  amaskaccum.cpp           aprecorner.cpp          ureadfile.cpp
+cvtest_SOURCES = aaccum.cpp aadaptthresh.cpp aapproxpoly.cpp \
+acalccontrasthist.cpp acameracalibration.cpp acamshift.cpp \
+acanny.cpp achesscorners.cpp acondens.cpp acontourcollection.cpp \
+acontourmoments.cpp acontours.cpp acontoursmatch.cpp aconvhull.cpp \
+acorner.cpp acreatecontourtree.cpp adistancetransform.cpp \
+aeigenobjects.cpp aemd.cpp aerrhandle.cpp afitellipse.cpp \
+afitlines.cpp afloodfill.cpp afloodfill8.cpp agesturerecognition.cpp \
+ahaar.cpp ahistograms.cpp ahmmobs.cpp ahoughtransform.cpp aimage.cpp \
+akalman.cpp akmeans.cpp amaskaccum.cpp amatchcontourtrees.cpp \
+ameanshift.cpp amemorytest.cpp aminarearect.cpp amineval.cpp \
+amoments.cpp amorphology.cpp amotiontemplates.cpp amotseg.cpp \
+aoptflowhs.cpp aoptflowlk.cpp aoptflowpyrlk.cpp apixelaccess.cpp \
+aposit.cpp aprecorner.cpp apyramids.cpp apyrsegmentation.cpp \
+asamplers.cpp asnakes.cpp asobel.cpp asubdivisions.cpp \
+atemplmatch.cpp athresh.cpp ats.cpp aundistort.cpp canny.cpp \
+cvtest.cpp tsysa.cpp ucontours.cpp ugraphics.cpp uiplutils.cpp ureadfile.cpp
 
 # here you should add all header files, which contains the functionality
 # of your shared lib (published for the users)
 include_HEADERS =
 
 # here you should add all header files, which shouldn't be installed
-noinst_HEADERS = cvtest.h
+noinst_HEADERS = aeigenobjects.inc apixelaccess.inc cvtest.h
 
-EXTRA_DIST = aeigenobjects.inc  amatrix.inc  apixelaccess.inc makefile.vc makefile.icl makefile.bcc makefile.gcc cvtest.dsp
+EXTRA_DIST = cvtest.dsp cvtest.vcproj
+
+INCLUDES = -I. -I../../trs -I../../../otherlibs/highgui -I../../../cxcore/include -I../../../cv/include -I../../../cv/src -I../../../cvaux/include
+
+#cvtest_LDADD = -L../../../cv/src -lcv -L../../../otherlibs/highgui -lhighgui -L../../trs -ltrs -L../../../cvaux/src -lcvaux -L../../../cxcore/src -Lcxcore
+cvtest_LDADD = -L../../../cv/src -lcv -L../../../cxcore/src -lcxcore -L../../trs -ltrs -L../../../cvaux/src -lcvaux -L../../../otherlibs/highgui -lhighgui
 
-INCLUDES = -I. -I../include -I../../../otherlibs/highgui -I../../trs/include -I../../../cv/include -I../../../cv/src -I../../../cvaux/include
 
-cvtest_LDADD = -L../../../cv/src -lopencv -L../../../otherlibs/highgui -lhighgui -L../../trs/src -ltrs -L../../../cvaux/src -lcvaux
 
-CFLAGS = @CFLAGS@ @DEBUG@
-CXXFLAGS = @CXXFLAGS@ @DEBUG@
diff --git a/opencv/tests/cv/src/Makefile.in b/opencv/tests/cv/src/Makefile.in
deleted file mode 100644 (file)
index 9368ebf..0000000
+++ /dev/null
@@ -1,1402 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ../../..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-host_alias = @host_alias@
-host_triplet = @host@
-ADDONS = @ADDONS@
-AS = @AS@
-CC = @CC@
-CXX = @CXX@
-DEBUG = @DEBUG@
-DLLTOOL = @DLLTOOL@
-ECHO = @ECHO@
-EXEEXT = @EXEEXT@
-IPL_INCLUDE = @IPL_INCLUDE@
-IPL_LIB = @IPL_LIB@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAKEINFO = @MAKEINFO@
-MMAJOR = @MMAJOR@
-MMINOR = @MMINOR@
-MSUBMINOR = @MSUBMINOR@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-STRIP = @STRIP@
-TCLTKLIB = @TCLTKLIB@
-TESTDIR = @TESTDIR@
-VERSION = @VERSION@
-with_apps = @with_apps@
-with_tests = @with_tests@
-
-noinst_PROGRAMS = cvla
-
-cvla_SOURCES = aabsdiff.cpp aaccum.cpp aadaptthresh.cpp aapproxpoly.cpp aarithm.cpp aarrayiterator.cpp abackproject.cpp acalccontrasthist.cpp acalculate.cpp acameracalibration.cpp acamshift.cpp acanny.cpp achesscorners.cpp acondens.cpp acontourcollection.cpp acontourmoments.cpp acontours.cpp acontoursmatch.cpp aconvert.cpp aconvhull.cpp acorner.cpp acreatecontourtree.cpp adistancetransform.cpp adrawing.cpp adrawing_regress.cpp aeigenobjects.cpp aemd.cpp aerrhandle.cpp afitellipse.cpp afitlines.cpp afloodfill.cpp afloodfill8.cpp agesturerecognition.cpp ahistogram.cpp ahistograms.cpp ahmmobs.cpp ahoughtransform.cpp aimage.cpp aimagestatistics.cpp akalman.cpp akmeans.cpp alaplace.cpp alogic.cpp amaskaccum.cpp amatchcontourtrees.cpp amathutils.cpp amatrix.cpp amatrix2.cpp ameanshift.cpp amemorytest.cpp aminarearect.cpp amineval.cpp amoments.cpp amorphology.cpp amotiontemplates.cpp amotseg.cpp anodeiterator.cpp anorm.cpp anormmask.cpp aoperations.cpp aoptflowhs.cpp aoptflowlk.cpp aoptflowpyrlk.cpp apixelaccess.cpp aposit.cpp aprecorner.cpp apyramids.cpp apyrsegmentation.cpp asamplers.cpp ascharr.cpp asequence.cpp asnakes.cpp asobel.cpp astoragearray.cpp asubdivisions.cpp asvd.cpp atemplmatch.cpp athresh.cpp atree.cpp atreeiterator.cpp aundistort.cpp canny.cpp tsysa.cpp ucontours.cpp ugraphics.cpp uiplutils.cpp ureadfile.cpp
-
-# here you should add all header files, which contains the functionality
-# of your shared lib (published for the users)
-include_HEADERS = 
-
-# here you should add all header files, which shouldn't be installed
-noinst_HEADERS = 
-
-EXTRA_DIST = aeigenobjects.inc amatrix.inc apixelaccess.inc aabsdiff.cpp aaccum.cpp aadaptthresh.cpp aapproxpoly.cpp aarithm.cpp aarrayiterator.cpp abackproject.cpp acalccontrasthist.cpp acalculate.cpp acameracalibration.cpp acamshift.cpp acanny.cpp achesscorners.cpp acondens.cpp acontourcollection.cpp acontourmoments.cpp acontours.cpp acontoursmatch.cpp aconvert.cpp aconvhull.cpp acorner.cpp acreatecontourtree.cpp adistancetransform.cpp adrawing.cpp adrawing_regress.cpp aeigenobjects.cpp aemd.cpp aerrhandle.cpp afitellipse.cpp afitlines.cpp afloodfill.cpp afloodfill8.cpp agesturerecognition.cpp ahistogram.cpp ahistograms.cpp ahmmobs.cpp ahoughtransform.cpp aimage.cpp aimagestatistics.cpp akalman.cpp akmeans.cpp alaplace.cpp alogic.cpp amaskaccum.cpp amatchcontourtrees.cpp amathutils.cpp amatrix.cpp amatrix2.cpp ameanshift.cpp amemorytest.cpp aminarearect.cpp amineval.cpp amoments.cpp amorphology.cpp amotiontemplates.cpp amotseg.cpp anodeiterator.cpp anorm.cpp anormmask.cpp aoperations.cpp aoptflowhs.cpp aoptflowlk.cpp aoptflowpyrlk.cpp apixelaccess.cpp aposit.cpp aprecorner.cpp apyramids.cpp apyrsegmentation.cpp asamplers.cpp ascharr.cpp asequence.cpp asnakes.cpp asobel.cpp astoragearray.cpp asubdivisions.cpp asvd.cpp atemplmatch.cpp athresh.cpp atree.cpp atreeiterator.cpp aundistort.cpp canny.cpp tsysa.cpp ucontours.cpp ugraphics.cpp uiplutils.cpp ureadfile.cpp
-
-INCLUDES =  -I. -I../include -I../../../otherlibs/highgui -I../../ats/include -I../../trs/include -I../../../cv/include -I../../../cv/src -I../../../cvaux/include -I../../../otherlibs/_Mkl/include
-
-cvla_LDADD = -L../../../cv/src -lopencv -L../../../otherlibs/highgui -lhighgui -L../../trs/src -ltrs -L../../ats/src -lats -L../../../cvaux/src -lcvaux -liplpx
-
-CFLAGS =  @DEBUG@
-CXXFLAGS =  @DEBUG@
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../../../config.h
-CONFIG_CLEAN_FILES = 
-noinst_PROGRAMS =  cvla$(EXEEXT)
-PROGRAMS =  $(noinst_PROGRAMS)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I../../..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-X_CFLAGS = @X_CFLAGS@
-X_LIBS = @X_LIBS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-cvla_OBJECTS =  aabsdiff.$(OBJEXT) aaccum.$(OBJEXT) \
-aadaptthresh.$(OBJEXT) aapproxpoly.$(OBJEXT) aarithm.$(OBJEXT) \
-aarrayiterator.$(OBJEXT) abackproject.$(OBJEXT) \
-acalccontrasthist.$(OBJEXT) acalculate.$(OBJEXT) \
-acameracalibration.$(OBJEXT) acamshift.$(OBJEXT) acanny.$(OBJEXT) \
-achesscorners.$(OBJEXT) acondens.$(OBJEXT) acontourcollection.$(OBJEXT) \
-acontourmoments.$(OBJEXT) acontours.$(OBJEXT) acontoursmatch.$(OBJEXT) \
-aconvert.$(OBJEXT) aconvhull.$(OBJEXT) acorner.$(OBJEXT) \
-acreatecontourtree.$(OBJEXT) adistancetransform.$(OBJEXT) \
-adrawing.$(OBJEXT) adrawing_regress.$(OBJEXT) aeigenobjects.$(OBJEXT) \
-aemd.$(OBJEXT) aerrhandle.$(OBJEXT) afitellipse.$(OBJEXT) \
-afitlines.$(OBJEXT) afloodfill.$(OBJEXT) afloodfill8.$(OBJEXT) \
-agesturerecognition.$(OBJEXT) ahistogram.$(OBJEXT) \
-ahistograms.$(OBJEXT) ahmmobs.$(OBJEXT) ahoughtransform.$(OBJEXT) \
-aimage.$(OBJEXT) aimagestatistics.$(OBJEXT) akalman.$(OBJEXT) \
-akmeans.$(OBJEXT) alaplace.$(OBJEXT) alogic.$(OBJEXT) \
-amaskaccum.$(OBJEXT) amatchcontourtrees.$(OBJEXT) amathutils.$(OBJEXT) \
-amatrix.$(OBJEXT) amatrix2.$(OBJEXT) ameanshift.$(OBJEXT) \
-amemorytest.$(OBJEXT) aminarearect.$(OBJEXT) amineval.$(OBJEXT) \
-amoments.$(OBJEXT) amorphology.$(OBJEXT) amotiontemplates.$(OBJEXT) \
-amotseg.$(OBJEXT) anodeiterator.$(OBJEXT) anorm.$(OBJEXT) \
-anormmask.$(OBJEXT) aoperations.$(OBJEXT) aoptflowhs.$(OBJEXT) \
-aoptflowlk.$(OBJEXT) aoptflowpyrlk.$(OBJEXT) apixelaccess.$(OBJEXT) \
-aposit.$(OBJEXT) aprecorner.$(OBJEXT) apyramids.$(OBJEXT) \
-apyrsegmentation.$(OBJEXT) asamplers.$(OBJEXT) ascharr.$(OBJEXT) \
-asequence.$(OBJEXT) asnakes.$(OBJEXT) asobel.$(OBJEXT) \
-astoragearray.$(OBJEXT) asubdivisions.$(OBJEXT) asvd.$(OBJEXT) \
-atemplmatch.$(OBJEXT) athresh.$(OBJEXT) atree.$(OBJEXT) \
-atreeiterator.$(OBJEXT) aundistort.$(OBJEXT) canny.$(OBJEXT) \
-tsysa.$(OBJEXT) ucontours.$(OBJEXT) ugraphics.$(OBJEXT) \
-uiplutils.$(OBJEXT) ureadfile.$(OBJEXT)
-cvla_DEPENDENCIES = 
-cvla_LDFLAGS = 
-CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
-HEADERS =  $(include_HEADERS) $(noinst_HEADERS)
-
-DIST_COMMON =  Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = gtar
-GZIP_ENV = --best
-SOURCES = $(cvla_SOURCES)
-OBJECTS = $(cvla_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .cpp .lo .o .obj .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-       cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps tests/cv/src/Makefile
-
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-noinstPROGRAMS:
-
-clean-noinstPROGRAMS:
-       -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-
-distclean-noinstPROGRAMS:
-
-maintainer-clean-noinstPROGRAMS:
-
-.c.o:
-       $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
-       $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
-       $(COMPILE) -c $<
-
-.S.o:
-       $(COMPILE) -c $<
-
-mostlyclean-compile:
-       -rm -f *.o core *.core
-       -rm -f *.$(OBJEXT)
-
-clean-compile:
-
-distclean-compile:
-       -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-.c.lo:
-       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.s.lo:
-       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.S.lo:
-       $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-distclean-libtool:
-
-maintainer-clean-libtool:
-
-cvla$(EXEEXT): $(cvla_OBJECTS) $(cvla_DEPENDENCIES)
-       @rm -f cvla$(EXEEXT)
-       $(CXXLINK) $(cvla_LDFLAGS) $(cvla_OBJECTS) $(cvla_LDADD) $(LIBS)
-.cpp.o:
-       $(CXXCOMPILE) -c $<
-.cpp.obj:
-       $(CXXCOMPILE) -c `cygpath -w $<`
-.cpp.lo:
-       $(LTCXXCOMPILE) -c $<
-
-install-includeHEADERS: $(include_HEADERS)
-       @$(NORMAL_INSTALL)
-       $(mkinstalldirs) $(DESTDIR)$(includedir)
-       @list='$(include_HEADERS)'; for p in $$list; do \
-         if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
-         echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
-         $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
-       done
-
-uninstall-includeHEADERS:
-       @$(NORMAL_UNINSTALL)
-       list='$(include_HEADERS)'; for p in $$list; do \
-         rm -f $(DESTDIR)$(includedir)/$$p; \
-       done
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
-              END { for (i in files) print i; }'`; \
-       here=`pwd` && cd $(srcdir) \
-         && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       list='$(SOURCES) $(HEADERS)'; \
-       unique=`for i in $$list; do echo $$i; done | \
-         awk '    { files[$$0] = 1; } \
-              END { for (i in files) print i; }'`; \
-       test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-         || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
-       -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = tests/cv/src
-
-distdir: $(DISTFILES)
-       @for file in $(DISTFILES); do \
-         d=$(srcdir); \
-         if test -d $$d/$$file; then \
-           cp -pr $$d/$$file $(distdir)/$$file; \
-         else \
-           test -f $(distdir)/$$file \
-           || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-           || cp -p $$d/$$file $(distdir)/$$file || :; \
-         fi; \
-       done
-aabsdiff.o: aabsdiff.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aaccum.o: aaccum.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aadaptthresh.o: aadaptthresh.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aapproxpoly.o: aapproxpoly.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aarithm.o: aarithm.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aarrayiterator.o: aarrayiterator.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-abackproject.o: abackproject.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acalccontrasthist.o: acalccontrasthist.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acalculate.o: acalculate.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acameracalibration.o: acameracalibration.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acamshift.o: acamshift.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acanny.o: acanny.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-achesscorners.o: achesscorners.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acondens.o: acondens.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acontourcollection.o: acontourcollection.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acontourmoments.o: acontourmoments.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acontours.o: acontours.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acontoursmatch.o: acontoursmatch.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aconvert.o: aconvert.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aconvhull.o: aconvhull.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acorner.o: acorner.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-acreatecontourtree.o: acreatecontourtree.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h ../../../cv/src/_cvgeom.h
-adistancetransform.o: adistancetransform.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-adrawing.o: adrawing.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-adrawing_regress.o: adrawing_regress.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aeigenobjects.o: aeigenobjects.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h aeigenobjects.inc
-aemd.o: aemd.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aerrhandle.o: aerrhandle.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h ../include/cvtest.hpp
-afitellipse.o: afitellipse.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-afitlines.o: afitlines.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-afloodfill.o: afloodfill.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-afloodfill8.o: afloodfill8.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-agesturerecognition.o: agesturerecognition.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ahistogram.o: ahistogram.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ahistograms.o: ahistograms.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ahmmobs.o: ahmmobs.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ahoughtransform.o: ahoughtransform.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aimage.o: aimage.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aimagestatistics.o: aimagestatistics.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-akalman.o: akalman.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-akmeans.o: akmeans.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-alaplace.o: alaplace.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-alogic.o: alogic.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amaskaccum.o: amaskaccum.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amatchcontourtrees.o: amatchcontourtrees.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amathutils.o: amathutils.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amatrix.o: amatrix.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amatrix2.o: amatrix2.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h ../include/cvmtest.h \
-       ../include/cblas.h amatrix.inc
-ameanshift.o: ameanshift.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amemorytest.o: amemorytest.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h ../include/cvtest.hpp
-aminarearect.o: aminarearect.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amineval.o: amineval.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amoments.o: amoments.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amorphology.o: amorphology.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amotiontemplates.o: amotiontemplates.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-amotseg.o: amotseg.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-anodeiterator.o: anodeiterator.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-anorm.o: anorm.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-anormmask.o: anormmask.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aoperations.o: aoperations.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aoptflowhs.o: aoptflowhs.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aoptflowlk.o: aoptflowlk.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aoptflowpyrlk.o: aoptflowpyrlk.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-apixelaccess.o: apixelaccess.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h apixelaccess.inc
-aposit.o: aposit.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aprecorner.o: aprecorner.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-apyramids.o: apyramids.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-apyrsegmentation.o: apyrsegmentation.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asamplers.o: asamplers.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ascharr.o: ascharr.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asequence.o: asequence.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asnakes.o: asnakes.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asobel.o: asobel.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-astoragearray.o: astoragearray.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asubdivisions.o: asubdivisions.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-asvd.o: asvd.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-atemplmatch.o: atemplmatch.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-athresh.o: athresh.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-atree.o: atree.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-atreeiterator.o: atreeiterator.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-aundistort.o: aundistort.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-canny.o: canny.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-tsysa.o: tsysa.cpp ../include/cvtest.h ../../../cv/include/cv.hpp \
-       ../../../cv/include/cv.h ../../../cv/include/ipl.h \
-       ../../../cv/include/iplerror.h ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ucontours.o: ucontours.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ugraphics.o: ugraphics.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-uiplutils.o: uiplutils.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-ureadfile.o: ureadfile.cpp ../include/cvtest.h \
-       ../../../cv/include/cv.hpp ../../../cv/include/cv.h \
-       ../../../cv/include/ipl.h ../../../cv/include/iplerror.h \
-       ../../../cv/include/iplmisc.h \
-       ../../../cv/include/cvpixelaccess.h \
-       ../../../cv/include/cvtypes.h ../../../cv/include/cverror.h \
-       ../../../cv/include/cvcompat.h \
-       ../../../cv/include/cvstorage.hpp \
-       ../../../cvaux/include/cvaux.h ../../ats/include/ats.h \
-       ../../trs/include/trsapi.h ../../trs/include/trsipi.h \
-       ../../trs/include/trserror.h \
-       ../../../otherlibs/highgui/highgui.h
-
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am: install-includeHEADERS
-install-data: install-data-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am: uninstall-includeHEADERS
-uninstall: uninstall-am
-all-am: Makefile $(PROGRAMS) $(HEADERS)
-all-redirect: all-am
-install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-       $(mkinstalldirs)  $(DESTDIR)$(includedir)
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -rm -f Makefile $(CONFIG_CLEAN_FILES)
-       -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am:  mostlyclean-noinstPROGRAMS mostlyclean-compile \
-               mostlyclean-libtool mostlyclean-tags \
-               mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am:  clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
-               clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am:  distclean-noinstPROGRAMS distclean-compile \
-               distclean-libtool distclean-tags distclean-generic \
-               clean-am
-       -rm -f libtool
-
-distclean: distclean-am
-
-maintainer-clean-am:  maintainer-clean-noinstPROGRAMS \
-               maintainer-clean-compile maintainer-clean-libtool \
-               maintainer-clean-tags maintainer-clean-generic \
-               distclean-am
-       @echo "This command is intended for maintainers to use;"
-       @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
-clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool uninstall-includeHEADERS \
-install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
-maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-#cvla_LIBS = 
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
index 5aa0d5f9482937786598d20ddd46eaaa540b10b1..11653e954ea62248c556cb31528adaaa45b8a6dd 100644 (file)
@@ -70,7 +70,6 @@ static int fcaLinAcc( void )
     
     AtsRandState      state;
     IplImage*         pSrc8u;
-    IplImage*         pSrc8s;
     IplImage*         pSrc32f;
     
     IplImage*         pDst;
@@ -92,12 +91,10 @@ static int fcaLinAcc( void )
     }
     atsRandInit(&state,0,255,127);
     pSrc8u         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8U, 3);
-    pSrc8s         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8S, 3);
     pSrc32f        = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 3);
     pDst           = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 3);
     pTemp          = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 3);       
     atsFillRandomImageEx(pSrc8u, &state );
-    atsFillRandomImageEx(pSrc8s, &state );
     atsFillRandomImageEx(pSrc32f, &state );
     atsFillRandomImageEx(pDst, &state );
     pTest = cvCloneImage(pDst);
@@ -106,9 +103,6 @@ static int fcaLinAcc( void )
     cvAcc(pSrc8u,pTest);
     atsConvert(pSrc8u,pTemp);
     cvAdd(pDst,pTemp,pDst);
-    cvAcc(pSrc8s,pTest);
-    atsConvert(pSrc8s,pTemp);
-    cvAdd(pDst,pTemp,pDst);
     cvAcc(pSrc32f,pTest);
     cvAdd(pDst,pSrc32f,pDst);
     Error = (long)cvNorm(pTest,pDst,CV_C);
@@ -120,7 +114,6 @@ static int fcaLinAcc( void )
     
     
     cvReleaseImage( &pSrc8u );
-    cvReleaseImage( &pSrc8s );
     cvReleaseImage( &pSrc32f );
     cvReleaseImage( &pDst );
     cvReleaseImage( &pTest);
@@ -136,7 +129,6 @@ static int fcaSqrAcc( void )
     
     AtsRandState      state;
     IplImage*         pSrc8u;
-    IplImage*         pSrc8s;
     IplImage*         pSrc32f;
     
     IplImage*         pDst;
@@ -158,12 +150,10 @@ static int fcaSqrAcc( void )
     }
     atsRandInit(&state,0,255,127);
     pSrc8u         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8U, 1);
-    pSrc8s         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8S, 1);
     pSrc32f        = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pDst           = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pTemp          = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);       
     atsFillRandomImageEx(pSrc8u, &state );
-    atsFillRandomImageEx(pSrc8s, &state );
     atsFillRandomImageEx(pSrc32f, &state );
     atsFillRandomImageEx(pDst, &state );
     pTest = cvCloneImage(pDst);
@@ -173,10 +163,6 @@ static int fcaSqrAcc( void )
     atsConvert(pSrc8u,pTemp);
     cvMul(pTemp,pTemp,pTemp);
     cvAdd(pDst,pTemp,pDst);
-    cvSquareAcc(pSrc8s,pTest);
-    atsConvert(pSrc8s,pTemp);
-    cvMul(pTemp,pTemp,pTemp);
-    cvAdd(pDst,pTemp,pDst);
     cvSquareAcc(pSrc32f,pTest);
     cvMul(pSrc32f,pSrc32f,pSrc32f);
     cvAdd(pDst,pSrc32f,pDst);
@@ -189,7 +175,6 @@ static int fcaSqrAcc( void )
     
     
     cvReleaseImage( &pSrc8u );
-    cvReleaseImage( &pSrc8s );
     cvReleaseImage( &pSrc32f );
     cvReleaseImage( &pDst );
     cvReleaseImage( &pTest );
@@ -205,10 +190,8 @@ static int fcaMultAcc( void )
     
     AtsRandState      state;
     IplImage*         pSrcA8u;
-    IplImage*         pSrcA8s;
     IplImage*         pSrcA32f;
     IplImage*         pSrcB8u;
-    IplImage*         pSrcB8s;
     IplImage*         pSrcB32f;
     
     IplImage*         pDst;
@@ -231,19 +214,15 @@ static int fcaMultAcc( void )
     }
     atsRandInit(&state,0,255,127);
     pSrcA8u         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8U, 1);
-    pSrcA8s         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8S, 1);
     pSrcA32f        = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pSrcB8u         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8U, 1);
-    pSrcB8s         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8S, 1);
     pSrcB32f        = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pDst            = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pTempA          = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pTempB          = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     atsFillRandomImageEx(pSrcA8u, &state );
-    atsFillRandomImageEx(pSrcA8s, &state );
     atsFillRandomImageEx(pSrcA32f, &state );
     atsFillRandomImageEx(pSrcB8u, &state );
-    atsFillRandomImageEx(pSrcB8s, &state );
     atsFillRandomImageEx(pSrcB32f, &state );
     atsFillRandomImageEx(pDst, &state );
     pTest = cvCloneImage(pDst);
@@ -254,13 +233,6 @@ static int fcaMultAcc( void )
     atsConvert(pSrcB8u,pTempB);
     cvMul(pTempA,pTempB,pTempA);
     cvAdd(pDst,pTempA,pDst);
-    //Error = (long)cvNorm(pTest,pDst,CV_C);
-    cvMultiplyAcc(pSrcA8s,pSrcB8s,pTest);
-    atsConvert(pSrcA8s,pTempA);
-    atsConvert(pSrcB8s,pTempB);
-    cvMul(pTempA,pTempB,pTempA);
-    cvAdd(pDst,pTempA,pDst);
-    //Error = (long)cvNorm(pTest,pDst,CV_C);
     cvMultiplyAcc(pSrcA32f,pSrcB32f,pTest);
     cvMul(pSrcA32f,pSrcB32f,pSrcA32f);
     cvAdd(pDst,pSrcA32f,pDst);
@@ -273,10 +245,8 @@ static int fcaMultAcc( void )
     
     
     cvReleaseImage( &pSrcA8u );
-    cvReleaseImage( &pSrcA8s );
     cvReleaseImage( &pSrcA32f );
     cvReleaseImage( &pSrcB8u );
-    cvReleaseImage( &pSrcB8s );
     cvReleaseImage( &pSrcB32f );
     cvReleaseImage( &pDst );
     cvReleaseImage( &pTest);
@@ -293,7 +263,6 @@ static int fcaRunAvg( void )
 
     AtsRandState      state;
     IplImage*         pSrc8u;
-    IplImage*         pSrc8s;
     IplImage*         pSrc32f;
     
     IplImage*         pDst;
@@ -315,12 +284,10 @@ static int fcaRunAvg( void )
     }
     atsRandInit(&state,0,255,127);
     pSrc8u         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8U, 1);
-    pSrc8s         = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_8S, 1);
     pSrc32f        = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pDst           = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);
     pTemp          = cvCreateImage(cvSize(lImageWidth, lImageHeight), IPL_DEPTH_32F, 1);       
     atsFillRandomImageEx(pSrc8u, &state );
-    atsFillRandomImageEx(pSrc8s, &state );
     atsFillRandomImageEx(pSrc32f, &state );
     atsFillRandomImageEx(pDst, &state );
     pTest = cvCloneImage(pDst);
@@ -331,12 +298,6 @@ static int fcaRunAvg( void )
     cvScale(pTemp,pTemp,alpha);
     cvAdd(pDst,pTemp,pDst);
     Error = (long)cvNorm(pTest,pDst,CV_C);
-    cvRunningAvg(pSrc8s,pTest,alpha);
-    atsConvert(pSrc8s,pTemp);
-    cvScale(pDst,pDst,(1.f-alpha));
-    cvScale(pTemp,pTemp,alpha);
-    cvAdd(pDst,pTemp,pDst);
-    Error = (long)cvNorm(pTest,pDst,CV_C);
     cvRunningAvg(pSrc32f,pTest,alpha);
     cvScale(pDst,pDst,(1.f-alpha));
     cvScale(pSrc32f,pTemp,alpha);
@@ -350,7 +311,6 @@ static int fcaRunAvg( void )
    
 
     cvReleaseImage( &pSrc8u );
-    cvReleaseImage( &pSrc8s );
     cvReleaseImage( &pSrc32f );
     cvReleaseImage( &pDst );
     cvReleaseImage( &pTest);
index 537c0fc4ec5e49e147b0c4277e170ef4fc303961..5a2d2ff4f991387dd1dbcd1262dfbb952b469e4b 100644 (file)
@@ -135,7 +135,7 @@ static int  aAdaptThreshold()
        
     memset(imInput->imageData,bgrn,l);
 
-    cvFillPoly(imInput, &cp, &kp, 1, signal);
+    cvFillPoly(imInput, &cp, &kp, 1, cvScalarAll(signal));
 
 //  do noise   
     upper = 22;
index 216dcc186a42482f1bd976a874f180c8d1a049ea..e1f1d7ed091182bfdee4e2ed8227f73376bcad20 100644 (file)
@@ -195,7 +195,7 @@ int CheckSlice( CvPoint StartPt, CvPoint EndPt, CvSeqReader* SrcReader, float Ep
         else
         {
             if( flag ) dist = sin_a * Pt.y + cos_a * Pt.x - d;
-            else dist = sqrt( (EndPt.y - Pt.y)*(EndPt.y - Pt.y) + (EndPt.x - Pt.x)*(EndPt.x - Pt.x) );
+            else dist = sqrt( (double)(EndPt.y - Pt.y)*(EndPt.y - Pt.y) + (EndPt.x - Pt.x)*(EndPt.x - Pt.x) );
 
             if( dist > Eps ) TotallErrors++;
 
index c4ad17b4e7efe88ffa26135ca8152aaee3cd897e..fbe07e058b754b0cd1c4b1b422683931c1d974bb 100644 (file)
@@ -58,17 +58,12 @@ static float epsilon;
 static int steps;
 
 #define ATS_8U  0
-#define ATS_8S  1
-#define ATS_32F 2
+#define ATS_32F 1
 
 #define EPS_8U      (ATS_8U << 4) | CV_TERMCRIT_EPS
 #define ITER_8U     (ATS_8U << 4) | CV_TERMCRIT_ITER
 #define EPS_ITER_8U (ATS_8U << 4) | CV_TERMCRIT_ITER | CV_TERMCRIT_EPS
 
-#define EPS_8S      (ATS_8S << 4) | CV_TERMCRIT_EPS
-#define ITER_8S     (ATS_8S << 4) | CV_TERMCRIT_ITER
-#define EPS_ITER_8S (ATS_8S << 4) | CV_TERMCRIT_ITER | CV_TERMCRIT_EPS
-
 #define EPS_32F      (ATS_32F << 4) | CV_TERMCRIT_EPS
 #define ITER_32F     (ATS_32F << 4) | CV_TERMCRIT_ITER
 #define EPS_ITER_32F (ATS_32F << 4) | CV_TERMCRIT_ITER | CV_TERMCRIT_EPS
@@ -78,8 +73,7 @@ static int foaCamShiftC1R( void* prm )
     /* Some variables */
     long       lParam  = (long)prm;
     int        Flvr = (lParam >> 4) & 0xf;
-    int        depth = (Flvr == ATS_8U ? IPL_DEPTH_8U : 
-                        Flvr == ATS_8S ? IPL_DEPTH_8S : IPL_DEPTH_32F);
+    int        depth = (Flvr == ATS_8U ? IPL_DEPTH_8U : IPL_DEPTH_32F);
     int        Type = lParam & 0xf;
     int        Errors = 0;
 
@@ -125,7 +119,7 @@ static int foaCamShiftC1R( void* prm )
 
     criteria.type = Type;
     criteria.epsilon = epsilon;
-    criteria.maxIter = iter;
+    criteria.max_iter = iter;
 
     /* Allocating source arrays; */
     src = cvCreateImage(roi, depth, 1);
@@ -150,18 +144,6 @@ static int foaCamShiftC1R( void* prm )
                              alpha,
                              10 );
             break;
-        case ATS_8S:
-            atsbInitEllipse( (uchar*)src->imageData,
-                             roi.width,
-                             roi.height,
-                             src->widthStep,
-                             x,
-                             y,
-                             Length,
-                             Width,
-                             alpha,
-                             10 );
-            break;
         case ATS_32F:
             atsfInitEllipse( (float*)src->imageData,
                              roi.width,
@@ -232,10 +214,6 @@ void InitACamShift()
     trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, ITER_8U );
     trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, EPS_ITER_8U );
 
-    trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, EPS_8S );
-    trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, ITER_8S );
-    trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, EPS_ITER_8S );
-
     trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, EPS_32F );
     trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, ITER_32F );
     trsRegArg( FuncName, TestName, TestClass, foaCamShiftC1R, EPS_ITER_32F );
index ab3dde87c729ef21e50f5c0a2409fe98269959ad..b48435867a8daaf8925532268cbc6725bcbb47ca 100644 (file)
@@ -77,9 +77,6 @@ static int fmaCanny( void* arg )
     if( !read_param )
     {
         read_param = 1;
-        /* Determine which test are needed to run */
-        trsCaseRead( &data_type,"/u/s/a", "u",
-                     "a - all, 8u - unsigned char, 8s - char" );
 
         /* Read test-parameters */
         trsiRead( &lImageWidth, "5", "width of the image" );
index 34a4269984a8b2adb3498bd43919cf9bc1304c55..4865a8b7f29cdeb58430f24a5c00895f79abd72e 100644 (file)
@@ -69,7 +69,7 @@ void show_points( IplImage* gray, CvPoint2D32f* u, int u_cnt, CvPoint2D32f* v, i
     cvGetImageRawData( gray, 0, 0, &size );
     
     IplImage* rgb = cvCreateImage( size, 8, 3 );
-    cvCvtPlaneToPix( gray, gray, gray, 0, rgb );
+    cvMerge( gray, gray, gray, 0, rgb );
 
     if( v )
     {
index 86de7f5955214802112bae66d349dd916b797b06..1ce9c640b67985731d43e526c32ccd745d57375a 100644 (file)
@@ -152,7 +152,7 @@ static int aContourMoments(void *arg)
     memset(Iplimage->imageData,bkcolor,l);
 //    CVL_CHECK(ippiFillPoly8uC1R((uchar*)Iplimage->imageData, Iplimage->widthStep, size, cp, kp, color1));
 
-    cvFillPoly(Iplimage, &cp, &kp, 1, color1);
+    cvFillPoly(Iplimage, &cp, &kp, 1, cvScalar(color1));
 
     for(i=0;i<kp;i++)
     {
@@ -160,7 +160,7 @@ static int aContourMoments(void *arg)
          else i1 = 0;
 //         CVL_CHECK(ippiLine8uC1R((uchar*)Iplimage->imageData, Iplimage->widthStep, size, cp[i], cp[i1],
 //                                 color2));
-         cvLine(Iplimage, cp[i], cp[i1], color2);
+         cvLine(Iplimage, cp[i], cp[i1], cvScalar(color2));
     }
     cvMoments(Iplimage, &mState);
 
index 80a5577c5e68d37a0042c6a3f16a8c277f65fe69..d39c02a0bdafee9fa693c307f7bbd7d96a38b48a 100644 (file)
@@ -175,7 +175,7 @@ static int contour_retrieving_test( void )
         cvZero( dst2_img );
         if( contours )
         {
-            cvDrawContours( dst2_img, contours, mark_val2, mark_val2, INT_MAX );
+            cvDrawContours( dst2_img, contours, cvScalar(mark_val2), cvScalar(mark_val2), INT_MAX );
         }
 
 #if DRAW_CONTOURS
@@ -227,7 +227,7 @@ static int contour_retrieving_test( void )
 
             if( contours2 )
             {
-                cvDrawContours( dst3_img, contours2, mark_val2, mark_val2, INT_MAX );
+                cvDrawContours( dst3_img, contours2, cvScalar(mark_val2), cvScalar(mark_val2), INT_MAX );
             }
 
             err1 = cvNorm( dst2_img, dst3_img, CV_L1 );
@@ -368,13 +368,13 @@ int get_slice_length( CvSeq* seq, CvSlice slice )
     int total = seq->total;
     int length;
 
-    /*if( slice.startIndex == slice.endIndex )
+    /*if( slice.start_index == slice.end_index )
         return 0;*/
-    if( slice.startIndex < 0 )
-        slice.startIndex += total;
-    if( slice.endIndex <= 0 )
-        slice.endIndex += total;
-    length = slice.endIndex - slice.startIndex;
+    if( slice.start_index < 0 )
+        slice.start_index += total;
+    if( slice.end_index <= 0 )
+        slice.end_index += total;
+    length = slice.end_index - slice.start_index;
     if( length < 0 )
         length += total;
     else if( length > total )
@@ -394,7 +394,7 @@ double calc_contour_perimeter( CvPoint* array, int count )
         int dx = array[i].x - array[i+1].x;
         int dy = array[i].y - array[i+1].y;
         
-        s += sqrt(dx*dx + dy*dy);
+        s += sqrt((double)dx*dx + dy*dy);
     }
 
     return s;
@@ -467,8 +467,8 @@ static int contour_perimeter_test( void )
         }
         else
         {
-            slice.startIndex = atsRandPlain32s( &rng_state ) % (count*3) - count;
-            slice.endIndex = atsRandPlain32s( &rng_state ) % (count*3) - count;
+            slice.start_index = atsRandPlain32s( &rng_state ) % (count*3) - count;
+            slice.end_index = atsRandPlain32s( &rng_state ) % (count*3) - count;
         }
 
         perimeter = cvArcLength( contour, slice );
@@ -479,21 +479,24 @@ static int contour_perimeter_test( void )
             goto test_exit;
         }
 
-        len0 = get_slice_length( contour, slice );
-        slice.endIndex++;
+        len0 = cvSliceLength( slice, contour );
+        slice.end_index++;
 
-        len = get_slice_length( contour, slice );
-        if( len == 0 )
+        len = cvSliceLength( slice, contour );
+        if( len <= 0 )
         {
             assert( len0 != 0 );
             len = MIN( len0 + 1, count );
-            if( slice.startIndex < 0 )
-                slice.startIndex += count;
-            else if( slice.startIndex >= count )
-                slice.startIndex -= count;
-            slice.endIndex = slice.startIndex + len;
+            if( slice.start_index < 0 )
+                slice.start_index += count;
+            else if( slice.start_index >= count )
+                slice.start_index -= count;
+            slice.end_index = slice.start_index + len;
         }
 
+        if( len <= 0 )
+            continue;
+
         if( len + 1 > curr_size )
         {
             curr_size = len + 1;
@@ -503,7 +506,7 @@ static int contour_perimeter_test( void )
         cvCvtSeqToArray( contour, array, slice );
 
         cvStartReadSeq( contour, &reader, 0 );
-        cvSetSeqReaderPos( &reader, slice.startIndex, 0 );
+        cvSetSeqReaderPos( &reader, slice.start_index, 0 );
 
         for( j = 0; j < len; j++ )
         {
index c21f8cefc25a7195275da4d53149f47f8978dd0b..0c5dff821dd7139ee8fe6131373d57bf945499e8 100644 (file)
@@ -131,7 +131,7 @@ static int aCreateContourTree(void)
 
     error = 0;
     criteria.type = CV_TERMCRIT_ITER;
-    criteria.maxIter = 100;
+    criteria.max_iter = 100;
     contour_h2 = cvContourFromContourTree (tree, storage, criteria);
     rezult = cvMatchContours ((CvSeq*)&contour_h1, contour_h2,CV_CONTOURS_MATCH_I1);
 
@@ -145,14 +145,14 @@ static int aCreateContourTree(void)
 
     criteria.type = CV_TERMCRIT_ITER + CV_TERMCRIT_EPS;
     criteria.epsilon = (float)0.00001;
-    criteria.maxIter = 1;
+    criteria.max_iter = 1;
     contour_h2 = cvContourFromContourTree (tree, storage, criteria);
     rezult = cvMatchContours ((CvSeq*)&contour_h1, contour_h2, CV_CONTOURS_MATCH_I1);
     error+=rezult;
 
     criteria.type = CV_TERMCRIT_ITER + CV_TERMCRIT_EPS;
     criteria.epsilon = 1000.;
-    criteria.maxIter = 100;
+    criteria.max_iter = 100;
     contour_h2 = cvContourFromContourTree (tree, storage, criteria);
     rezult = cvMatchContours ((CvSeq*)&contour_h1, contour_h2, CV_CONTOURS_MATCH_I1);
     error+=rezult;
index 4855a407c02f2888af0eb0b3d91c35abf22360b0..de9fcc1e385b2187be80ee0f29601816f192818f 100644 (file)
@@ -171,7 +171,7 @@ int test_dt(void* arg)
             euclid = FLT_MAX;
             for(ip = 0; ip < npoints; ip++)
             {
-                distance = (float)sqrt((xi-x[ip])*(xi-x[ip])+(yi-y[ip])*(yi-y[ip]));
+                distance = (float)sqrt((double)(xi-x[ip])*(xi-x[ip])+(yi-y[ip])*(yi-y[ip]));
                 if(distance < euclid)
                 {
                     euclid = distance;
index 596e938f772bac92c66ffccb8265e857221c51b5..4cc3022d21e6c2bc0adcd3968cd863643b0e31ac 100644 (file)
@@ -152,7 +152,7 @@ static int drawing_test()
         CvPoint p1 = cvPoint( i - 30, i * 4 + 10 );
         CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 );
 
-        cvLine( image, p1, p2, RGB(i, 255 - i, 178 + i), i % 10 );
+        cvLine( image, p1, p2, CV_RGB(178+i, 255-i, i), i % 10 );
     }
     Errors += ProcessImage( image, "cvLine", read );
 
@@ -164,7 +164,7 @@ static int drawing_test()
         CvPoint p1 = cvPoint( i - 30, i * 4 + 10 );
         CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 );
 
-        cvLineAA( image, p1, p2, RGB(i, 255 - i, 178 + i), 0 );
+        cvLine( image, p1, p2, CV_RGB(178+i, 255-i, i), 1, CV_AA, 0 );
     }
     //Errors += ProcessImage( image, "cvLineAA", read );
 
@@ -176,7 +176,7 @@ static int drawing_test()
         CvPoint p1 = cvPoint( i - 30, i * 4 + 10 );
         CvPoint p2 = cvPoint( size.width + 30 - i, size.height - 10 - i * 4 );
 
-        cvRectangle( image, p1, p2, RGB(i, 255 - i, 178 + i), i % 10 );
+        cvRectangle( image, p1, p2, CV_RGB(178+i, 255-i, i), i % 10 );
     }
     Errors += ProcessImage( image, "cvRectangle", read );
 
@@ -192,8 +192,8 @@ static int drawing_test()
         CvPoint p1 = cvPoint( i * 3, i * 2 );
         CvPoint p2 = cvPoint( size.width - i * 3, size.height - i * 2 );
 
-        cvCircle( image, p1, i, RGB(i, 255 - i, 178 + i), i % 10 );
-        cvCircle( image, p2, i, RGB(i, 255 - i, 178 + i), i % 10 );
+        cvCircle( image, p1, i, CV_RGB(178+i, 255-i, i), i % 10 );
+        cvCircle( image, p2, i, CV_RGB(178+i, 255-i, i), i % 10 );
 
 #if 0
         show_iplimage( "Diff", image );
@@ -225,7 +225,7 @@ static int drawing_test()
 
         cvEllipse( image, p1, axes,
                    180 * i / 100, 90 * i / 100, 90 * (i - 100) / 100,
-                   RGB(i, 255 - i, 178 + i), i % 10 );
+                   CV_RGB(178+i, 255-i, i), i % 10 );
     }
     Errors += ProcessImage( image, "cvEllipse", read );
 
@@ -251,7 +251,7 @@ static int drawing_test()
         {
             CvPoint p[4] = {{ j * 100 - 10, i }, { j * 100 + 10, i },
                             { j * 100 + 30, i * 2 }, { j * 100 + 170, i * 3 }};
-            cvFillConvexPoly( image, p, 4, RGB(i, 255 - i, 178 + i) );
+            cvFillConvexPoly( image, p, 4, CV_RGB(178+i, 255-i, i) );
 
         }
     Errors += ProcessImage( image, "cvFillConvexPoly", read );
@@ -270,7 +270,7 @@ static int drawing_test()
         CvPoint* p[] = {p0, p1, p2, p3, p4};
 
         int n[] = {4, 4, 4, 4, 4};
-        cvFillPoly( image, p, n, 5, RGB(i, 255 - i, 178 + i) );
+        cvFillPoly( image, p, n, 5, CV_RGB(178+i, 255-i, i) );
     }
     Errors += ProcessImage( image, "cvFillPoly", read );
 
@@ -288,7 +288,7 @@ static int drawing_test()
         CvPoint* p[] = {p0, p1, p2, p3, p4};
 
         int n[] = {4, 4, 4, 4, 4};
-        cvPolyLine( image, p, n, 5, 1, RGB(i, 255 - i, 178 + i), i % 10 );
+        cvPolyLine( image, p, n, 5, 1, CV_RGB(178+i, 255-i, i), i % 10 );
     }
     Errors += ProcessImage( image, "cvPolyLine", read );
 
@@ -318,7 +318,7 @@ static int drawing_test()
         CvFont font;
         cvInitFont( &font, CV_FONT_VECTOR0,
                     (double)i / 5, (double)i / 5, (double)i / 10, i );
-        cvPutText( image, "privet. this is test. :)", cvPoint(0, i * 20), &font, RGB(i, 255 - i, 178 + i) );
+        cvPutText( image, "privet. this is test. :)", cvPoint(0, i * 20), &font, CV_RGB(178+i, 255-i, i) );
     }
     Errors += ProcessImage( image, "cvPutText", read );
 
index e88e0110e3a980e7fd69556e5939c3121d8a80a0..5b198721bb108c9dbfe5626f031b100b81d95b7e 100644 (file)
@@ -68,7 +68,7 @@ static double rel_bufSize;
 
 /*-----------------------------=--=-=== Callback functions ===-=--=---------------------*/
 
-CvStatus read_callback_8u( int ind, void* buf, void* userData)
+int read_callback_8u( int ind, void* buf, void* userData)
 {
     int i, j, k = 0;
     UserData* data = (UserData*)userData;
@@ -76,7 +76,7 @@ CvStatus read_callback_8u( int ind, void* buf, void* userData)
     uchar* buff = (uchar*)buf;
 
     if( ind<0 ) return CV_BADFACTOR_ERR;
-    if( buf==NULL || userData==NULL ) CV_NULLPTR_ERR;
+    if( buf==NULL || userData==NULL ) return CV_NULLPTR_ERR;
 
     for( i=0; i<data->size1.height; i++, start+=data->step1 )
         for( j=0; j<data->size1.width; j++, k++ )
@@ -84,7 +84,7 @@ CvStatus read_callback_8u( int ind, void* buf, void* userData)
     return CV_NO_ERR;
 }
 /*----------------------*/
-CvStatus read_callback_32f( int ind, void* buf, void* userData)
+int read_callback_32f( int ind, void* buf, void* userData)
 {
     int i, j, k = 0;
     UserData* data = (UserData*)userData;
@@ -92,7 +92,7 @@ CvStatus read_callback_32f( int ind, void* buf, void* userData)
     float* buff = (float*)buf;
 
     if( ind<0 ) return CV_BADFACTOR_ERR;
-    if( buf==NULL || userData==NULL ) CV_NULLPTR_ERR;
+    if( buf==NULL || userData==NULL ) return CV_NULLPTR_ERR;
 
     for( i=0; i<data->size2.height; i++, start+=data->step2/4 )
         for( j=0; j<data->size2.width; j++, k++ )
@@ -100,7 +100,7 @@ CvStatus read_callback_32f( int ind, void* buf, void* userData)
     return CV_NO_ERR;
 }
 /*========================*/
-CvStatus write_callback_8u( int ind, void* buf, void* userData)
+int write_callback_8u( int ind, void* buf, void* userData)
 {
     int i, j, k = 0;
     UserData* data = (UserData*)userData;
@@ -108,7 +108,7 @@ CvStatus write_callback_8u( int ind, void* buf, void* userData)
     uchar* buff = (uchar*)buf;
 
     if( ind<0 ) return CV_BADFACTOR_ERR;
-    if( buf==NULL || userData==NULL ) CV_NULLPTR_ERR;
+    if( buf==NULL || userData==NULL ) return CV_NULLPTR_ERR;
 
     for( i=0; i<data->size1.height; i++, start+=data->step1 )
         for( j=0; j<data->size1.width; j++, k++ )
@@ -116,7 +116,7 @@ CvStatus write_callback_8u( int ind, void* buf, void* userData)
     return CV_NO_ERR;
 }
 /*----------------------*/
-CvStatus write_callback_32f( int ind, void* buf, void* userData)
+int write_callback_32f( int ind, void* buf, void* userData)
 {
     int i, j, k = 0;
     UserData* data = (UserData*)userData;
@@ -124,7 +124,7 @@ CvStatus write_callback_32f( int ind, void* buf, void* userData)
     float* buff = (float*)buf;
 
     if( ind<0 ) return CV_BADFACTOR_ERR;
-    if( buf==NULL || userData==NULL ) CV_NULLPTR_ERR;
+    if( buf==NULL || userData==NULL ) return CV_NULLPTR_ERR;
 
     for( i=0; i<data->size2.height; i++, start+=data->step2/4 )
         for( j=0; j<data->size2.width; j++, k++ )
@@ -147,14 +147,14 @@ static int fmaEigenObjects( void )
     double eps0, amax=0, singleCoeff, p;
     AtsRandState state;
     CvSize size;
-    CvStatus  r;
+    int  r;
     CvTermCriteria limit;
     UserData userData;
-    CvStatus (*read_callback)( int ind, void* buf, void* userData)=
+    int (*read_callback)( int ind, void* buf, void* userData)=
                  read_callback_8u;
-    CvStatus (*read2_callback)( int ind, void* buf, void* userData)=
+    int (*read2_callback)( int ind, void* buf, void* userData)=
                  read_callback_32f;
-    CvStatus (*write_callback)( int ind, void* buf, void* userData)=
+    int (*write_callback)( int ind, void* buf, void* userData)=
                  write_callback_32f;
     CvInput* u_r = (CvInput*)&read_callback;
     CvInput* u_r2= (CvInput*)&read2_callback;
@@ -227,7 +227,7 @@ static int fmaEigenObjects( void )
         }
     }
 
-    limit.type = CV_TERMCRIT_ITER;  limit.maxIter = m1;  limit.epsilon = 1;//(float)eps0;
+    limit.type = CV_TERMCRIT_ITER;  limit.max_iter = m1;  limit.epsilon = 1;//(float)eps0;
 
     bufSize = (int)(4*n*obj_number*rel_bufSize);
 trsWrite(TW_RUN|TW_CON, "\n i/o buffer size : %10d bytes\n", bufSize );
index 6d1a205a7d1dc294eb23204fcb75f57eda32ff9f..5908cbdedcad78d276956235c9d3d5a066e11c5d 100644 (file)
-/*M///////////////////////////////////////////////////////////////////////////////////////\r
-//\r
-//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
-//\r
-//  By downloading, copying, installing or using the software you agree to this license.\r
-//  If you do not agree to this license, do not download, install,\r
-//  copy or use the software.\r
-//\r
-//\r
-//                        Intel License Agreement\r
-//                For Open Source Computer Vision Library\r
-//\r
-// Copyright (C) 2000, Intel Corporation, all rights reserved.\r
-// Third party copyrights are property of their respective owners.\r
-//\r
-// Redistribution and use in source and binary forms, with or without modification,\r
-// are permitted provided that the following conditions are met:\r
-//\r
-//   * Redistribution's of source code must retain the above copyright notice,\r
-//     this list of conditions and the following disclaimer.\r
-//\r
-//   * Redistribution's in binary form must reproduce the above copyright notice,\r
-//     this list of conditions and the following disclaimer in the documentation\r
-//     and/or other materials provided with the distribution.\r
-//\r
-//   * The name of Intel Corporation may not be used to endorse or promote products\r
-//     derived from this software without specific prior written permission.\r
-//\r
-// This software is provided by the copyright holders and contributors "as is" and\r
-// any express or implied warranties, including, but not limited to, the implied\r
-// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
-// In no event shall the Intel Corporation or contributors be liable for any direct,\r
-// indirect, incidental, special, exemplary, or consequential damages\r
-// (including, but not limited to, procurement of substitute goods or services;\r
-// loss of use, data, or profits; or business interruption) however caused\r
-// and on any theory of liability, whether in contract, strict liability,\r
-// or tort (including negligence or otherwise) arising in any way out of\r
-// the use of this software, even if advised of the possibility of such damage.\r
-//\r
-//M*/\r
-\r
-/*______________________________________________________________________________________*/\r
-/*                                                                                      */\r
-/*              Test functions for the Eigen Objects functions group                    */\r
-/*______________________________________________________________________________________*/\r
-\r
-#include "cvtest.h"\r
-\r
-static CvStatus _cvCalcCovarMatrix_8u32fR_q( int      nObjects,\r
-                                     uchar**  objects,\r
-                                     int      objStep,\r
-                                     float*   avg,\r
-                                     int      avgStep,\r
-                                     CvSize size,\r
-                                     float*   covarMatrix )\r
-{\r
-    int i, j;\r
-\r
-    if ( nObjects < 2 )                                          return CV_BADFACTOR_ERR;\r
-    if ( size.width > objStep || 4*size.width > avgStep || size.height < 1)\r
-                                                                 return CV_BADSIZE_ERR;\r
-    if ( objects == NULL || avg == NULL || covarMatrix == NULL ) return CV_NULLPTR_ERR;\r
-\r
-    avgStep /= 4;\r
-\r
-    for(i=0; i<nObjects; i++)\r
-    {\r
-        uchar* bu = objects[i];\r
-        for(j=i; j<nObjects; j++)\r
-        {\r
-            int     ij = i*nObjects + j, k, l;\r
-            float    w = 0.f;\r
-            float*   a = avg;\r
-            uchar* bu1 = bu;\r
-            uchar* bu2 = objects[j];\r
-\r
-            for(k=0; k<size.height; k++, bu1 += objStep, bu2 += objStep, a += avgStep)\r
-            {\r
-                for(l = 0; l < size.width-3; l+=4)\r
-                {\r
-                    float  f = a  [l];\r
-                    uchar u1 = bu1[l];\r
-                    uchar u2 = bu2[l];\r
-                    w += ( u1 - f ) * ( u2 - f );\r
-                    f  = a  [l+1];\r
-                    u1 = bu1[l+1];\r
-                    u2 = bu2[l+1];\r
-                    w += ( u1 - f ) * ( u2 - f );\r
-                    f  = a  [l+2];\r
-                    u1 = bu1[l+2];\r
-                    u2 = bu2[l+2];\r
-                    w += ( u1 - f ) * ( u2 - f );\r
-                    f  = a  [l+3];\r
-                    u1 = bu1[l+3];\r
-                    u2 = bu2[l+3];\r
-                    w += ( u1 - f ) * ( u2 - f );\r
-                }\r
-                for(; l < size.width; l++)\r
-                {\r
-                    float  f = a  [l];\r
-                    uchar u1 = bu1[l];\r
-                    uchar u2 = bu2[l];\r
-                    w += ( u1 - f ) * ( u2 - f );\r
-                }\r
-            }\r
-\r
-            covarMatrix[ij] = w;\r
-            ij = j*nObjects + i;\r
-            covarMatrix[ij] = w;\r
-        }\r
-    }\r
-\r
-    return CV_NO_ERR;\r
-}   /* end of _cvCalcCovarMatrix_8u32fR */\r
-\r
-\r
-/* copy of _cvJacobiEigen_32f */\r
-CvStatus _cvJacobiEigens_32f ( float* A,\r
-                               float* V,\r
-                               float* E,\r
-                               int    n,\r
-                               float  eps )\r
-{\r
-    int i, j, k, ind;\r
-    float *AA = A, *VV = V;\r
-    double Amax, anorm=0, ax;\r
-\r
-    if ( A == NULL || V == NULL || E == NULL ) return CV_NULLPTR_ERR;\r
-    if ( n <= 0 )                              return CV_BADSIZE_ERR;\r
-    if (eps < 1.0e-7f )  eps = 1.0e-7f;\r
-\r
-    /*-------- Prepare --------*/\r
-    for(i=0; i<n; i++, VV+=n, AA+=n)\r
-    {\r
-        for(j=0; j<i; j++)\r
-        {\r
-            double Am = AA[j];\r
-            anorm += Am*Am;\r
-        }\r
-        for(j=0; j<n; j++) VV[j] = 0.f;\r
-        VV[i] = 1.f;\r
-    }\r
-\r
-    anorm = sqrt( anorm + anorm );\r
-    ax    = anorm*eps/n;\r
-    Amax  = anorm;\r
-\r
-    while ( Amax > ax )\r
-    {\r
-        Amax /= n;\r
-        do  /* while (ind) */\r
-        {\r
-            int p, q;\r
-            float *V1  = V, *A1  = A;\r
-            ind = 0;\r
-            for(p=0; p<n-1; p++, A1+=n, V1+=n)\r
-            {\r
-                float *A2 = A + n*(p+1), *V2 = V + n*(p+1);\r
-                for(q=p+1; q<n; q++, A2+=n, V2+=n)\r
-                {\r
-                    double x, y, c, s, c2, s2, a;\r
-                    float *A3, Apq=A1[q], App, Aqq, Aip, Aiq, Vpi, Vqi;\r
-                    if( fabs( Apq ) < Amax ) continue;\r
-\r
-                    ind=1;\r
-\r
-                    /*---- Calculation of rotation angle's sine & cosine ----*/\r
-                    App = A1[p];\r
-                    Aqq = A2[q];\r
-                    y   = 5.0e-1*(App - Aqq);\r
-                    x = -Apq / sqrt(Apq*Apq + y*y);\r
-                    if(y<0.0) x = -x;\r
-                    s = x / sqrt(2.0*(1.0 + sqrt(1.0 - x*x)));\r
-                    s2 = s*s;\r
-                    c  = sqrt(1.0 - s2);\r
-                    c2 = c*c;\r
-                    a  = 2.0*Apq*c*s;\r
-\r
-                    /*---- Apq annulation ----*/\r
-                    A3 = A;\r
-                    for(i=0; i<p; i++, A3+=n)\r
-                    {\r
-                        Aip = A3[p];\r
-                        Aiq = A3[q];\r
-                        Vpi = V1[i];\r
-                        Vqi = V2[i];\r
-                        A3[p] = (float)(Aip*c - Aiq*s);\r
-                        A3[q] = (float)(Aiq*c + Aip*s);\r
-                        V1[i] = (float)(Vpi*c - Vqi*s);\r
-                        V2[i] = (float)(Vqi*c + Vpi*s);\r
-                    }\r
-                    for(; i<q; i++, A3+=n)\r
-                    {\r
-                        Aip = A1[i];\r
-                        Aiq = A3[q];\r
-                        Vpi = V1[i];\r
-                        Vqi = V2[i];\r
-                        A1[i] = (float)(Aip*c - Aiq*s);\r
-                        A3[q] = (float)(Aiq*c + Aip*s);\r
-                        V1[i] = (float)(Vpi*c - Vqi*s);\r
-                        V2[i] = (float)(Vqi*c + Vpi*s);\r
-                    }\r
-                    for(; i<n; i++)\r
-                    {\r
-                        Aip = A1[i];\r
-                        Aiq = A2[i];\r
-                        Vpi = V1[i];\r
-                        Vqi = V2[i];\r
-                        A1[i] = (float)(Aip*c - Aiq*s);\r
-                        A2[i] = (float)(Aiq*c + Aip*s);\r
-                        V1[i] = (float)(Vpi*c - Vqi*s);\r
-                        V2[i] = (float)(Vqi*c + Vpi*s);\r
-                    }\r
-                    A1[p] = (float)(App*c2 + Aqq*s2 - a);\r
-                    A2[q] = (float)(App*s2 + Aqq*c2 + a);\r
-                    A1[q] = A2[p] = 0.0f;\r
-                } /*q*/\r
-            }     /*p*/\r
-        } while (ind);\r
-        Amax /= n;\r
-    }   /* while ( Amax > ax ) */\r
-\r
-    for(i=0, k=0; i<n; i++, k+=n+1) E[i] = A[k];\r
-    /*printf(" M = %d\n", M);*/\r
-\r
-    /* -------- ordering --------*/\r
-    for(i=0; i<n; i++)\r
-    {\r
-        int m = i;\r
-        float Em = (float)fabs(E[i]);\r
-        for(j=i+1; j<n; j++)\r
-        {\r
-            float Ej = (float)fabs(E[j]);\r
-            m  = ( Em < Ej ) ?  j :  m;\r
-            Em = ( Em < Ej ) ? Ej : Em;\r
-        }\r
-        if( m != i )\r
-        {\r
-            int l;\r
-            float b = E[i];\r
-            E[i] = E[m];\r
-            E[m] = b;\r
-            for(j=0, k=i*n, l=m*n; j<n; j++, k++, l++)\r
-            {\r
-                b    = V[k];\r
-                V[k] = V[l];\r
-                V[l] = b;\r
-            }\r
-        }\r
-    }\r
-\r
-    return CV_NO_ERR;\r
-}\r
-\r
-\r
-\r
-/*______________________________________________________________________________________*/\r
-\r
-CvStatus  _cvCalcEigenObjects_8u32fR_q( int      nObjects,\r
-                                      uchar**  objects,\r
-                                      int      objStep,\r
-                                      float**  eigObjs,\r
-                                      int      eigStep,\r
-                                      CvSize size,\r
-                                      float*   eigVals,\r
-                                      float*   avg,\r
-                                      int      avgStep,\r
-                                      int*     nEigObjs,\r
-                                      double*  eps      )\r
-{\r
-    int i, j, k, l;\r
-    uchar *bu;\r
-    float *c=0, *ev=0, *bf, *bf1, *bf2, m;\r
-    CvStatus  r;\r
-\r
-\r
-    if ( nObjects < 2 )                                         return CV_BADFACTOR_ERR;\r
-    if ( size.width > objStep || 4*size.width > eigStep ||\r
-         4*size.width > avgStep || size.height < 1)             return CV_BADSIZE_ERR;\r
-    if ( objects == NULL || eigObjs == NULL || eigVals == NULL ||\r
-         avg == NULL || nEigObjs == NULL || eps == NULL )       return CV_NULLPTR_ERR;\r
-    for( i=0; i<nObjects;  i++ ) if( objects[i] == NULL ) return CV_NULLPTR_ERR;\r
-    for( i=0; i<*nEigObjs; i++ ) if( eigObjs[i] == NULL ) return CV_NULLPTR_ERR;\r
-\r
-    eigStep /= 4;\r
-    avgStep /= 4;\r
-\r
-/* Calculation of averaged object */\r
-    bf = avg;\r
-    for(i = 0; i < size.height; i++, bf += avgStep)\r
-        for(j = 0; j < size.width; j++)\r
-            bf[j] = 0.f;\r
-    for(k = 0; k < nObjects; k++)\r
-    {\r
-        bu = objects[k];\r
-        bf = avg;\r
-        for(i = 0; i < size.height; i++, bu +=objStep, bf += avgStep)\r
-            for(j = 0; j < size.width; j++)\r
-                bf[j] += bu[j];\r
-    }\r
-    m = 1.0f/(float)nObjects;\r
-    bf = avg;\r
-    for(i = 0; i < size.height; i++, bf += avgStep)\r
-        for(j = 0; j < size.width; j++)\r
-            bf[j] *= m;\r
-\r
-/* Calculation of covariance matrix */\r
-    c  = (float*)icvAlloc ( sizeof(float)*nObjects*nObjects );\r
-    if(c==NULL) return CV_OUTOFMEM_ERR;\r
-\r
-    r = _cvCalcCovarMatrix_8u32fR_q ( nObjects, objects, objStep,\r
-                                     avg, 4*avgStep, size, c );\r
-    if(r) { icvFree((void**)&c );  return r; }\r
-\r
-/* Calculation of eigenvalues & eigenvectors */\r
-    ev = (float*)icvAlloc ( sizeof(float)*nObjects*nObjects );\r
-    if(ev==NULL) { icvFree((void**)&c );  return CV_OUTOFMEM_ERR; }\r
-\r
-    _cvJacobiEigens_32f( c, ev, eigVals, nObjects, 0.0f );\r
-    icvFree((void**)&c );\r
-\r
-    for(i=0; i<*nEigObjs; i++) if( fabs(eigVals[i]/eigVals[0]) < *eps ) break;\r
-    *nEigObjs = i;\r
-    *eps = fabs(eigVals[*nEigObjs-1]/eigVals[0]);\r
-\r
-/* Calculation of eigenobjects */\r
-    bf2 = ev;\r
-    for(i=0; i<*nEigObjs; i++, bf2+=nObjects)\r
-    {\r
-        float  e = (float)(1.0/sqrt(eigVals[i]));\r
-        float* u = eigObjs[i];\r
-\r
-        bf  = u;\r
-        for(l=0; l<size.height; l++, bf+=eigStep)\r
-            for(j=0; j<size.width; j++) bf[j] = 0.0f;\r
-\r
-        for(k=0; k<nObjects; k++)\r
-        {\r
-            float v = e*bf2[k];\r
-            bf  = u;\r
-            bu  = objects[k];\r
-            bf1 = avg;\r
-            for(l=0; l<size.height; l++, bf+=eigStep, bf1+=avgStep, bu+=objStep)\r
-                for(j=0; j<size.width; j++) bf[j] += v * ((float)bu[j] - bf1[j]);\r
-        }\r
-    }\r
-\r
-    icvFree((void**)&ev );\r
-    return CV_NO_ERR;\r
-} /* --- End of _cvCalcEigenObjects_8u32fR --- */\r
-/*______________________________________________________________________________________*/\r
-\r
-float _cvCalcDecompCoeff_8u32fR_q( uchar*  obj,\r
-                                   int     objStep,\r
-                                   float*  eigObj,\r
-                                   int     eigStep,\r
-                                   float*  avg,\r
-                                   int     avgStep,\r
-                                   CvSize size )\r
-{\r
-    int i, k;\r
-    float w = 0.0f;\r
-\r
-    if ( size.width > objStep || 4*size.width > eigStep\r
-         || 4*size.width > avgStep || size.height < 1)  return -1.0e30f;\r
-    if ( obj == NULL || eigObj == NULL || avg == NULL ) return -1.0e30f;\r
-\r
-    eigStep /= 4;\r
-    avgStep /= 4;\r
-\r
-    for(i = 0; i < size.height; i++, obj += objStep, eigObj += eigStep, avg += avgStep)\r
-        for(k = 0; k < size.width; k++)\r
-            w += eigObj[k]*( (float)obj[k] - avg[k] );\r
-\r
-    return w;\r
-}\r
-/*______________________________________________________________________________________*/\r
-\r
-CvStatus  _cvEigenDecomposite_8u32fR_q( uchar*  obj,\r
-                                          int     objStep,\r
-                                          int     nEigObjs,\r
-                                          float** eigObjs,\r
-                                          int     eigStep,\r
-                                          float*  avg,\r
-                                          int     avgStep,\r
-                                          CvSize size,\r
-                                          float*  coeffs )\r
-{\r
-    int i;\r
-\r
-    if ( nEigObjs < 2 )                                    return CV_BADFACTOR_ERR;\r
-    if ( size.width > objStep || 4*size.width > eigStep ||\r
-         4*size.width > avgStep || size.height < 1)        return CV_BADSIZE_ERR;\r
-    if ( obj == NULL || eigObjs == NULL || coeffs == NULL || avg == NULL)\r
-        return CV_NULLPTR_ERR;\r
-\r
-    for(i=0; i<nEigObjs; i++)\r
-    {\r
-        float w = _cvCalcDecompCoeff_8u32fR_q( obj, objStep, eigObjs[i], eigStep,\r
-                                              avg, avgStep, size );\r
-        if( w < -1.0e29f ) return CV_NOTDEFINED_ERR;\r
-        coeffs[i] = w;\r
-    }\r
-    return CV_NO_ERR;\r
-}\r
-/*______________________________________________________________________________________*/\r
-\r
-CvStatus  _cvEigenProjection_8u32fR_q( int     nEigObjs,\r
-                                         float** eigens,\r
-                                         int     eigStep,\r
-                                         float*  coeffs,\r
-                                         float*  avg,\r
-                                         int     avgStep,\r
-                                         uchar*  rest,\r
-                                         int     restStep,\r
-                                         CvSize size )\r
-{\r
-    int i, j, k;\r
-\r
-    if ( size.width > avgStep || 4*size.width > eigStep || size.height < 1)\r
-                                                        return CV_BADSIZE_ERR;\r
-    if ( rest == NULL || eigens == NULL || avg == NULL || coeffs == NULL )\r
-                                                        return CV_NULLPTR_ERR;\r
-    eigStep /= 4;\r
-    avgStep /= 4;\r
-\r
-    for(i = 0; i < size.height; i++, rest+=restStep, avg+=avgStep)\r
-    {\r
-        int ij = i*eigStep;\r
-        for(j = 0; j < size.width; j++, ij++)\r
-        {\r
-            float w = avg[j];\r
-            for(k=0; k<nEigObjs-3; k+=4)\r
-            {\r
-                float* b = eigens[k];\r
-                w += coeffs[k  ] * b[ij];\r
-                b = eigens [k+1];\r
-                w += coeffs[k+1] * b[ij];\r
-                b = eigens [k+2];\r
-                w += coeffs[k+2] * b[ij];\r
-                b = eigens [k+3];\r
-                w += coeffs[k+3] * b[ij];\r
-            }\r
-            for(; k<nEigObjs; k++)\r
-            {\r
-                float* b = eigens[k];\r
-                w += coeffs[k] * b[ij];\r
-            }\r
-            w = w<-0.499999f ? -0.499999f : w>255.499f ? 255.499f : w;\r
-            rest[j] = (uchar)cvRound( w );\r
-        }\r
-    }\r
-    return CV_NO_ERR;\r
-}\r
-/*______________________________________________________________________________________*/\r
-\r
-/*   << End  of  file >>  */\r
+/*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<nObjects; i++)
+    {
+        uchar* bu = objects[i];
+        for(j=i; j<nObjects; j++)
+        {
+            int     ij = i*nObjects + j, k, l;
+            float    w = 0.f;
+            float*   a = avg;
+            uchar* bu1 = bu;
+            uchar* bu2 = objects[j];
+
+            for(k=0; k<size.height; k++, bu1 += objStep, bu2 += objStep, a += avgStep)
+            {
+                for(l = 0; l < size.width-3; l+=4)
+                {
+                    float  f = a  [l];
+                    uchar u1 = bu1[l];
+                    uchar u2 = bu2[l];
+                    w += ( u1 - f ) * ( u2 - f );
+                    f  = a  [l+1];
+                    u1 = bu1[l+1];
+                    u2 = bu2[l+1];
+                    w += ( u1 - f ) * ( u2 - f );
+                    f  = a  [l+2];
+                    u1 = bu1[l+2];
+                    u2 = bu2[l+2];
+                    w += ( u1 - f ) * ( u2 - f );
+                    f  = a  [l+3];
+                    u1 = bu1[l+3];
+                    u2 = bu2[l+3];
+                    w += ( u1 - f ) * ( u2 - f );
+                }
+                for(; l < size.width; l++)
+                {
+                    float  f = a  [l];
+                    uchar u1 = bu1[l];
+                    uchar u2 = bu2[l];
+                    w += ( u1 - f ) * ( u2 - f );
+                }
+            }
+
+            covarMatrix[ij] = w;
+            ij = j*nObjects + i;
+            covarMatrix[ij] = w;
+        }
+    }
+
+    return CV_NO_ERR;
+}   /* end of _cvCalcCovarMatrix_8u32fR */
+
+
+/* copy of _cvJacobiEigen_32f */
+int _cvJacobiEigens_32f ( float* A,
+                               float* V,
+                               float* E,
+                               int    n,
+                               float  eps )
+{
+    int i, j, k, ind;
+    float *AA = A, *VV = V;
+    double Amax, anorm=0, ax;
+
+    if ( A == NULL || V == NULL || E == NULL ) return CV_NULLPTR_ERR;
+    if ( n <= 0 )                              return CV_BADSIZE_ERR;
+    if (eps < 1.0e-7f )  eps = 1.0e-7f;
+
+    /*-------- Prepare --------*/
+    for(i=0; i<n; i++, VV+=n, AA+=n)
+    {
+        for(j=0; j<i; j++)
+        {
+            double Am = AA[j];
+            anorm += Am*Am;
+        }
+        for(j=0; j<n; j++) VV[j] = 0.f;
+        VV[i] = 1.f;
+    }
+
+    anorm = sqrt( anorm + anorm );
+    ax    = anorm*eps/n;
+    Amax  = anorm;
+
+    while ( Amax > ax )
+    {
+        Amax /= n;
+        do  /* while (ind) */
+        {
+            int p, q;
+            float *V1  = V, *A1  = A;
+            ind = 0;
+            for(p=0; p<n-1; p++, A1+=n, V1+=n)
+            {
+                float *A2 = A + n*(p+1), *V2 = V + n*(p+1);
+                for(q=p+1; q<n; q++, A2+=n, V2+=n)
+                {
+                    double x, y, c, s, c2, s2, a;
+                    float *A3, Apq=A1[q], App, Aqq, Aip, Aiq, Vpi, Vqi;
+                    if( fabs( Apq ) < Amax ) continue;
+
+                    ind=1;
+
+                    /*---- Calculation of rotation angle's sine & cosine ----*/
+                    App = A1[p];
+                    Aqq = A2[q];
+                    y   = 5.0e-1*(App - Aqq);
+                    x = -Apq / sqrt(Apq*Apq + y*y);
+                    if(y<0.0) x = -x;
+                    s = x / sqrt(2.0*(1.0 + sqrt(1.0 - x*x)));
+                    s2 = s*s;
+                    c  = sqrt(1.0 - s2);
+                    c2 = c*c;
+                    a  = 2.0*Apq*c*s;
+
+                    /*---- Apq annulation ----*/
+                    A3 = A;
+                    for(i=0; i<p; i++, A3+=n)
+                    {
+                        Aip = A3[p];
+                        Aiq = A3[q];
+                        Vpi = V1[i];
+                        Vqi = V2[i];
+                        A3[p] = (float)(Aip*c - Aiq*s);
+                        A3[q] = (float)(Aiq*c + Aip*s);
+                        V1[i] = (float)(Vpi*c - Vqi*s);
+                        V2[i] = (float)(Vqi*c + Vpi*s);
+                    }
+                    for(; i<q; i++, A3+=n)
+                    {
+                        Aip = A1[i];
+                        Aiq = A3[q];
+                        Vpi = V1[i];
+                        Vqi = V2[i];
+                        A1[i] = (float)(Aip*c - Aiq*s);
+                        A3[q] = (float)(Aiq*c + Aip*s);
+                        V1[i] = (float)(Vpi*c - Vqi*s);
+                        V2[i] = (float)(Vqi*c + Vpi*s);
+                    }
+                    for(; i<n; i++)
+                    {
+                        Aip = A1[i];
+                        Aiq = A2[i];
+                        Vpi = V1[i];
+                        Vqi = V2[i];
+                        A1[i] = (float)(Aip*c - Aiq*s);
+                        A2[i] = (float)(Aiq*c + Aip*s);
+                        V1[i] = (float)(Vpi*c - Vqi*s);
+                        V2[i] = (float)(Vqi*c + Vpi*s);
+                    }
+                    A1[p] = (float)(App*c2 + Aqq*s2 - a);
+                    A2[q] = (float)(App*s2 + Aqq*c2 + a);
+                    A1[q] = A2[p] = 0.0f;
+                } /*q*/
+            }     /*p*/
+        } while (ind);
+        Amax /= n;
+    }   /* while ( Amax > ax ) */
+
+    for(i=0, k=0; i<n; i++, k+=n+1) E[i] = A[k];
+    /*printf(" M = %d\n", M);*/
+
+    /* -------- ordering --------*/
+    for(i=0; i<n; i++)
+    {
+        int m = i;
+        float Em = (float)fabs(E[i]);
+        for(j=i+1; j<n; j++)
+        {
+            float Ej = (float)fabs(E[j]);
+            m  = ( Em < Ej ) ?  j :  m;
+            Em = ( Em < Ej ) ? Ej : Em;
+        }
+        if( m != i )
+        {
+            int l;
+            float b = E[i];
+            E[i] = E[m];
+            E[m] = b;
+            for(j=0, k=i*n, l=m*n; j<n; j++, k++, l++)
+            {
+                b    = V[k];
+                V[k] = V[l];
+                V[l] = b;
+            }
+        }
+    }
+
+    return CV_NO_ERR;
+}
+
+
+
+/*______________________________________________________________________________________*/
+
+int  _cvCalcEigenObjects_8u32fR_q( int      nObjects,
+                                      uchar**  objects,
+                                      int      objStep,
+                                      float**  eigObjs,
+                                      int      eigStep,
+                                      CvSize size,
+                                      float*   eigVals,
+                                      float*   avg,
+                                      int      avgStep,
+                                      int*     nEigObjs,
+                                      double*  eps      )
+{
+    int i, j, k, l;
+    uchar *bu;
+    float *c=0, *ev=0, *bf, *bf1, *bf2, m;
+    int  r;
+
+
+    if ( nObjects < 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 ( objects == NULL || eigObjs == NULL || eigVals == NULL ||
+         avg == NULL || nEigObjs == NULL || eps == NULL )       return CV_NULLPTR_ERR;
+    for( i=0; i<nObjects;  i++ ) if( objects[i] == NULL ) return CV_NULLPTR_ERR;
+    for( i=0; i<*nEigObjs; i++ ) if( eigObjs[i] == NULL ) return CV_NULLPTR_ERR;
+
+    eigStep /= 4;
+    avgStep /= 4;
+
+/* Calculation of averaged object */
+    bf = avg;
+    for(i = 0; i < size.height; i++, bf += avgStep)
+        for(j = 0; j < size.width; j++)
+            bf[j] = 0.f;
+    for(k = 0; k < nObjects; k++)
+    {
+        bu = objects[k];
+        bf = avg;
+        for(i = 0; i < size.height; i++, bu +=objStep, bf += avgStep)
+            for(j = 0; j < size.width; j++)
+                bf[j] += bu[j];
+    }
+    m = 1.0f/(float)nObjects;
+    bf = avg;
+    for(i = 0; i < size.height; i++, bf += avgStep)
+        for(j = 0; j < size.width; j++)
+            bf[j] *= m;
+
+/* Calculation of covariance matrix */
+    c  = (float*)icvAlloc ( sizeof(float)*nObjects*nObjects );
+    if(c==NULL) return CV_OUTOFMEM_ERR;
+
+    r = _cvCalcCovarMatrix_8u32fR_q ( nObjects, objects, objStep,
+                                     avg, 4*avgStep, size, c );
+    if(r) { icvFree((void**)&c );  return r; }
+
+/* Calculation of eigenvalues & eigenvectors */
+    ev = (float*)icvAlloc ( sizeof(float)*nObjects*nObjects );
+    if(ev==NULL) { icvFree((void**)&c );  return CV_OUTOFMEM_ERR; }
+
+    _cvJacobiEigens_32f( c, ev, eigVals, nObjects, 0.0f );
+    icvFree((void**)&c );
+
+    for(i=0; i<*nEigObjs; i++) if( fabs(eigVals[i]/eigVals[0]) < *eps ) break;
+    *nEigObjs = i;
+    *eps = fabs(eigVals[*nEigObjs-1]/eigVals[0]);
+
+/* Calculation of eigenobjects */
+    bf2 = ev;
+    for(i=0; i<*nEigObjs; i++, bf2+=nObjects)
+    {
+        float  e = (float)(1.0/sqrt(eigVals[i]));
+        float* u = eigObjs[i];
+
+        bf  = u;
+        for(l=0; l<size.height; l++, bf+=eigStep)
+            for(j=0; j<size.width; j++) bf[j] = 0.0f;
+
+        for(k=0; k<nObjects; k++)
+        {
+            float v = e*bf2[k];
+            bf  = u;
+            bu  = objects[k];
+            bf1 = avg;
+            for(l=0; l<size.height; l++, bf+=eigStep, bf1+=avgStep, bu+=objStep)
+                for(j=0; j<size.width; j++) bf[j] += v * ((float)bu[j] - bf1[j]);
+        }
+    }
+
+    icvFree((void**)&ev );
+    return CV_NO_ERR;
+} /* --- End of _cvCalcEigenObjects_8u32fR --- */
+/*______________________________________________________________________________________*/
+
+float _cvCalcDecompCoeff_8u32fR_q( uchar*  obj,
+                                   int     objStep,
+                                   float*  eigObj,
+                                   int     eigStep,
+                                   float*  avg,
+                                   int     avgStep,
+                                   CvSize size )
+{
+    int i, k;
+    float w = 0.0f;
+
+    if ( size.width > 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<nEigObjs; i++)
+    {
+        float w = _cvCalcDecompCoeff_8u32fR_q( obj, objStep, eigObjs[i], eigStep,
+                                              avg, avgStep, size );
+        if( w < -1.0e29f ) return CV_NOTDEFINED_ERR;
+        coeffs[i] = w;
+    }
+    return CV_NO_ERR;
+}
+/*______________________________________________________________________________________*/
+
+int  _cvEigenProjection_8u32fR_q( int     nEigObjs,
+                                         float** eigens,
+                                         int     eigStep,
+                                         float*  coeffs,
+                                         float*  avg,
+                                         int     avgStep,
+                                         uchar*  rest,
+                                         int     restStep,
+                                         CvSize size )
+{
+    int i, j, k;
+
+    if ( size.width > 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; k<nEigObjs-3; k+=4)
+            {
+                float* b = eigens[k];
+                w += coeffs[k  ] * b[ij];
+                b = eigens [k+1];
+                w += coeffs[k+1] * b[ij];
+                b = eigens [k+2];
+                w += coeffs[k+2] * b[ij];
+                b = eigens [k+3];
+                w += coeffs[k+3] * b[ij];
+            }
+            for(; k<nEigObjs; k++)
+            {
+                float* b = eigens[k];
+                w += coeffs[k] * b[ij];
+            }
+            w = w<-0.499999f ? -0.499999f : w>255.499f ? 255.499f : w;
+            rest[j] = (uchar)cvRound( w );
+        }
+    }
+    return CV_NO_ERR;
+}
+/*______________________________________________________________________________________*/
+
+/*   << End  of  file >>  */
index 40fccbbd05af7d73b690917bcc845e926f5954fd..c85337239ddbb56e234d9be4698a87a380f997e3 100644 (file)
@@ -62,7 +62,7 @@ int Counter=0;
 static int X1=0, X2=0, Y1=0, Y2=0;
 
 /*---------------------- Test function (the most slowly algorithm) ----------------------- */
-CvStatus _cvFloodFill8uC1R_slow ( uchar*  pImage,
+int _cvFloodFill8uC1R_slow ( uchar*  pImage,
                                   int     step,
                                   CvSize  imgSize,
                                   CvPoint initPoint,
@@ -136,7 +136,7 @@ CvStatus _cvFloodFill8uC1R_slow ( uchar*  pImage,
     return CV_NO_ERR;
 } /*  _cvFloodFill8uC1R_slow */
 /*--------------------------------------------------------------------------------------*/
-CvStatus _cvFloodFill32fC1R_slow ( float*  pImage,
+int _cvFloodFill32fC1R_slow ( float*  pImage,
                                    int     step,
                                    CvSize  imgSize,
                                    CvPoint initPoint,
@@ -224,7 +224,7 @@ static int fmaFloodFill( void )
     CvSize  size;
     CvPoint seed;
     CvConnectedComp Comp;
-    CvStatus r;
+    int r;
 
     /* Reading test parameters */
     trsiRead( &nx,        "64", "Image width" );
@@ -283,7 +283,7 @@ static int fmaFloodFill( void )
      /* 8U */
             Counter = 0;   X1 = X2 = i;    Y1 = Y2 = j;
             /* Run CVL function */
-            cvFloodFill ( I1, seed, 10.0, 0.0, 0.0, &Comp );
+            cvFloodFill ( I1, seed, cvScalar(10.0), cvScalar(0.0), cvScalar(0.0), &Comp );
             /* Run test function */
             r = _cvFloodFill8uC1R_slow (pI2+mp, step, size, seed, 10, 0, 0 );
             /* Comparison */
@@ -296,7 +296,7 @@ static int fmaFloodFill( void )
      /* 32F */
             Counter = 0;   X1 = X2 = i;    Y1 = Y2 = j;
             /* Run CVL function */
-            cvFloodFill ( I3, seed, 10.0, 0.0, 0.0, &Comp );
+            cvFloodFill ( I3, seed, cvScalar(10.0), cvScalar(0.0), cvScalar(0.0), &Comp );
             /* Run test function */
             r = _cvFloodFill32fC1R_slow (pI4+mp4, step4, size, seed, 10.0, 0.0f, 0.0f );
             /* Comparison */
@@ -336,7 +336,7 @@ static int fmaFloodFill( void )
      /* 8U */
                 Counter = 0; X1 = X2 = i;    Y1 = Y2 = j;
                 /* Run CVL function */
-                cvFloodFill ( I1, seed, 255.0, (double)d1, (double)d2, &Comp );
+                cvFloodFill ( I1, seed, cvScalar(255.0), cvScalar(d1), cvScalar(d2), &Comp );
                 /* Run test function */
                 r = _cvFloodFill8uC1R_slow (pI2+mp, step, size, seed, 255, d1, d2 );
                 /* Comparison */
@@ -349,7 +349,7 @@ static int fmaFloodFill( void )
      /* 32F */
                 Counter = 0; X1 = X2 = i;    Y1 = Y2 = j;
                 /* Run CVL function */
-                cvFloodFill ( I3, seed, 255.0, (double)d1, (double)d2, &Comp );
+                cvFloodFill ( I3, seed, cvScalar(255.0), cvScalar(d1), cvScalar(d2), &Comp );
                 /* Run test function */
                 r = _cvFloodFill32fC1R_slow (pI4+mp4, step4, size, seed, 255.0, (float)d1, (float)d2 );
                 /* Comparison */
index ff6861356c85b975d74ecb5ae2256623678c10fa..421f7ad63853106feb160b16a68560014b989916 100644 (file)
@@ -95,6 +95,8 @@ static int foaImage( void )
         {
             if( depths[i] == IPL_DEPTH_1U && channels[j] != 1 ) // skip for IPL_DEPTH_1U
                 continue;                                       // all non 1 channels
+            if( depths[i] == IPL_DEPTH_8S )
+                continue;
             IplImage* image = cvCreateImageHeader( size, depths[i], channels[j] );
             if( image->width != size.width || image->height != size.height )
             {
@@ -199,6 +201,8 @@ static int foaImage( void )
         {
             if( depths[i] == IPL_DEPTH_1U && channels[j] != 1 ) // skip for IPL_DEPTH_1U
                 continue;                                       // all non 1 channels
+            if( depths[i] == IPL_DEPTH_8S )
+                continue;
             IplImage* src = cvCreateImage( size, depths[i], channels[j] );
             //IplImage* dst = cvCreateImage( size, depths[i], channels[j] );
             IplImage* dst = 0;
index 93e43b6eb80eb31ba45f57e46366aafb952a7afc..82c111c8f4f5880dff691c4470f6b522fdcb69f5 100644 (file)
@@ -233,7 +233,7 @@ static int fmaKMeans(void)
     /* run etalon kmeans */
     /* actually it is the simpliest realization of kmeans */
 
-    int ni = _real_kmeans( lNumClust, vectors, lNumVect, lVectSize, etalon_output, crit.epsilon, crit.maxIter );
+    int ni = _real_kmeans( lNumClust, vectors, lNumVect, lVectSize, etalon_output, crit.epsilon, crit.max_iter );
 
     trsWrite(  ATS_CON, "%d iterations done\n",  ni );
                   
index f09584cc19a7db5eed62b1af064e9bc652a66219..812d05e449e2e42d91bb8914b90983d2cd3b70fa 100644 (file)
@@ -69,7 +69,6 @@ static int fn_l = 0, fn_h = ATS_DIM(funcs)-1,
 static int init_moments_params = 0;
 
 static const int img8u_range = 255;
-static const int img8s_range = 128;
 static const float img32f_range = 100.f;
 static const int img32f_bits = 3;
 
@@ -132,8 +131,8 @@ static void read_moments_params( void )
                      "mb - moments binary\n");
         if( func != 0 ) fn_l = fn_h = func - 1;
 
-        trsCaseRead( &data_types,"/a/8u/8s/32f", "a",
-            "a - all, 8u - unsigned char, 8s - signed char, 32f - float" );
+        trsCaseRead( &data_types,"/a/8u/32f", "a",
+            "a - all, 8u - unsigned char, 32f - float" );
         if( data_types != 0 ) dt_l = dt_h = data_types - 1;
 
         trsCaseRead( &channels, "/a/1/3", "a", "a - all, 1 - single channel, 3 - three channels" );
@@ -188,7 +187,7 @@ static int moments_test( void* arg )
           ATS_RANGE( depth, dt_l, dt_h+1 ) &&
           ATS_RANGE( channels, ch_l, ch_h+1 ))) return TRS_UNDEF;
 
-    depth = depth == 2 ? IPL_DEPTH_32F : depth == 1 ? IPL_DEPTH_8S : IPL_DEPTH_8U;
+    depth = depth == 1 ? IPL_DEPTH_32F : IPL_DEPTH_8U;
     channels = channels*2 + 1;
 
     img  = atsCreateImage( max_img_size, max_img_size, depth, channels, 0 );
@@ -217,9 +216,6 @@ static int moments_test( void* arg )
                 case IPL_DEPTH_8U:
                     atsRandSetBounds( &rng_state, 0, img8u_range );
                     break;
-                case IPL_DEPTH_8S:
-                    atsRandSetBounds( &rng_state, -img8s_range, img8s_range );
-                    break;
                 case IPL_DEPTH_32F:
                     atsRandSetBounds( &rng_state, -img32f_range, img32f_range );
                     if( binary ) atsRandSetFloatBits( &rng_state, img32f_bits );
@@ -380,15 +376,11 @@ void InitAMoments( void )
 
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _8U_C1 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _8U_C3 );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _8S_C1 );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _8S_C3 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _32F_C1 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, _32F_C3 );
 
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_8U_C1 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_8U_C3 );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_8S_C1 );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_8S_C3 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_32F_C1 );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, moments_test, BIN_32F_C3 );
 
index 1e6676d5922c3fad1d1ce1db8c41c869c14aba22..2c717b9c472781350a4127969b43924fc45fc967 100644 (file)
@@ -133,7 +133,7 @@ again:
     region->rect.y = YMin;
     region->rect.width = XMax - XMin + 1;
     region->rect.height = YMax - YMin + 1;
-    region->value = (float)nv;
+    region->value = cvScalar(nv);
     icvFree(&CurStack);
     icvFree(&NextStack);
     return;
@@ -230,7 +230,7 @@ static int fcaMotSeg( void )
                                                         test32f->widthStep,
                                                         thresh,
                                                         &ConComp);
-                                       ConComp.value = color;
+                                       ConComp.value = cvScalar(color);
                                        CV_WRITE_SEQ_ELEM( ConComp, writer );
                                        color+=1;
                                }
@@ -249,7 +249,7 @@ static int fcaMotSeg( void )
                                                         test32f->widthStep,
                                                         thresh,
                                                         &ConComp);
-                                       ConComp.value = color;
+                                       ConComp.value = cvScalar(color);
                                        CV_WRITE_SEQ_ELEM( ConComp, writer );
                                        color+=1;
                                }
@@ -267,7 +267,7 @@ static int fcaMotSeg( void )
                                                         test32f->widthStep,
                                                         thresh,
                                                         &ConComp);
-                                       ConComp.value = color;
+                                       ConComp.value = cvScalar(color);
                                        CV_WRITE_SEQ_ELEM( ConComp, writer );
                                        color+=1;
                                }
@@ -285,7 +285,7 @@ static int fcaMotSeg( void )
                                                         test32f->widthStep,
                                                         thresh,
                                                         &ConComp);
-                                       ConComp.value = color;
+                                       ConComp.value = cvScalar(color);
                                        CV_WRITE_SEQ_ELEM( ConComp, writer );
                                        color+=1;
                                }
index a63c1a513f2be50d0c28fa15f15959757e448627..6b80ba38998b85e9d27cea5ba4a35f0163c3cf14 100644 (file)
@@ -96,7 +96,7 @@ static int fmaCalcOpticalFlowHS( void )
 
     /* initialization - for warning disable */
     criteria.epsilon = 0;
-    criteria.maxIter = 0;
+    criteria.max_iter = 0;
     criteria.type  = 1;
 
     /* Allocating memory for all frames */
@@ -201,11 +201,11 @@ for( usePrevious = 0; usePrevious < 2; usePrevious++ )
         case 0:
             {
                 criteria.type = CV_TERMCRIT_ITER;
-                criteria.maxIter = 3;
+                criteria.max_iter = 3;
 
                 trsWrite( ATS_LST|ATS_CON,
-                         "usePrevious = %d, criteria = ITER, maxIter = %d\n",
-                         usePrevious, criteria.maxIter);
+                         "usePrevious = %d, criteria = ITER, max_iter = %d\n",
+                         usePrevious, criteria.max_iter);
 
                 break;
             }
@@ -223,12 +223,12 @@ for( usePrevious = 0; usePrevious < 2; usePrevious++ )
             {
                 criteria.type = CV_TERMCRIT_EPS | CV_TERMCRIT_ITER;
                 criteria.epsilon = 0.0001f;
-                criteria.maxIter = 3;
+                criteria.max_iter = 3;
                 trsWrite( ATS_LST|ATS_CON,
                          "usePrevious = %d,"
                          "criteria = EPS|ITER,"
-                         "epsilon = %f, maxIter = %d\n",
-                         usePrevious, criteria.epsilon, criteria.maxIter);
+                         "epsilon = %f, max_iter = %d\n",
+                         usePrevious, criteria.epsilon, criteria.max_iter);
 
                 break;
             }
@@ -236,12 +236,12 @@ for( usePrevious = 0; usePrevious < 2; usePrevious++ )
             {
                 criteria.type = CV_TERMCRIT_EPS | CV_TERMCRIT_ITER;
                 criteria.epsilon = 0.00001f;
-                criteria.maxIter = 100;
+                criteria.max_iter = 100;
                 trsWrite( ATS_LST|ATS_CON,
                          "usePrevious = %d,"
                          "criteria = EPS|ITER,"
-                         "epsilon = %f, maxIter = %d\n",
-                         usePrevious, criteria.epsilon, criteria.maxIter);
+                         "epsilon = %f, max_iter = %d\n",
+                         usePrevious, criteria.epsilon, criteria.max_iter);
 
                 break;
             }
@@ -342,12 +342,12 @@ for( usePrevious = 0; usePrevious < 2; usePrevious++ )
             switch (criteria.type)
             {
             case CV_TERMCRIT_ITER:
-                Stop = (criteria.maxIter == iteration );break;
+                Stop = (criteria.max_iter == iteration );break;
             case CV_TERMCRIT_EPS:
                 Stop = (criteria.epsilon > epsilon );break;
             case CV_TERMCRIT_ITER|CV_TERMCRIT_EPS:
                 Stop = ( ( criteria.epsilon > epsilon    ) ||
-                         ( criteria.maxIter == iteration ));
+                         ( criteria.max_iter == iteration ));
                 break;
             }
             if (Stop)
index d2050da5131a063e142e33e11fa8361633811655..c0ea3cdfdf8a94a6cdd556405e66a01f87d9a08f 100644 (file)
@@ -112,7 +112,7 @@ static int fmaPOSIT(void)
     /* Initilization */
     criteria.type = CV_TERMCRIT_EPS|CV_TERMCRIT_ITER;
     criteria.epsilon = flEpsilon;
-    criteria.maxIter = 10000;
+    criteria.max_iter = 10000;
 
     /* Allocating source arrays; */
     obj_points = (CvPoint3D32f*)icvAlloc( 8 * sizeof(CvPoint3D32f) );
index 49330ad0c9ca653605036e19c4038d868ee65d87..6528568936b1399df614a9d6d26c442630381266 100644 (file)
@@ -136,8 +136,8 @@ static int aPyrSegmentation(void* agr)
     {
         case 1:
         {
-            cvFillPoly( image, &cp, &nPoints, 1, color2);
-            cvFillPoly( image, &cp2, &nPoints, 1, color3); 
+            cvFillPoly( image, &cp, &nPoints, 1, cvScalar(color2));
+            cvFillPoly( image, &cp2, &nPoints, 1, cvScalar(color3)); 
 
             row = (uchar*)image->imageData;
             f_row = (uchar*)image_f->imageData;
index dced0ca7d16e51d4bdab5b6055f198ec8e89c61b..0b50ecc92280077c7fa01bb1a3252d991ec8d653 100644 (file)
@@ -71,8 +71,8 @@ static const int numfig_grad  = 1;
 
 static char* file_name[] = 
 {
-    "Ring",
-    "Square"
+    "ring",
+    "square"
 }; 
               
 
@@ -102,7 +102,7 @@ static int fmaSnakes( void* arg )
 
     static int  read_param = 0;
 
-    atsGetTestDataPath( rel_path, "Snakes", 0, 0 );
+    atsGetTestDataPath( rel_path, "snakes", 0, 0 );
 
     /* Initialization global parameters */
     if( !read_param )
@@ -167,7 +167,7 @@ static int fmaSnakes( void* arg )
         fscanf(file, "%d", &num_pos );
 
         /* get number iterations between two positions */
-        fscanf(file, "%d", &criteria.maxIter ); 
+        fscanf(file, "%d", &criteria.max_iter ); 
 
         /* read initial snake position */
         for ( j = 0; j < length; j++ )
index 8220b185e3fef96c6fea839fba3a913cc50e62b1..a0ac8d0c28db496dad9b1efbba4914406ba63874 100644 (file)
@@ -66,7 +66,6 @@ static int dt_l = 0, dt_h = 2,
 static int init_templ_match_params = 0;
 
 static const int img8u_range = 255;
-static const int img8s_range = 128;
 static const float img32f_range = 100.f;
 static const int img32f_bits = 23;
 
@@ -77,8 +76,8 @@ static void read_templ_match_params( void )
         int  data_types, method;
 
         /* Determine which tests are needed to run */
-        trsCaseRead( &data_types,"/a/8u/8s/32f", "a",
-            "a - all, 8u - unsigned char, 8s - signed char, 32f - float" );
+        trsCaseRead( &data_types,"/a/8u/32f", "a",
+            "a - all, 8u - unsigned char, 32f - float" );
         if( data_types != 0 ) dt_l = dt_h = data_types - 1;
 
         trsCaseRead( &method,"/a/sd/sdn/cr/crn/cf/cfn", "a",
@@ -92,11 +91,11 @@ static void read_templ_match_params( void )
         if( method != 0 ) meth_l = meth_h = method - 1;
 
         /* read tests params */
-        trsiRead( &min_img_size, "1", "Minimal width or height of image" );
+        trsiRead( &min_img_size, "3", "Minimal width or height of image" );
         trsiRead( &max_img_size, "32", "Maximal width or height of image" );
         trsCaseRead( &img_size_delta_type,"/a/m", "m", "a - add, m - multiply" );
         trsiRead( &img_size_delta, "3", "Image size step(factor)" );
-        trsiRead( &min_templ_size, "1", "Minimal width or height of image" );
+        trsiRead( &min_templ_size, "1", "Minimal width or height of template" );
         trsCaseRead( &templ_size_delta_type,"/a/m", "a", "a - add, m - multiply" );
         trsiRead( &templ_size_delta, "3", "Image size step(factor)" );
         trsiRead( &base_iters, "1000", "Base number of iterations" );
@@ -193,8 +192,8 @@ static void match_templ_etalon( IplImage* src, IplImage* templ, IplImage* dst,
 
 static int match_templ_test( void* arg )
 {
-    const double success_error_level = 1e-6;
-    const double error_level_scale = 1e-3;
+    const double success_error_level = 1;
+    const double error_level_scale = 1;
 
     int   param     = (int)arg;
     int   depth     = param/6;
@@ -222,7 +221,7 @@ static int match_templ_test( void* arg )
     if( !(ATS_RANGE( depth, dt_l, dt_h+1 ) &&
           ATS_RANGE( method, meth_l, meth_h+1 ))) return TRS_UNDEF;
 
-    depth = depth == 2 ? IPL_DEPTH_32F : depth == 1 ? IPL_DEPTH_8S : IPL_DEPTH_8U;
+    depth = depth == 1 ? IPL_DEPTH_32F : IPL_DEPTH_8U;
 
     src_img = atsCreateImage( max_img_size, max_img_size, depth, 1, 0 );
     templ_img = atsCreateImage( max_img_size, max_img_size, depth, 1, 0 );
@@ -255,9 +254,6 @@ static int match_templ_test( void* arg )
     case IPL_DEPTH_8U:
         atsRandSetBounds( &rng_state, 0, img8u_range );
         break;
-    case IPL_DEPTH_8S:
-        atsRandSetBounds( &rng_state, -img8s_range, img8s_range );
-        break;
     case IPL_DEPTH_32F:
         atsRandSetBounds( &rng_state, -img32f_range, img32f_range );
         atsRandSetFloatBits( &rng_state, img32f_bits );
@@ -382,19 +378,12 @@ test_exit:
 #define MTEMPL_CCOEFF_8U          4
 #define MTEMPL_CCOEFF_NORMED_8U   5
 
-#define MTEMPL_SQDIFF_8S          6
-#define MTEMPL_SQDIFF_NORMED_8S   7
-#define MTEMPL_CCORR_8S           8
-#define MTEMPL_CCORR_NORMED_8S    9
-#define MTEMPL_CCOEFF_8S         10
-#define MTEMPL_CCOEFF_NORMED_8S  11
-
-#define MTEMPL_SQDIFF_32F        12
-#define MTEMPL_SQDIFF_NORMED_32F 13
-#define MTEMPL_CCORR_32F         14
-#define MTEMPL_CCORR_NORMED_32F  15
-#define MTEMPL_CCOEFF_32F        16
-#define MTEMPL_CCOEFF_NORMED_32F 17
+#define MTEMPL_SQDIFF_32F         6
+#define MTEMPL_SQDIFF_NORMED_32F  7
+#define MTEMPL_CCORR_32F          8
+#define MTEMPL_CCORR_NORMED_32F   9
+#define MTEMPL_CCOEFF_32F        10
+#define MTEMPL_CCOEFF_NORMED_32F 11
 
 
 void InitAMatchTemplate( void )
@@ -407,13 +396,6 @@ void InitAMatchTemplate( void )
     trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCOEFF_8U );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCOEFF_NORMED_8U );
 
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_SQDIFF_8S );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_SQDIFF_NORMED_8S );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCORR_8S );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCORR_NORMED_8S );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCOEFF_8S );
-    trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCOEFF_NORMED_8S );
-
     trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_SQDIFF_32F );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_SQDIFF_NORMED_32F );
     trsRegArg( funcs[0], test_desc, atsAlgoClass, match_templ_test, MTEMPL_CCORR_32F );
index 7e13301c994b07430e94c1ea961abe49e47d48f9..8767a1c9559bc983706df56ff7cf9a0645618c90 100644 (file)
@@ -49,7 +49,6 @@ static long  Len;
 static float Thresh;
 
 #define ATS_8U  3
-#define ATS_8S  4
 #define ATS_32F 5
 
 #define BINARY_8U      (CV_THRESH_BINARY     << 4) + ATS_8U
@@ -72,7 +71,6 @@ static float Thresh;
 
 
 static int myThresh( uchar*        Src8u,
-                     char*         Src8s,
                      float*        Src32f,
                      float         Thresh,
                      float         Max,
@@ -86,27 +84,22 @@ static int myThresh( uchar*        Src8u,
         {
         case CV_THRESH_BINARY:
             Src8u[i]  = (uchar)(Src8u[i]  > (uchar)Thresh ? Max : 0);
-            Src8s[i]  = (char) (Src8s[i]  > (char) Thresh ? Max : 0);
             Src32f[i] =        (Src32f[i] >        Thresh ? Max : 0);
             break;
         case CV_THRESH_BINARY_INV:
             Src8u[i]  = (uchar)(Src8u[i]  > (uchar)Thresh ? 0 : Max);
-            Src8s[i]  = (char) (Src8s[i]  > (char) Thresh ? 0 : Max);
             Src32f[i] =        (Src32f[i] >        Thresh ? 0 : Max);
             break;
         case CV_THRESH_TRUNC:
             Src8u[i]  = (uchar)(Src8u[i]  > (uchar)Thresh ? Thresh : Src8u[i] );
-            Src8s[i]  = (char) (Src8s[i]  > (char) Thresh ? Thresh : Src8s[i] );
             Src32f[i] =        (Src32f[i] >        Thresh ? Thresh : Src32f[i]);
             break;
         case CV_THRESH_TOZERO:
             Src8u[i]  = (uchar)(Src8u[i]  > (uchar)Thresh ? Src8u[i]  : 0);
-            Src8s[i]  = (char) (Src8s[i]  > (char) Thresh ? Src8s[i]  : 0);
             Src32f[i] =        (Src32f[i] >        Thresh ? Src32f[i] : 0);
             break;
         case CV_THRESH_TOZERO_INV:
             Src8u[i]  = (uchar)(Src8u[i]  > (uchar)Thresh ? 0 : Src8u[i] );
-            Src8s[i]  = (char) (Src8s[i]  > (char) Thresh ? 0 : Src8s[i] );
             Src32f[i] =        (Src32f[i] >        Thresh ? 0 : Src32f[i]);
             break;
         default:
@@ -118,25 +111,22 @@ static int myThresh( uchar*        Src8u,
 
 
 static int myThreshR( IplImage*     Src8u,
-                      IplImage*     Src8s,
                       IplImage*     Src32f,
                       float         Thresh,
                       float         Max,
                       CvThreshType  Type )
 {
     char* s8u;
-    char* s8s;
     char* s32f;
-    int step8u, step8s, step32f;
+    int step8u, step32f;
     CvSize size;
 
     cvGetImageRawData(Src8u, (uchar**)&s8u, &step8u, &size);
-    cvGetImageRawData(Src8s, (uchar**)&s8s, &step8s, 0);
     cvGetImageRawData(Src32f, (uchar**)&s32f, &step32f, 0);
 
     int y;
-    for( y = 0; y < size.height; y++, s8u += step8u, s8s += step8s, s32f += step32f )
-        myThresh( (uchar*)s8u, s8s, (float*)s32f, Thresh, Max, size.width, Type );
+    for( y = 0; y < size.height; y++, s8u += step8u, s32f += step32f )
+        myThresh( (uchar*)s8u, (float*)s32f, Thresh, Max, size.width, Type );
     return 0;
 }
 
@@ -148,10 +138,8 @@ static int foaThreshold( void* prm )
     CvThreshType  Type    = (CvThreshType)((lParam >> 4) & 0xf);
 
     IplImage* Src8uR;
-    IplImage* Src8sR;
     IplImage* Src32fR;
     IplImage* Src8uControlR;
-    IplImage* Src8sControlR;
     IplImage* Src32fControlR;
 
     int    height;
@@ -179,21 +167,16 @@ static int foaThreshold( void* prm )
     height = Len / 2 + 1;
     
     Src8uR         = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
-    Src8sR         = cvCreateImage(cvSize(width, height), IPL_DEPTH_8S, 1);
     Src32fR        = cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
     Src8uControlR  = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
-    Src8sControlR  = cvCreateImage(cvSize(width, height), IPL_DEPTH_8S, 1);
     Src32fControlR = cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
     
     assert( Src8uR );
-    assert( Src8sR );
     assert( Src32fR );
     assert( Src8uControlR );
-    assert( Src8sControlR );
     assert( Src32fControlR );
 
-    ThreshMin = (Flavour == ATS_8U ? MAX( -Thresh, 0 ) :
-                 Flavour == ATS_8S ? MAX( -Thresh, -128 ) : -Thresh);
+    ThreshMin = (Flavour == ATS_8U ? MAX( -Thresh, 0 ) : -Thresh);
     ThreshMax = Thresh;
 
     for( _Thresh = ThreshMin; _Thresh <= ThreshMax; _Thresh++ )
@@ -203,7 +186,6 @@ static int foaThreshold( void* prm )
         for( i = 0; i < height; i++ )
         {
             ats1bInitRandom( 0, 255, (uchar*)Src8uControlR->imageData + i * Src8uControlR->widthStep, Len );
-            ats1cInitRandom( -128, 127, Src8sControlR->imageData + i * Src8sControlR->widthStep, Len );
             ats1flInitRandom( -255, 255, (float*)(Src32fControlR->imageData + i * Src32fControlR->widthStep), Len );
         }
 
@@ -214,27 +196,15 @@ static int foaThreshold( void* prm )
             cvThreshold( Src8uControlR, Src8uR, _Thresh, 250, Type );
             /* Run my function */
             myThreshR( Src8uControlR,
-                       Src8sControlR,
                        Src32fControlR,
                        _Thresh, 250, Type );
             Errors += atsCompare2Db( (uchar*)Src8uR->imageData, (uchar*)Src8uControlR->imageData,
                                      size, Src8uR->widthStep, 0 );
             break;
-        case ATS_8S:
-            cvThreshold( Src8sControlR,Src8sR, _Thresh, 120, Type );
-            /* Run my function */
-            myThreshR( Src8uControlR,
-                       Src8sControlR,
-                       Src32fControlR,
-                       _Thresh, 120, Type );
-            Errors += atsCompare2Dc( Src8sR->imageData, Src8sControlR->imageData,
-                                     size, Src8sR->widthStep, 0 );
-            break;
         case ATS_32F:
             cvThreshold( Src32fControlR, Src32fR, _Thresh, 250, Type );
             /* Run my function */
             myThreshR( Src8uControlR,
-                       Src8sControlR,
                        Src32fControlR,
                        _Thresh, 250, Type );
             Errors += atsCompare2Dfl( (float*)Src32fR->imageData, (float*)Src32fControlR->imageData,
@@ -245,10 +215,8 @@ static int foaThreshold( void* prm )
         }
     }
     cvReleaseImage( &Src8uR );
-    cvReleaseImage( &Src8sR );
     cvReleaseImage( &Src32fR );
     cvReleaseImage( &Src8uControlR );
-    cvReleaseImage( &Src8sControlR );
     cvReleaseImage( &Src32fControlR );
 
     return Errors == 0 ? TRS_OK : trsResult( TRS_FAIL, "Fixed %d errors", Errors );
@@ -262,12 +230,6 @@ void InitAThreshold()
     trsRegArg( FuncName,  TestName, TestClass, foaThreshold, TOZERO_8U    );
     trsRegArg( FuncName,  TestName, TestClass, foaThreshold, TOZERO_INV_8U);
 
-    trsRegArg( FuncName,  TestName, TestClass, foaThreshold, BINARY_8S    );
-    trsRegArg( FuncName,  TestName, TestClass, foaThreshold, BINARY_INV_8S);
-    trsRegArg( FuncName,  TestName, TestClass, foaThreshold, TRUNC_8S     );
-    trsRegArg( FuncName,  TestName, TestClass, foaThreshold, TOZERO_8S    );
-    trsRegArg( FuncName,  TestName, TestClass, foaThreshold, TOZERO_INV_8S);
-    
     trsRegArg( FuncName, TestName, TestClass, foaThreshold, BINARY_32F   );
     trsRegArg( FuncName, TestName, TestClass, foaThreshold, BINARY_INV_32F);
     trsRegArg( FuncName, TestName, TestClass, foaThreshold, TRUNC_32F    );
index dff573de87013f99ad02cdedc10475cec69b101d..a64752e008f6fbe07932aacbcb87abe599187292 100644 (file)
@@ -47,7 +47,8 @@
 #endif
 
 #include <math.h>
-#include "cv.hpp"
+#include "cv.h"
+#include "cxmisc.h"
 #include "cvaux.h"
 #include "highgui.h"
 #include "trsapi.h"
@@ -232,7 +233,7 @@ void atsInitModuleTestData( char* module, char* path_from_module );
 
 char* atsGetTestDataPath( char* buffer, char* folder, char* filename, char* extention );
 
-int atsLoadPrimitives( int argc, char** argv );
+void atsLoadPrimitives( int flag );
 
 /******************************************************************************/
 /*                                 Defines                                    */
@@ -613,17 +614,6 @@ typedef CvSeq* ( *Contour )( CvMemStorage* storage );
             else trsWrite( ATS_CON | ATS_LST, "ok\n" );      \
         }
 
-/* patch */
-typedef enum {
-   cv1u,
-   cv8u, cv8s,
-   cv16u, cv16s, cv16sc,
-   cv32u, cv32s, cv32sc,
-   cv32f, cv32fc,
-   cv64u, cv64s, cv64sc,
-   cv64f, cv64fc
-} CvDataType;
-
 #define _CV_C            1
 #define _CV_L1           2
 #define _CV_L2           4
index 827e092495018c731f15ec83a254e9fcb73d81b5..59572f6b03cc407d19ac0e032dc6f18e4a987bcb 100644 (file)
 
 #include "cvtest.h"
 
-void InitAAbsDiff();
 void InitAAcc();
 void InitAApproxPoly();
-void InitAArithmetic();
 void InitAArrayIterator();
 void InitABackProject();
 void InitACalibration();
@@ -53,14 +51,11 @@ void InitACanny();
 void InitAChessCorners();
 void InitAConDens();
 void InitAContours();
-void InitAConvert();
 void InitAConvexHull();
 void InitACorner();
 void InitACvCalculate();
 void InitADerv();
 void InitADistanceTransform();
-void InitADrawing();
-void InitADrawingRegress();
 void InitAEMD();
 void InitAFitEllipse();
 void InitAFitLine();
@@ -74,16 +69,12 @@ void InitAHistogramOperations();
 void InitAHistograms();
 void InitAHoughLines();
 void InitAImage();
-void InitAImageStatistics();
 void InitAImageToHMMObs();
 void InitAKalman();
 void InitAKMeans();
-void InitALogic();
 void InitAMaskAcc();
 void InitAMatchTemplate();
 void InitAMathUtils();
-void InitAMatr();
-void InitAMatr2();
 void InitAMeanShift();
 void InitAMinAreaRect();
 void InitAMinEVal();
@@ -100,7 +91,6 @@ void InitASequence();
 void InitASnakes();
 void InitAStorageArray();
 void InitASubdiv();
-void InitASVD();
 void InitAThreshold();
 void InitAAdaptThreshold();
 void InitATree();
@@ -109,8 +99,6 @@ void InitAFloodFill();
 void InitAFloodFill8();
 void InitAUnDistort();
 void InitAEigenObjects();
-void InitANorm();
-void InitANormMask();
 void InitAContourMoments();
 void InitAMatchContours();
 void InitACreateContourTree();
@@ -135,15 +123,11 @@ int main(int argC,char *argV[])
 #else
     atsInitModuleTestData( argV[0], "../testdata" );
 #endif
-    atsLoadPrimitives( argC, argV );
+    atsLoadPrimitives( 1 );
 
-    InitAAbsDiff();
     InitAAcc();
     // InitAAdaptThreshold(); // test is not up-to-date
     InitAApproxPoly();
-    InitAArithmetic();
-    InitAArrayIterator();
-    InitABackProject();
     InitACalcOpticalFlowLK();
     InitACalcOpticalFlowHS();
     InitACalibration();
@@ -153,42 +137,30 @@ int main(int argC,char *argV[])
     InitAConDens();
     InitAContours();
     InitAContourMoments();
-    InitAConvert();
     InitAConvexHull();
     InitACorner();
     InitACreateContourTree();
-    InitACvCalculate();
     InitADerv();
     InitADistanceTransform();
-    InitADrawing();
-    InitADrawingRegress();
     InitAEigenObjects();
     InitAEMD();
 
     InitAFitEllipse();
     InitAFitLine();
-
     InitAFloodFill();
     InitAFloodFill8();
     InitAHaar();
-    InitAHistogram();
     //InitACalcContrastHist(); // the function is not available
-    InitAHistogramOperations();
     InitAHistograms();
     InitAHoughLines();
     InitAImage();
-    InitAImageStatistics();
     //InitAImageToHMMObs(); // test uses IPL DCT
     InitAKalman();
     //InitAKMeans(); // test is not up-to-date
-    InitALogic();
     InitAMaskAcc();
     InitAMatchContours();
     InitAMatchContourTrees();
     InitAMatchTemplate();
-    InitAMathUtils();
-    InitAMatr();
-    InitAMatr2();
 
     InitAMeanShift();
     InitAMinAreaRect();
@@ -197,25 +169,15 @@ int main(int argC,char *argV[])
     InitAMotionTemplates();
     // InitAMotSeg(); // test is not up-to-date
     InitAMinEVal ();
-
-    InitANodeIterator();
-    InitANorm();
-    InitANormMask();
     InitAOptFlowPyrLK();
-
     InitAPixelAccess();
 
     InitAPOSIT();
     InitAPyramids();
     InitASamplers();
-    InitASequence();
     InitASnakes();
-    InitAStorageArray();
     InitASubdiv();
-    InitASVD();
     InitAThreshold();
-    InitATree();
-    InitATreeIterator();
     InitAUnDistort();
     InitAPreCorner();
     InitAPyrSegmentation();
diff --git a/opencv/tests/cxts/Makefile.am b/opencv/tests/cxts/Makefile.am
new file mode 100644 (file)
index 0000000..35b0448
--- /dev/null
@@ -0,0 +1,10 @@
+lib_LIBRARIES = libcxts.a
+
+libcxts_a_SOURCES = cxts.cpp cxts_arrtest.cpp cxts_math.cpp
+
+noinst_HEADERS = _cxts.h cxts.h
+
+EXTRA_DIST = cxts.dsp cxts.vcproj precomp.cpp
+
+INCLUDES = -I. -I../../cxcore/include -I../..
+AM_CFLAGS = @CFLAGS@ @DEBUG@
diff --git a/opencv/tests/cxts/_cxts.h b/opencv/tests/cxts/_cxts.h
new file mode 100644 (file)
index 0000000..d38dd9d
--- /dev/null
@@ -0,0 +1,59 @@
+/*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*/
+
+#ifndef __CXTS_INTERNAL_H__
+#define __CXTS_INTERNAL_H__
+
+#if defined WIN32 && (_MSC_VER >= 1200 || defined _ICL)
+#pragma warning( disable: 4514 )
+#endif
+
+#include "cxts.h"
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#endif/*__CXTS_INTERNAL_H__*/
+
diff --git a/opencv/tests/cxts/cxts.cpp b/opencv/tests/cxts/cxts.cpp
new file mode 100644 (file)
index 0000000..a51c486
--- /dev/null
@@ -0,0 +1,1407 @@
+/*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*/
+
+#include "_cxts.h"
+#include <ctype.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <time.h>
+#ifdef WIN32
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+CvTest* CvTest::first = 0;
+CvTest* CvTest::last = 0;
+int CvTest::test_count = 0;
+
+/*****************************************************************************************\
+*                                Exception and memory handlers                            *
+\*****************************************************************************************/
+
+// a few platform-dependent declarations
+
+#define CV_TS_NORMAL 0
+#define CV_TS_BLUE   1
+#define CV_TS_GREEN  2
+#define CV_TS_RED    4
+
+#ifdef WIN32
+#include <windows.h>
+
+#ifdef _MSC_VER
+#include <eh.h>
+#endif
+
+static void cv_seh_translator( unsigned int /*u*/, EXCEPTION_POINTERS* pExp )
+{
+    int code = CvTS::FAIL_EXCEPTION;
+    switch( pExp->ExceptionRecord->ExceptionCode )
+    {
+    case EXCEPTION_ACCESS_VIOLATION:
+    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+    case EXCEPTION_DATATYPE_MISALIGNMENT:
+    case EXCEPTION_FLT_STACK_CHECK:
+    case EXCEPTION_STACK_OVERFLOW:
+    case EXCEPTION_IN_PAGE_ERROR:
+        code = CvTS::FAIL_MEMORY_EXCEPTION;
+        break;
+    case EXCEPTION_FLT_DENORMAL_OPERAND:
+    case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+    case EXCEPTION_FLT_INEXACT_RESULT:
+    case EXCEPTION_FLT_INVALID_OPERATION:
+    case EXCEPTION_FLT_OVERFLOW:
+    case EXCEPTION_FLT_UNDERFLOW:
+    case EXCEPTION_INT_DIVIDE_BY_ZERO:
+    case EXCEPTION_INT_OVERFLOW:
+        code = CvTS::FAIL_ARITHM_EXCEPTION;
+        break;
+    case EXCEPTION_BREAKPOINT:
+    case EXCEPTION_ILLEGAL_INSTRUCTION:
+    case EXCEPTION_INVALID_DISPOSITION:
+    case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+    case EXCEPTION_PRIV_INSTRUCTION:
+    case EXCEPTION_SINGLE_STEP:
+        code = CvTS::FAIL_EXCEPTION;
+    }
+    throw code;
+}
+
+
+#define CV_TS_TRY_BLOCK_BEGIN                   \
+    try {
+
+#define CV_TS_TRY_BLOCK_END                     \
+    } catch( int _code ) {                      \
+        ts->set_failed_test_info( _code );      \
+    }
+
+static void change_color( int color )
+{
+    static int normal_attributes = -1;
+    HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
+    fflush(stdout);
+
+    if( normal_attributes < 0 )
+    {
+        CONSOLE_SCREEN_BUFFER_INFO info;
+        GetConsoleScreenBufferInfo( hstdout, &info );
+        normal_attributes = info.wAttributes;
+    }
+
+    SetConsoleTextAttribute( hstdout,
+        (WORD)(color == CV_TS_NORMAL ? normal_attributes :
+        ((color & CV_TS_BLUE ? FOREGROUND_BLUE : 0)|
+        (color & CV_TS_GREEN ? FOREGROUND_GREEN : 0)|
+        (color & CV_TS_RED ? FOREGROUND_RED : 0)|FOREGROUND_INTENSITY)) );
+}
+
+#else
+
+#include <signal.h>
+
+static const int cv_ts_sig_id[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, -1 };
+
+static jmp_buf cv_ts_jmp_mark;
+
+void cv_signal_handler( int sig_code )
+{
+    int code = CvTS::FAIL_EXCEPTION;
+    switch( sig_code )
+    {
+    case SIGFPE:
+        code = CvTS::FAIL_ARITHM_EXCEPTION;
+        break;
+    case SIGSEGV:
+    case SIGBUS:
+        code = CvTS::FAIL_ARITHM_EXCEPTION;
+        break;
+    case SIGILL:
+        code = CvTS::FAIL_EXCEPTION;
+    }
+
+    longjmp( cv_ts_jmp_mark, code );
+}
+
+#define CV_TS_TRY_BLOCK_BEGIN                   \
+    {                                           \
+        int _code = setjmp( cv_ts_jmp_mark );   \
+        if( !_code ) {
+
+#define CV_TS_TRY_BLOCK_END                     \
+        }                                       \
+        else  {                                 \
+            ts->set_failed_test_info( _code );  \
+        }                                       \
+    }
+
+static void change_color( int color )
+{
+    static const uchar ansi_tab[] = { 30, 34, 32, 36, 31, 35, 33, 37 };
+    char buf[16];
+    int code = 0;
+    fflush( stdout );
+    if( color != CV_TS_NORMAL )
+        code = ansi_tab[color & (CV_TS_BLUE|CV_TS_GREEN|CV_TS_RED)];
+    sprintf( buf, "\x1b[%dm", code );
+    printf( buf );
+}
+
+#endif
+
+
+/***************************** memory manager *****************************/
+
+typedef struct CvTestAllocBlock
+{
+    struct CvTestAllocBlock* prev;
+    struct CvTestAllocBlock* next;
+    char* origin;
+    char* data;
+    size_t size;
+    int index;
+}
+CvTestAllocBlock;
+
+
+class CvTestMemoryManager
+{
+public:
+    CvTestMemoryManager( CvTS* ts );
+    virtual ~CvTestMemoryManager();
+
+    virtual void clear_and_check( int min_index = -1 );
+    virtual void start_tracking( int index_to_stop_at=-1 );
+    virtual void stop_tracking_and_check();
+    int get_alloc_index() { return index; }
+
+    static void* alloc_proxy( size_t size, void* userdata );
+    static int free_proxy( void* ptr, void* userdata );
+
+protected:
+
+    virtual void* alloc( size_t size );
+    virtual int free( void* ptr );
+    virtual int free_block( CvTestAllocBlock* block );
+
+    int index;
+    int track_blocks;
+    int show_msg_box;
+    int index_to_stop_at;
+    const char* guard_pattern;
+    int guard_size;
+    int block_align;
+    enum { MAX_MARKS = 1024 };
+    int marks[MAX_MARKS];
+    int marks_top;
+    CvTS* ts;
+    CvTestAllocBlock* first;
+    CvTestAllocBlock* last;
+};
+
+
+void* CvTestMemoryManager::alloc_proxy( size_t size, void* userdata )
+{
+    return ((CvTestMemoryManager*)userdata)->alloc( size );
+}
+
+
+int CvTestMemoryManager::free_proxy( void* ptr, void* userdata )
+{
+    return ((CvTestMemoryManager*)userdata)->free( ptr );
+}
+
+
+CvTestMemoryManager::CvTestMemoryManager( CvTS* _test_system )
+{
+    ts = _test_system;
+    guard_pattern = "THIS IS A GUARD PATTERN!";
+    guard_size = strlen(guard_pattern);
+    block_align = CV_MALLOC_ALIGN;
+    track_blocks = 0;
+    marks_top = 0;
+    first = last = 0;
+    index = 0;
+    index_to_stop_at = -1;
+    show_msg_box = 1;
+}
+
+
+CvTestMemoryManager::~CvTestMemoryManager()
+{
+    clear_and_check();
+}
+
+
+void CvTestMemoryManager::clear_and_check( int min_index )
+{
+    int alloc_index = -1;
+    CvTestAllocBlock* block;
+    int leak_size = 0, leak_block_count = 0, mem_size = 0;
+    void* mem_addr = 0; 
+
+    while( marks_top > 0 && marks[marks_top - 1] >= min_index )
+        marks_top--;
+
+    for( block = last; block != 0; )
+    {
+        CvTestAllocBlock* prev = block->prev;
+        if( block->index < min_index )
+            break;
+        leak_size += block->size;
+        leak_block_count++;
+        alloc_index = block->index;
+        mem_addr = block->data;
+        mem_size = block->size;
+        free_block( block );
+        block = prev;
+    }
+    track_blocks--;
+    if( leak_block_count > 0 )
+    {
+        ts->set_failed_test_info( CvTS::FAIL_MEMORY_LEAK, alloc_index );
+        ts->printf( CvTS::LOG, "Memory leaks: %u blocks, %u bytes total\n"
+                    "%s leaked block: %p, %u bytes\n",
+                    leak_block_count, leak_size, leak_block_count > 1 ? "The first" : "The",
+                    mem_addr, mem_size ); 
+    }
+
+    index = block ? block->index + 1 : 0;
+}
+
+
+void CvTestMemoryManager::start_tracking( int _index_to_stop_at )
+{
+    track_blocks--;
+    marks[marks_top++] = index;
+    assert( marks_top <= MAX_MARKS );
+    track_blocks+=2;
+    index_to_stop_at = _index_to_stop_at >= index ? _index_to_stop_at : -1;
+}
+
+
+void CvTestMemoryManager::stop_tracking_and_check()
+{
+    if( marks_top > 0 )
+    {
+        int min_index = marks[--marks_top];
+        clear_and_check( min_index );
+    }
+}
+
+
+int CvTestMemoryManager::free_block( CvTestAllocBlock* block )
+{
+    int code = 0;
+    char* data = block->data;
+    
+    if( block->origin == 0 || ((size_t)block->origin & (sizeof(double)-1)) != 0 )
+        code = CvTS::FAIL_MEMORY_CORRUPTION_BEGIN;
+        
+    if( memcmp( data - guard_size, guard_pattern, guard_size ) != 0 )
+        code = CvTS::FAIL_MEMORY_CORRUPTION_BEGIN;
+    else if( memcmp( data + block->size, guard_pattern, guard_size ) != 0 )
+        code = CvTS::FAIL_MEMORY_CORRUPTION_END;
+
+    if( code >= 0 )
+    {
+        if( block->prev )
+            block->prev->next = block->next;
+        else if( first == block )
+            first = block->next;
+
+        if( block->next )
+            block->next->prev = block->prev;
+        else if( last == block )
+            last = block->prev;
+
+        free( block->origin );
+    }
+    else
+    {
+        ts->set_failed_test_info( code, block->index );
+        ts->printf( CvTS::LOG, "Corrupted block (%s): %p, %u bytes\n",
+                    code == CvTS::FAIL_MEMORY_CORRUPTION_BEGIN ? "beginning" : "end",
+                    block->data, block->size );
+    }
+
+    return code;
+}
+
+
+void* CvTestMemoryManager::alloc( size_t size )
+{
+    char* data;
+    CvTestAllocBlock* block;
+    size_t new_size = sizeof(*block) + size + guard_size*2 + block_align + sizeof(size_t)*2;
+    char* ptr = (char*)malloc( new_size );
+
+    if( !ptr )
+        return 0;
+
+    data = (char*)cvAlignPtr( ptr + sizeof(size_t) + sizeof(*block) + guard_size, block_align );
+    block = (CvTestAllocBlock*)cvAlignPtr( data - guard_size -
+            sizeof(size_t) - sizeof(*block), sizeof(size_t) );
+    block->origin = ptr;
+    block->data = data;
+    block->size = 0;
+    block->index = -1;
+    block->next = block->prev = 0;
+    memcpy( data - guard_size, guard_pattern, guard_size );
+    memcpy( data + size, guard_pattern, guard_size );
+
+    if( track_blocks > 0 )
+    {
+        track_blocks--;
+        block->size = size;
+
+        if( index == index_to_stop_at )
+        {
+            if( show_msg_box )
+            {
+        #ifdef WIN32
+                MessageBox( NULL, "The block that is corrupted and/or not deallocated has been just allocated\n"
+                            "Press Ok to start debugging", "Memory Manager", MB_ICONERROR|MB_OK|MB_SYSTEMMODAL );
+        #endif
+            }
+            CV_DBG_BREAK();
+        }
+
+        block->index = index++;
+
+        block->prev = last;
+        block->next = 0;
+        if( last )
+            last = last->next = block;
+        else
+            first = last = block;
+
+        track_blocks++;
+    }
+
+    return data;
+}
+
+
+int CvTestMemoryManager::free( void* ptr )
+{
+    char* data = (char*)ptr;
+    CvTestAllocBlock* block = (CvTestAllocBlock*)
+        cvAlignPtr( data - guard_size - sizeof(size_t) - sizeof(*block), sizeof(size_t) );
+
+    int code = free_block( block );
+    if( code < 0 && ts->is_debug_mode() )
+        CV_DBG_BREAK();
+    return 0;
+}
+
+
+/***************************** error handler *****************************/
+
+#if 0
+static int cvTestErrorCallback( int status, const char* func_name, const char* err_msg,
+                         const char* file_name, int line, void* userdata )
+{
+    if( status < 0 && status != CV_StsBackTrace && status != CV_StsAutoTrace )
+        ((CvTS*)userdata)->set_failed_test_info( CvTS::FAIL_ERROR_IN_CALLED_FUNC );
+
+    // print error message
+    return cvStdErrReport( status, func_name, err_msg, file_name, line, 0 );
+}
+#endif
+
+/*****************************************************************************************\
+*                                    Base Class for Tests                                 *
+\*****************************************************************************************/
+
+CvTest::CvTest( const char* _test_name, const char* _test_funcs, const char* _test_descr ) :
+    name(_test_name ? _test_name : ""), tested_functions(_test_funcs ? _test_funcs : ""),
+    description(_test_descr ? _test_descr : ""), ts(0)
+{
+    if( last )
+        last->next = this;
+    else
+        first = this;
+    last = this;
+    test_count++;
+    ts = 0;
+}
+
+CvTest::~CvTest()
+{
+    clear();
+}
+
+
+void CvTest::clear()
+{
+}
+
+
+int CvTest::init( CvTS* _test_system )
+{
+    clear();
+    ts = _test_system;
+    return read_params( ts->get_file_storage() );
+}
+
+
+int CvTest::read_params( CvFileStorage* /*fs*/ )
+{
+    return 0;
+}
+
+
+int CvTest::write_default_params(CvFileStorage*)
+{
+    return 0;
+}
+
+
+int CvTest::get_timing_mode( int )
+{
+    return ts->get_timing_mode();
+}
+
+
+bool CvTest::can_do_fast_forward()
+{
+    return true;
+}
+
+
+void CvTest::safe_run( int start_from )
+{
+    CV_TS_TRY_BLOCK_BEGIN;
+
+    run( start_from );
+
+    CV_TS_TRY_BLOCK_END;
+}
+
+
+void CvTest::run( int start_from )
+{
+    int i, test_case_idx, count = get_test_case_count();
+    int64 t_start = cvGetTickCount();
+    double freq = cvGetTickFrequency();
+    bool ff = can_do_fast_forward();
+    int progress = 0;
+    
+    for( test_case_idx = ff && start_from >= 0 ? start_from : 0;
+         count < 0 || test_case_idx < count; test_case_idx++ )
+    {
+        ts->update_context( this, test_case_idx, ff );
+        int timing_mode = get_timing_mode( test_case_idx );
+        int64 t00 = 0, t0, t1 = 0;
+        double t_acc = 0;
+
+        if( prepare_test_case( test_case_idx ) < 0 || ts->get_err_code() < 0 )
+            return;
+
+        for( i = 0; i < (timing_mode ? 10 : 1); i++ )
+        {
+            t0 = cvGetTickCount();
+            run_func();
+            t1 = cvGetTickCount();
+            if( ts->get_err_code() < 0 )
+                return;
+
+            if( !timing_mode || i == 0 )
+            {
+                t_acc = (double)(t1 - t0);
+                t00 = t0;
+            }
+            else
+            {
+                t0 = t1 - t0;
+                
+                if( timing_mode == CvTS::MIN_TIME )
+                {
+                    if( (double)t0 < t_acc )
+                        t_acc = (double)t0;
+                }
+                else
+                {
+                    assert( timing_mode == CvTS::AVG_TIME );
+                    t_acc += (double)t0;
+                }
+                
+                if( t1 - t00 > freq*2000000 )
+                    break;
+            }
+        }
+
+        if( timing_mode )
+        {
+            if( timing_mode == CvTS::AVG_TIME )
+                t_acc /= i;
+            print_time( test_case_idx, t_acc );
+        }
+
+        if( validate_test_results( test_case_idx ) < 0 || ts->get_err_code() < 0 )
+            return;
+
+        progress = update_progress( progress, test_case_idx, count, (double)(t1 - t_start)/(freq*1000) );
+    }
+}
+
+
+int CvTest::get_test_case_count()
+{
+    return -1;
+}
+
+
+int CvTest::prepare_test_case( int )
+{
+    return 0;
+}
+
+
+int CvTest::validate_test_results( int )
+{
+    return 0;
+}
+
+
+void CvTest::print_time( int /*test_case_idx*/, double /*time_usecs*/ )
+{
+}
+
+
+int CvTest::update_progress( int progress, int test_case_idx, int count, double dt )
+{
+    int width = 60 - strlen(get_name());
+    if( count > 0 )
+    {
+        int t = cvRound( ((double)test_case_idx * width)/count );
+        if( t > progress )
+        {
+            ts->printf( CvTS::CONSOLE, "." );
+            progress = t;
+        }
+    }
+    else if( cvRound(dt*0.001) > progress )
+    {
+        ts->printf( CvTS::CONSOLE, "." );
+        progress = cvRound(dt*0.001);
+    }
+
+    return progress;
+}
+
+/*****************************************************************************************\
+*                                 Base Class for Test System                              *
+\*****************************************************************************************/
+
+/******************************** Constructors/Destructors ******************************/
+
+CvTS::CvTS()
+{
+    start_time = 0;
+    version = CV_TS_VERSION;
+    memory_manager = 0;
+    /*
+    memory_manager = new CvTestMemoryManager(this);
+    cvSetMemoryManager( CvTestMemoryManager::alloc_proxy,
+                        CvTestMemoryManager::free_proxy,
+                        memory_manager );*/
+    ostrm_suffixes[SUMMARY_IDX] = ".sum";
+    ostrm_suffixes[LOG_IDX] = ".log";
+    ostrm_suffixes[CSV_IDX] = ".csv";
+    ostrm_suffixes[CONSOLE_IDX] = 0;
+    ostrm_base_name = 0;
+    memset( output_streams, 0, sizeof(output_streams) );
+    selected_tests = new CvTestPtrVec();
+    failed_tests = new CvTestInfoVec();
+
+    clear();
+}
+
+
+void CvTS::clear()
+{
+    int i;
+    CvTest* test;
+    for( test = get_first_test(); test != 0; test = test->get_next() )
+        test->clear();
+
+    for( i = 0; i <= CONSOLE_IDX; i++ )
+    {
+        if( i == LOG_IDX )
+            fflush( stderr );
+        else if( i == CONSOLE_IDX )
+            fflush( stdout );
+
+        if( i < CONSOLE_IDX && output_streams[i].f )
+        {
+            fclose( output_streams[i].f );
+            output_streams[i].f = 0;
+        }
+        
+        if( i == LOG_IDX && output_streams[i].default_handle > 0 )
+        {
+            dup2( output_streams[i].default_handle, 2 );
+            output_streams[i].default_handle = 0;
+        }
+        output_streams[i].enable = 1;
+    }
+    cvReleaseFileStorage( &fs );
+    selected_tests->clear();
+    failed_tests->clear();
+    if( ostrm_base_name )
+    {
+        free( ostrm_base_name );
+        ostrm_base_name = 0;
+    }
+    params.rng_seed = (uint64)-1;
+    params.debug_mode = 1;
+    params.print_only_failed = 0;
+    params.skip_header = 0;
+    params.timing_mode = NO_TIME;
+
+    if( memory_manager )
+        memory_manager->clear_and_check();
+}
+
+
+CvTS::~CvTS()
+{
+    clear();
+    delete selected_tests;
+    delete failed_tests;
+    cvSetMemoryManager( 0, 0 );
+}
+
+
+const char* CvTS::str_from_code( int code )
+{
+    switch( code )
+    {
+    case OK: return "Ok";
+    case FAIL_GENERIC: return "Generic/Unknown";
+    case FAIL_MISSING_TEST_DATA: return "No test data";
+    case FAIL_ERROR_IN_CALLED_FUNC: return "cvError invoked";
+    case FAIL_EXCEPTION: return "Hardware/OS exception";
+    case FAIL_MEMORY_EXCEPTION: return "Invalid memory access";
+    case FAIL_ARITHM_EXCEPTION: return "Arithmetic exception";
+    case FAIL_MEMORY_CORRUPTION_BEGIN: return "Corrupted memblock (beginning)";
+    case FAIL_MEMORY_CORRUPTION_END: return "Corrupted memblock (end)";
+    case FAIL_MEMORY_LEAK: return "Memory leak";
+    case FAIL_INVALID_OUTPUT: return "Invalid function output";
+    case FAIL_MISMATCH: return "Unexpected output";
+    case FAIL_BAD_ACCURACY: return "Bad accuracy";
+    case FAIL_HANG: return "Infinite loop(?)";
+    case FAIL_BAD_ARG_CHECK: return "Incorrect handling of bad arguments";
+    default: return "Generic/Unknown";
+    }
+}
+
+/************************************** Running tests **********************************/
+
+void CvTS::make_output_stream_base_name( const char* config_name )
+{
+    int k, len = strlen( config_name );
+
+    if( ostrm_base_name )
+        free( ostrm_base_name );
+
+    for( k = len-1; k >= 0; k-- )
+    {
+        char c = config_name[k];
+        if( c == '.' || c == '/' || c == '\\' || c == ':' )
+            break;
+    }
+
+    if( k > 0 && config_name[k] == '.' )
+        len = k;
+    
+    ostrm_base_name = (char*)malloc( len + 1 );
+    memcpy( ostrm_base_name, config_name, len );
+    ostrm_base_name[len] = '\0';
+}
+
+
+void CvTS::set_handlers( bool on )
+{
+    if( on )
+    {
+        cvSetErrMode( CV_ErrModeParent );
+        cvRedirectError( cvStdErrReport );
+    #ifdef WIN32
+        #ifdef _MSC_VER
+        _set_se_translator( cv_seh_translator );
+        #endif
+    #else
+        for( int i = 0; cv_ts_sig_id[i] >= 0; i++ )
+            signal( cv_ts_sig_id[i], cv_signal_handler );
+    #endif
+    }
+    else
+    {
+        cvSetErrMode( CV_ErrModeLeaf );
+        cvRedirectError( cvGuiBoxReport );
+    #ifdef WIN32
+        #ifdef _MSC_VER
+        _set_se_translator( 0 );
+        #endif
+    #else
+        for( int i = 0; cv_ts_sig_id[i] >= 0; i++ )
+            signal( cv_ts_sig_id[i], SIG_DFL );
+    #endif
+    }
+}
+
+#ifndef MAX_PATH
+#define MAX_PATH 1024
+#endif
+
+int CvTS::run( int argc, char** argv )
+{
+    time( &start_time );
+    
+    int i, write_params = 0;
+    CvTest* test;
+
+    // 0. reset all the parameters
+    clear();
+
+    // 1. parse command line options
+    for( i = 1; i < argc; i++ )
+    {
+        if( argv[i] && argv[i][0] != '-' )
+        {
+            config_name = argv[i];
+            break;
+        }
+        else
+        {
+            if( strcmp( argv[i], "-w" ) == 0 )
+                write_params = 1;
+        }
+    }
+
+    if( write_params )
+    {
+        if( !config_name )
+        {
+            printf( LOG, "ERROR: output config name is not specified\n" );
+            return -1;
+        }
+        fs = cvOpenFileStorage( config_name, 0, CV_STORAGE_WRITE );
+        if( !fs )
+        {
+            printf( LOG, "ERROR: could not open config file %s", config_name );
+            return -1;
+        }
+        cvWriteComment( fs, CV_TS_VERSION " config file", 0 );
+        cvStartWriteStruct( fs, "common", CV_NODE_MAP );
+        write_default_params( fs );
+        cvEndWriteStruct( fs );
+
+        for( test = get_first_test(); test != 0; test = test->get_next() )
+        {
+            cvStartWriteStruct( fs, test->get_name(), CV_NODE_MAP );
+            test->write_default_params( fs );
+            cvEndWriteStruct( fs );
+            test->clear();
+        }
+        cvReleaseFileStorage( &fs );
+        return 0;
+    }
+
+    if( !config_name )
+        printf( LOG, "WARNING: config name is not specified, using default parameters\n" );
+    else
+    {
+        // 2. read common parameters of test system
+        fs = cvOpenFileStorage( config_name, 0, CV_STORAGE_READ );
+        if( !fs )
+        {
+            printf( LOG, "ERROR: could not open config file %s", config_name );
+            return -1;
+        }
+    }
+
+    if( read_params(fs) < 0 )
+        return -1;
+
+    if( !ostrm_base_name )
+        make_output_stream_base_name( config_name ? config_name : argv[0] );
+
+    ostream_testname_mask = -1; // disable printing test names at initial stage
+
+    // 3. open file streams
+    for( i = 0; i < CONSOLE_IDX; i++ )
+    {
+        char filename[MAX_PATH];
+        sprintf( filename, "%s%s", ostrm_base_name, ostrm_suffixes[i] );
+        output_streams[i].f = fopen( filename, "wt" );
+        if( !output_streams[i].f )
+        {
+            printf( LOG, "ERROR: could not open %s\n", filename );
+            return -1;
+        }
+
+        if( i == LOG_IDX )
+        {
+            // redirect stderr to log file
+            fflush( stderr );
+            output_streams[i].default_handle = dup(2);
+            dup2( fileno(output_streams[i].f), 2 );
+        }
+    }
+
+    // 4. traverse through the list of all registered tests.
+    // Initialize the selected tests and put them into the separate sequence
+    for( test = get_first_test(); test != 0; test = test->get_next() )
+    {
+        if( filter(test) )
+        {
+            if( test->init(this) >= 0 )
+                selected_tests->push( test );
+            else
+                printf( LOG, "WARNING: an error occured during test %s initialization\n", test->get_name() );
+        }
+    }
+
+    // 5. setup all the neccessary handlers and print header
+    set_handlers( !params.debug_mode );
+
+    if( !params.skip_header )
+        print_summary_header( SUMMARY + LOG + CONSOLE );
+    rng = params.rng_seed;
+    update_context( 0, -1, true );
+
+    // 6. run all the tests
+    for( i = 0; i < selected_tests->size(); i++ )
+    {
+        CvTest* test = (CvTest*)selected_tests->at(i);
+        int code;
+        CvTestInfo temp;
+
+        if( memory_manager )
+            memory_manager->start_tracking();
+        update_context( test, -1, true );
+        ostream_testname_mask = 0; // reset "test name was printed" flags
+
+        temp = current_test_info;
+        test->safe_run(0);
+        if( get_err_code() >= 0 )
+        {
+            update_context( test, -1, false );
+            current_test_info.rng_seed = temp.rng_seed;
+            current_test_info.base_alloc_index = temp.base_alloc_index;
+        }
+        test->clear();
+        if( memory_manager )
+            memory_manager->stop_tracking_and_check();
+
+        code = get_err_code();
+        if( code >= 0 )
+        {
+            if( !params.print_only_failed )
+            {
+                printf( SUMMARY + CONSOLE, "\t" );
+                change_color( CV_TS_GREEN );
+                printf( SUMMARY + CONSOLE, "Ok\n" );
+                change_color( CV_TS_NORMAL );
+            }
+        }
+        else
+        {
+            printf( SUMMARY + CONSOLE, "\t" );
+            change_color( CV_TS_RED );
+            printf( SUMMARY + CONSOLE, "FAIL(%s)\n", str_from_code(code) );
+            change_color( CV_TS_NORMAL );
+            printf( LOG, "context: test case = %d, seed = %08x%08x\n",
+                    current_test_info.test_case_idx,
+                    (unsigned)(current_test_info.rng_seed>>32),
+                    (unsigned)(current_test_info.rng_seed));
+            failed_tests->push(current_test_info);
+            if( params.rerun_immediately )
+                break;
+        }
+    }
+
+    ostream_testname_mask = -1;
+    print_summary_tailer( SUMMARY + CONSOLE + LOG );
+
+    if( !params.debug_mode && (params.rerun_failed || params.rerun_immediately) )
+    {
+        set_handlers(0);
+        update_context( 0, -1, true );
+        for( i = 0; i < failed_tests->size(); i++ )
+        {
+            CvTestInfo info = failed_tests->at(i);
+            if( (info.code == FAIL_MEMORY_CORRUPTION_BEGIN ||
+                info.code == FAIL_MEMORY_CORRUPTION_END ||
+                info.code == FAIL_MEMORY_LEAK) && memory_manager )
+                memory_manager->start_tracking( info.alloc_index - info.base_alloc_index
+                                                + memory_manager->get_alloc_index() );
+            rng = info.rng_seed;
+            test->safe_run( info.test_case_idx );
+        }
+    }
+
+    clear();
+
+    return 0;
+}
+
+
+int CvTS::read_params( CvFileStorage* fs )
+{
+    CvFileNode* node = fs ? cvGetFileNodeByName( fs, 0, "common" ) : 0;
+    params.debug_mode = cvReadIntByName( fs, node, "debug_mode", 1 ) != 0;
+    params.skip_header = cvReadIntByName( fs, node, "skip_header", 0 ) != 0;
+    params.print_only_failed = cvReadIntByName( fs, node, "print_only_failed", 0 ) != 0;
+    params.rerun_failed = cvReadIntByName( fs, node, "rerun_failed", 0 ) != 0;
+    params.rerun_immediately = cvReadIntByName( fs, node, "rerun_immediately", 0 ) != 0;
+    const char* str = cvReadStringByName( fs, node, "filter_mode", "tests" );
+    params.test_filter_mode = strcmp( str, "functions" ) == 0 ? CHOOSE_FUNCTIONS : CHOOSE_TESTS;
+    str = cvReadStringByName( fs, node, "timing_mode", "none" );
+    params.timing_mode = strcmp( str, "average" ) == 0 || strcmp( str, "avg" ) == 0 ? AVG_TIME :
+                         strcmp( str, "minimum" ) == 0 || strcmp( str, "min" ) == 0 ||
+                         strcmp( str, "yes" ) == 0 ? MIN_TIME : NO_TIME;
+    params.test_filter_pattern = cvReadStringByName( fs, node, params.test_filter_mode == CHOOSE_FUNCTIONS ?
+                                                     "functions" : "tests", "" );
+    params.resource_path = cvReadStringByName( fs, node, "." );
+    str = cvReadStringByName( fs, node, "seed", 0 );
+    params.rng_seed = 0;
+    if( str && strlen(str) == 16 )
+    {
+        params.rng_seed = 0;
+        for( int i = 0; i < 16; i++ )
+        {
+            int c = tolower(str[i]);
+            if( !isxdigit(c) )
+            {
+                params.rng_seed = 0;
+                break;
+            }
+            params.rng_seed = params.rng_seed * 16 +
+                (str[i] < 'a' ? str[i] - '0' : str[i] - 'a' + 10);
+        }
+    }
+    
+    if( params.rng_seed == 0 )
+        params.rng_seed = cvGetTickCount();
+
+    str = cvReadStringByName( fs, node, "output_file_base_name", 0 );
+    if( str )
+        make_output_stream_base_name( str );
+
+    return 0;
+}
+
+
+void CvTS::write_default_params( CvFileStorage* fs )
+{
+    read_params(0); // fill parameters with default values
+
+    cvWriteInt( fs, "debug_mode", params.debug_mode );
+    cvWriteInt( fs, "skip_header", params.skip_header );
+    cvWriteInt( fs, "print_only_failed", params.print_only_failed );
+    cvWriteInt( fs, "rerun_failed", params.rerun_failed );
+    cvWriteInt( fs, "rerun_immediately", params.rerun_immediately );
+    cvWriteString( fs, "filter_mode", params.test_filter_mode == CHOOSE_FUNCTIONS ? "functions" : "tests" );
+    cvWriteString( fs, "timing_mode", params.timing_mode == NO_TIME ? "none" :
+                   params.timing_mode == MIN_TIME ? "min" : "avg" );
+    // test_filter, seed & output_file_base_name are not written
+}
+
+
+void CvTS::enable_output_streams( int stream_mask, int value )
+{
+    for( int i = 0; i < MAX_IDX; i++ )
+        if( stream_mask & (1 << i) )
+            output_streams[i].enable = value != 0;
+}
+
+
+void CvTS::update_context( CvTest* test, int test_case_idx, bool update_ts_context )
+{
+    current_test_info.test = test;
+    current_test_info.test_case_idx = test_case_idx;
+    current_test_info.alloc_index = 0;
+    current_test_info.code = 0;
+    cvSetErrStatus( CV_StsOk );
+    if( update_ts_context )
+    {
+        current_test_info.rng_seed = rng;
+        current_test_info.base_alloc_index = memory_manager ?
+            memory_manager->get_alloc_index() : 0;
+    }
+}
+
+
+void CvTS::set_failed_test_info( int fail_code, int alloc_index )
+{
+    if( fail_code == FAIL_MEMORY_CORRUPTION_BEGIN ||
+        fail_code == FAIL_MEMORY_CORRUPTION_END ||
+        current_test_info.code >= 0 )
+    {
+        current_test_info.code = fail_code;
+        current_test_info.alloc_index = alloc_index;
+    }
+}
+
+
+const char* CvTS::get_libs_info( const char** addon_modules )
+{
+    const char* all_info = 0;
+    cvGetModuleInfo( 0, &all_info, addon_modules );
+    return all_info;
+}
+
+void CvTS::print_summary_header( int streams )
+{
+    printf( streams, "Engine: %s\n", version );
+    time_t t1;
+    time( &t1 );
+    struct tm *t2 = localtime( &t1 );
+    char buf[1024];
+    strftime( buf, sizeof(buf)-1, "%c", t2 );
+    printf( streams, "Execution Date & Time: %s\n", buf );
+    printf( streams, "Config File: %s\n", config_name );
+    const char* addon_modules = 0;
+    const char* lib_verinfo = get_libs_info( &addon_modules );
+    printf( streams, "Tested Libraries: %s\n", lib_verinfo );
+    printf( streams, "Optimized Low-level Addons: %s\n", addon_modules );
+    printf( streams, "=================================================\n");
+}
+    
+void CvTS::print_summary_tailer( int streams )
+{
+    printf( streams, "=================================================\n");
+    if( selected_tests && failed_tests )
+    {
+        time_t end_time;
+        time( &end_time );
+        double total_time = difftime( end_time, start_time );
+        printf( streams, "Summary: %d out of %d tests failed\n",
+            failed_tests->size(), selected_tests->size() );
+        int minutes = cvFloor(total_time/60.);
+        int seconds = cvRound(total_time - minutes*60);
+        int hours = minutes / 60;
+        minutes %= 60;
+        printf( streams, "Running time: %02d:%02d:%02d\n", hours, minutes, seconds );
+    }
+}
+
+
+void CvTS::vprintf( int streams, const char* fmt, va_list l )
+{
+    if( streams )
+    {
+        char str[1 << 14];
+        vsprintf( str, fmt, l );
+
+        for( int i = 0; i < MAX_IDX; i++ )
+        {
+            if( (streams & (1 << i)) && output_streams[i].enable )
+            {
+                FILE* f = i == CONSOLE_IDX ? stdout :
+                          i == LOG_IDX ? stderr : output_streams[i].f;
+                if( f )
+                {
+                    if( !(ostream_testname_mask & (1 << i)) && current_test_info.test )
+                    {
+                        fprintf( f, "-------------------------------------------------\n" );
+                        fprintf( f, "%s: ", current_test_info.test->get_name() );
+                        fflush( f );
+                        ostream_testname_mask |= 1 << i;
+                    }
+                    fputs( str, f );
+                   if( i == CONSOLE_IDX )
+                       fflush(f);
+                }
+            }
+        }
+    }
+}
+
+
+void CvTS::printf( int streams, const char* fmt, ... )
+{
+    if( streams )
+    {
+        va_list l;
+        va_start( l, fmt );
+        vprintf( streams, fmt, l );
+        va_end( l );
+    }
+}
+
+
+static char* cv_strnstr( const char* str, int len,
+                         const char* pattern,
+                         int pattern_len = -1,
+                         int whole_word = 1 )
+{
+    int i;
+
+    if( len < 0 && pattern_len < 0 )
+        return (char*)strstr( str, pattern );
+
+    if( len < 0 )
+        len = strlen( str );
+
+    if( pattern_len < 0 )
+        pattern_len = strlen( pattern );
+
+    for( i = 0; i < len - pattern_len + 1; i++ )
+    {
+        int j = i + pattern_len;
+        if( str[i] == pattern[0] &&
+            memcmp( str + i, pattern, pattern_len ) == 0 &&
+            (!whole_word ||
+            ((i == 0 || !isalnum(str[i-1]) && str[i-1] != '_') &&
+             (j == len || !isalnum(str[j]) && str[j] != '_'))))
+            return (char*)(str + i);
+    }
+
+    return 0;
+}
+
+
+int CvTS::filter( CvTest* test )
+{
+    const char* pattern = params.test_filter_pattern;
+    if( !pattern || strcmp( pattern, "" ) == 0 || strcmp( pattern, "*" ) == 0 )
+        return 1;
+
+    if( params.test_filter_mode == CHOOSE_TESTS )
+    {
+        int found = 0;
+        
+        while( pattern && *pattern )
+        {
+            char *ptr, *endptr = (char*)strchr( pattern, ',' );
+            int len, have_wildcard;
+            int t_name_len;
+
+            if( endptr )
+                *endptr = '\0';
+
+            ptr = (char*)strchr( pattern, '*' );
+            if( ptr )
+            {
+                len = ptr - pattern;
+                have_wildcard = 1;
+            }
+            else
+            {
+                len = strlen( pattern );
+                have_wildcard = 0;
+            }
+
+            t_name_len = strlen( test->get_name() );
+            found = (t_name_len == len || have_wildcard && t_name_len > len) &&
+                    (len == 0 || memcmp( test->get_name(), pattern, len ) == 0);
+            if( endptr )
+            {
+                *endptr = ',';
+                pattern = endptr + 1;
+                while( isspace(*pattern) )
+                    pattern++;
+            }
+
+            if( found || !endptr )
+                break;
+        }
+
+        return found;
+    }
+    else
+    {
+        assert( params.test_filter_mode == CHOOSE_FUNCTIONS );
+        int glob_len = strlen( pattern );
+        const char* ptr = test->get_func_list();
+        const char *tmp_ptr;
+
+        while( ptr && *ptr )
+        {
+            const char* endptr = ptr - 1;
+            const char* name_ptr;
+            const char* name_first_match;
+            int name_len;
+            char c;
+
+            do c = *++endptr;
+            while( isspace(c) );
+
+            if( !c )
+                break;
+
+            assert( isalpha(c) );
+            name_ptr = endptr;
+
+            do c = *++endptr;
+            while( isalnum(c) || c == '_' );
+
+            if( c == ':' ) // class
+            {
+                assert( endptr[1] == ':' );
+                endptr = endptr + 2;
+                name_len = endptr - name_ptr;
+
+                // find the first occurence of the class name
+                // in pattern
+                name_first_match = cv_strnstr( pattern,
+                                      glob_len, name_ptr, name_len, 1 );
+
+                if( *endptr == '*' )
+                {
+                    if( name_first_match )
+                        return 1;
+                }
+                else
+                {
+                    assert( *endptr == '{' ); // a list of methods
+
+                    if( !name_first_match )
+                    {
+                        // skip all the methods, if there is no such a class name
+                        // in pattern
+                        endptr = strchr( endptr, '}' );
+                        assert( endptr != 0 );
+                        endptr--;
+                    }
+
+                    for( ;; )
+                    {
+                        const char* method_name_ptr;
+                        int method_name_len;
+
+                        do c = *++endptr;
+                        while( isspace(c) );
+
+                        if( c == '}' )
+                            break;
+                        assert( isalpha(c) );
+
+                        method_name_ptr = endptr;
+                    
+                        do c = *++endptr;
+                        while( isalnum(c) || c == '_' );
+                    
+                        method_name_len = endptr - method_name_ptr;
+                    
+                        // search for class_name::* or
+                        // class_name::{...method_name...}
+                        tmp_ptr = name_first_match;
+                        do
+                        {
+                            const char* tmp_ptr2;
+                            tmp_ptr += name_len;
+                            if( *tmp_ptr == '*' )
+                                return 1;
+                            assert( *tmp_ptr == '{' );
+                            tmp_ptr2 = strchr( tmp_ptr, '}' );
+                            assert( tmp_ptr2 );
+
+                            if( cv_strnstr( tmp_ptr, tmp_ptr2 - tmp_ptr + 1,
+                                             method_name_ptr, method_name_len, 1 ))
+                                return 1;
+
+                            tmp_ptr = cv_strnstr( tmp_ptr2, glob_len -
+                                                   (tmp_ptr2 - pattern),
+                                                   name_ptr, name_len, 1 );
+                        }
+                        while( tmp_ptr );
+
+                        endptr--;
+                        do c = *++endptr;
+                        while( isspace(c) );
+
+                        if( c != ',' )
+                            endptr--;
+                    }
+                }
+            }
+            else
+            {
+                assert( !c || isspace(c) || c == ',' );
+                name_len = endptr - name_ptr;
+                tmp_ptr = pattern;
+
+                for(;;)
+                {
+                    const char *tmp_ptr2, *tmp_ptr3;
+
+                    tmp_ptr = cv_strnstr( tmp_ptr, glob_len -
+                        (tmp_ptr - pattern), name_ptr, name_len, 1 );
+
+                    if( !tmp_ptr )
+                        break;
+
+                    // make sure it is not a method
+                    tmp_ptr2 = strchr( tmp_ptr, '}' );
+                    if( !tmp_ptr2 )
+                        return 1;
+
+                    tmp_ptr3 = strchr( tmp_ptr, '{' );
+                    if( tmp_ptr3 < tmp_ptr2 )
+                        return 1;
+
+                    tmp_ptr = tmp_ptr2 + 1;
+                }
+
+                endptr--;
+            }
+
+            do c = *++endptr;
+            while( isspace(c) );
+
+            if( c == ',' )
+                endptr++;
+            ptr = endptr;
+        }
+
+        return 0;
+    }
+}
+
+/* End of file. */
diff --git a/opencv/tests/cxts/cxts.h b/opencv/tests/cxts/cxts.h
new file mode 100644 (file)
index 0000000..e9d4152
--- /dev/null
@@ -0,0 +1,645 @@
+/*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*/
+
+#ifndef __CXTS_H__
+#define __CXTS_H__
+
+#include "cxcore.h"
+#include "cxmisc.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <setjmp.h>
+#include <assert.h>
+#include <time.h>
+
+#if _MSC_VER >= 1200
+#pragma warning( disable: 4710 )
+#endif
+
+#define CV_TS_VERSION "CxTest 0.1"
+
+// Helper class for growing vector (to avoid dependency from STL)
+template < typename T > class CvTestVec
+{
+public:
+    CvTestVec() { _max_size = _size = 0; _buf = 0; }
+    ~CvTestVec() { delete[] _buf; }
+    T& operator []( int i ) { assert( (unsigned)i < (unsigned)_size ); return _buf[i]; }
+    T at( int i ) { assert( (unsigned)i < (unsigned)_size ); return _buf[i]; }
+    T pop() { assert( _size > 0 ); return _buf[--_size]; }
+    void push( const T& elem )
+    {
+        if( _size >= _max_size )
+        {
+            int i, _new_size = _max_size < 16 ? 16 : _max_size*3/2;
+            T* temp = new T[_new_size];
+            for( i = 0; i < _size; i++ )
+                temp[i] = _buf[i];
+            delete[] _buf;
+            _max_size = _new_size;
+            _buf = temp;
+        }
+        _buf[_size++] = elem;
+    }
+
+    int size() { return _size; }
+    void clear() { _size = 0; }
+
+protected:
+    T* _buf;
+    int _size, _max_size;
+};
+
+/*****************************************************************************************\
+*                                    Base class for tests                                 *
+\*****************************************************************************************/
+
+class CvTest;
+class CvTS;
+
+class CV_EXPORTS CvTest
+{
+public:
+    // constructor(s) and destructor
+    CvTest( const char* test_name, const char* test_funcs, const char* test_descr = "" );
+    virtual ~CvTest();
+
+    virtual int init( CvTS* system );
+
+    // writes default parameters to file storage
+    virtual int write_default_params(CvFileStorage* fs);
+
+    // the main procedure of the test
+    virtual void run( int start_from );
+
+    // the wrapper for run that cares of exceptions
+    virtual void safe_run( int start_from );
+
+    const char* get_name() { return name; }
+    const char* get_func_list() { return tested_functions; }
+    const char* get_description() { return description; }
+    CvTest* get_next() { return next; }
+    static CvTest* get_first_test() { return first; }
+
+    // returns true iff test cases do not depend on each other
+    // (so that test system could get right to the problematic test cases)
+    virtual bool can_do_fast_forward();
+
+    // deallocates all the memory.
+    // called by init() (before initialization) and by the destructor
+    virtual void clear();
+
+protected:
+    static CvTest* first;
+    static CvTest* last;
+    static int test_count;
+    CvTest* next;
+
+    virtual int read_params( CvFileStorage* fs );
+
+    // returns the number of tests or -1 if it is unknown a-priori
+    virtual int get_test_case_count();
+
+    // prepares data for the next test case. rng seed is updated by the function
+    virtual int prepare_test_case( int test_case_idx );
+
+    // checks if the test output is valid and accurate
+    virtual int validate_test_results( int test_case_idx );
+
+    // calls the tested function. the method is called from run_test_case()
+    virtual void run_func() = 0; // runs tested func(s)
+
+    // retrives timing mode for particular test case
+    virtual int get_timing_mode( int test_case_idx );
+
+    // prints results of timing test
+    virtual void print_time( int test_case_idx, double time_usecs );
+
+    // updates progress bar
+    virtual int update_progress( int progress, int test_case_idx, int count, double dt );
+
+    // name of the test (it is possible to locate a test by its name)
+    const char* name;
+
+    // comma-separated list of functions that are invoked
+    // (and, thus, tested explicitly or implicitly) by the test
+    // methods of classes can be grouped using {}.
+    // a few examples:
+    //    "cvCanny, cvAdd, cvSub, cvMul"
+    //    "CvImage::{Create, CopyOf}, cvMatMulAdd, CvCalibFilter::{PushFrame, SetCameraCount}"
+    const char* tested_functions;
+
+    // description of the test
+    const char* description;
+
+    // pointer to the system that includes the test
+    CvTS* ts;
+};
+
+
+/*****************************************************************************************\
+*                               Information about a failed test                           *
+\*****************************************************************************************/
+
+typedef struct CvTestInfo
+{
+    // pointer to the test
+    CvTest* test;
+
+    // failure code (CV_FAIL*)
+    int code;
+
+    // seed value right before the data for the failed test case is prepared.
+    uint64 rng_seed;
+
+    // index of test case, can be then passed to CvTest::proceed_to_test_case()
+    int test_case_idx;
+
+    // index of the corrupted or leaked block
+    int alloc_index;
+
+    // index of the first block in the group
+    // (used to adjust alloc_index when some test/test cases are skipped).
+    int base_alloc_index;
+}
+CvTestInfo;
+
+/*****************************************************************************************\
+*                                 Base Class for test system                              *
+\*****************************************************************************************/
+
+class CvTestMemoryManager;
+
+typedef CvTestVec<int> CvTestIntVec;
+typedef CvTestVec<void*> CvTestPtrVec;
+typedef CvTestVec<CvTestInfo> CvTestInfoVec;
+
+class CV_EXPORTS CvTS
+{
+public:
+
+    // constructor(s) and destructor
+    CvTS();
+    virtual ~CvTS();
+
+    enum
+    {
+        NUL=0,
+        SUMMARY_IDX=0,
+        SUMMARY=1 << SUMMARY_IDX,
+        LOG_IDX=1,
+        LOG=1 << LOG_IDX,
+        CSV_IDX=2,
+        CSV=1 << CSV_IDX,
+        CONSOLE_IDX=3,
+        CONSOLE=1 << CONSOLE_IDX,
+        MAX_IDX=4
+    };
+
+    // low-level printing functions that are used by individual tests and by the system itself
+    virtual void printf( int streams, const char* fmt, ... );
+    virtual void vprintf( int streams, const char* fmt, va_list arglist );
+
+    // runs the tests (the whole set or some selected tests)
+    virtual int run( int argc, char** argv );
+
+    // updates the context: current test, test case, rng state
+    virtual void update_context( CvTest* test, int test_case_idx, bool update_ts_context );
+
+    const CvTestInfo* get_current_test_info() { return &current_test_info; }
+
+    // sets information about a failed test
+    virtual void set_failed_test_info( int fail_code, int alloc_index = -1 );
+
+    // test error codes
+    enum
+    {
+        // everything is Ok
+        OK=0,
+
+        // generic error: stub value to be used
+        // temporarily if the error's cause is unknown
+        FAIL_GENERIC=-1,
+
+        // the test is missing some essential data to proceed further
+        FAIL_MISSING_TEST_DATA=-2,
+
+        // the tested function raised an error via cxcore error handler
+        FAIL_ERROR_IN_CALLED_FUNC=-3,
+
+        // an exception has been raised;
+        // for memory and arithmetic exception
+        // there are two specialized codes (see below...)
+        FAIL_EXCEPTION=-4,
+
+        // a memory exception
+        // (access violation, access to missed page, stack overflow etc.)
+        FAIL_MEMORY_EXCEPTION=-5,
+
+        // arithmetic exception (overflow, division by zero etc.)
+        FAIL_ARITHM_EXCEPTION=-6,
+
+        // the tested function corrupted memory (no exception have been raised)
+        FAIL_MEMORY_CORRUPTION_BEGIN=-7,
+        FAIL_MEMORY_CORRUPTION_END=-8,
+
+        // the tested function (or test ifself) do not deallocate some memory
+        FAIL_MEMORY_LEAK=-9,
+
+        // the tested function returned invalid object, e.g. matrix, containing NaNs,
+        // structure with NULL or out-of-range fields (while it should not)
+        FAIL_INVALID_OUTPUT=-10,
+
+        // the tested function returned valid object, but it does not match to
+        // the original (or produced by the test) object
+        FAIL_MISMATCH=-11,
+
+        // the tested function returned valid object (a single number or numerical array),
+        // but it differs too much from the original (or produced by the test) object
+        FAIL_BAD_ACCURACY=-12,
+
+        // the tested function hung. Sometimes, can be determined by unexpectedly long
+        // processing time (in this case there should be possibility to interrupt such a function
+        FAIL_HANG=-13,
+
+        // unexpected responce on passing bad arguments to the tested function
+        // (the function crashed, proceed succesfully (while it should not), or returned
+        // error code that is different from what is expected)
+        FAIL_BAD_ARG_CHECK=-14,
+
+        // the test has been skipped because it is not in the selected subset of the tests to run,
+        // because it has been run already within the same run with the same parameters, or because
+        // of some other reason and this is not considered as an error.
+        // Normally CvTS::run() (or overrided method in the derived class) takes care of what
+        // needs to be run, so this code should not occur.
+        SKIPPED=1
+    };
+
+    // get file storage
+    CvFileStorage* get_file_storage() { return fs; }
+
+    // get RNG to generate random input data for a test
+    CvRNG* get_rng() { return &rng; }
+
+    // returns the current error code
+    int get_err_code() { return current_test_info.code; }
+
+    // retrieves the first registered test
+    CvTest* get_first_test() { return CvTest::get_first_test(); }
+
+    // retrieves one of global options of the test system
+    bool is_debug_mode() { return params.debug_mode; }
+
+    // timing modes:
+    enum { NO_TIME = 0, AVG_TIME = 1, MIN_TIME = 2 };
+
+    // returns the current timing mode
+    int get_timing_mode() { return params.timing_mode; }
+
+protected:
+    // deallocates memory buffers and closes all the streams;
+    // called by init() and from destructor. It does not remove any tests!!!
+    virtual void clear();
+
+    // retrieves information about the test libraries (names, versions, build dates etc.)
+    virtual const char* get_libs_info( const char** loaded_ipp_modules );
+
+    // returns textual description of failure code
+    virtual const char* str_from_code( int code );
+
+    // prints header of summary of test suite run.
+    // It goes before the results of individual tests and contains information about tested libraries
+    // (as reported by get_libs_info()), information about test environment (CPU, test machine name),
+    // date and time etc.
+    virtual void print_summary_header( int streams );
+
+    // prints tailer of summary of test suite run.
+    // it goes after the results of individual tests and contains the number of
+    // failed tests, total running time, exit code (whether the system has been crashed,
+    // interrupted by the user etc.), names of files with additional information etc.
+    virtual void print_summary_tailer( int streams );
+
+    // reads common parameters of the test system; called from init()
+    virtual int read_params( CvFileStorage* fs );
+
+    // checks, whether the test needs to be run (1) or not (0); called from run()
+    virtual int filter( CvTest* test );
+
+    // makes base name of output files
+    virtual void make_output_stream_base_name( const char* config_name );
+
+    // forms default test configuration file that can be
+    // customized further
+    virtual void write_default_params( CvFileStorage* fs );
+
+    // enables/disables the specific output stream[s]
+    virtual void enable_output_streams( int streams, int flag );
+
+    // sets memory and exception handlers
+    virtual void set_handlers( bool on );
+
+    // a sequence of tests to run
+    CvTestPtrVec* selected_tests;
+
+    // a sequence of failed tests
+    CvTestInfoVec* failed_tests;
+
+    // base name for output streams
+    char* ostrm_base_name;
+    char* ostrm_suffixes[MAX_IDX];
+
+    // parameters that can be read from file storage
+    CvFileStorage* fs;
+
+    enum { CHOOSE_TESTS = 0, CHOOSE_FUNCTIONS = 1 };
+
+    // common parameters:
+    struct
+    {
+        // if non-zero, the tests are run in unprotected mode to debug possible crashes,
+        // otherwise the system tries to catch the exceptions and continue with other tests
+        bool debug_mode;
+
+        // if non-zero, the header is not print
+        bool skip_header;
+
+        // if non-zero, the system includes only failed tests into summary
+        bool print_only_failed;
+
+        // rerun failed tests in debug mode
+        bool rerun_failed;
+
+        // if non-zero, the failed tests are rerun immediately
+        bool rerun_immediately;
+
+        // choose_tests or choose_functions;
+        int  test_filter_mode;
+
+        // timing mode
+        int  timing_mode;
+
+        // pattern for choosing tests
+        const char* test_filter_pattern;
+
+        // RNG seed, passed to and updated by every test executed.
+        uint64 rng_seed;
+
+        // relative or absolute path of directory containing subfolders with test data
+        const char* resource_path;
+    }
+    params;
+
+    // these are allocated within a test to try keep them valid in case of stack corruption
+    CvRNG rng;
+
+    // test system start time
+    time_t start_time;
+
+    // test system version (=CV_TS_VERSION by default)
+    const char* version;
+
+    // name of config file
+    const char* config_name;
+
+    // information about the current test
+    CvTestInfo current_test_info;
+
+    // memory manager used to detect memory corruptions and leaks
+    CvTestMemoryManager* memory_manager;
+
+    // output streams
+    struct StreamInfo
+    {
+        FILE* f;
+        //const char* filename;
+        int default_handle; // for stderr
+        int enable;
+    };
+
+    StreamInfo output_streams[MAX_IDX];
+    int ostream_testname_mask;
+};
+
+
+/*****************************************************************************************\
+*            Subclass of CvTest for testing functions that process dense arrays           *
+\*****************************************************************************************/
+
+class CV_EXPORTS CvArrTest : public CvTest
+{
+public:
+    // constructor(s) and destructor
+    CvArrTest( const char* test_name, const char* test_funcs, const char* test_descr = "" );
+    virtual ~CvArrTest();
+
+    virtual int write_default_params( CvFileStorage* fs );
+    virtual void clear();
+
+protected:
+
+    virtual int read_params( CvFileStorage* fs );
+    virtual int prepare_test_case( int test_case_idx );
+    virtual int validate_test_results( int test_case_idx );
+
+    virtual int get_test_case_count();
+    virtual void prepare_to_validation( int test_case_idx ) = 0;
+    virtual void get_test_array_types_and_sizes( int test_case_idx, CvSize** sizes, int** types );
+    virtual void fill_array( int test_case_idx, int i, int j, CvMat* arr );
+    virtual void get_minmax_bounds( int i, int j, int type, CvScalar* low, CvScalar* high );
+    virtual double get_success_error_level( int test_case_idx, int i, int j );
+
+    int test_case_count;
+    bool cvmat_allowed;
+    bool iplimage_allowed;
+    bool optional_mask;
+    bool element_wise_relative_error;
+
+    int min_log_array_size;
+    int max_log_array_size;
+
+    int max_arr; // = MAX_ARR by default, the number of different types of arrays
+    int max_hdr; // size of header buffer
+    enum { INPUT, INPUT_OUTPUT, OUTPUT, REF_INPUT_OUTPUT, REF_OUTPUT, TEMP, MASK, MAX_ARR };
+    CvTestPtrVec* test_array;
+    CvMat* test_mat[MAX_ARR];
+    CvMat* hdr;
+    float buf[4];
+};
+
+
+/****************************************************************************************\
+*                                 Utility Functions                                      *
+\****************************************************************************************/
+
+inline  int cvTsClipInt( int val, int min_val, int max_val )
+{
+    if( val < min_val )
+        val = min_val;
+    if( val > max_val )
+        val = max_val;
+    return val;
+}
+
+// return min & max values for given type, e.g. for CV_8S ~  -128 and 127, respectively.
+CV_EXPORTS double cvTsMinVal( int type );
+CV_EXPORTS double cvTsMaxVal( int type );
+
+// returns c-norm of the array
+CV_EXPORTS double cvTsMaxVal( const CvMat* arr );
+
+inline CvMat* cvTsGetMat( const CvMat* arr, CvMat* stub, int* coi=0 )
+{
+    return cvGetMat( arr, stub, coi );
+}
+
+// fills array with random numbers
+CV_EXPORTS void cvTsRandUni( CvRNG* rng, CvMat* a, CvScalar param1, CvScalar param2 );
+
+inline  unsigned cvTsRandInt( CvRNG* rng )
+{
+    uint64 temp = *rng;
+    temp = (uint64)(unsigned)temp*1554115554 + (temp >> 32);
+    *rng = temp;
+    return (unsigned)temp;
+}
+
+inline  double cvTsRandReal( CvRNG* rng )
+{
+    return cvTsRandInt( rng ) * 2.3283064365386962890625e-10 /* 2^-32 */;
+}
+
+// fills c with zeros
+CV_EXPORTS void cvTsZero( CvMat* c );
+
+// initializes scaled identity matrix
+CV_EXPORTS void cvTsSetIdentity( CvMat* c, CvScalar diag_value );
+
+// copies a to b (whole matrix or only the selected region)
+CV_EXPORTS void cvTsCopy( const CvMat* a, CvMat* b, const CvMat* mask=0 );
+
+// converts one array to another
+CV_EXPORTS void  cvTsConvert( const CvMat* src, CvMat* dst );
+
+// working with multi-channel arrays
+CV_EXPORTS void cvTsExtract( const CvMat* a, CvMat* plane, int coi );
+CV_EXPORTS void cvTsInsert( const CvMat* plane, CvMat* a, int coi );
+
+// c = alpha*a + beta*b + gamma
+CV_EXPORTS void cvTsAdd( const CvMat* a, CvScalar alpha, const CvMat* b, CvScalar beta,
+                    CvScalar gamma, CvMat* c, int calc_abs );
+
+// c = a*b*alpha
+CV_EXPORTS void cvTsMul( const CvMat* _a, const CvMat* _b, CvScalar alpha, CvMat* _c );
+
+// c = a*alpha/b
+CV_EXPORTS void cvTsDiv( const CvMat* _a, const CvMat* _b, CvScalar alpha, CvMat* _c );
+
+enum { CV_TS_MIN = 0, CV_TS_MAX = 1 };
+
+// min/max
+CV_EXPORTS void cvTsMinMax( const CvMat* _a, const CvMat* _b, CvMat* _c, int op_type );
+CV_EXPORTS void cvTsMinMaxS( const CvMat* _a, double scalar, CvMat* _c, int op_type );
+
+// checks that the array does not have NaNs and/or Infs and all the elements are
+// within [min_val,max_val). idx is the index of the first "bad" element.
+CV_EXPORTS int cvTsCheck( const CvMat* data, double min_val, double max_val, CvPoint* idx );
+
+// compares two arrays. max_diff is the maximum actual difference,
+// success_err_level is maximum allowed difference, idx is the index of the first
+// element for which difference is >success_err_level
+// (or index of element with the maximum difference)
+CV_EXPORTS int cvTsCmpEps( const CvMat* data, const CvMat* etalon, double* max_diff,
+                      double success_err_level, CvPoint* idx,
+                      bool element_wise_relative_error );
+
+// compares two arrays. the result is 8s image that takes values -1, 0, 1
+CV_EXPORTS void cvTsCmp( const CvMat* a, const CvMat* b, CvMat* result, int cmp_op );
+
+// compares array and a scalar.
+CV_EXPORTS void cvTsCmpS( const CvMat* a, double fval, CvMat* result, int cmp_op );
+
+// retrieves C, L1 or L2 norm of array or its region
+CV_EXPORTS double cvTsNorm( const CvMat* _arr, const CvMat* _mask, int norm_type, int coi );
+
+// retrieves mean, standard deviation and the number of nonzero mask pixels
+CV_EXPORTS int cvTsMeanStdDevNonZero( const CvMat* _arr, const CvMat* _mask,
+                           CvScalar* _mean, CvScalar* _stddev, int coi );
+
+// retrieves global extremums and their positions
+CV_EXPORTS void cvTsMinMaxLoc( const CvMat* _arr, const CvMat* _mask,
+                    double* _minval, double* _maxval,
+                    CvPoint* _minidx, CvPoint* _maxidx, int coi );
+
+enum { CV_TS_LOGIC_AND = 0, CV_TS_LOGIC_OR = 1, CV_TS_LOGIC_XOR = 2, CV_TS_LOGIC_NOT = 3 };
+
+CV_EXPORTS void cvTsLogic( const CvMat* a, const CvMat* b, CvMat* c, int logic_op );
+CV_EXPORTS void cvTsLogicS( const CvMat* a, CvScalar s, CvMat* c, int logic_op );
+
+enum { CV_TS_GEMM_A_T = 1, CV_TS_GEMM_B_T = 2, CV_TS_GEMM_C_T = 4 };
+
+CV_EXPORTS void cvTsGEMM( const CvMat* a, const CvMat* b, double alpha,
+                     const CvMat* c, double beta, CvMat* d, int flags );
+
+CV_EXPORTS void cvTsConvolve2D( const CvMat* a, CvMat* b, const CvMat* kernel, CvPoint anchor );
+// op_type == CV_TS_MIN/CV_TS_MAX
+CV_EXPORTS void cvTsMinMaxFilter( const CvMat* a, CvMat* b, const CvMat* kernel,
+                             CvPoint anchor, int op_type );
+
+enum { CV_TS_BORDER_REPLICATE = 0, CV_TS_BORDER_FILLZERO = 2, CV_TS_BORDER_FILLMIN = 3,
+       CV_TS_BORDER_FILLMAX = 4, CV_TS_BORDER_REFLECT = 5 };
+
+CV_EXPORTS void cvTsPrepareToFilter( const CvMat* a, CvMat* b, CvPoint ofs,
+                                int border_mode = CV_TS_BORDER_REPLICATE );
+
+CV_EXPORTS double cvTsCrossCorr( const CvMat* a, const CvMat* b );
+
+CV_EXPORTS CvMat* cvTsSelect( const CvMat* a, CvMat* header, CvRect rect );
+
+CV_EXPORTS CvMat* cvTsTranspose( const CvMat* a, CvMat* b );
+CV_EXPORTS void cvTsFlip( const CvMat* a, CvMat* b, int flip_type );
+
+CV_EXPORTS void cvTsTransform( const CvMat* a, CvMat* b, const CvMat* transmat, const CvMat* shift );
+
+// modifies values that are close to zero
+CV_EXPORTS void  cvTsPatchZeros( CvMat* mat, double level );
+
+#endif/*__CXTS_H__*/
+
diff --git a/opencv/tests/cxts/cxts_arrtest.cpp b/opencv/tests/cxts/cxts_arrtest.cpp
new file mode 100644 (file)
index 0000000..449ada5
--- /dev/null
@@ -0,0 +1,394 @@
+/*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*/
+
+#include "_cxts.h"
+
+static const int default_test_case_count = 500;
+static const int default_max_log_array_size = 9;
+
+CvArrTest::CvArrTest( const char* _test_name, const char* _test_funcs, const char* _test_descr ) :
+    CvTest( _test_name, _test_funcs, _test_descr )
+{
+    test_case_count = default_test_case_count;
+
+    iplimage_allowed = true;
+    cvmat_allowed = true;
+    optional_mask = true;
+    min_log_array_size = 0;
+    max_log_array_size = default_max_log_array_size;
+    element_wise_relative_error = true;
+
+    max_arr = MAX_ARR;
+    test_array = new CvTestPtrVec[max_arr];
+    max_hdr = 0;
+    hdr = 0;
+}
+
+
+CvArrTest::~CvArrTest()
+{
+    clear();
+    delete[] test_array;
+    test_array = 0;
+}
+
+
+int CvArrTest::write_default_params( CvFileStorage* fs )
+{
+    cvWriteInt( fs, "test_case_count", test_case_count );
+    cvWriteInt( fs, "min_log_array_size", min_log_array_size );
+    cvWriteInt( fs, "max_log_array_size", max_log_array_size );
+    return 0;
+}
+
+
+void CvArrTest::clear()
+{
+    if( test_array )
+    {
+        int i, j, n;
+
+        for( i = 0; i < max_arr; i++ )
+        {
+            n = test_array[i].size();
+            for( j = 0; j < n; j++ )
+                cvRelease( &test_array[i][j] );
+        }
+    }
+    delete[] hdr;
+    hdr = 0;
+    max_hdr = 0;
+}
+
+
+int CvArrTest::read_params( CvFileStorage* fs )
+{
+    CvFileNode* node = cvGetFileNodeByName( fs, 0, get_name() );
+    min_log_array_size = cvReadIntByName( fs, node, "min_log_array_size", min_log_array_size );
+    max_log_array_size = cvReadIntByName( fs, node, "max_log_array_size",
+                                          max_log_array_size );
+    test_case_count = cvReadIntByName( fs, node, "test_case_count",
+                                       test_case_count );
+
+    min_log_array_size = cvTsClipInt( min_log_array_size, 0, 20 );
+    max_log_array_size = cvTsClipInt( max_log_array_size, min_log_array_size, 20 );
+    test_case_count = cvTsClipInt( test_case_count, 0, 100000 );
+
+    return 0;
+}
+
+
+int CvArrTest::get_test_case_count()
+{
+    return test_case_count;
+}
+
+void CvArrTest::get_test_array_types_and_sizes( int /*test_case_idx*/, CvSize** sizes, int** types )
+{
+    CvRNG* rng = ts->get_rng();
+    CvSize size;
+    double val;
+    int i, j;
+
+    val = cvRandReal(rng) * (max_log_array_size - min_log_array_size) + min_log_array_size;
+    size.width = cvRound( exp(val*CV_LOG2) );
+    val = cvRandReal(rng) * (max_log_array_size - min_log_array_size) + min_log_array_size;
+    size.height = cvRound( exp(val*CV_LOG2) );
+
+    for( i = 0; i < max_arr; i++ )
+    {
+        int count = test_array[i].size();
+        for( j = 0; j < count; j++ )
+        {
+            sizes[i][j] = size;
+            if( i == MASK )
+                types[i][j] = CV_8UC1;
+        }
+    }
+}
+
+
+static const int icvTsTypeToDepth[] =
+{
+    IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U, IPL_DEPTH_16S,
+    IPL_DEPTH_32S, IPL_DEPTH_32F, IPL_DEPTH_64F
+};
+
+
+int CvArrTest::prepare_test_case( int test_case_idx )
+{
+    CvSize** sizes = (CvSize**)malloc( max_arr*sizeof(sizes[0]) );
+    int** types = (int**)malloc( max_arr*sizeof(types[0]) );
+    int i, j, total = 0;
+    CvRNG* rng = ts->get_rng();
+
+    CV_FUNCNAME( "CvArrTest::prepare_test_case" );
+
+    __BEGIN__;
+
+    for( i = 0; i < max_arr; i++ )
+    {
+        int count = test_array[i].size();
+        count = MAX(count, 1);
+        sizes[i] = (CvSize*)malloc( count*sizeof(sizes[i][0]) );
+        types[i] = (int*)malloc( count*sizeof(types[i][0]) );
+    }
+
+    get_test_array_types_and_sizes( test_case_idx, sizes, types );
+
+    for( i = 0; i < max_arr; i++ )
+    {
+        int count = test_array[i].size();
+        total += count;
+        for( j = 0; j < count; j++ )
+        {
+            unsigned t = cvRandInt(rng);
+            int is_image = !cvmat_allowed ? 1 : iplimage_allowed ? (t & 1) : 0;
+            int create_mask = (t & 6) == 0; // ~ each of 3 tests will use mask
+            int use_roi = t & 8;
+            CvSize size = sizes[i][j], whole_size = size;
+            CvRect roi = {0,0,0,0};
+
+            cvRelease( &test_array[i][j] );
+            if( size.width > 0 && size.height > 0 &&
+                types[i][j] >= 0 && (i != MASK || create_mask) )
+            {
+                if( use_roi )
+                {
+                    roi.width = size.width;
+                    roi.height = size.height;
+                    whole_size.width += cvRandInt(rng) % 10;
+                    whole_size.height += cvRandInt(rng) % 10;
+                    if( whole_size.width > size.width )
+                        roi.x = cvRandInt(rng) % (whole_size.width - size.width);
+                    if( whole_size.height > size.height )
+                        roi.y = cvRandInt(rng) % (whole_size.height - size.height);
+                }
+
+                if( is_image )
+                {
+                    CV_CALL( test_array[i][j] = cvCreateImage( whole_size,
+                        icvTsTypeToDepth[CV_MAT_DEPTH(types[i][j])],
+                        CV_MAT_CN(types[i][j]) ));
+                    if( use_roi )
+                        cvSetImageROI( (IplImage*)test_array[i][j], roi );
+                }
+                else
+                {
+                    CV_CALL( test_array[i][j] = cvCreateMat( whole_size.height,
+                                                whole_size.width, types[i][j] ));
+                    if( use_roi )
+                    {
+                        CvMat submat, *mat = (CvMat*)test_array[i][j];
+                        cvGetSubRect( test_array[i][j], &submat, roi );
+                        submat.refcount = mat->refcount;
+                        *mat = submat;
+                    }
+                }
+            }
+        }
+    }
+
+    if( total > max_hdr )
+    {
+        delete hdr;
+        max_hdr = total;
+        hdr = new CvMat[max_hdr];
+    }
+
+    total = 0;
+    for( i = 0; i < max_arr; i++ )
+    {
+        int count = test_array[i].size();
+        test_mat[i] = count > 0 ? hdr + total : 0;
+        for( j = 0; j < count; j++ )
+        {
+            CvArr* arr = test_array[i][j];
+            CvMat* mat = &test_mat[i][j];
+            if( !arr )
+                memset( mat, 0, sizeof(*mat) );
+            else if( CV_IS_MAT( arr ))
+            {
+                *mat = *(CvMat*)arr;
+                mat->refcount = 0;
+            }
+            else
+                cvGetMat( arr, mat, 0, 0 );
+            if( mat->data.ptr )
+                fill_array( test_case_idx, i, j, mat );
+        }
+        total += count;
+    }
+
+    for( i = 0; i < max_arr; i++ )
+    {
+        free( sizes[i] );
+        free( types[i] );
+    }
+
+    __END__;
+
+    free( sizes );
+    free( types );
+    return 0;
+}
+
+
+void CvArrTest::get_minmax_bounds( int i, int /*j*/, int type, CvScalar* low, CvScalar* high )
+{
+    double l, u;
+
+    if( i == MASK )
+    {
+        l = -2;
+        u = 2;
+    }
+    else
+    {
+        l = cvTsMinVal(type);
+        u = cvTsMaxVal(type);
+    }
+
+    *low = cvScalarAll(l);
+    *high = cvScalarAll(u);
+}
+
+
+void CvArrTest::fill_array( int /*test_case_idx*/, int i, int j, CvMat* arr )
+{
+    if( i == REF_INPUT_OUTPUT )
+        cvTsCopy( &test_mat[INPUT_OUTPUT][j], arr, 0 );
+    else if( i == INPUT || i == INPUT_OUTPUT || i == MASK )
+    {
+        int type = cvGetElemType( arr );
+        CvScalar low, high;
+
+        get_minmax_bounds( i, j, type, &low, &high );
+        cvTsRandUni( ts->get_rng(), arr, low, high );
+    }
+}
+
+
+double CvArrTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
+{
+    int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
+    assert( i == OUTPUT || i == INPUT_OUTPUT );
+    return elem_depth < CV_32F ? 0 : elem_depth == CV_32F ? FLT_EPSILON*100: DBL_EPSILON*5000;
+}
+
+
+int CvArrTest::validate_test_results( int test_case_idx )
+{
+    static const char* arr_names[] = { "input", "input/output", "output",
+                                       "ref input/output", "ref output",
+                                       "temporary", "mask" };
+    static const char* type_names[] = { "8u", "8s", "16u", "16s", "32s", "32f", "64f" };
+    int i, j;
+    prepare_to_validation( test_case_idx );
+
+    for( i = 0; i < 2; i++ )
+    {
+        int i0 = i == 0 ? OUTPUT : INPUT_OUTPUT;
+        int i1 = i == 0 ? REF_OUTPUT : REF_INPUT_OUTPUT;
+        int count = test_array[i0].size();
+
+        assert( count == test_array[i1].size() );
+        for( j = 0; j < count; j++ )
+        {
+            double err_level;
+            CvPoint idx = {0,0};
+            double max_diff = 0;
+            int code;
+            char msg[100];
+
+            if( !test_array[i1][j] )
+                continue;
+
+            err_level = get_success_error_level( test_case_idx, i0, j );
+            code = cvTsCmpEps( &test_mat[i0][j], &test_mat[i1][j], &max_diff, err_level, &idx,
+                               element_wise_relative_error );
+
+            switch( code )
+            {
+            case -1:
+                sprintf( msg, "Too big difference (=%g)", max_diff );
+                code = CvTS::FAIL_BAD_ACCURACY;
+                break;
+            case -2:
+                strcpy( msg, "Invalid output" );
+                code = CvTS::FAIL_INVALID_OUTPUT;
+                break;
+            case -3:
+                strcpy( msg, "Invalid output in the reference array" );
+                code = CvTS::FAIL_INVALID_OUTPUT;
+                break;
+            default:
+                continue;
+            }
+            ts->printf( CvTS::LOG, "%s in %s array %d at (%d,%d)\n", msg,
+                        arr_names[i0], j, idx.x, idx.y );
+            for( i0 = 0; i0 < max_arr; i0++ )
+            {
+                int count = test_array[i0].size();
+                if( i0 == REF_INPUT_OUTPUT || i0 == OUTPUT || i0 == TEMP )
+                    continue;
+                for( i1 = 0; i1 < count; i1++ )
+                {
+                    CvArr* arr = test_array[i0][i1];
+                    if( arr )
+                    {
+                        CvSize size = cvGetSize(arr);
+                        int type = cvGetElemType(arr);
+                        ts->printf( CvTS::LOG, "%s array %d type=%sC%d, size=(%d,%d)\n",
+                                    arr_names[i0], i1, type_names[CV_MAT_DEPTH(type)],
+                                    CV_MAT_CN(type), size.width, size.height );
+                    }
+                }
+            }
+            ts->set_failed_test_info( code );
+            return code;
+        }
+    }
+
+    return 0;
+}
+
+/* End of file. */
diff --git a/opencv/tests/cxts/cxts_math.cpp b/opencv/tests/cxts/cxts_math.cpp
new file mode 100644 (file)
index 0000000..33394fb
--- /dev/null
@@ -0,0 +1,3282 @@
+/*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*/
+
+#include "_cxts.h"
+
+/****************************************************************************************\
+*                                   Utility Functions                                    *
+\****************************************************************************************/
+
+void cvTsRandUni( CvRNG* rng, CvMat* a, CvScalar param0, CvScalar param1 )
+{
+    int i, j, k, cn, ncols;
+    CvScalar scale = param0;
+    CvScalar delta = param1;
+    double C = 1./(65536.*65536.);
+
+    cn = CV_MAT_CN(a->type);
+    ncols = a->cols*cn;
+
+    for( k = 0; k < 4; k++ )
+    {
+        double s = scale.val[k] - delta.val[k];
+        if( s >= 0 )
+            scale.val[k] = s;
+        else
+        {
+            delta.val[k] = scale.val[k];
+            scale.val[k] = -s;
+        }
+        scale.val[k] *= C;
+    }
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* data = a->data.ptr + i*a->step;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    int val = cvFloor( cvTsRandInt(rng)*scale.val[k] + delta.val[k] );
+                    ((uchar*)data)[j + k] = CV_CAST_8U(val);
+                }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    int val = cvFloor( cvTsRandInt(rng)*scale.val[k] + delta.val[k] );
+                    ((char*)data)[j + k] = CV_CAST_8S(val);
+                }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    int val = cvFloor( cvTsRandInt(rng)*scale.val[k] + delta.val[k] );
+                    ((ushort*)data)[j + k] = CV_CAST_16U(val);
+                }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    int val = cvFloor( cvTsRandInt(rng)*scale.val[k] + delta.val[k] );
+                    ((short*)data)[j + k] = CV_CAST_16S(val);
+                }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    int val = cvFloor( cvTsRandInt(rng)*scale.val[k] + delta.val[k] );
+                    ((int*)data)[j + k] = val;
+                }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    double val = cvTsRandInt(rng)*scale.val[k] + delta.val[k];
+                    ((float*)data)[j + k] = (float)val;
+                }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j += cn )
+                for( k = 0; k < cn; k++ )
+                {
+                    double val = cvTsRandInt(rng);
+                    val = (val + cvTsRandInt(rng)*C)*scale.val[k] + delta.val[k];
+                    ((double*)data)[j + k] = val;
+                }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+}
+
+
+void cvTsZero( CvMat* c )
+{
+    int i, width;
+    width = c->cols*CV_ELEM_SIZE(c->type);
+    for( i = 0; i < c->rows; i++ )
+        memset( c->data.ptr + i*c->step, 0, width );
+}
+
+
+// initializes scaled identity matrix
+void cvTsSetIdentity( CvMat* c, CvScalar diag_value )
+{
+    int i, width;
+    cvTsZero( c );
+    width = MIN(c->rows, c->cols);
+    for( i = 0; i < width; i++ )
+        cvSet2D( c, i, i, diag_value );
+}
+
+
+// copies selected region of one array to another array
+void cvTsCopy( const CvMat* a, CvMat* b, const CvMat* mask )
+{
+    int i = 0, j = 0, k;
+    int el_size, ncols;
+
+    el_size = CV_ELEM_SIZE(a->type);
+    ncols = a->cols;
+    if( mask )
+    {
+        assert( CV_ARE_SIZES_EQ(a,mask) &&
+            (CV_MAT_TYPE(mask->type) == CV_8UC1 ||
+             CV_MAT_TYPE(mask->type) == CV_8SC1 ));
+    }
+
+    assert( CV_ARE_TYPES_EQ(a,b) && CV_ARE_SIZES_EQ(a,b) );
+
+    if( !mask )
+        ncols *= el_size;
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+
+        if( !mask )
+            memcpy( b_data, a_data, ncols );
+        else
+        {
+            uchar* m_data = mask->data.ptr + mask->step*i;
+
+            for( j = 0; j < ncols; j++, b_data += el_size, a_data += el_size )
+            {
+                if( m_data[j] )
+                {
+                    for( k = 0; k < el_size; k++ )
+                        b_data[k] = a_data[k];
+                }
+            }
+        }
+    }
+}
+
+
+void cvTsConvert( const CvMat* a, CvMat* b )
+{
+    int i, j, ncols = ncols = b->cols*CV_MAT_CN(b->type);
+    double* buf = 0;
+
+    assert( CV_ARE_SIZES_EQ(a,b) && CV_ARE_CNS_EQ(a,b) );
+    buf = (double*)cvStackAlloc(ncols*sizeof(buf[0]));
+
+    for( i = 0; i < b->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + i*a->step;
+        uchar* b_data = b->data.ptr + i*b->step;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((uchar*)a_data)[j];
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((char*)a_data)[j];
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((ushort*)a_data)[j];
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((short*)a_data)[j];
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((int*)a_data)[j];
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((float*)a_data)[j];
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = ((double*)a_data)[j];
+            break;
+        default:
+            assert(0);
+            return;
+        }
+
+        switch( CV_MAT_DEPTH(b->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((uchar*)b_data)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((char*)b_data)[j] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((ushort*)b_data)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((short*)b_data)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((int*)b_data)[j] = CV_CAST_32S(val);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                ((float*)b_data)[j] = CV_CAST_32F(buf[j]);
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                ((double*)b_data)[j] = CV_CAST_64F(buf[j]);
+            break;
+        default:
+            assert(0);
+        }
+    }
+}
+
+
+// extracts a single channel from a multi-channel array
+void cvTsExtract( const CvMat* a, CvMat* b, int coi )
+{
+    int i = 0, j = 0, k;
+    int el_size, el_size1, ncols;
+
+    el_size = CV_ELEM_SIZE(a->type);
+    el_size1 = CV_ELEM_SIZE(b->type);
+    ncols = a->cols;
+
+    assert( CV_ARE_DEPTHS_EQ(a,b) && CV_ARE_SIZES_EQ(a,b) &&
+            (unsigned)coi < (unsigned)CV_MAT_CN(a->type) &&
+            CV_MAT_CN(b->type) == 1 );
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+        a_data += el_size1*coi;
+        for( j = 0; j < ncols; j++, b_data += el_size1, a_data += el_size )
+        {
+            for( k = 0; k < el_size1; k++ )
+                b_data[k] = a_data[k];
+        }
+    }
+}
+
+// replaces a single channel in a multi-channel array
+void cvTsInsert( const CvMat* a, CvMat* b, int coi )
+{
+    int i = 0, j = 0, k;
+    int el_size, el_size1, ncols;
+
+    el_size = CV_ELEM_SIZE(b->type);
+    el_size1 = CV_ELEM_SIZE(a->type);
+    ncols = a->cols;
+
+    assert( CV_ARE_DEPTHS_EQ(a,b) && CV_ARE_SIZES_EQ(a,b) &&
+            (unsigned)coi < (unsigned)CV_MAT_CN(b->type) &&
+            CV_MAT_CN(a->type) == 1 );
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+        b_data += el_size1*coi;
+        for( j = 0; j < ncols; j++, b_data += el_size, a_data += el_size1 )
+        {
+            for( k = 0; k < el_size1; k++ )
+                b_data[k] = a_data[k];
+        }
+    }
+}
+
+
+// c = alpha*a + beta*b + gamma
+void cvTsAdd( const CvMat* a, CvScalar alpha, const CvMat* b, CvScalar beta,
+              CvScalar gamma, CvMat* c, int calc_abs )
+{
+    int i, j, k, cn, ncols;
+    double* buf = 0;
+    double* alpha_buf = 0;
+    double* beta_buf = 0;
+    double* gamma_buf = 0;
+
+    if( !c )
+    {
+        assert(0);
+        return;
+    }
+
+    cn = CV_MAT_CN(c->type);
+    ncols = c->cols;
+
+    if( !a )
+    {
+        a = b;
+        alpha = beta;
+        b = 0;
+        beta = cvScalar(0);
+    }
+
+    if( a )
+    {
+        assert( CV_ARE_SIZES_EQ(a,c) && CV_MAT_CN(a->type) == cn );
+        buf = (double*)malloc( a->cols * cn * sizeof(buf[0]) );
+        alpha_buf = (double*)malloc( a->cols * cn * sizeof(alpha_buf[0]) );
+    }
+
+    if( b )
+    {
+        assert( CV_ARE_SIZES_EQ(b,c) && CV_MAT_CN(b->type) == cn );
+        beta_buf = (double*)malloc( b->cols * cn * sizeof(beta_buf[0]) );
+    }
+
+    ncols *= cn;
+    gamma_buf = (double*)malloc( ncols * sizeof(gamma_buf[0]) );
+    if( !buf )
+        buf = gamma_buf;
+
+    if( !a && !b && calc_abs )
+    {
+        for( k = 0; k < cn; k++ )
+            gamma.val[k] = fabs(gamma.val[k]);
+    }
+
+    for( i = 0; i < 1 + (a != 0) + (b != 0); i++ )
+    {
+        double* scalar_buf = i == 0 ? gamma_buf : i == 1 ? alpha_buf : beta_buf;
+        CvScalar scalar = i == 0 ? gamma : i == 1 ? alpha : beta;
+        for( j = 0; j < ncols; j += cn )
+            for( k = 0; k < cn; k++ )
+                scalar_buf[j + k] = scalar.val[k];
+    }
+
+    for( i = 0; i < c->rows; i++ )
+    {
+        uchar* c_data = c->data.ptr + i*c->step;
+
+        if( a )
+        {
+            uchar* a_data = a->data.ptr + i*a->step;
+
+            switch( CV_MAT_DEPTH(a->type) )
+            {
+            case CV_8U:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((uchar*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_8S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((char*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_16U:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((ushort*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_16S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((short*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_32S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((int*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_32F:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((float*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            case CV_64F:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = ((double*)a_data)[j]*alpha_buf[j] + gamma_buf[j];
+                break;
+            default:
+                assert(0);
+                return;
+            }
+        }
+
+        if( b )
+        {
+            uchar* b_data = b->data.ptr + i*b->step;
+
+            switch( CV_MAT_DEPTH(b->type) )
+            {
+            case CV_8U:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((uchar*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_8S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((char*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_16U:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((ushort*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_16S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((short*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_32S:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((int*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_32F:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((float*)b_data)[j]*beta_buf[j];
+                break;
+            case CV_64F:
+                for( j = 0; j < ncols; j++ )
+                    buf[j] += ((double*)b_data)[j]*beta_buf[j];
+                break;
+            default:
+                assert(0);
+                return;
+            }
+        }
+
+        if( a || b )
+        {
+            if( calc_abs )
+            {
+                for( j = 0; j < ncols; j++ )
+                    buf[j] = fabs(buf[j]);
+            }
+        }
+        else if( i > 0 )
+        {
+            memcpy( c_data, c_data - c->step, c->cols*CV_ELEM_SIZE(c->type) );
+            continue;
+        }
+
+        switch( CV_MAT_DEPTH(c->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((uchar*)c_data)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((char*)c_data)[j] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((ushort*)c_data)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((short*)c_data)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((int*)c_data)[j] = CV_CAST_32S(val);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                ((float*)c_data)[j] = CV_CAST_32F(buf[j]);
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                ((double*)c_data)[j] = CV_CAST_64F(buf[j]);
+            break;
+        default:
+            assert(0);
+        }
+    }
+
+    if( buf && buf != gamma_buf )
+        free( buf );
+    if( gamma_buf )
+        free( gamma_buf );
+    if( alpha_buf )
+        free( alpha_buf );
+    if( beta_buf )
+        free( beta_buf );
+}
+
+
+// c = a*b*alpha
+void cvTsMul( const CvMat* a, const CvMat* b, CvScalar alpha, CvMat* c )
+{
+    int i, j, k, cn, ncols;
+    double* buf = 0;
+    double* alpha_buf = 0;
+
+    if( !a || !b || !c )
+    {
+        assert(0);
+        return;
+    }
+
+    assert( CV_ARE_SIZES_EQ(a,c) && CV_ARE_SIZES_EQ(b,c) &&
+            CV_ARE_TYPES_EQ(a,b) && CV_ARE_CNS_EQ(a,c) );
+
+    cn = CV_MAT_CN(c->type);
+    ncols = c->cols * cn;
+    alpha_buf = (double*)malloc( ncols * sizeof(alpha_buf[0]) );
+    buf = (double*)malloc( ncols * sizeof(buf[0]) );
+
+    for( j = 0; j < ncols; j += cn )
+        for( k = 0; k < cn; k++ )
+            alpha_buf[j + k] = alpha.val[k];
+
+    for( i = 0; i < c->rows; i++ )
+    {
+        uchar* c_data = c->data.ptr + i*c->step;
+        uchar* a_data = a->data.ptr + i*a->step;
+        uchar* b_data = b->data.ptr + i*b->step;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((uchar*)a_data)[j])*((uchar*)b_data)[j];
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((char*)a_data)[j])*((char*)b_data)[j];
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((ushort*)a_data)[j])*((ushort*)b_data)[j];
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((short*)a_data)[j])*((short*)b_data)[j];
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((int*)a_data)[j])*((int*)b_data)[j];
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((float*)a_data)[j])*((float*)b_data)[j];
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                buf[j] = (alpha_buf[j]*((double*)a_data)[j])*((double*)b_data)[j];
+            break;
+        default:
+            assert(0);
+            return;
+        }
+
+        switch( CV_MAT_DEPTH(c->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((uchar*)c_data)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((char*)c_data)[j] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((ushort*)c_data)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((short*)c_data)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((int*)c_data)[j] = CV_CAST_32S(val);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                ((float*)c_data)[j] = CV_CAST_32F(buf[j]);
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                ((double*)c_data)[j] = CV_CAST_64F(buf[j]);
+            break;
+        default:
+            assert(0);
+        }
+    }
+
+    if( alpha_buf )
+        free( alpha_buf );
+
+    if( buf )
+        free( buf );
+}
+
+
+// c = a*alpha/b
+void cvTsDiv( const CvMat* a, const CvMat* b, CvScalar alpha, CvMat* c )
+{
+    int i, j, k, cn, ncols;
+    double* buf = 0;
+    double* alpha_buf = 0;
+
+    if( !b || !c )
+    {
+        assert(0);
+        return;
+    }
+
+    if( a )
+    {
+        assert( CV_ARE_SIZES_EQ(a,c) &&
+                CV_ARE_TYPES_EQ(a,b) && CV_ARE_CNS_EQ(a,c) );
+    }
+
+    assert( CV_ARE_SIZES_EQ(b,c) && CV_ARE_CNS_EQ(b,c) );
+
+    cn = CV_MAT_CN(c->type);
+    ncols = c->cols * cn;
+    alpha_buf = (double*)malloc( ncols * sizeof(alpha_buf[0]) );
+    buf = (double*)malloc( ncols * sizeof(buf[0]) );
+
+    for( j = 0; j < ncols; j += cn )
+        for( k = 0; k < cn; k++ )
+            alpha_buf[j + k] = alpha.val[k];
+
+    for( i = 0; i < c->rows; i++ )
+    {
+        uchar* c_data = c->data.ptr + i*c->step;
+        uchar* a_data = a ? a->data.ptr + i*a->step : 0;
+        uchar* b_data = b->data.ptr + i*b->step;
+
+        switch( CV_MAT_DEPTH(b->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int denom = ((uchar*)b_data)[j];
+                int num = a_data ? ((uchar*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int denom = ((char*)b_data)[j];
+                int num = a_data ? ((char*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int denom = ((ushort*)b_data)[j];
+                int num = a_data ? ((ushort*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int denom = ((short*)b_data)[j];
+                int num = a_data ? ((short*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int denom = ((int*)b_data)[j];
+                int num = a_data ? ((int*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double denom = ((float*)b_data)[j];
+                double num = a_data ? ((float*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double denom = ((double*)b_data)[j];
+                double num = a_data ? ((double*)a_data)[j] : 1;
+                buf[j] = !denom ? 0 : (alpha_buf[j]*num/denom);
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+
+        switch( CV_MAT_DEPTH(c->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((uchar*)c_data)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((char*)c_data)[j] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((ushort*)c_data)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((short*)c_data)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = cvRound(buf[j]);
+                ((int*)c_data)[j] = CV_CAST_32S(val);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                ((float*)c_data)[j] = CV_CAST_32F(buf[j]);
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                ((double*)c_data)[j] = CV_CAST_64F(buf[j]);
+            break;
+        default:
+            assert(0);
+        }
+    }
+
+    if( alpha_buf )
+        free( alpha_buf );
+
+    if( buf )
+        free( buf );
+}
+
+
+// c = min(a,b) or c = max(a,b)
+void cvTsMinMax( const CvMat* a, const CvMat* b, CvMat* c, int op_type )
+{
+    int i, j, ncols;
+    int calc_max = op_type == CV_TS_MAX;
+
+    if( !a || !b || !c )
+    {
+        assert(0);
+        return;
+    }
+
+    assert( CV_ARE_SIZES_EQ(a,c) && CV_ARE_TYPES_EQ(a,c) &&
+            CV_ARE_SIZES_EQ(b,c) && CV_ARE_TYPES_EQ(b,c) &&
+            CV_MAT_CN(a->type) == 1 );
+    ncols = c->cols;
+
+    for( i = 0; i < c->rows; i++ )
+    {
+        uchar* c_data = c->data.ptr + i*c->step;
+        uchar* a_data = a->data.ptr + i*a->step;
+        uchar* b_data = b->data.ptr + i*b->step;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((uchar*)a_data)[j];
+                int bj = ((uchar*)b_data)[j];
+                ((uchar*)c_data)[j] = (uchar)(calc_max ? MAX(aj, bj) : MIN(aj,bj));
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((char*)a_data)[j];
+                int bj = ((char*)b_data)[j];
+                ((char*)c_data)[j] = (char)(calc_max ? MAX(aj, bj) : MIN(aj,bj));
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((ushort*)a_data)[j];
+                int bj = ((ushort*)b_data)[j];
+                ((ushort*)c_data)[j] = (ushort)(calc_max ? MAX(aj, bj) : MIN(aj,bj));
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((short*)a_data)[j];
+                int bj = ((short*)b_data)[j];
+                ((short*)c_data)[j] = (short)(calc_max ? MAX(aj, bj) : MIN(aj,bj));
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((int*)a_data)[j];
+                int bj = ((int*)b_data)[j];
+                ((int*)c_data)[j] = calc_max ? MAX(aj, bj) : MIN(aj,bj);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                float aj = ((float*)a_data)[j];
+                float bj = ((float*)b_data)[j];
+                ((float*)c_data)[j] = calc_max ? MAX(aj, bj) : MIN(aj,bj);
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double aj = ((double*)a_data)[j];
+                double bj = ((double*)b_data)[j];
+                ((double*)c_data)[j] = calc_max ? MAX(aj, bj) : MIN(aj,bj);
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+}
+
+// c = min(a,b) or c = max(a,b)
+void cvTsMinMaxS( const CvMat* a, double s, CvMat* c, int op_type )
+{
+    int i, j, ncols;
+    int calc_max = op_type == CV_TS_MAX;
+    float fs = (float)s;
+    int is = cvRound(s);
+
+    if( !a || !c )
+    {
+        assert(0);
+        return;
+    }
+
+    assert( CV_ARE_SIZES_EQ(a,c) && CV_ARE_TYPES_EQ(a,c) &&
+            CV_MAT_CN(a->type) == 1 );
+    ncols = c->cols;
+
+    switch( CV_MAT_DEPTH(a->type) )
+    {
+    case CV_8U:
+        is = CV_CAST_8U(is);
+        break;
+    case CV_8S:
+        is = CV_CAST_8S(is);
+        break;
+    case CV_16U:
+        is = CV_CAST_16U(is);
+        break;
+    case CV_16S:
+        is = CV_CAST_16S(is);
+        break;
+    default:
+        ;
+    }
+
+    for( i = 0; i < c->rows; i++ )
+    {
+        uchar* c_data = c->data.ptr + i*c->step;
+        uchar* a_data = a->data.ptr + i*a->step;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((uchar*)a_data)[j];
+                ((uchar*)c_data)[j] = (uchar)(calc_max ? MAX(aj, is) : MIN(aj, is));
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((char*)a_data)[j];
+                ((char*)c_data)[j] = (char)(calc_max ? MAX(aj, is) : MIN(aj, is));
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((ushort*)a_data)[j];
+                ((ushort*)c_data)[j] = (ushort)(calc_max ? MAX(aj, is) : MIN(aj, is));
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((short*)a_data)[j];
+                ((short*)c_data)[j] = (short)(calc_max ? MAX(aj, is) : MIN(aj, is));
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int aj = ((int*)a_data)[j];
+                ((int*)c_data)[j] = calc_max ? MAX(aj, is) : MIN(aj, is);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                float aj = ((float*)a_data)[j];
+                ((float*)c_data)[j] = calc_max ? MAX(aj, fs) : MIN(aj, fs);
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double aj = ((double*)a_data)[j];
+                ((double*)c_data)[j] = calc_max ? MAX(aj, s) : MIN(aj, s);
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+}
+
+// checks that the array does not have NaNs and/or Infs and all the elements are
+// within [min_val,max_val). idx is the index of the first "bad" element.
+int cvTsCheck( const CvMat* a, double min_val, double max_val, CvPoint* idx )
+{
+    int i = 0, j = 0;
+    int cn, ncols;
+    int imin = 0, imax = 0;
+    cn = CV_MAT_CN(a->type);
+    ncols = a->cols*cn;
+
+    if( CV_MAT_DEPTH(a->type) <= CV_32S )
+    {
+        imin = cvCeil(min_val);
+        imax = cvFloor(max_val);
+    }
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* data = a->data.ptr + a->step*i;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = ((uchar*)data)[j];
+                if( val < imin || imax < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = ((char*)data)[j];
+                if( val < imin || imax < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = ((ushort*)data)[j];
+                if( val < imin || imax < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = ((short*)data)[j];
+                if( val < imin || imax < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = ((int*)data)[j];
+                if( val < imin || imax < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double val = ((float*)data)[j];
+                if( cvIsNaN(val) || cvIsInf(val) || val < min_val || max_val < val )
+                    goto _exit_;
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double val = ((double*)data)[j];
+                if( cvIsNaN(val) || cvIsInf(val) || val < min_val || max_val < val )
+                    goto _exit_;
+            }
+            break;
+        default:
+            assert(0);
+            return -1;
+        }
+    }
+
+    return 0;
+_exit_:
+
+    idx->x = j;
+    idx->y = i;
+    return -1;
+}
+
+// compares two arrays. max_diff is the maximum actual difference,
+// success_err_level is maximum allowed difference, idx is the index of the first
+// element for which difference is >success_err_level
+// (or index of element with the maximum difference)
+int cvTsCmpEps( const CvMat* check_arr, const CvMat* etalon, double* _max_diff,
+                double success_err_level, CvPoint* idx, bool element_wise_relative_error )
+{
+    int i = 0, j = 0;
+    int cn, ncols;
+    double maxdiff = 0;
+    double maxval = 0;
+    int imaxdiff = 0;
+    int ilevel = 0;
+    int result = -1;
+
+    cn = CV_MAT_CN(check_arr->type);
+    ncols = check_arr->cols*cn;
+
+    *idx = cvPoint(0,0);
+
+    assert( CV_ARE_TYPES_EQ(check_arr,etalon) && CV_ARE_SIZES_EQ(check_arr,etalon) );
+
+    if( CV_MAT_DEPTH(check_arr->type) < CV_32S )
+        ilevel = cvFloor(success_err_level);
+
+    if( CV_MAT_DEPTH(check_arr->type) >= CV_32F && !element_wise_relative_error )
+    {
+        double maxval0 = 1.;
+        maxval = cvTsNorm( etalon, 0, CV_C, 0 );
+        maxval = MAX(maxval, maxval0);
+    }
+
+    for( i = 0; i < check_arr->rows; i++ )
+    {
+        uchar* a_data = check_arr->data.ptr + check_arr->step*i;
+        uchar* b_data = etalon->data.ptr + etalon->step*i;
+
+        switch( CV_MAT_DEPTH(check_arr->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = abs(((uchar*)a_data)[j] - ((uchar*)b_data)[j]);
+                if( val > imaxdiff )
+                {
+                    imaxdiff = val;
+                    *idx = cvPoint(j,i);
+                    if( val > ilevel )
+                        goto _exit_;
+                }
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = abs(((char*)a_data)[j] - ((char*)b_data)[j]);
+                if( val > imaxdiff )
+                {
+                    imaxdiff = val;
+                    *idx = cvPoint(j,i);
+                    if( val > ilevel )
+                        goto _exit_;
+                }
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = abs(((ushort*)a_data)[j] - ((ushort*)b_data)[j]);
+                if( val > imaxdiff )
+                {
+                    imaxdiff = val;
+                    *idx = cvPoint(j,i);
+                    if( val > ilevel )
+                        goto _exit_;
+                }
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int val = abs(((short*)a_data)[j] - ((short*)b_data)[j]);
+                if( val > imaxdiff )
+                {
+                    imaxdiff = val;
+                    *idx = cvPoint(j,i);
+                    if( val > ilevel )
+                        goto _exit_;
+                }
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                double val = fabs((double)((int*)a_data)[j] - (double)((int*)b_data)[j]);
+                if( val > maxdiff )
+                {
+                    maxdiff = val;
+                    *idx = cvPoint(j,i);
+                    if( val > success_err_level )
+                        goto _exit_;
+                }
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double a_val = ((float*)a_data)[j];
+                double b_val = ((float*)b_data)[j];
+                double threshold;
+                if( cvIsNaN(a_val) || cvIsInf(a_val) )
+                {
+                    result = -2;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+                if( cvIsNaN(b_val) || cvIsInf(b_val) )
+                {
+                    result = -3;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+                a_val = fabs(a_val - b_val);
+                threshold = element_wise_relative_error ? fabs(b_val)+FLT_EPSILON : maxval;
+                if( a_val > threshold*success_err_level )
+                {
+                    maxdiff = a_val/threshold;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double a_val = ((double*)a_data)[j];
+                double b_val = ((double*)b_data)[j];
+                double threshold;
+                if( cvIsNaN(a_val) || cvIsInf(a_val) )
+                {
+                    result = -2;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+                if( cvIsNaN(b_val) || cvIsInf(b_val) )
+                {
+                    result = -3;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+                a_val = fabs(a_val - b_val);
+                threshold = element_wise_relative_error ? fabs(b_val)+DBL_EPSILON : maxval;
+                if( a_val > threshold*success_err_level )
+                {
+                    maxdiff = a_val/threshold;
+                    *idx = cvPoint(j,i);
+                    goto _exit_;
+                }
+            }
+            break;
+        default:
+            assert(0);
+            return -1;
+        }
+    }
+
+    result = 0;
+_exit_:
+
+    if( CV_MAT_DEPTH(check_arr->type) < CV_32S )
+        maxdiff = imaxdiff;
+
+    if( result < -1 )
+        maxdiff = exp(1000.);
+    *_max_diff = maxdiff;
+    return result;
+}
+
+// compares two arrays. the result is 8s image that takes values -1, 0, 1
+void cvTsCmp( const CvMat* a, const CvMat* b, CvMat* result, int cmp_op )
+{
+    int i = 0, j = 0, ncols;
+    ncols = a->cols;
+
+    assert( CV_ARE_TYPES_EQ(a,b) && CV_ARE_SIZES_EQ(a,b) && CV_MAT_CN(a->type) == 1 );
+    assert( CV_ARE_SIZES_EQ(a,result) &&
+            (CV_MAT_TYPE(result->type) == CV_8UC1 ||
+             CV_MAT_TYPE(result->type) == CV_8SC1 ));
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+        char* r_data = (char*)(result->data.ptr + result->step*i);
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((uchar*)a_data)[j];
+                int b_val = ((uchar*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((char*)a_data)[j];
+                int b_val = ((char*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((ushort*)a_data)[j];
+                int b_val = ((ushort*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((short*)a_data)[j];
+                int b_val = ((short*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((int*)a_data)[j];
+                int b_val = ((int*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                float a_val = ((float*)a_data)[j];
+                float b_val = ((float*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double a_val = ((double*)a_data)[j];
+                double b_val = ((double*)b_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,b_val);
+            }
+            break;
+        default:
+            assert(0);
+        }
+
+        switch( cmp_op )
+        {
+        case CV_CMP_EQ:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] == 0 ? -1 : 0);
+            break;
+        case CV_CMP_NE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] != 0 ? -1 : 0);
+            break;
+        case CV_CMP_LT:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] < 0 ? -1 : 0);
+            break;
+        case CV_CMP_LE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] <= 0 ? -1 : 0);
+            break;
+        case CV_CMP_GE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] >= 0 ? -1 : 0);
+            break;
+        case CV_CMP_GT:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] > 0 ? -1 : 0);
+            break;
+        default:
+            ;
+        }
+    }
+}
+
+// compares two arrays. the result is 8s image that takes values -1, 0, 1
+void cvTsCmpS( const CvMat* a, double fval, CvMat* result, int cmp_op )
+{
+    int i = 0, j = 0;
+    int ncols, ival = 0;
+    ncols = a->cols;
+
+    if( CV_MAT_DEPTH(a->type) <= CV_32S )
+        ival = cvRound(fval);
+
+    assert( CV_MAT_CN(a->type) == 1 );
+    assert( CV_ARE_SIZES_EQ(a,result) &&
+            (CV_MAT_TYPE(result->type) == CV_8UC1 ||
+             CV_MAT_TYPE(result->type) == CV_8SC1 ));
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        char* r_data = (char*)(result->data.ptr + result->step*i);
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((uchar*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,ival);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((char*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,ival);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((ushort*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,ival);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((short*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,ival);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int a_val = ((int*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,ival);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                float a_val = ((float*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,fval);
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double a_val = ((double*)a_data)[j];
+                r_data[j] = (char)CV_CMP(a_val,fval);
+            }
+            break;
+        default:
+            assert(0);
+        }
+
+        switch( cmp_op )
+        {
+        case CV_CMP_EQ:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] == 0 ? -1 : 0);
+            break;
+        case CV_CMP_NE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] != 0 ? -1 : 0);
+            break;
+        case CV_CMP_LT:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] < 0 ? -1 : 0);
+            break;
+        case CV_CMP_LE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] <= 0 ? -1 : 0);
+            break;
+        case CV_CMP_GE:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] >= 0 ? -1 : 0);
+            break;
+        case CV_CMP_GT:
+            for( j = 0; j < ncols; j++ )
+                r_data[j] = (char)(r_data[j] > 0 ? -1 : 0);
+            break;
+        default:
+            ;
+        }
+    }
+}
+
+
+// calculates norm of a matrix
+double cvTsNorm( const CvMat* arr, const CvMat* mask, int norm_type, int coi )
+{
+    int i = 0, j = 0, k;
+    int depth, cn0, cn, ncols, el_size1;
+    int inorm = 0;
+    double fnorm = 0;
+    void* buffer = 0;
+    uchar* zerobuf = 0;
+
+    cn0 = cn = CV_MAT_CN(arr->type);
+    ncols = arr->cols*cn;
+    depth = CV_MAT_DEPTH(arr->type);
+    el_size1 = CV_ELEM_SIZE(depth);
+    zerobuf = (uchar*)cvStackAlloc(el_size1*cn);
+    memset( zerobuf, 0, el_size1*cn);
+
+    if( mask )
+    {
+        assert( CV_ARE_SIZES_EQ( arr, mask ) && CV_IS_MASK_ARR(mask) );
+        buffer = cvStackAlloc( el_size1*ncols );
+    }
+
+    if( coi == 0 )
+        cn = 1;
+
+    for( i = 0; i < arr->rows; i++ )
+    {
+        const uchar* data = arr->data.ptr + arr->step*i + (coi - (coi != 0))*el_size1;
+
+        if( mask )
+        {
+            const uchar* mdata = mask->data.ptr + mask->step*i;
+            switch( depth )
+            {
+            case CV_8U:
+            case CV_8S:
+                for( j = 0; j < ncols; j += cn0 )
+                {
+                    const uchar* src = *mdata++ ? (uchar*)data + j : zerobuf;
+                    for( k = 0; k < cn0; k++ )
+                        ((uchar*)buffer)[j+k] = src[k];
+                }
+                break;
+            case CV_16U:
+            case CV_16S:
+                for( j = 0; j < ncols; j += cn0 )
+                {
+                    const short* src = *mdata++ ? (short*)data + j : (short*)zerobuf;
+                    for( k = 0; k < cn0; k++ )
+                        ((short*)buffer)[j+k] = src[k];
+                }
+                break;
+            case CV_32S:
+            case CV_32F:
+                for( j = 0; j < ncols; j += cn0 )
+                {
+                    const int* src = *mdata++ ? (int*)data + j : (int*)zerobuf;
+                    for( k = 0; k < cn0; k++ )
+                        ((int*)buffer)[j+k] = src[k];
+                }
+                break;
+            case CV_64F:
+                for( j = 0; j < ncols; j += cn0 )
+                {
+                    const double* src = *mdata++ ? (double*)data + j : (double*)zerobuf;
+                    for( k = 0; k < cn0; k++ )
+                        ((double*)buffer)[j+k] = src[k];
+                }
+                break;
+            default:
+                assert(0);
+                return -1;
+            }
+            data = (const uchar*)buffer;
+        }
+
+        switch( depth )
+        {
+        case CV_8U:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const uchar*)data)[j];
+                    inorm = MAX( inorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const uchar*)data)[j];
+                    inorm += val;
+                }
+                fnorm += inorm;
+            }
+            else
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const uchar*)data)[j];
+                    inorm += val*val;
+                }
+                fnorm += inorm;
+            }
+            break;
+        case CV_8S:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = abs(((const char*)data)[j]);
+                    inorm = MAX( inorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = abs(((const char*)data)[j]);
+                    inorm += val;
+                }
+                fnorm += inorm;
+            }
+            else
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const char*)data)[j];
+                    inorm += val*val;
+                }
+                fnorm += inorm;
+            }
+            break;
+        case CV_16U:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const ushort*)data)[j];
+                    inorm = MAX( inorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = ((const ushort*)data)[j];
+                    inorm += val;
+                }
+                fnorm += inorm;
+            }
+            else
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = ((const ushort*)data)[j];
+                    fnorm += val*val;
+                }
+            }
+            break;
+        case CV_16S:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = abs(((const short*)data)[j]);
+                    inorm = MAX( inorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                inorm = 0;
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = abs(((const short*)data)[j]);
+                    inorm += val;
+                }
+                fnorm += inorm;
+            }
+            else
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = ((const short*)data)[j];
+                    fnorm += val*val;
+                }
+            }
+            break;
+        case CV_32S:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    int val = abs(((const int*)data)[j]);
+                    inorm = MAX( inorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = fabs((double)((const int*)data)[j]);
+                    fnorm += val;
+                }
+            }
+            else
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = ((const int*)data)[j];
+                    fnorm += val*val;
+                }
+            }
+            break;
+        case CV_32F:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = fabs((double)((const float*)data)[j]);
+                    fnorm = MAX( fnorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = fabs((double)((const float*)data)[j]);
+                    fnorm += val;
+                }
+            }
+            else
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = ((const float*)data)[j];
+                    fnorm += val*val;
+                }
+            }
+            break;
+        case CV_64F:
+            if( norm_type == CV_C )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = fabs(((const double*)data)[j]);
+                    fnorm = MAX( fnorm, val );
+                }
+            }
+            else if( norm_type == CV_L1 )
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = fabs(((const double*)data)[j]);
+                    fnorm += val;
+                }
+            }
+            else
+            {
+                for( j = 0; j < ncols; j += cn )
+                {
+                    double val = ((const double*)data)[j];
+                    fnorm += val*val;
+                }
+            }
+            break;
+        default:
+            assert(0);
+            return -1;
+        }
+    }
+
+    if( norm_type == CV_L2 )
+        fnorm = sqrt( fnorm );
+    else if( depth < CV_32F && norm_type == CV_C )
+        fnorm = inorm;
+
+    return fnorm;
+}
+
+
+// retrieves mean, standard deviation and the number of nonzero mask pixels
+int cvTsMeanStdDevNonZero( const CvMat* arr, const CvMat* mask,
+                           CvScalar* _mean, CvScalar* _stddev, int coi )
+{
+    int i = 0, j = 0, k;
+    int depth, cn0, cn, cols, ncols, el_size1;
+    CvScalar sum = cvScalar(0), sqsum = cvScalar(0);
+    double inv_area;
+    int isum[4], isqsum[4];
+    int nonzero = 0;
+    uchar* maskbuf = 0;
+
+    cn0 = cn = CV_MAT_CN(arr->type);
+    cols = arr->cols;
+    ncols = arr->cols*cn;
+    depth = CV_MAT_DEPTH(arr->type);
+    el_size1 = CV_ELEM_SIZE(depth);
+    if( mask )
+    {
+        assert( CV_ARE_SIZES_EQ( arr, mask ) && CV_IS_MASK_ARR(mask) );
+    }
+    else
+    {
+        maskbuf = (uchar*)cvStackAlloc( cols );
+        memset( maskbuf, 1, cols );
+        nonzero = cols*arr->rows;
+    }
+
+    if( coi != 0 )
+        cn = 1;
+
+    for( i = 0; i < arr->rows; i++ )
+    {
+        const uchar* data = arr->data.ptr + arr->step*i + (coi - (coi != 0))*el_size1;
+        const uchar* mdata;
+
+        if( mask )
+        {
+            mdata = mask->data.ptr + mask->step*i;
+            for( j = 0; j < cols; j++ )
+                nonzero += mdata[j] != 0;
+        }
+        else
+        {
+            mdata = maskbuf;
+        }
+
+        // if only a number of pixels in the mask is needed, skip the rest of the loop body
+        if( !_mean && !_stddev )
+            continue;
+
+        switch( depth )
+        {
+        case CV_8U:
+            for( k = 0; k < cn; k++ )
+                isum[k] = isqsum[k] = 0;
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        int val = ((const uchar*)data)[j+k];
+                        isum[k] += val;
+                        isqsum[k] += val*val;
+                    }
+                }
+            for( k = 0; k < cn; k++ )
+            {
+                sum.val[k] += isum[k];
+                sqsum.val[k] += isqsum[k];
+            }
+            break;
+        case CV_8S:
+            for( k = 0; k < cn; k++ )
+                isum[k] = isqsum[k] = 0;
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        int val = ((const char*)data)[j+k];
+                        isum[k] += val;
+                        isqsum[k] += val*val;
+                    }
+                }
+            for( k = 0; k < cn; k++ )
+            {
+                sum.val[k] += isum[k];
+                sqsum.val[k] += isqsum[k];
+            }
+            break;
+        case CV_16U:
+            for( k = 0; k < cn; k++ )
+                isum[k] = 0;
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        int val = ((const ushort*)data)[j+k];
+                        isum[k] += val;
+                        sqsum.val[k] += ((double)val)*val;
+                    }
+                }
+            for( k = 0; k < cn; k++ )
+                sum.val[k] += isum[k];
+            break;
+        case CV_16S:
+            for( k = 0; k < cn; k++ )
+                isum[k] = 0;
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        int val = ((const short*)data)[j+k];
+                        isum[k] += val;
+                        sqsum.val[k] += ((double)val)*val;
+                    }
+                }
+            for( k = 0; k < cn; k++ )
+                sum.val[k] += isum[k];
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        double val = ((const int*)data)[j+k];
+                        sum.val[k] += val;
+                        sqsum.val[k] += val*val;
+                    }
+                }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        double val = ((const float*)data)[j+k];
+                        sum.val[k] += val;
+                        sqsum.val[k] += val*val;
+                    }
+                }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j += cn0 )
+                if( *mdata++ )
+                {
+                    for( k = 0; k < cn; k++ )
+                    {
+                        double val = ((const double*)data)[j+k];
+                        sum.val[k] += val;
+                        sqsum.val[k] += val*val;
+                    }
+                }
+            break;
+        default:
+            assert(0);
+            return -1;
+        }
+    }
+
+    inv_area = nonzero ? 1./nonzero : 0.;
+    for( k = 0; k < cn; k++ )
+    {
+        sum.val[k] *= inv_area;
+        double t = sqsum.val[k]*inv_area - sum.val[k]*sum.val[k];
+        sqsum.val[k] = sqrt(MAX(t, 0));
+    }
+    if( _mean )
+        *_mean = sum;
+    if( _stddev )
+        *_stddev = sqsum;
+    return nonzero;
+}
+
+// retrieves global extremums and their positions
+void cvTsMinMaxLoc( const CvMat* arr, const CvMat* mask,
+                    double* _minval, double* _maxval,
+                    CvPoint* _minidx, CvPoint* _maxidx, int coi )
+{
+    int i = 0, j = 0;
+    int depth, cn, cols, ncols, el_size1;
+    CvPoint minidx = {-1,-1}, maxidx = {-1,-1};
+    uchar* maskbuf = 0;
+    int iminval = INT_MAX, imaxval = INT_MIN;
+    double minval = DBL_MAX, maxval = -minval;
+
+    cn = CV_MAT_CN(arr->type);
+    cols = arr->cols;
+    ncols = arr->cols*cn;
+    depth = CV_MAT_DEPTH(arr->type);
+    el_size1 = CV_ELEM_SIZE(depth);
+
+    if( mask )
+    {
+        assert( CV_ARE_SIZES_EQ( arr, mask ) && CV_IS_MASK_ARR(mask) );
+    }
+    else
+    {
+        maskbuf = (uchar*)cvStackAlloc( cols );
+        memset( maskbuf, 1, cols );
+    }
+
+    if( coi == 0 && cn > 1 )
+    {
+        assert(0);
+        return;
+    }
+
+    for( i = 0; i < arr->rows; i++ )
+    {
+        const uchar* data = arr->data.ptr + arr->step*i + (coi - (coi != 0))*el_size1;
+        const uchar* mdata = mask ? mask->data.ptr + mask->step*i : maskbuf;
+
+        switch( depth )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                int val = ((const uchar*)data)[j];
+                if( val < iminval && *mdata )
+                {
+                    iminval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > imaxval && *mdata )
+                {
+                    imaxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                int val = ((const char*)data)[j];
+                if( val < iminval && *mdata )
+                {
+                    iminval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > imaxval && *mdata )
+                {
+                    imaxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                int val = ((const ushort*)data)[j];
+                if( val < iminval && *mdata )
+                {
+                    iminval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > imaxval && *mdata )
+                {
+                    imaxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                int val = ((const short*)data)[j];
+                if( val < iminval && *mdata )
+                {
+                    iminval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > imaxval && *mdata )
+                {
+                    imaxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                int val = ((const int*)data)[j];
+                if( val < iminval && *mdata )
+                {
+                    iminval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > imaxval && *mdata )
+                {
+                    imaxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                float val = ((const float*)data)[j];
+                if( val < minval && *mdata )
+                {
+                    minval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > maxval && *mdata )
+                {
+                    maxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j += cn, mdata++ )
+            {
+                double val = ((const double*)data)[j];
+                if( val < minval && *mdata )
+                {
+                    minval = val;
+                    minidx = cvPoint(j,i);
+                }
+                if( val > maxval && *mdata )
+                {
+                    maxval = val;
+                    maxidx = cvPoint(j,i);
+                }
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+
+    if( minidx.x < 0 )
+        minval = maxval = 0;
+    else
+    {
+        if( depth < CV_32F )
+            minval = iminval, maxval = imaxval;
+        minidx.x /= cn;
+        maxidx.x /= cn;
+    }
+
+    if( _minval )
+        *_minval = minval;
+
+    if( _maxval )
+        *_maxval = maxval;
+
+    if( _minidx )
+        *_minidx = minidx;
+
+    if( _maxidx )
+        *_maxidx = maxidx;
+}
+
+
+void cvTsLogic( const CvMat* a, const CvMat* b, CvMat* c, int logic_op )
+{
+    int i = 0, j = 0, ncols;
+    ncols = a->cols*CV_ELEM_SIZE(a->type);
+
+    assert( CV_ARE_TYPES_EQ(a,b) && CV_ARE_SIZES_EQ(a,b) );
+    assert( CV_ARE_TYPES_EQ(a,c) && CV_ARE_SIZES_EQ(a,c) );
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+        uchar* c_data = c->data.ptr + c->step*i;
+
+        switch( logic_op )
+        {
+        case CV_TS_LOGIC_AND:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] & b_data[j]);
+            break;
+        case CV_TS_LOGIC_OR:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] | b_data[j]);
+            break;
+        case CV_TS_LOGIC_XOR:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] ^ b_data[j]);
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+}
+
+void cvTsLogicS( const CvMat* a, CvScalar s, CvMat* c, int logic_op )
+{
+    int i = 0, j = 0, k;
+    int cn, ncols, elem_size;
+    uchar* b_data;
+    double buf[4];
+    cn = CV_MAT_CN(a->type);
+    elem_size = CV_ELEM_SIZE(a->type);
+    ncols = a->cols * elem_size;
+    b_data = (uchar*)malloc( ncols );
+
+    assert( CV_ARE_TYPES_EQ(a,c) && CV_ARE_SIZES_EQ(a,c) );
+
+    if( logic_op == CV_TS_LOGIC_NOT )
+    {
+        memset( b_data, -1, ncols );
+        logic_op = CV_TS_LOGIC_XOR;
+    }
+    else
+    {
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( k = 0; k < cn; k++ )
+            {
+                int val = cvRound(s.val[k]);
+                ((uchar*)buf)[k] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( k = 0; k < cn; k++ )
+            {
+                int val = cvRound(s.val[k]);
+                ((char*)buf)[k] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( k = 0; k < cn; k++ )
+            {
+                int val = cvRound(s.val[k]);
+                ((ushort*)buf)[k] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( k = 0; k < cn; k++ )
+            {
+                int val = cvRound(s.val[k]);
+                ((short*)buf)[k] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( k = 0; k < cn; k++ )
+            {
+                int val = cvRound(s.val[k]);
+                ((int*)buf)[k] = CV_CAST_32S(val);
+            }
+            break;
+        case CV_32F:
+            for( k = 0; k < cn; k++ )
+            {
+                double val = s.val[k];
+                ((float*)buf)[k] = CV_CAST_32F(val);
+            }
+            break;
+        case CV_64F:
+            for( k = 0; k < cn; k++ )
+            {
+                double val = s.val[k];
+                ((double*)buf)[k] = CV_CAST_64F(val);
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+
+        for( j = 0; j < ncols; j += elem_size )
+            memcpy( b_data + j, buf, elem_size );
+    }
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* c_data = c->data.ptr + c->step*i;
+
+        switch( logic_op )
+        {
+        case CV_TS_LOGIC_AND:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] & b_data[j]);
+            break;
+        case CV_TS_LOGIC_OR:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] | b_data[j]);
+            break;
+        case CV_TS_LOGIC_XOR:
+            for( j = 0; j < ncols; j++ )
+                c_data[j] = (uchar)(a_data[j] ^ b_data[j]);
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+
+    if( b_data )
+        free( b_data );
+}
+
+
+void cvTsGEMM( const CvMat* a, const CvMat* b, double alpha,
+               const CvMat* c, double beta, CvMat* d, int flags )
+{
+    int i, j, k;
+    int a_rows, a_cols, b_rows, b_cols;
+    int c_rows, c_cols, d_rows, d_cols;
+    int cn, el_size;
+    int a_step, a_delta, b_step, b_delta;
+    int c_step, c_delta, d_step;
+
+    a_rows = a->rows; a_cols = a->cols;
+    cn = CV_MAT_CN(a->type);
+    el_size = CV_ELEM_SIZE(a->type & ~CV_MAT_CN_MASK);
+    a_step = a->step / el_size; a_delta = cn;
+    d_rows = d->rows; d_cols = d->cols;
+    b_rows = b->rows; b_cols = b->cols;
+    b_step = b->step / el_size; b_delta = cn;
+    c_rows = c ? c->rows : 0; c_cols = c ? c->cols : 0;
+    c_step = c ? c->step / el_size : 0; c_delta = c ? cn : 0;
+    d_step = d->step / el_size;
+
+    assert( CV_ARE_TYPES_EQ(a,b) && CV_ARE_TYPES_EQ(a,d) );
+    assert( CV_MAT_CN(a->type) <= 2 );
+
+    if( flags & CV_TS_GEMM_A_T )
+    {
+        CV_SWAP( a_rows, a_cols, i );
+        CV_SWAP( a_step, a_delta, i );
+    }
+
+    if( flags & CV_TS_GEMM_B_T )
+    {
+        CV_SWAP( b_rows, b_cols, i );
+        CV_SWAP( b_step, b_delta, i );
+    }
+
+    if( flags & CV_TS_GEMM_C_T )
+    {
+        CV_SWAP( c_rows, c_cols, i );
+        CV_SWAP( c_step, c_delta, i );
+    }
+
+    assert( a_rows == d_rows && a_cols == b_rows && b_cols == d_cols );
+    assert( a->data.ptr != d->data.ptr && b->data.ptr != d->data.ptr );
+
+    if( c )
+    {
+        assert( CV_ARE_TYPES_EQ(a,c) && c_rows == d_rows && c_cols == d_cols );
+        assert( c->data.ptr != d->data.ptr || (flags & CV_TS_GEMM_C_T) == 0 );
+    }
+
+    if( CV_MAT_DEPTH(a->type) == CV_32F )
+    {
+        float* a_data0 = a->data.fl;
+        float* b_data0 = b->data.fl;
+        float* c_data0 = c ? c->data.fl : 0;
+        float* d_data = d->data.fl;
+
+        for( i = 0; i < d_rows; i++, d_data += d_step, c_data0 += c_step, a_data0 += a_step )
+        {
+            for( j = 0; j < d_cols; j++ )
+            {
+                float* a_data = a_data0;
+                float* b_data = b_data0 + j*b_delta;
+                float* c_data = c_data0 + j*c_delta;
+
+                if( cn == 1 )
+                {
+                    double s = 0;
+                    for( k = 0; k < a_cols; k++ )
+                    {
+                        s += ((double)a_data[0])*b_data[0];
+                        a_data += a_delta;
+                        b_data += b_step;
+                    }
+                    d_data[j] = (float)(s*alpha + (c_data ? c_data[0]*beta : 0));
+                }
+                else
+                {
+                    double s_re = 0, s_im = 0;
+
+                    for( k = 0; k < a_cols; k++ )
+                    {
+                        s_re += ((double)a_data[0])*b_data[0] - ((double)a_data[1])*b_data[1];
+                        s_im += ((double)a_data[0])*b_data[1] + ((double)a_data[1])*b_data[0];
+                        a_data += a_delta;
+                        b_data += b_step;
+                    }
+
+                    s_re *= alpha;
+                    s_im *= alpha;
+
+                    if( c_data )
+                    {
+                        s_re += c_data[0]*beta;
+                        s_im += c_data[1]*beta;
+                    }
+
+                    d_data[j*2] = (float)s_re;
+                    d_data[j*2+1] = (float)s_im;
+                }
+            }
+        }
+    }
+    else if( CV_MAT_DEPTH(a->type) == CV_64F )
+    {
+        double* a_data0 = a->data.db;
+        double* b_data0 = b->data.db;
+        double* c_data0 = c ? c->data.db : 0;
+        double* d_data = d->data.db;
+
+        for( i = 0; i < d_rows; i++, d_data += d_step, c_data0 += c_step, a_data0 += a_step )
+        {
+            for( j = 0; j < d_cols; j++ )
+            {
+                double* a_data = a_data0;
+                double* b_data = b_data0 + j*b_delta;
+                double* c_data = c_data0 + j*c_delta;
+
+                if( cn == 1 )
+                {
+                    double s = 0;
+                    for( k = 0; k < a_cols; k++ )
+                    {
+                        s += a_data[0]*b_data[0];
+                        a_data += a_delta;
+                        b_data += b_step;
+                    }
+                    d_data[j] = s*alpha + (c_data ? c_data[0]*beta : 0);
+                }
+                else
+                {
+                    double s_re = 0, s_im = 0;
+
+                    for( k = 0; k < a_cols; k++ )
+                    {
+                        s_re += a_data[0]*b_data[0] - a_data[1]*b_data[1];
+                        s_im += a_data[0]*b_data[1] + a_data[1]*b_data[0];
+                        a_data += a_delta;
+                        b_data += b_step;
+                    }
+                    s_re *= alpha;
+                    s_im *= alpha;
+
+                    if( c_data )
+                    {
+                        s_re += c_data[0]*beta;
+                        s_im += c_data[1]*beta;
+                    }
+
+                    d_data[j*2] = s_re;
+                    d_data[j*2+1] = s_im;
+                }
+            }
+        }
+    }
+    else
+    {
+        assert(0);
+    }
+}
+
+
+CvMat* cvTsSelect( const CvMat* a, CvMat* header, CvRect rect )
+{
+    CvMat h;
+    int el_size;
+
+    h = cvMat( rect.height, rect.width, a->type );
+    el_size = CV_ELEM_SIZE(a->type);
+
+    h.data.ptr = a->data.ptr + rect.y*a->step + rect.x*el_size;
+    h.step = rect.height > 1 ? a->step : 0;
+    h.type &= ~CV_MAT_CONT_FLAG;
+    if( rect.height == 1 || h.step == h.cols*el_size )
+        h.type |= CV_MAT_CONT_FLAG;
+    *header = h;
+    return header;
+}
+
+
+double cvTsMinVal( int type )
+{
+    switch( CV_MAT_DEPTH(type) )
+    {
+    case CV_8U:
+        return 0;
+    case CV_8S:
+        return -128;
+    case CV_16U:
+        return 0;
+    case CV_16S:
+        return -32768;
+    case CV_32S:
+        return -1000000;
+    case CV_32F:
+        return -1000.;
+    case CV_64F:
+        return -1000.;
+    }
+    return log(-1.);
+}
+
+
+double cvTsMaxVal( int type )
+{
+    switch( CV_MAT_DEPTH(type) )
+    {
+    case CV_8U:
+        return 255;
+    case CV_8S:
+        return 127;
+    case CV_16U:
+        return 65535;
+    case CV_16S:
+        return 32767;
+    case CV_32S:
+        return 1000000;
+    case CV_32F:
+        return 1000.;
+    case CV_64F:
+        return 1000.;
+    }
+    return log(-1.);
+}
+
+
+void cvTsPrepareToFilter( const CvMat* a, CvMat* b, CvPoint ofs, int border_mode )
+{
+    int i;
+    CvMat temp, temp2;
+    CvScalar fill_val = cvScalarAll(0);
+    int fill_mode = border_mode == CV_TS_BORDER_FILLMIN ||
+                    border_mode == CV_TS_BORDER_FILLMAX ||
+                    border_mode == CV_TS_BORDER_FILLZERO;
+
+    assert( 0 <= ofs.x && ofs.x <= b->cols - a->cols &&
+            0 <= ofs.y && ofs.y <= b->rows - a->rows );
+
+    switch( border_mode )
+    {
+    case CV_TS_BORDER_FILLMIN:
+        fill_val = cvScalarAll(cvTsMinVal(a->type));
+        break;
+    case CV_TS_BORDER_FILLMAX:
+        fill_val = cvScalarAll(cvTsMaxVal(a->type));
+        break;
+    default:
+        ;
+    }
+
+    cvTsSelect( b, &temp, cvRect( ofs.x, ofs.y, a->cols, a->rows ));
+    cvTsCopy( a, &temp, 0 );
+
+    if( ofs.y > 0 )
+    {
+        if( fill_mode )
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, 0, a->cols, ofs.y ));
+            cvTsAdd( 0, cvScalar(0), 0, cvScalar(0), fill_val, &temp, 0 );
+        }
+        else
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, ofs.y, a->cols, 1 ));
+            for( i = 0; i < ofs.y; i++ )
+            {
+                cvTsSelect( b, &temp2, cvRect( ofs.x, i, a->cols, 1 ));
+                cvTsCopy( &temp, &temp2, 0 );
+            }
+        }
+    }
+
+    ofs.y += a->rows;
+    if( ofs.y < b->rows )
+    {
+        if( fill_mode )
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, ofs.y, a->cols, b->rows - ofs.y ));
+            cvTsAdd( 0, cvScalar(0), 0, cvScalar(0), fill_val, &temp, 0 );
+        }
+        else
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, ofs.y - 1, a->cols, 1 ));
+            for( i = ofs.y; i < b->rows; i++ )
+            {
+                cvTsSelect( b, &temp2, cvRect( ofs.x, i, a->cols, 1 ));
+                cvTsCopy( &temp, &temp2, 0 );
+            }
+        }
+    }
+
+    if( ofs.x > 0 )
+    {
+        if( fill_mode )
+        {
+            cvTsSelect( b, &temp, cvRect( 0, 0, ofs.x, b->rows ));
+            cvTsAdd( 0, cvScalar(0), 0, cvScalar(0), fill_val, &temp, 0 );
+        }
+        else
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, 0, 1, b->rows ));
+            for( i = 0; i < ofs.x; i++ )
+            {
+                cvTsSelect( b, &temp2, cvRect( i, 0, 1, b->rows ));
+                cvTsCopy( &temp, &temp2, 0 );
+            }
+        }
+    }
+
+    ofs.x += a->cols;
+    if( ofs.x < b->cols )
+    {
+        if( fill_mode )
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x, 0, b->cols - ofs.x, b->rows ));
+            cvTsAdd( 0, cvScalar(0), 0, cvScalar(0), fill_val, &temp, 0 );
+        }
+        else
+        {
+            cvTsSelect( b, &temp, cvRect( ofs.x-1, 0, 1, b->rows ));
+            for( i = ofs.x; i < b->cols; i++ )
+            {
+                cvTsSelect( b, &temp2, cvRect( i, 0, 1, b->rows ));
+                cvTsCopy( &temp, &temp2, 0 );
+            }
+        }
+    }
+}
+
+void cvTsConvolve2D( const CvMat* a, CvMat* b, const CvMat* kernel, CvPoint anchor )
+{
+    int i, j, k;
+    int cn, ncols, el_size;
+    int ker_size = kernel->rows*kernel->cols;
+    int a_step;
+    int* offset = (int*)alloca( ker_size*sizeof(offset[0]));
+    double* k_data = (double*)alloca( ker_size*sizeof(k_data[0]));
+
+    cn = CV_MAT_CN(a->type);
+    ncols = a->cols*cn;
+    el_size = CV_ELEM_SIZE(a->type & ~CV_MAT_CN_MASK);
+    a_step = a->step / el_size;
+
+    assert( CV_ARE_SIZES_EQ( a, b ) && CV_ARE_TYPES_EQ( a, b ) );
+    assert( CV_MAT_TYPE(kernel->type) == CV_64FC1 );
+    assert( 0 <= anchor.x && anchor.x < kernel->cols &&
+            0 <= anchor.y && anchor.y < kernel->rows );
+
+    for( i = 0, k = 0; i < kernel->rows; i++ )
+        for( j = 0; j < kernel->cols; j++ )
+        {
+            double f = ((double*)(kernel->data.ptr + kernel->step*i))[j];
+            if( f )
+            {
+                k_data[k] = f;
+                offset[k++] = (i - anchor.y)*a_step + (j - anchor.x)*cn;
+            }
+        }
+
+    ker_size = k;
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                int val;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((uchar*)a_data)[j+offset[k]]*k_data[k];
+                val = cvRound(s);
+                ((uchar*)b_data)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                int val;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((char*)a_data)[j+offset[k]]*k_data[k];
+                val = cvRound(s);
+                ((char*)b_data)[j] = CV_CAST_8S(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                int val;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((ushort*)a_data)[j+offset[k]]*k_data[k];
+                val = cvRound(s);
+                ((ushort*)b_data)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                int val;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((short*)a_data)[j+offset[k]]*k_data[k];
+                val = cvRound(s);
+                ((short*)b_data)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((int*)a_data)[j+offset[k]]*k_data[k];
+                ((int*)b_data)[j] = cvRound(s);
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((float*)a_data)[j+offset[k]]*k_data[k];
+                ((float*)b_data)[j] = (float)s;
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double s = 0;
+                for( k = 0; k < ker_size; k++ )
+                    s += ((double*)a_data)[j+offset[k]]*k_data[k];
+                ((double*)b_data)[j] = (double)s;
+            }
+            break;
+        default:
+            assert(0);
+        }
+    }
+
+    free( offset );
+    free( k_data );
+}
+
+
+void cvTsMinMaxFilter( const CvMat* a, CvMat* b, const CvMat* kernel,
+                       CvPoint anchor, int op_type )
+{
+    int i, j, k;
+    int cn, ncols, el_size, a_step;
+    int ker_size = kernel->rows*kernel->cols;
+    int* offset = (int*)alloca( ker_size*sizeof(offset[0]));
+    int calc_max = op_type == CV_TS_MAX;
+
+    cn = CV_MAT_CN(a->type);
+    ncols = a->cols*cn;
+    el_size = CV_ELEM_SIZE(a->type & ~CV_MAT_CN_MASK);
+    a_step = a->step / el_size;
+
+    assert( CV_ARE_SIZES_EQ( a, b ) && CV_ARE_TYPES_EQ( a, b ) );
+    assert( CV_MAT_TYPE(kernel->type) == CV_8UC1 || CV_MAT_TYPE(kernel->type) == CV_8SC1 );
+    assert( 0 <= anchor.x && anchor.x < kernel->cols &&
+            0 <= anchor.y && anchor.y < kernel->rows );
+
+    for( i = 0, k = 0; i < kernel->rows; i++ )
+        for( j = 0; j < kernel->cols; j++ )
+        {
+            if( kernel->data.ptr[kernel->step*i + j] )
+                offset[k++] = (i - anchor.y)*a_step + (j - anchor.x)*cn;
+        }
+
+    ker_size = k;
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int m = ((uchar*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    int v = ((uchar*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((uchar*)b_data)[j] = (uchar)m;
+            }
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int m = ((char*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    int v = ((char*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((char*)b_data)[j] = (char)m;
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+            {
+                int m = ((ushort*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    int v = ((ushort*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((ushort*)b_data)[j] = (ushort)m;
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int m = ((short*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    int v = ((short*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((short*)b_data)[j] = (short)m;
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+            {
+                int m = ((int*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    int v = ((int*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((int*)b_data)[j] = m;
+            }
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+            {
+                float m = ((float*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    float v = ((float*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((float*)b_data)[j] = (float)m;
+            }
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+            {
+                double m = ((double*)a_data)[j+offset[0]];
+                for( k = 1; k < ker_size; k++ )
+                {
+                    double v = ((double*)a_data)[j+offset[k]];
+                    if( calc_max )
+                    {
+                        if( m < v )
+                            m = v;
+                    }
+                    else if( m > v )
+                        m = v;
+                }
+                ((double*)b_data)[j] = (double)m;
+            }
+            break;
+        default:
+            assert(0);
+        }
+    }
+
+    free( offset );
+}
+
+
+double cvTsCrossCorr( const CvMat* a, const CvMat* b )
+{
+    int i, j;
+    int cn, ncols;
+    double s = 0;
+
+    cn = CV_MAT_CN(a->type);
+    ncols = a->cols*cn;
+
+    assert( CV_ARE_SIZES_EQ( a, b ) && CV_ARE_TYPES_EQ( a, b ) );
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* a_data = a->data.ptr + a->step*i;
+        uchar* b_data = b->data.ptr + b->step*i;
+
+        switch( CV_MAT_DEPTH(a->type) )
+        {
+        case CV_8U:
+            for( j = 0; j < ncols; j++ )
+                s += ((uchar*)a_data)[j]*((uchar*)b_data)[j];
+            break;
+        case CV_8S:
+            for( j = 0; j < ncols; j++ )
+                s += ((char*)a_data)[j]*((char*)b_data)[j];
+            break;
+        case CV_16U:
+            for( j = 0; j < ncols; j++ )
+                s += (double)((ushort*)a_data)[j]*((ushort*)b_data)[j];
+            break;
+        case CV_16S:
+            for( j = 0; j < ncols; j++ )
+                s += ((short*)a_data)[j]*((short*)b_data)[j];
+            break;
+        case CV_32S:
+            for( j = 0; j < ncols; j++ )
+                s += ((double)((int*)a_data)[j])*((int*)b_data)[j];
+            break;
+        case CV_32F:
+            for( j = 0; j < ncols; j++ )
+                s += ((double)((float*)a_data)[j])*((float*)b_data)[j];
+            break;
+        case CV_64F:
+            for( j = 0; j < ncols; j++ )
+                s += ((double*)a_data)[j]*((double*)b_data)[j];
+            break;
+        default:
+            assert(0);
+            return log(-1.);
+        }
+    }
+
+    return s;
+}
+
+
+void cvTsTransform( const CvMat* a, CvMat* b, const CvMat* transmat, const CvMat* shift )
+{
+    int i, j, k, cols, dst_cols;
+    int cn, dst_cn, depth, mat_depth, shiftstep;
+    double mat[20], *buf, *dst_buf;
+
+    cn = CV_MAT_CN(a->type);
+    dst_cn = CV_MAT_CN(b->type);
+    depth = CV_MAT_DEPTH(a->type);
+    mat_depth = CV_MAT_DEPTH(transmat->type);
+    cols = transmat->cols;
+
+    // prepare cn x (cn + 1) transform matrix
+    if( mat_depth == CV_32F )
+    {
+        shiftstep = shift && shift->step ? shift->step/sizeof(float) : 1;
+        for( i = 0; i < transmat->rows; i++ )
+        {
+            mat[i*(cn+1) + cn] = 0.;
+            for( j = 0; j < cols; j++ )
+                mat[i*(cn+1) + j] = ((float*)(transmat->data.ptr + transmat->step*i))[j];
+            if( shift )
+                mat[i*(cn+1) + cn] = shift->data.fl[i*shiftstep];
+        }
+    }
+    else
+    {
+        assert( mat_depth == CV_64F );
+
+        shiftstep = shift && shift->step ? shift->step/sizeof(double) : 1;
+        for( i = 0; i < transmat->rows; i++ )
+        {
+            mat[i*(cn+1) + cn] = 0.;
+            for( j = 0; j < cols; j++ )
+                mat[i*(cn+1) + j] = ((double*)(transmat->data.ptr + transmat->step*i))[j];
+            if( shift )
+                mat[i*(cn+1) + cn] = shift->data.db[i*shiftstep];
+        }
+    }
+
+    // transform data
+    cols = a->cols * cn;
+    dst_cols = a->cols * dst_cn;
+    buf = (double*)cvStackAlloc( cols * sizeof(double) );
+    dst_buf = (double*)cvStackAlloc( dst_cols * sizeof(double) );
+
+    for( i = 0; i < a->rows; i++ )
+    {
+        uchar* src = a->data.ptr + i*a->step;
+        uchar* dst = b->data.ptr + i*b->step;
+        double* _dst = dst_buf;
+
+        switch( depth )
+        {
+        case CV_8U:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((uchar*)src)[j];
+            break;
+        case CV_16U:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((ushort*)src)[j];
+            break;
+        case CV_16S:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((short*)src)[j];
+            break;
+        case CV_32S:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((int*)src)[j];
+            break;
+        case CV_32F:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((float*)src)[j];
+            break;
+        case CV_64F:
+            for( j = 0; j < cols; j++ )
+                buf[j] = ((double*)src)[j];
+            break;
+        default:
+            assert(0);
+        }
+
+        switch( cn )
+        {
+        case 1:
+            for( j = 0; j < cols; j++, _dst += dst_cn )
+                for( k = 0; k < dst_cn; k++ )
+                    _dst[k] = buf[j]*mat[2*k] + mat[2*k+1];
+            break;
+        case 2:
+            for( j = 0; j < cols; j += 2, _dst += dst_cn )
+                for( k = 0; k < dst_cn; k++ )
+                    _dst[k] = buf[j]*mat[3*k] + buf[j+1]*mat[3*k+1] + mat[3*k+2];
+            break;
+        case 3:
+            for( j = 0; j < cols; j += 3, _dst += dst_cn )
+                for( k = 0; k < dst_cn; k++ )
+                    _dst[k] = buf[j]*mat[4*k] + buf[j+1]*mat[4*k+1] +
+                              buf[j+2]*mat[4*k+2] + mat[4*k+3];
+            break;
+        case 4:
+            for( j = 0; j < cols; j += 4, _dst += dst_cn )
+                for( k = 0; k < dst_cn; k++ )
+                    _dst[k] = buf[j]*mat[5*k] + buf[j+1]*mat[5*k+1] +
+                        buf[j+2]*mat[5*k+2] + buf[j+3]*mat[5*k+3] + mat[5*k+4];
+            break;
+        default:
+            assert(0);
+        }
+
+        switch( depth )
+        {
+        case CV_8U:
+            for( j = 0; j < dst_cols; j++ )
+            {
+                int val = cvRound(dst_buf[j]);
+                ((uchar*)dst)[j] = CV_CAST_8U(val);
+            }
+            break;
+        case CV_16U:
+            for( j = 0; j < dst_cols; j++ )
+            {
+                int val = cvRound(dst_buf[j]);
+                ((ushort*)dst)[j] = CV_CAST_16U(val);
+            }
+            break;
+        case CV_16S:
+            for( j = 0; j < dst_cols; j++ )
+            {
+                int val = cvRound(dst_buf[j]);
+                ((short*)dst)[j] = CV_CAST_16S(val);
+            }
+            break;
+        case CV_32S:
+            for( j = 0; j < dst_cols; j++ )
+                ((int*)dst)[j] = cvRound(dst_buf[j]);
+            break;
+        case CV_32F:
+            for( j = 0; j < dst_cols; j++ )
+                ((float*)dst)[j] = (float)dst_buf[j];
+            break;
+        case CV_64F:
+            for( j = 0; j < dst_cols; j++ )
+                ((double*)dst)[j] = dst_buf[j];
+            break;
+        default:
+            assert(0);
+        }
+    }
+}
+
+
+CvMat* cvTsTranspose( const CvMat* a, CvMat* b )
+{
+    int i, j, k, rows, cols, elem_size;
+    uchar *a_data, *b_data;
+    int a_step, b_step;
+
+    elem_size = CV_ELEM_SIZE(a->type);
+    rows = a->rows;
+    cols = a->cols;
+
+    assert( a->rows == b->cols && a->cols == b->rows && CV_ARE_TYPES_EQ(a,b) );
+    a_data = a->data.ptr;
+    a_step = a->step;
+    b_data = b->data.ptr;
+    b_step = b->step;
+
+    if( rows == cols )
+    {
+        for( i = 0; i < rows; i++ )
+        {
+            for( j = 0; j <= i; j++ )
+            {
+                uchar* a_ij = a_data + a_step*i + elem_size*j;
+                uchar* a_ji = a_data + a_step*j + elem_size*i;
+                uchar* b_ij = b_data + b_step*i + elem_size*j;
+                uchar* b_ji = b_data + b_step*j + elem_size*i;
+                for( k = 0; k < elem_size; k++ )
+                {
+                    uchar t0 = a_ij[k];
+                    uchar t1 = a_ji[k];
+                    b_ji[k] = t0;
+                    b_ij[k] = t1;
+                }
+            }
+        }
+    }
+    else
+    {
+        for( i = 0; i < cols; i++ )
+        {
+            for( j = 0; j < rows; j++ )
+            {
+                uchar* a_ji = a_data + a_step*j + elem_size*i;
+                uchar* b_ij = b_data + b_step*i + elem_size*j;
+                for( k = 0; k < elem_size; k++ )
+                    b_ij[k] = a_ji[k];
+            }
+        }
+    }
+
+    return b;
+}
+
+
+void cvTsFlip( const CvMat* a, CvMat* b, int flip_type )
+{
+    int i, j, k, rows, cols, elem_size;
+    uchar *a_data, *b_data;
+    int a_step, b_step;
+
+    elem_size = CV_ELEM_SIZE(a->type);
+    rows = a->rows;
+    cols = a->cols*elem_size;
+
+    assert( CV_ARE_SIZES_EQ(a,b) && CV_ARE_TYPES_EQ(a,b) && a->data.ptr != b->data.ptr );
+    a_data = a->data.ptr;
+    a_step = a->step;
+    b_data = b->data.ptr;
+    b_step = b->step;
+
+    if( flip_type <= 0 )
+    {
+        a_data += a_step*(rows-1);
+        a_step = -a_step;
+    }
+
+    for( i = 0; i < rows; i++ )
+    {
+        if( flip_type == 0 )
+            memcpy( b_data, a_data, cols );
+        else
+        {
+            for( j = 0; j < cols; j += elem_size )
+                for( k = 0; k < elem_size; k++ )
+                    b_data[j+k] = a_data[cols - elem_size - j + k];
+        }
+        a_data += a_step;
+        b_data += b_step;
+    }
+}
+
+
+void  cvTsPatchZeros( CvMat* mat, double level )
+{
+    int i, j, ncols = mat->cols * CV_MAT_CN(mat->type);
+
+    for( i = 0; i < mat->rows; i++ )
+    {
+        switch( CV_MAT_DEPTH(mat->type) )
+        {
+        case CV_32F:
+            {
+            float* data = (float*)(mat->data.ptr + i*mat->step);
+            for( j = 0; j < ncols; j++ )
+                if( fabs(data[j]) < level )
+                    data[j] += 1;
+            }
+            break;
+        case CV_64F:
+            {
+            double* data = (double*)(mat->data.ptr + i*mat->step);
+            for( j = 0; j < ncols; j++ )
+                if( fabs(data[j]) < level )
+                    data[j] += 1;
+            }
+            break;
+        default:
+            assert(0);
+            return;
+        }
+    }
+}
+
+
+/* End of file. */
diff --git a/opencv/tests/cxts/precomp.cpp b/opencv/tests/cxts/precomp.cpp
new file mode 100644 (file)
index 0000000..5c5265a
--- /dev/null
@@ -0,0 +1,44 @@
+/*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*/
+
+#include "_cxts.h"
+
+/* End of file. */