From 80cd7b93506cc1926882d5fd08a2c74ee9359e29 Mon Sep 17 00:00:00 2001 From: kecsap Date: Mon, 14 Jul 2008 12:24:10 +0000 Subject: [PATCH] Update the trunk to the OpenCV's CVS (2008-07-14) git-svn-id: file:///svnroot/opencv/trunk@3 06388636-69cd-4dee-b09d-1587a8dc34ce --- INSTALL | 8 + Makefile.am | 3 + Makefile.in | 18 + THANKS | 15 +- _make/opencv.dsw | 78 + _make/opencv.sln | 222 - aclocal.m4 | 711 +- apps/HaarFaceDetect/Makefile.am | 3 + apps/Makefile.in | 15 + apps/haartraining/Makefile.in | 15 + apps/haartraining/include/Makefile.in | 15 + apps/haartraining/src/Makefile.am | 3 + apps/haartraining/src/Makefile.in | 18 + configure | 4324 +++--- configure.in | 297 +- cv/Makefile.in | 15 + cv/include/Makefile.in | 15 + cv/include/cv.h | 55 +- cv/include/cvcompat.h | 78 +- cv/include/cvtypes.h | 6 +- cv/src/Makefile.am | 9 +- cv/src/Makefile.in | 18 + cv/src/_cvipp.h | 12 +- cv/src/cv.dsp | 154 +- cv/src/cv.vcproj | 5430 ------- cv/src/cvcalibinit.cpp | 903 +- cv/src/cvcalibration.cpp | 60 + cv/src/cvcontours.cpp | 110 +- cv/src/cvconvhull.cpp | 26 +- cv/src/cvgeometry.cpp | 267 +- cv/src/cvhaar.cpp | 234 +- cv/src/cvlinefit.cpp | 286 +- cv/src/cvlkpyramid.cpp | 32 +- cv/src/cvsmooth.cpp | 180 +- cvaux/Makefile.in | 15 + cvaux/include/Makefile.in | 15 + cvaux/include/cvaux.h | 106 +- cvaux/include/cvaux.hpp | 2 +- cvaux/include/cvmat.hpp | 12 +- cvaux/include/cvvidsurv.hpp | 309 +- cvaux/src/Makefile.am | 3 + cvaux/src/Makefile.in | 18 + cvaux/src/_cvfacedetection.h | 10 +- cvaux/src/cv3dtracker.cpp | 6 +- cvaux/src/cvaux.dsp | 147 +- cvaux/src/cvaux.vcproj | 2930 ---- cvaux/src/cvbgfg_acmmm2003.cpp | 193 +- cvaux/src/cvbgfg_gaussmix.cpp | 37 +- cvaux/src/cveigenobjects.cpp | 16 +- cvaux/src/cvface.h | 8 +- cvaux/src/vs/bgfg_estimation.cpp | 28 +- cvaux/src/vs/blobtrackanalysis.cpp | 12 +- cvaux/src/vs/blobtrackanalysishist.cpp | 313 +- cvaux/src/vs/blobtrackanalysisior.cpp | 42 +- cvaux/src/vs/blobtrackanalysistrackdist.cpp | 178 +- cvaux/src/vs/blobtrackgen1.cpp | 46 +- cvaux/src/vs/blobtrackgenyml.cpp | 55 +- cvaux/src/vs/blobtrackingauto.cpp | 155 +- cvaux/src/vs/blobtrackingcc.cpp | 159 +- cvaux/src/vs/blobtrackingccwithcr.cpp | 144 +- cvaux/src/vs/blobtrackingkalman.cpp | 28 +- cvaux/src/vs/blobtrackinglist.cpp | 144 +- cvaux/src/vs/blobtrackingmsfg.cpp | 278 +- cvaux/src/vs/blobtrackingmsfgs.cpp | 133 +- cvaux/src/vs/blobtrackpostprockalman.cpp | 48 +- cvaux/src/vs/blobtrackpostproclinear.cpp | 13 +- cvaux/src/vs/blobtrackpostproclist.cpp | 23 +- cvaux/src/vs/enteringblobdetection.cpp | 455 +- cvaux/src/vs/enteringblobdetectionreal.cpp | 39 +- cvaux/src/vs/testseq.cpp | 399 +- cvconfig.h.in | 3 + cxcore/Makefile.in | 15 + cxcore/include/Makefile.in | 15 + cxcore/include/cxcore.h | 36 +- cxcore/include/cxcore.hpp | 10 +- cxcore/include/cxmisc.h | 20 +- cxcore/include/cxtypes.h | 226 +- cxcore/src/Makefile.am | 3 + cxcore/src/Makefile.in | 18 + cxcore/src/_cxcore.h | 4 +- cxcore/src/cxconvert.cpp | 46 +- cxcore/src/cxcore.dsp | 146 +- cxcore/src/cxcore.vcproj | 3245 ----- cxcore/src/cxdatastructs.cpp | 366 +- cxcore/src/cxdxt.cpp | 22 +- cxcore/src/cxpersistence.cpp | 220 +- cxcore/src/cxutils.cpp | 261 + data/Makefile.in | 15 + debian/control | 26 +- debian/rules | 13 +- docs/Makefile.in | 15 + docs/appPage/appindex.htm | 6 +- docs/ref/opencvref_cv.htm | 270 +- docs/ref/opencvref_cxcore.htm | 30 +- interfaces/Makefile.in | 15 + interfaces/swig/Makefile.am | 2 +- interfaces/swig/Makefile.in | 17 +- interfaces/swig/filtered/Makefile.in | 15 + interfaces/swig/filtered/constants.h | 6 +- interfaces/swig/filtered/cv.h | 105 +- interfaces/swig/general/Makefile.in | 15 + interfaces/swig/general/cvarr_operators.i | 80 +- interfaces/swig/general/extensions.i | 22 +- interfaces/swig/general/memory.i | 5 + interfaces/swig/general/typemaps.i | 9 +- interfaces/swig/python/Makefile.in | 15 + interfaces/swig/python/_cv.cpp |15214 +++++++++++--------- interfaces/swig/python/_highgui.cpp | 640 +- interfaces/swig/python/_ml.cpp | 1446 +- interfaces/swig/python/adaptors.py | 6 +- interfaces/swig/python/cv.py | 259 +- interfaces/swig/python/cvarr.i | 31 +- interfaces/swig/python/highgui.i | 17 +- interfaces/swig/python/highgui.py | 4 +- interfaces/swig/python/imagedata.i | 21 +- interfaces/swig/python/ml.py | 2 +- interfaces/swig/python/pyhelpers.cpp | 89 +- interfaces/swig/python/pyhelpers.i | 10 + interfaces/swig/python/pytypemaps.i | 40 +- ml/Makefile.in | 15 + ml/include/Makefile.in | 15 + ml/include/ml.h | 78 +- ml/src/Makefile.am | 3 + ml/src/Makefile.in | 18 + ml/src/ml.dsp | 18 +- ml/src/ml.vcproj | 998 -- ml/src/mlsvm.cpp | 102 +- otherlibs/Makefile.in | 15 + otherlibs/_graphics/include/jasper/jas_cm.h | 4 +- otherlibs/_graphics/include/jasper/jas_config.h | 55 +- otherlibs/_graphics/include/jasper/jas_config.h.in | 45 +- otherlibs/_graphics/include/jasper/jas_config2.h | 15 +- otherlibs/_graphics/include/jasper/jas_debug.h | 4 +- otherlibs/_graphics/include/jasper/jas_fix.h | 8 +- otherlibs/_graphics/include/jasper/jas_getopt.h | 4 +- otherlibs/_graphics/include/jasper/jas_icc.h | 2 +- otherlibs/_graphics/include/jasper/jas_image.h | 4 +- otherlibs/_graphics/include/jasper/jas_init.h | 2 +- otherlibs/_graphics/include/jasper/jas_malloc.h | 4 +- otherlibs/_graphics/include/jasper/jas_math.h | 4 +- otherlibs/_graphics/include/jasper/jas_seq.h | 6 +- otherlibs/_graphics/include/jasper/jas_stream.h | 6 +- otherlibs/_graphics/include/jasper/jas_string.h | 4 +- otherlibs/_graphics/include/jasper/jas_tvp.h | 4 +- otherlibs/_graphics/include/jasper/jas_types.h | 26 +- otherlibs/_graphics/include/jasper/jas_version.h | 6 +- otherlibs/_graphics/include/jasper/jasper.h | 3 +- otherlibs/_graphics/include/png.h | 420 +- otherlibs/_graphics/include/pngconf.h | 188 +- otherlibs/_graphics/include/zconf.h | 285 +- otherlibs/_graphics/include/zlib.h | 231 +- otherlibs/_graphics/src/graphic_libs.sln | 132 - otherlibs/_graphics/src/libjasper/LICENSE | 2 +- otherlibs/_graphics/src/libjasper/jas_cm.c | 57 +- otherlibs/_graphics/src/libjasper/jas_debug.c | 2 +- otherlibs/_graphics/src/libjasper/jas_getopt.c | 10 +- otherlibs/_graphics/src/libjasper/jas_icc.c | 7 +- otherlibs/_graphics/src/libjasper/jas_iccdata.c | 2 +- otherlibs/_graphics/src/libjasper/jas_image.c | 11 +- otherlibs/_graphics/src/libjasper/jas_init.c | 2 +- otherlibs/_graphics/src/libjasper/jas_malloc.c | 17 +- otherlibs/_graphics/src/libjasper/jas_seq.c | 80 +- otherlibs/_graphics/src/libjasper/jas_stream.c | 4 +- otherlibs/_graphics/src/libjasper/jas_string.c | 4 +- otherlibs/_graphics/src/libjasper/jas_tvp.c | 4 +- otherlibs/_graphics/src/libjasper/jas_version.c | 2 +- otherlibs/_graphics/src/libjasper/jp2_cod.c | 51 +- otherlibs/_graphics/src/libjasper/jp2_cod.h | 11 +- otherlibs/_graphics/src/libjasper/jp2_dec.c | 8 +- otherlibs/_graphics/src/libjasper/jp2_dec.h | 2 +- otherlibs/_graphics/src/libjasper/jp2_enc.c | 6 +- otherlibs/_graphics/src/libjasper/jpc_bs.c | 7 +- otherlibs/_graphics/src/libjasper/jpc_bs.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_cod.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_cs.c | 35 +- otherlibs/_graphics/src/libjasper/jpc_cs.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_dec.c | 43 +- otherlibs/_graphics/src/libjasper/jpc_dec.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_enc.c | 123 +- otherlibs/_graphics/src/libjasper/jpc_enc.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_fix.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_flt.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_math.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_math.h | 2 +- otherlibs/_graphics/src/libjasper/jpc_mct.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_mct.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqcod.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqcod.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqdec.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqdec.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqenc.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_mqenc.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_qmfb.c | 3792 +++-- otherlibs/_graphics/src/libjasper/jpc_qmfb.h | 111 +- otherlibs/_graphics/src/libjasper/jpc_t1cod.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_t1cod.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_t1dec.c | 18 +- otherlibs/_graphics/src/libjasper/jpc_t1dec.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_t1enc.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_t1enc.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_t2cod.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_t2cod.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_t2dec.c | 22 +- otherlibs/_graphics/src/libjasper/jpc_t2dec.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_t2enc.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_t2enc.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_tagtree.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_tagtree.h | 4 +- otherlibs/_graphics/src/libjasper/jpc_tsfb.c | 640 +- otherlibs/_graphics/src/libjasper/jpc_tsfb.h | 55 +- otherlibs/_graphics/src/libjasper/jpc_util.c | 4 +- otherlibs/_graphics/src/libjasper/jpc_util.h | 2 +- otherlibs/_graphics/src/libjasper/libjasper.dsp | 126 +- otherlibs/_graphics/src/libjasper/libjasper.vcproj | 633 - otherlibs/_graphics/src/libjpeg/libjpeg.dsp | 118 +- otherlibs/_graphics/src/libjpeg/libjpeg.vcproj | 2253 --- otherlibs/_graphics/src/libpng/README | 44 +- otherlibs/_graphics/src/libpng/libpng.dsp | 122 +- otherlibs/_graphics/src/libpng/libpng.vcproj | 1053 -- otherlibs/_graphics/src/libpng/png.c | 166 +- otherlibs/_graphics/src/libpng/pngerror.c | 162 +- otherlibs/_graphics/src/libpng/pnggccrd.c | 5383 +------ otherlibs/_graphics/src/libpng/pngget.c | 91 +- otherlibs/_graphics/src/libpng/pngmem.c | 21 +- otherlibs/_graphics/src/libpng/pngpread.c | 253 +- otherlibs/_graphics/src/libpng/pngread.c | 203 +- otherlibs/_graphics/src/libpng/pngrio.c | 12 +- otherlibs/_graphics/src/libpng/pngrtran.c | 565 +- otherlibs/_graphics/src/libpng/pngrutil.c | 249 +- otherlibs/_graphics/src/libpng/pngset.c | 269 +- otherlibs/_graphics/src/libpng/pngtest.c | 93 +- otherlibs/_graphics/src/libpng/pngtrans.c | 34 +- otherlibs/_graphics/src/libpng/pngvcrd.c | 3904 +---- otherlibs/_graphics/src/libpng/pngwio.c | 10 +- otherlibs/_graphics/src/libpng/pngwrite.c | 170 +- otherlibs/_graphics/src/libpng/pngwtran.c | 21 +- otherlibs/_graphics/src/libpng/pngwutil.c | 246 +- otherlibs/_graphics/src/libtiff/libtiff.dsp | 118 +- otherlibs/_graphics/src/libtiff/libtiff.vcproj | 1845 --- otherlibs/_graphics/src/zlib/README | 9 +- otherlibs/_graphics/src/zlib/adler32.c | 113 +- otherlibs/_graphics/src/zlib/compress.c | 4 +- otherlibs/_graphics/src/zlib/crc32.c | 104 +- otherlibs/_graphics/src/zlib/deflate.c | 284 +- otherlibs/_graphics/src/zlib/deflate.h | 12 +- otherlibs/_graphics/src/zlib/example.c | 6 +- otherlibs/_graphics/src/zlib/gzio.c | 55 +- otherlibs/_graphics/src/zlib/infback.c | 11 +- otherlibs/_graphics/src/zlib/inffast.c | 13 + otherlibs/_graphics/src/zlib/inflate.c | 126 +- otherlibs/_graphics/src/zlib/inflate.h | 8 +- otherlibs/_graphics/src/zlib/inftrees.c | 11 +- otherlibs/_graphics/src/zlib/inftrees.h | 10 +- otherlibs/_graphics/src/zlib/trees.c | 38 +- otherlibs/_graphics/src/zlib/uncompr.c | 2 +- otherlibs/_graphics/src/zlib/zlib.dsp | 118 +- otherlibs/_graphics/src/zlib/zlib.vcproj | 885 -- otherlibs/_graphics/src/zlib/zutil.c | 35 +- otherlibs/_graphics/src/zlib/zutil.h | 32 +- otherlibs/highgui/Makefile.am | 46 +- otherlibs/highgui/Makefile.in | 85 +- otherlibs/highgui/_highgui.h | 110 +- otherlibs/highgui/cvcap.cpp | 222 +- otherlibs/highgui/cvcap_cmu.cpp | 663 +- otherlibs/highgui/cvcap_dc1394.cpp | 85 +- otherlibs/highgui/cvcap_ffmpeg.cpp | 935 +- otherlibs/highgui/cvcap_mil.cpp | 167 +- otherlibs/highgui/cvcap_qt.cpp | 748 +- otherlibs/highgui/cvcap_tyzx.cpp | 121 +- otherlibs/highgui/cvcap_v4l.cpp | 131 +- otherlibs/highgui/cvcap_vfw.cpp | 760 +- otherlibs/highgui/cvcap_w32.cpp | 169 +- otherlibs/highgui/cvcap_xine.cpp | 87 +- otherlibs/highgui/highgui.dsp | 168 +- otherlibs/highgui/highgui.h | 22 +- otherlibs/highgui/highgui.vcproj | 2237 --- otherlibs/highgui/loadsave.cpp | 21 + otherlibs/highgui/makefile.gnu | 2 +- otherlibs/highgui/makefile.ms | 8 +- otherlibs/highgui/utils.cpp | 68 +- samples/Makefile.am | 2 +- samples/Makefile.in | 17 +- samples/c/Makefile.am | 2 +- samples/c/Makefile.in | 15 + samples/c/blobtrack.cpp | 202 +- samples/c/cvsample.dsp | 136 +- samples/c/cvsample.vcproj | 413 - samples/c/facedetect.c | 126 +- samples/c/facedetect.cmd | 2 +- samples/python/Makefile.in | 15 + samples/python/facedetect.py | 18 +- tests/Makefile.am | 2 +- tests/Makefile.in | 143 +- tests/cv/Makefile.in | 15 + tests/cv/src/Makefile.am | 4 + tests/cv/src/Makefile.in | 18 + tests/cv/src/aconvhull.cpp | 12 +- tests/cv/src/cvtest.dsp | 137 +- tests/cv/src/cvtest.vcproj | 2112 --- tests/cxcore/Makefile.in | 15 + tests/cxcore/src/Makefile.am | 4 + tests/cxcore/src/Makefile.in | 18 + tests/cxcore/src/adatastruct.cpp | 133 +- tests/cxcore/src/cxcoretest.dsp | 134 +- tests/cxcore/src/cxcoretest.vcproj | 672 - tests/cxts/Makefile.am | 3 + tests/cxts/Makefile.in | 18 + tests/cxts/cxts.cpp | 2 +- tests/cxts/cxts.dsp | 148 +- tests/cxts/cxts.vcproj | 612 - tests/cxts/cxts_math.cpp | 116 +- tests/python/Makefile.am | 7 + tests/python/Makefile.in | 19 +- utils/Makefile.in | 15 + utils/cvinfo/cvinfo.dsp | 14 +- utils/cvinfo/cvinfo.vcproj | 438 - 316 files changed, 28386 insertions(+), 55510 deletions(-) diff --git a/INSTALL b/INSTALL index 99d0300..44414ec 100644 --- a/INSTALL +++ b/INSTALL @@ -236,3 +236,11 @@ MacOSX + If you'd like to step in as a developer, you will need to get the appropriate versions of automake, etc. (see Linux section) from darwinports. + +Other Systems +============= + + Although there is no official support for non-x86 based + processors it is reportedly possible to compile OpenCV on ARM. + + * on ARM pass CXXFLAGS=-fsigned-char to configure. diff --git a/Makefile.am b/Makefile.am index 30eadd3..964d12d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,8 @@ # The top-level input Makefile for OpenCV +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + # tell make where aclocal finds its files in Maintainer Mode ACLOCAL_AMFLAGS = -I ./autotools/aclocal diff --git a/Makefile.in b/Makefile.in index 8f5cc59..a8195ec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -116,10 +116,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -142,8 +146,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -154,6 +160,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -172,11 +180,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -196,10 +209,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ @@ -264,6 +279,9 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +# use the default c++ flags +AM_CXXFLAGS = @DEF_CXXFLAGS@ + # tell make where aclocal finds its files in Maintainer Mode ACLOCAL_AMFLAGS = -I ./autotools/aclocal @BUILD_APPS_FALSE@APPS_DIR = diff --git a/THANKS b/THANKS index 815438d..5a9d4c2 100644 --- a/THANKS +++ b/THANKS @@ -23,7 +23,7 @@ Asbach, Mark RWTH Aachen University New-style Linux makefiles, SW Boldyrev, Sergey Intel Corp. rpm spec & linux makefiles Bornet, Olivier IDIAP Research Institute New-style Linux makefiles, SWIG & specialized Python wrappers Bouguet, Jean-Yves Intel Corp. Algorithms for Camera calibration, calibration toolbox for MATLAB, LK in pyramids ... -Bovyrin, Alexander Intel Corp. Contours, Stereo, Improvements in object detection +Bovyrin, Alexander Intel Corp. Contours, Stereo, Improvements in object detection, blobtrack/vs module in cvaux Bradski, Gary Intel Corp. Idea and Vision, Leading, CAMSHIFT & MHI algorithms and more ... Bradley, David Princeton Univ. Haar classifier for profile faces Breen, Ed ??? EiC intepreter, used for Hawk @@ -35,6 +35,7 @@ Chudinovich, Boris Intel Corp. Ideas and algorithms on conto Cowperthwaite, David Intel Corp. 3d Tracker Davies, Bob Intel Corp. First OpenCV installation program, communications with user group, tech. advisor +Delacour, Xavier ??? Octave bindings, some Video I/O components for highgui Devernay, Frederic INRIA (?) Multiple patches for OpenCV (cvcam, cxcore, cv, highgui). Don Murray PointGrey PointGrey SDK and patches for stereo gesture recognition code Dubey, Premnath ??? Patch for cvcam (Windows version) @@ -47,14 +48,17 @@ Grachev, Ilya Intel Corp. TCL/TK demos (cvlkdemo, cvcsd Gruebele, Philip ??? Multiple patches for OpenCV Guhring, Philipp ??? Single-object mode in cvHaarDetectObjects +Hafeneger, Stefan ??? Some 3D & Calibration related functionality Halsall, Chris Open Source Solutions Inc O-Reilly papers on OpenCV, calibration app for Linux (is not supported now?) patches for Linux version +Hameed, Shameem University of Michigan Haar classifiers for eye detection + Hasler, Nils Max Planck Institut 16-bit images support, Jasper and OpenEXR bindings in HighGUI Khamenya, Valery BioVisioN AG OpenCV CVS repository at SourceForge Khudyakov, Vasily Novosibirsk University Face feature detection Kruppa, Hannes ETH Zurich Haar classifier for fullbody, lowerbody, upperbody detection. -Kuranov, Alexander Intel Corp. Matlab wrappers, Face detection code, haartraining and related applications +Kuranov, Alexander Intel Corp. Matlab wrappers, face detection code, haartraining and related applications Kuriakin, Valery Intel Corp. Started OpenCV project in Nizhny Novrogod Lab Lienhart, Rainer Intel Corp. Haar feature-based face detection algorithm and the original code @@ -74,12 +78,13 @@ Philomin, Vasanth PHILIPS (?) Several bug reports/fixes on Pisarevsky, Vadim Intel Corp. OpenCV hacker :) Pleskov, Alexander Intel Corp. Pyramidal segmentation, gesture recognition code, comp. geometry functions -Rodyushkin, Konstantin Intel Corp. applications OpenCV to 3dFace caused a few bug reports, functionality proposals +Rodyushkin, Konstantin Intel Corp. applications OpenCV to 3dFace caused a few bug reports, functionality proposals, + blobtrack/vs module in cvaux Schaefer, Dirk MD-Mathematische Dienste GmbH original code for Bayer->RGB pattern conversion Schiele, Bernt ETH Zurich Haar classifier for fullbody, lowerbody, upperbody detection. -Shavit, Adi ??? OpenCV forum moderation -Shevtsova, Irina Moscow State Uni EM, Bayesian classifier, Random Trees and CNN in Machine Learning module +Shavit, Adi ??? OpenCV forum moderation, OpenCV logo +Shevtsova, Irina Moscow State Uni EM, Bayesian classifier, Random Trees, CNN in Machine Learning module; SVM enhancements Sobolev, Andrey Moscow State Uni Contour skeletons and linear-contour model Stanchak, Roman Naval Research Lab Multiple improvements in Highgui (GTK+), Python wrappers and the core functionality Stavinzky, Jay ??? 8u->8u L1 Distance transform. diff --git a/_make/opencv.dsw b/_make/opencv.dsw index 0ecfcfb..91a43a9 100644 --- a/_make/opencv.dsw +++ b/_make/opencv.dsw @@ -152,6 +152,72 @@ Package=<4> Begin Project Dependency Project_Dep_Name cxcore End Project Dependency + Begin Project Dependency + Project_Dep_Name libjasper + End Project Dependency + Begin Project Dependency + Project_Dep_Name libjpeg + End Project Dependency + Begin Project Dependency + Project_Dep_Name libpng + End Project Dependency + Begin Project Dependency + Project_Dep_Name libtiff + End Project Dependency + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency +}}} + +############################################################################### + +Project: "libjasper"=..\otherlibs\_graphics\src\libjasper\libjasper.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "libjpeg"=..\otherlibs\_graphics\src\libjpeg\libjpeg.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "libpng"=..\otherlibs\_graphics\src\libpng\libpng.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency +}}} + +############################################################################### + +Project: "libtiff"=..\otherlibs\_graphics\src\libtiff\libtiff.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ }}} ############################################################################### @@ -171,6 +237,18 @@ Package=<4> ############################################################################### +Project: "zlib"=..\otherlibs\_graphics\src\zlib\zlib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Global: Package=<5> diff --git a/_make/opencv.sln b/_make/opencv.sln index 1d1a71d..e69de29 100644 --- a/_make/opencv.sln +++ b/_make/opencv.sln @@ -1,222 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cv", "..\cv\src\cv.vcproj", "{90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvaux", "..\cvaux\src\cvaux.vcproj", "{FFABC1E5-619E-4EE7-B09E-95842DCE8887}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} = {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvinfo", "..\utils\cvinfo\cvinfo.vcproj", "{2046CEFA-02BF-4616-845F-0BC884160372}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvsample", "..\samples\c\cvsample.vcproj", "{2820F96A-13D2-4EFE-BC9F-A9AF482026AE}" - ProjectSection(ProjectDependencies) = postProject - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB} = {98487437-52F8-41E0-A3AF-1FC59BBBD3FB} - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} = {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvtest", "..\tests\cv\src\cvtest.vcproj", "{48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}" - ProjectSection(ProjectDependencies) = postProject - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB} = {98487437-52F8-41E0-A3AF-1FC59BBBD3FB} - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} = {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C} - {FFABC1E5-619E-4EE7-B09E-95842DCE8887} = {FFABC1E5-619E-4EE7-B09E-95842DCE8887} - {189C2FF4-D924-4A87-A070-505196436CFE} = {189C2FF4-D924-4A87-A070-505196436CFE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cxcore", "..\cxcore\src\cxcore.vcproj", "{1E8B43A2-BF3C-4DFC-9644-B65018E075B0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cxcoretest", "..\tests\cxcore\src\cxcoretest.vcproj", "{96F22AD4-D49F-492D-A349-1DB0392367CE}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - {189C2FF4-D924-4A87-A070-505196436CFE} = {189C2FF4-D924-4A87-A070-505196436CFE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cxts", "..\tests\cxts\cxts.vcproj", "{189C2FF4-D924-4A87-A070-505196436CFE}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "highgui", "..\otherlibs\highgui\highgui.vcproj", "{98487437-52F8-41E0-A3AF-1FC59BBBD3FB}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ml", "..\ml\src\ml.vcproj", "{A07C1F2F-3AF0-4660-AA95-4D660DDAE799}" - ProjectSection(ProjectDependencies) = postProject - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} = {1E8B43A2-BF3C-4DFC-9644-B65018E075B0} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug OpenMP|Win32 = Debug OpenMP|Win32 - Debug OpenMP|x64 = Debug OpenMP|x64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release OpenMP|Win32 = Release OpenMP|Win32 - Release OpenMP|x64 = Release OpenMP|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug OpenMP|Win32.ActiveCfg = Debug OpenMP|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug OpenMP|Win32.Build.0 = Debug OpenMP|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug OpenMP|x64.Build.0 = Debug|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug|Win32.ActiveCfg = Debug|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug|Win32.Build.0 = Debug|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug|x64.ActiveCfg = Debug|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Debug|x64.Build.0 = Debug|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release OpenMP|Win32.ActiveCfg = Release OpenMP|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release OpenMP|x64.ActiveCfg = Release|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release OpenMP|x64.Build.0 = Release|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release|Win32.ActiveCfg = Release|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release|Win32.Build.0 = Release|Win32 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release|x64.ActiveCfg = Release|x64 - {90ADDCD2-52A4-4B80-AB81-F5B86D8A7A9C}.Release|x64.Build.0 = Release|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug OpenMP|x64.Build.0 = Debug|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug|Win32.ActiveCfg = Debug|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug|Win32.Build.0 = Debug|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug|x64.ActiveCfg = Debug|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Debug|x64.Build.0 = Debug|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release OpenMP|x64.ActiveCfg = Release|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release OpenMP|x64.Build.0 = Release|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release|Win32.ActiveCfg = Release|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release|Win32.Build.0 = Release|Win32 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release|x64.ActiveCfg = Release|x64 - {FFABC1E5-619E-4EE7-B09E-95842DCE8887}.Release|x64.Build.0 = Release|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug OpenMP|x64.Build.0 = Debug|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug|Win32.ActiveCfg = Debug|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug|Win32.Build.0 = Debug|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug|x64.ActiveCfg = Debug|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Debug|x64.Build.0 = Debug|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release OpenMP|x64.ActiveCfg = Release|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release OpenMP|x64.Build.0 = Release|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release|Win32.ActiveCfg = Release|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release|Win32.Build.0 = Release|Win32 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release|x64.ActiveCfg = Release|x64 - {2046CEFA-02BF-4616-845F-0BC884160372}.Release|x64.Build.0 = Release|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug OpenMP|x64.Build.0 = Debug|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug|Win32.Build.0 = Debug|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug|x64.ActiveCfg = Debug|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Debug|x64.Build.0 = Debug|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release OpenMP|x64.ActiveCfg = Release|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release OpenMP|x64.Build.0 = Release|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release|Win32.ActiveCfg = Release|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release|Win32.Build.0 = Release|Win32 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release|x64.ActiveCfg = Release|x64 - {2820F96A-13D2-4EFE-BC9F-A9AF482026AE}.Release|x64.Build.0 = Release|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug OpenMP|x64.Build.0 = Debug|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug|Win32.ActiveCfg = Debug|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug|Win32.Build.0 = Debug|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug|x64.ActiveCfg = Debug|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Debug|x64.Build.0 = Debug|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release OpenMP|x64.ActiveCfg = Release|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release OpenMP|x64.Build.0 = Release|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release|Win32.ActiveCfg = Release|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release|Win32.Build.0 = Release|Win32 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release|x64.ActiveCfg = Release|x64 - {48C010C6-36E1-4EE6-9B9C-9AD1CBA0D9BC}.Release|x64.Build.0 = Release|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug OpenMP|Win32.ActiveCfg = Debug OpenMP|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug OpenMP|Win32.Build.0 = Debug OpenMP|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug OpenMP|x64.ActiveCfg = Debug OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug OpenMP|x64.Build.0 = Debug OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug|Win32.ActiveCfg = Debug|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug|Win32.Build.0 = Debug|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug|x64.ActiveCfg = Debug|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Debug|x64.Build.0 = Debug|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release OpenMP|Win32.ActiveCfg = Release OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release OpenMP|Win32.Build.0 = Release OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release OpenMP|x64.ActiveCfg = Release OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release OpenMP|x64.Build.0 = Release OpenMP|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release|Win32.ActiveCfg = Release|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release|Win32.Build.0 = Release|Win32 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release|x64.ActiveCfg = Release|x64 - {1E8B43A2-BF3C-4DFC-9644-B65018E075B0}.Release|x64.Build.0 = Release|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug OpenMP|x64.Build.0 = Debug|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug|Win32.ActiveCfg = Debug|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug|Win32.Build.0 = Debug|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug|x64.ActiveCfg = Debug|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Debug|x64.Build.0 = Debug|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release OpenMP|x64.ActiveCfg = Release|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release OpenMP|x64.Build.0 = Release|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release|Win32.ActiveCfg = Release|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release|Win32.Build.0 = Release|Win32 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release|x64.ActiveCfg = Release|x64 - {96F22AD4-D49F-492D-A349-1DB0392367CE}.Release|x64.Build.0 = Release|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug OpenMP|x64.Build.0 = Debug|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug|Win32.ActiveCfg = Debug|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug|Win32.Build.0 = Debug|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug|x64.ActiveCfg = Debug|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Debug|x64.Build.0 = Debug|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release OpenMP|x64.ActiveCfg = Release|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release OpenMP|x64.Build.0 = Release|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release|Win32.ActiveCfg = Release|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release|Win32.Build.0 = Release|Win32 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release|x64.ActiveCfg = Release|x64 - {189C2FF4-D924-4A87-A070-505196436CFE}.Release|x64.Build.0 = Release|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug OpenMP|Win32.ActiveCfg = Debug OpenMP|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug OpenMP|Win32.Build.0 = Debug OpenMP|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug OpenMP|x64.Build.0 = Debug|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug|Win32.ActiveCfg = Debug|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug|Win32.Build.0 = Debug|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug|x64.ActiveCfg = Debug|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Debug|x64.Build.0 = Debug|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release OpenMP|x64.ActiveCfg = Release|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release OpenMP|x64.Build.0 = Release|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release|Win32.ActiveCfg = Release|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release|Win32.Build.0 = Release|Win32 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release|x64.ActiveCfg = Release|x64 - {98487437-52F8-41E0-A3AF-1FC59BBBD3FB}.Release|x64.Build.0 = Release|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug OpenMP|Win32.ActiveCfg = Debug|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug OpenMP|Win32.Build.0 = Debug|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug OpenMP|x64.ActiveCfg = Debug|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug OpenMP|x64.Build.0 = Debug|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug|Win32.ActiveCfg = Debug|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug|Win32.Build.0 = Debug|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug|x64.ActiveCfg = Debug|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Debug|x64.Build.0 = Debug|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release OpenMP|Win32.ActiveCfg = Release|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release OpenMP|x64.ActiveCfg = Release|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release OpenMP|x64.Build.0 = Release|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release|Win32.ActiveCfg = Release|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release|Win32.Build.0 = Release|Win32 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release|x64.ActiveCfg = Release|x64 - {A07C1F2F-3AF0-4660-AA95-4D660DDAE799}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/aclocal.m4 b/aclocal.m4 index ae3bd96..59ac6d5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -13,7 +13,7 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL +# serial 52 Debian 1.5.26-1 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) @@ -101,7 +101,6 @@ AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl AC_REQUIRE([AC_OBJEXT])dnl AC_REQUIRE([AC_EXEEXT])dnl dnl - AC_LIBTOOL_SYS_MAX_CMD_LEN AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE AC_LIBTOOL_OBJDIR @@ -176,7 +175,7 @@ test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= @@ -203,6 +202,8 @@ file_magic*) ;; esac +_LT_REQUIRED_DARWIN_CHECKS + AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) @@ -263,8 +264,9 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Check for compiler boilerplate output or warnings with # the simple compiler test code. AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* @@ -276,13 +278,85 @@ $rm conftest* # Check for linker boilerplate output or warnings with # the simple link test code. AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` -$rm conftest* +$rm -r conftest* ])# _LT_LINKER_BOILERPLATE +# _LT_REQUIRED_DARWIN_CHECKS +# -------------------------- +# Check for some things on darwin +AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[0123]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac +]) # _LT_AC_SYS_LIBPATH_AIX # ---------------------- @@ -293,12 +367,20 @@ $rm conftest* # If we don't find anything, use the default library path according # to the aix ld manual. AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_AC_SYS_LIBPATH_AIX @@ -529,13 +611,17 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; @@ -552,6 +638,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ;; *64-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; @@ -592,7 +681,11 @@ sparc*-*solaris*) *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; esac ;; esac @@ -623,7 +716,7 @@ AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -664,11 +757,12 @@ fi # ------------------------------------------------------------ # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -684,7 +778,7 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], $2=yes fi fi - $rm conftest* + $rm -r conftest* LDFLAGS="$save_LDFLAGS" ]) @@ -782,24 +876,27 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi ;; esac ]) @@ -952,7 +1049,7 @@ else AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], @@ -960,7 +1057,7 @@ else [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) @@ -1026,7 +1123,8 @@ fi # --------------------------------- # Check to see if options -c and -o are simultaneously supported by compiler AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no @@ -1034,7 +1132,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -1174,6 +1272,7 @@ else darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" + old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) @@ -1191,7 +1290,8 @@ fi # ----------------------------- # PORTME Fill in your ld.so characteristics AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= @@ -1205,20 +1305,58 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi +fi]) need_lib_prefix=unknown hardcode_into_libs=no @@ -1236,7 +1374,7 @@ aix3*) soname_spec='${libname}${release}${shared_ext}$major' ;; -aix4* | aix5*) +aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no @@ -1375,12 +1513,8 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -1434,7 +1568,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -1497,7 +1631,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no @@ -1568,7 +1702,7 @@ linux* | k*bsd*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1674,6 +1808,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -1769,6 +1907,13 @@ esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], +[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], +[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" @@ -1779,7 +1924,8 @@ fi # _LT_AC_TAGCONFIG # ---------------- AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], [include additional configurations @<:@automatic@:>@])], [tagnames="$withval"]) @@ -2040,7 +2186,7 @@ m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], # AC_PATH_TOOL_PREFIX # ------------------- -# find a file program which can recognise shared library +# find a file program which can recognize shared library AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([for $1]) @@ -2103,7 +2249,7 @@ fi # AC_PATH_MAGIC # ------------- -# find a file program which can recognise a shared library +# find a file program which can recognize a shared library AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then @@ -2250,7 +2396,7 @@ esac # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependent libraries], +[AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= @@ -2267,7 +2413,7 @@ lt_cv_deplibs_check_method='unknown' # whether `pass_all' will *always* work, you probably want this one. case $host_os in -aix4* | aix5*) +aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; @@ -2289,9 +2435,15 @@ cygwin*) mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi ;; darwin* | rhapsody*) @@ -2336,7 +2488,7 @@ hpux10.20* | hpux11*) esac ;; -interix3*) +interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; @@ -2386,6 +2538,10 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -2438,7 +2594,7 @@ AC_DEFUN([AC_PROG_NM], lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do @@ -2654,10 +2810,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' +lt_simple_link_test_code='int main(){return(0);}' _LT_AC_SYS_COMPILER @@ -2693,7 +2849,7 @@ aix3*) fi ;; -aix4* | aix5*) +aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -2750,6 +2906,7 @@ _LT_AC_TAGVAR(postdep_objects, $1)= _LT_AC_TAGVAR(predeps, $1)= _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= # Source file extension for C++ test sources. ac_ext=cpp @@ -2759,10 +2916,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -2859,7 +3016,7 @@ case $host_os in # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aix4* | aix5*) + aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -2872,7 +3029,7 @@ case $host_os in # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) @@ -2908,7 +3065,7 @@ case $host_os in strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes + : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported @@ -3018,59 +3175,31 @@ case $host_os in fi ;; darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no + _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else case $cc_basename in xlc*) output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -3153,9 +3282,7 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - ;; + hppa*64*|ia64*) ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; @@ -3223,7 +3350,7 @@ case $host_os in ;; esac ;; - interix3*) + interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' @@ -3315,7 +3442,7 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC* | pgcpp*) # Portland Group C++ compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' @@ -3343,6 +3470,29 @@ case $host_os in # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; esac ;; lynxos*) @@ -3381,16 +3531,20 @@ case $host_os in _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi - output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in @@ -3552,15 +3706,10 @@ case $host_os in case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3607,6 +3756,12 @@ case $host_os in fi _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac fi ;; esac @@ -3722,7 +3877,8 @@ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], +[AC_REQUIRE([LT_AC_PROG_SED])dnl dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each @@ -3847,10 +4003,15 @@ fi $rm -f confest.$objext +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + # PORTME: override above test on systems where it is broken ifelse([$1],[CXX], [case $host_os in -interix3*) +interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_AC_TAGVAR(predep_objects,$1)= @@ -3858,19 +4019,51 @@ interix3*) _LT_AC_TAGVAR(postdeps,$1)= ;; +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + solaris*) case $cc_basename in CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. - _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun' + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi ;; esac ;; esac ]) - case " $_LT_AC_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac @@ -3913,10 +4106,17 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" +lt_simple_compile_test_code="\ + subroutine t + return + end +" # Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" +lt_simple_link_test_code="\ + program t + end +" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -3948,7 +4148,7 @@ aix3*) postinstall_cmds='$RANLIB $lib' fi ;; -aix4* | aix5*) +aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -3995,10 +4195,10 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" +lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -4051,7 +4251,7 @@ objext=o _LT_AC_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" @@ -4125,6 +4325,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(predeps, $1) \ _LT_AC_TAGVAR(postdeps, $1) \ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ _LT_AC_TAGVAR(archive_cmds, $1) \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ _LT_AC_TAGVAR(postinstall_cmds, $1) \ @@ -4140,6 +4341,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(module_cmds, $1) \ _LT_AC_TAGVAR(module_expsym_cmds, $1) \ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ _LT_AC_TAGVAR(exclude_expsyms, $1) \ _LT_AC_TAGVAR(include_expsyms, $1); do @@ -4186,7 +4388,7 @@ ifelse([$1], [], # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: @@ -4423,6 +4625,10 @@ predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) # shared library. postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) + # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) @@ -4511,7 +4717,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) @@ -4594,6 +4800,7 @@ fi # --------------------------------- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_OBJEXT]) # Check for command to grab the raw symbol name followed by C symbol from nm. @@ -4771,7 +4978,7 @@ EOF echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi - rm -f conftest* conftst* + rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then @@ -4820,13 +5027,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # like `-m68040'. _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | os2* | pw32*) + mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -4837,7 +5047,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; - interix3*) + interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -4863,7 +5073,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) esac else case $host_os in - aix4* | aix5*) + aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor @@ -4959,7 +5169,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC* | pgcpp*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' @@ -4973,6 +5183,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac ;; esac ;; @@ -5093,14 +5311,17 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) @@ -5109,7 +5330,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; - interix3*) + interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -5167,10 +5388,11 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) @@ -5219,6 +5441,22 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; esac ;; @@ -5228,6 +5466,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + solaris*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -5287,7 +5529,7 @@ AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) # if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; @@ -5311,7 +5553,7 @@ esac # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) @@ -5322,11 +5564,12 @@ AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], # ------------------------------------ # See if the linker supports building shared libraries. AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) + aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | grep 'GNU' > /dev/null; then @@ -5339,7 +5582,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) _LT_AC_TAGVAR(link_all_deplibs, $1)=no @@ -5348,6 +5591,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ],[ runpath_var= _LT_AC_TAGVAR(allow_undefined_flag, $1)= @@ -5378,12 +5622,14 @@ ifelse([$1],[CXX],[ # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= # Just being paranoid about ensuring that cc_basename is set. _LT_CC_BASENAME([$compiler]) @@ -5433,7 +5679,7 @@ ifelse([$1],[CXX],[ # See if GNU ld supports shared libraries. case $host_os in - aix3* | aix4* | aix5*) + aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -5481,7 +5727,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -5499,7 +5745,7 @@ EOF fi ;; - interix3*) + interix[[3-9]]*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' @@ -5514,7 +5760,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux* | k*bsd*-gnu) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -5532,13 +5778,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi _LT_AC_TAGVAR(link_all_deplibs, $1)=no else @@ -5579,7 +5834,7 @@ EOF sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 @@ -5644,7 +5899,7 @@ _LT_EOF fi ;; - aix4* | aix5*) + aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -5664,7 +5919,7 @@ _LT_EOF # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -5698,7 +5953,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes + : else # We have old collect2 _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported @@ -5791,7 +6046,7 @@ _LT_EOF # The linker will automatically build a .lib file if we build a DLL. _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; @@ -5824,19 +6079,18 @@ _LT_EOF _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes ; then output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else case $cc_basename in xlc*) output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -5998,24 +6252,28 @@ _LT_EOF ;; openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; @@ -6074,17 +6332,16 @@ _LT_EOF case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6141,7 +6398,7 @@ _LT_EOF fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -6216,7 +6473,7 @@ x|xyes) # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest @@ -6319,6 +6576,30 @@ AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) ]) + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -6339,12 +6620,13 @@ do test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -6377,6 +6659,7 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do done ]) SED=$lt_cv_path_SED +AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) diff --git a/apps/HaarFaceDetect/Makefile.am b/apps/HaarFaceDetect/Makefile.am index 90f5426..b05f0b8 100644 --- a/apps/HaarFaceDetect/Makefile.am +++ b/apps/HaarFaceDetect/Makefile.am @@ -1,3 +1,6 @@ +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + # here it is our binary program bin_PROGRAMS = HaarFaceDetect diff --git a/apps/Makefile.in b/apps/Makefile.in index e247463..b4e2447 100644 --- a/apps/Makefile.in +++ b/apps/Makefile.in @@ -80,10 +80,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -106,8 +110,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -118,6 +124,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -136,11 +144,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -160,10 +173,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/apps/haartraining/Makefile.in b/apps/haartraining/Makefile.in index 0aa9397..f1d7c3d 100644 --- a/apps/haartraining/Makefile.in +++ b/apps/haartraining/Makefile.in @@ -80,10 +80,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -106,8 +110,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -118,6 +124,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -136,11 +144,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -160,10 +173,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/apps/haartraining/include/Makefile.in b/apps/haartraining/include/Makefile.in index b73c019..9558c21 100644 --- a/apps/haartraining/include/Makefile.in +++ b/apps/haartraining/include/Makefile.in @@ -84,10 +84,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -110,8 +114,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -122,6 +128,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -140,11 +148,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -164,10 +177,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/apps/haartraining/src/Makefile.am b/apps/haartraining/src/Makefile.am index 8acc023..b420b9f 100644 --- a/apps/haartraining/src/Makefile.am +++ b/apps/haartraining/src/Makefile.am @@ -1,3 +1,6 @@ +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + lib_LIBRARIES = libcvhaartraining.a bin_PROGRAMS = opencv-haartraining opencv-createsamples opencv-performance diff --git a/apps/haartraining/src/Makefile.in b/apps/haartraining/src/Makefile.in index 225632f..37c6730 100644 --- a/apps/haartraining/src/Makefile.in +++ b/apps/haartraining/src/Makefile.in @@ -126,10 +126,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -152,8 +156,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -164,6 +170,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -182,11 +190,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -206,10 +219,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ @@ -273,6 +288,9 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ + +# use the default c++ flags +AM_CXXFLAGS = @DEF_CXXFLAGS@ lib_LIBRARIES = libcvhaartraining.a ALL_CV_LIBS = \ libcvhaartraining.a \ diff --git a/configure b/configure index 4cedcf3..d3d96e3 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.46 . +# From configure.in Revision: 1.54 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for opencv 1.1.0. +# Generated by GNU Autoconf 2.61 for opencv 1.1.0. # # Report bugs to . # @@ -13,7 +13,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -22,10 +23,13 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -218,7 +222,7 @@ test \$exitcode = 0) || { (exit 1); exit 1; } else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -236,7 +240,6 @@ IFS=$as_save_IFS # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -245,10 +248,12 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : _ASEOF @@ -256,7 +261,6 @@ _ASEOF CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -265,10 +269,12 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : (as_func_return () { @@ -515,19 +521,28 @@ else as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -722,36 +737,36 @@ ac_unique_file="opencv.pc.in" # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include #endif -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif" @@ -807,6 +822,7 @@ target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA +am__isrc CYGPATH_W PACKAGE VERSION @@ -852,6 +868,7 @@ CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP +SED GREP EGREP LN_S @@ -869,6 +886,8 @@ LIBTOOL BUILD_APPS_TRUE BUILD_APPS_FALSE PY_CXXFLAGS +OCT_CXXFLAGS +DEF_CXXFLAGS ALLOCA CARBON_CFLAGS CARBON_LIBS @@ -885,6 +904,10 @@ QUICKTIME_CFLAGS QUICKTIME_LIBS BUILD_QUICKTIME_TRUE BUILD_QUICKTIME_FALSE +GSTREAMER_CFLAGS +GSTREAMER_LIBS +BUILD_GSTREAMER_TRUE +BUILD_GSTREAMER_FALSE XINE_LIBS BUILD_XINE_TRUE BUILD_XINE_FALSE @@ -912,9 +935,15 @@ PYTHON_CSPEC PYTHON_LSPEC BUILD_PYTHON_WRAPPERS_TRUE BUILD_PYTHON_WRAPPERS_FALSE +OCTAVE +MKOCTFILE +OCTAVE_ARCH +BUILD_OCTAVE_WRAPPERS_TRUE +BUILD_OCTAVE_WRAPPERS_FALSE SWIG SWIG_VERSION SWIG_RUNTIME_LIBS_DIR +SWIG_OCTAVE_OPT SWIG_PYTHON_OPT SWIG_PYTHON_LIBS UPDATE_SWIG_WRAPPERS_TRUE @@ -929,6 +958,7 @@ target_alias CXX CXXFLAGS LDFLAGS +LIBS CPPFLAGS CCC CC @@ -1044,10 +1074,10 @@ do -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) @@ -1063,10 +1093,10 @@ do -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ @@ -1260,19 +1290,19 @@ do -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) @@ -1538,7 +1568,10 @@ Optional Packages: --with-tags[=TAGS] include additional configurations [automatic] --with-swig use swig wrapper generator [no] --with-python use python for wrapping [yes] + --with-octave use octave for wrapping [no] --with-xine use xine libraries (see LICENSE) [no] + --with-gstreamer use gstreamer multimedia framework (see LICENSE) + [no] --with-ffmpeg use ffmpeg libraries (see LICENSE) [automatic] --with-1394libs use libraw1394/libdc1394 [automatic] --with-v4l use video4linux [automatic] @@ -1553,6 +1586,7 @@ Some influential environment variables: CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command @@ -1630,7 +1664,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF opencv configure 1.1.0 -generated by GNU Autoconf 2.60 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -1644,7 +1678,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by opencv $as_me 1.1.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2028,14 +2062,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -case autotools/aclocal in - [\\/]* | ?:[\\/]* ) ac_macro_dir=autotools/aclocal ;; - *) ac_macro_dir=$srcdir/autotools/aclocal ;; -esac -test -d "$ac_macro_dir" || - { { echo "$as_me:$LINENO: error: cannot find macro directory \`autotools/aclocal'" >&5 -echo "$as_me: error: cannot find macro directory \`autotools/aclocal'" >&2;} - { (exit 1); exit 1; }; } # put CVS revision of this configure.in into the resulting configure script @@ -2173,7 +2199,8 @@ test -n "$target_alias" && # we updated to 1.9 because of cross-platform issues ac_config_headers="$ac_config_headers cvconfig.h" -am__api_version="1.9" +am__api_version='1.10' + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -2210,7 +2237,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2325,38 +2352,53 @@ else echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" else - mkdir_p='$(install_sh) -d' + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac for ac_prog in gawk mawk nawk awk do @@ -2376,7 +2418,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2439,12 +2481,16 @@ else fi rmdir .tst 2>/dev/null -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } + fi fi # test whether we have cygpath @@ -2487,7 +2533,7 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right @@ -2511,7 +2557,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2551,7 +2597,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2591,7 +2637,7 @@ else fi fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. @@ -2711,7 +2757,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2755,7 +2801,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2889,7 +2935,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in @@ -2917,6 +2963,12 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -2928,8 +2980,6 @@ See \`config.log' for more details." >&2;} fi ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -3107,27 +3157,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -3182,27 +3215,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 @@ -3237,27 +3253,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 @@ -3293,27 +3292,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 @@ -3406,9 +3388,7 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi - - -if test "x$enable_dependency_tracking" != xno; then + if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else @@ -3418,7 +3398,6 @@ fi - depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 @@ -3486,6 +3465,7 @@ else depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -3515,9 +3495,7 @@ fi echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - -if + if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= @@ -3550,7 +3528,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3590,7 +3568,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3647,7 +3625,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3688,7 +3666,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3746,7 +3724,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3790,7 +3768,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3910,27 +3888,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -3985,27 +3946,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -4040,27 +3984,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 @@ -4096,27 +4023,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 @@ -4232,27 +4142,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 @@ -4356,6 +4249,7 @@ else depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -4385,9 +4279,7 @@ fi echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - -if + if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= @@ -4450,17 +4342,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -4494,17 +4379,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -4569,17 +4447,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -4613,17 +4484,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -4718,12 +4582,13 @@ do test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -4758,6 +4623,7 @@ done fi SED=$lt_cv_path_SED + { echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6; } @@ -4782,7 +4648,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4864,7 +4730,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -5119,8 +4985,8 @@ else echo "${ECHO_T}no, using $LN_S" >&6; } fi -{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -5161,9 +5027,15 @@ cygwin*) mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi ;; darwin* | rhapsody*) @@ -5208,7 +5080,7 @@ hpux10.20* | hpux11*) esac ;; -interix3*) +interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; @@ -5258,6 +5130,10 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + solaris*) lt_cv_deplibs_check_method=pass_all ;; @@ -5345,7 +5221,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5348 "configure"' > conftest.$ac_ext + echo '#line 5224 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5380,7 +5256,8 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5391,6 +5268,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) case `/usr/bin/file conftest.o` in *32-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; @@ -5407,6 +5287,9 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ;; *64-bit*) case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; @@ -5469,27 +5352,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 @@ -5498,7 +5365,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -5552,7 +5419,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5592,7 +5459,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5648,7 +5515,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5688,7 +5555,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5744,7 +5611,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5784,7 +5651,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5868,27 +5735,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 @@ -6064,27 +5914,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 @@ -6147,27 +5980,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -6203,17 +6019,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6330,17 +6139,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -6374,17 +6176,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -6449,17 +6244,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -6493,17 +6281,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -6544,7 +6325,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -6562,7 +6343,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6588,7 +6369,7 @@ fi fi if test -z "$F77"; then ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -6606,7 +6387,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6713,27 +6494,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -6776,27 +6540,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 @@ -6923,24 +6670,27 @@ else fi ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi ;; esac @@ -6957,6 +6707,7 @@ fi + # Check for command to grab the raw symbol name followed by C symbol from nm. { echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } @@ -7251,7 +7002,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7291,7 +7042,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7347,7 +7098,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7387,7 +7138,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7443,7 +7194,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7483,7 +7234,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7545,7 +7296,7 @@ test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o # Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= @@ -7745,10 +7496,10 @@ objext=o objext=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' +lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. @@ -7763,13 +7514,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -7789,7 +7540,7 @@ if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -7800,11 +7551,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7803: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7554: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7807: \$? = $ac_status" >&5 + echo "$as_me:7558: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7855,13 +7606,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; @@ -7871,7 +7624,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -7929,7 +7682,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' @@ -7981,6 +7734,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; esac ;; @@ -7990,6 +7759,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static='-non_shared' ;; + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' @@ -8057,7 +7830,7 @@ if test "${lt_prog_compiler_pic_works+set}" = set; then else lt_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -8068,11 +7841,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8071: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7844: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8075: \$? = $ac_status" >&5 + echo "$as_me:7848: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8121,7 +7894,7 @@ else lt_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -8161,7 +7934,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -8172,11 +7945,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8175: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7948: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8179: \$? = $ac_status" >&5 + echo "$as_me:7952: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8368,7 +8141,7 @@ EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -8386,7 +8159,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' @@ -8401,7 +8174,7 @@ EOF archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux* | k*bsd*-gnu) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -8419,13 +8192,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs=no else @@ -8585,7 +8367,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct=yes + : else # We have old collect2 hardcode_direct=unsupported @@ -8653,33 +8435,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8687,7 +8460,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -8728,33 +8501,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8762,7 +8526,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -8808,7 +8572,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; @@ -8850,10 +8614,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -9015,24 +8779,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; @@ -9091,17 +8859,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs=yes ;; @@ -9158,7 +8925,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no @@ -9235,7 +9002,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -9293,17 +9060,55 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" + if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -9463,12 +9268,8 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -9522,7 +9323,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -9585,7 +9386,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -9656,7 +9457,7 @@ linux* | k*bsd*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -9762,6 +9563,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -9915,6 +9720,7 @@ else darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" + old_striplib="$STRIP -S" { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else @@ -9998,27 +9804,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 @@ -10027,7 +9817,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -10109,27 +9899,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 @@ -10138,7 +9912,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 @@ -10188,27 +9962,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_shl_load=yes else echo "$as_me: failed program was:" >&5 @@ -10217,7 +9975,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -10289,27 +10047,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 @@ -10318,7 +10060,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 @@ -10368,27 +10110,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 @@ -10397,7 +10123,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -10448,27 +10174,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_svld_dlopen=yes else echo "$as_me: failed program was:" >&5 @@ -10477,7 +10187,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -10528,27 +10238,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_dld_link=yes else echo "$as_me: failed program was:" >&5 @@ -10557,7 +10251,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -10613,7 +10307,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Free Software Foundation, Inc. # # This file is part of GNU Libtool: @@ -11279,7 +10974,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols @@ -11448,10 +11143,10 @@ objext=o objext_CXX=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" +lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -11467,13 +11162,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -11732,7 +11427,7 @@ case $host_os in strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_CXX=yes + : else # We have old collect2 hardcode_direct_CXX=unsupported @@ -11800,33 +11495,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -11834,7 +11520,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -11876,33 +11562,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -11910,7 +11587,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -12021,10 +11698,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -12107,9 +11784,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_separator_CXX=: case $host_cpu in - hppa*64*|ia64*) - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - ;; + hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; @@ -12177,7 +11852,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; - interix3*) + interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' @@ -12297,6 +11972,29 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; esac ;; lynxos*) @@ -12335,16 +12033,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_CXX=no ;; openbsd*) - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + ld_shlibs_CXX=no fi - output_verbose_link_cmd='echo' ;; osf3*) case $cc_basename in @@ -12506,15 +12208,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -12561,6 +12258,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac fi ;; esac @@ -12752,7 +12455,7 @@ $rm -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in -interix3*) +interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= @@ -12760,13 +12463,46 @@ interix3*) postdeps_CXX= ;; +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + solaris*) case $cc_basename in CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. - postdeps_CXX='-lCstd -lCrun' + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi ;; esac ;; @@ -12803,12 +12539,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | os2* | pw32*) + mingw* | cygwin* | os2* | pw32*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) @@ -12820,7 +12558,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -12956,6 +12694,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_CXX='-non_shared' ;; *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac ;; esac ;; @@ -13070,7 +12816,7 @@ if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then else lt_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -13081,11 +12827,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13084: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12830: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13088: \$? = $ac_status" >&5 + echo "$as_me:12834: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13134,7 +12880,7 @@ else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13174,7 +12920,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -13185,11 +12931,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13188: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12934: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13192: \$? = $ac_status" >&5 + echo "$as_me:12938: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13255,7 +13001,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) link_all_deplibs_CXX=no @@ -13289,7 +13035,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -13347,20 +13093,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -13517,12 +13250,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -13576,7 +13304,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -13639,7 +13367,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -13710,7 +13438,7 @@ linux* | k*bsd*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -13816,6 +13544,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -14010,6 +13742,7 @@ if test -f "$ltmain"; then module_cmds_CXX \ module_expsym_cmds_CXX \ lt_cv_prog_compiler_c_o_CXX \ + fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX; do @@ -14330,7 +14063,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_CXX @@ -14421,10 +14154,17 @@ objext=o objext_F77=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" +lt_simple_compile_test_code="\ + subroutine t + return + end +" # Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" +lt_simple_link_test_code="\ + program t + end +" # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -14440,13 +14180,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -14533,13 +14273,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; @@ -14549,7 +14291,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_F77='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -14607,7 +14349,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' @@ -14659,6 +14401,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='' + ;; + esac + ;; esac ;; @@ -14668,6 +14426,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_F77='-non_shared' ;; + rdos*) + lt_prog_compiler_static_F77='-non_shared' + ;; + solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' @@ -14735,7 +14497,7 @@ if test "${lt_prog_compiler_pic_works_F77+set}" = set; then else lt_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -14746,11 +14508,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14749: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14511: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14753: \$? = $ac_status" >&5 + echo "$as_me:14515: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14799,7 +14561,7 @@ else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -14839,7 +14601,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -14850,11 +14612,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14853: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14615: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14857: \$? = $ac_status" >&5 + echo "$as_me:14619: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15046,7 +14808,7 @@ EOF allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -15064,7 +14826,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' @@ -15079,7 +14841,7 @@ EOF archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux* | k*bsd*-gnu) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -15097,13 +14859,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_F77=no else @@ -15263,7 +15034,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_F77=yes + : else # We have old collect2 hardcode_direct_F77=unsupported @@ -15321,33 +15092,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15355,7 +15117,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -15386,33 +15148,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -15420,7 +15173,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -15466,7 +15219,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; @@ -15508,10 +15261,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -15673,24 +15426,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs_F77=no fi ;; @@ -15749,17 +15506,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs_F77=yes ;; @@ -15816,7 +15572,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no @@ -15893,7 +15649,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -15951,20 +15707,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -16121,12 +15864,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -16180,7 +15918,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -16243,7 +15981,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -16314,7 +16052,7 @@ linux* | k*bsd*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -16420,6 +16158,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -16614,6 +16356,7 @@ if test -f "$ltmain"; then module_cmds_F77 \ module_expsym_cmds_F77 \ lt_cv_prog_compiler_c_o_F77 \ + fix_srcfile_path_F77 \ exclude_expsyms_F77 \ include_expsyms_F77; do @@ -16934,7 +16677,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_F77 @@ -16992,10 +16735,10 @@ objext=o objext_GCJ=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" +lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -17011,13 +16754,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -17058,7 +16801,7 @@ if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -17069,11 +16812,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17072: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16815: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17076: \$? = $ac_status" >&5 + echo "$as_me:16819: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17124,13 +16867,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' ;; @@ -17140,7 +16885,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_pic_GCJ='-fno-common' ;; - interix3*) + interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; @@ -17198,7 +16943,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' @@ -17250,6 +16995,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='' + ;; + esac + ;; esac ;; @@ -17259,6 +17020,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } lt_prog_compiler_static_GCJ='-non_shared' ;; + rdos*) + lt_prog_compiler_static_GCJ='-non_shared' + ;; + solaris*) lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' @@ -17326,7 +17091,7 @@ if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then else lt_prog_compiler_pic_works_GCJ=no ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_GCJ" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -17337,11 +17102,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17340: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17105: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17344: \$? = $ac_status" >&5 + echo "$as_me:17109: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17390,7 +17155,7 @@ else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - printf "$lt_simple_link_test_code" > conftest.$ac_ext + echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings @@ -17430,7 +17195,7 @@ else mkdir conftest cd conftest mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or @@ -17441,11 +17206,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17444: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17209: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17448: \$? = $ac_status" >&5 + echo "$as_me:17213: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17637,7 +17402,7 @@ EOF allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -17655,7 +17420,7 @@ EOF fi ;; - interix3*) + interix[3-9]*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' @@ -17670,7 +17435,7 @@ EOF archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - linux* | k*bsd*-gnu) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_addflag= case $cc_basename,$host_cpu in @@ -17688,13 +17453,22 @@ EOF ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test $supports_anon_versioning = yes; then archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi link_all_deplibs_GCJ=no else @@ -17854,7 +17628,7 @@ _LT_EOF strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct_GCJ=yes + : else # We have old collect2 hardcode_direct_GCJ=unsupported @@ -17922,33 +17696,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -17956,7 +17721,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -17997,33 +17762,24 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -18031,7 +17787,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi @@ -18077,7 +17833,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # The linker will automatically build a .lib file if we build a DLL. old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; @@ -18119,10 +17875,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $cc_basename in xlc*) output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' ;; *) @@ -18284,24 +18040,28 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' + if test -f /usr/libexec/ld.so; then + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs_GCJ=no fi ;; @@ -18360,17 +18120,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + if test "$GCC" = yes; then + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' + fi + ;; esac link_all_deplibs_GCJ=yes ;; @@ -18427,7 +18186,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no @@ -18504,7 +18263,7 @@ x|xyes) { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 @@ -18562,20 +18321,7 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi + need_lib_prefix=unknown hardcode_into_libs=no @@ -18732,12 +18478,7 @@ darwin* | rhapsody*) shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -18791,7 +18532,7 @@ freebsd* | dragonfly*) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; - freebsd*) # from 4.6 on + *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -18854,7 +18595,7 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -interix3*) +interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -18925,7 +18666,7 @@ linux* | k*bsd*-gnu) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -19031,6 +18772,10 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; +rdos*) + dynamic_linker=no + ;; + solaris*) version_type=linux need_lib_prefix=no @@ -19225,6 +18970,7 @@ if test -f "$ltmain"; then module_cmds_GCJ \ module_expsym_cmds_GCJ \ lt_cv_prog_compiler_c_o_GCJ \ + fix_srcfile_path_GCJ \ exclude_expsyms_GCJ \ include_expsyms_GCJ; do @@ -19545,7 +19291,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_GCJ @@ -19602,7 +19348,7 @@ objext=o objext_RC=$objext # Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" @@ -19621,13 +19367,13 @@ compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $rm conftest* ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext +echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* @@ -19705,6 +19451,7 @@ if test -f "$ltmain"; then module_cmds_RC \ module_expsym_cmds_RC \ lt_cv_prog_compiler_c_o_RC \ + fix_srcfile_path_RC \ exclude_expsyms_RC \ include_expsyms_RC; do @@ -20025,7 +19772,7 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" +fix_srcfile_path=$lt_fix_srcfile_path # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols_RC @@ -20149,9 +19896,7 @@ else enable_apps="yes" fi - - -if test x"$enable_apps" = x"yes"; then + if test x"$enable_apps" = x"yes"; then BUILD_APPS_TRUE= BUILD_APPS_FALSE='#' else @@ -20187,6 +19932,16 @@ else fi +# does the user want to compile octave modules as well? + +# Check whether --with-octave was given. +if test "${with_octave+set}" = set; then + withval=$with_octave; with_octave=$withval +else + with_octave=no +fi + + # does the user want OpenCV to use xine video libraries? # Check whether --with-xine was given. @@ -20197,6 +19952,16 @@ else fi +# does the user want OpenCV to use the gstreamer multimedia framework? + +# Check whether --with-gstreamer was given. +if test "${with_gstreamer+set}" = set; then + withval=$with_gstreamer; with_gstreamer=$withval +else + with_gstreamer=no +fi + + # does the user want OpenCV to use ffmpeg video libraries? # Check whether --with-ffmpeg was given. @@ -20291,6 +20056,11 @@ if test x"$CXXFLAGS" = "x-g -O2" ; then CXXFLAGS="" fi +# set the default c++ flags for all the compilations +# we don't append CXXFLAGS, because it's done at compile time +# see http://www.gnu.org/software/libtool/manual/automake/Flag-Variables-Ordering.html +# for more information +DEFAULT_CXXFLAGS="" # see if the user wants aggressive optimizations of the code, # check whether to include debugging code @@ -20301,7 +20071,7 @@ if test x"$debug" = "xyes"; then echo "${ECHO_T}yes" >&6; } if test x"$ac_cv_c_compiler_gnu" = "xyes"; then CPPFLAGS="-DDEBUG -D_DEBUG $CPPFLAGS" - CXXFLAGS="-ggdb -O0 $CXXFLAGS" + DEFAULT_CXXFLAGS="-ggdb -O0 $DEFAULT_CXXFLAGS" fi else { echo "$as_me:$LINENO: result: no" >&5 @@ -20312,40 +20082,45 @@ echo "$as_me: TARGET=$target " >&6;} i*86-apple-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # apples g++ fails with '-march=i686' and there are no apple machines older than prescott/core anyway - CXXFLAGS="-g -march=prescott -ffast-math -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -march=prescott -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; i686-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # default to i686/pentiumpro -- people can override this - CXXFLAGS="-g -march=i686 -ffast-math -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -march=i686 -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; powerpc-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # default to G3 processors -- people can override this - CXXFLAGS="-g -mcpu=G3 -mtune=G5 -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -mcpu=G3 -mtune=G5 -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; *-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then - CXXFLAGS="-fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; esac CPPFLAGS="-DNDEBUG $CPPFLAGS" - CXXFLAGS="-O3 $CXXFLAGS" + DEFAULT_CXXFLAGS="-O3 $DEFAULT_CXXFLAGS" fi if test x"$ac_cv_c_compiler_gnu" = "xyes"; then - PY_CXXFLAGS="-Wall -pipe $CXXFLAGS" - CXXFLAGS="-Wall -fno-rtti -pipe $CXXFLAGS" + PY_CXXFLAGS="-Wall -pipe $DEFAULT_CXXFLAGS" + OCT_CXXFLAGS="-fno-strict-aliasing -Wall -Wno-uninitialized -pipe $DEFAULT_CXXFLAGS" + DEF_CXXFLAGS="-Wall -fno-rtti -pipe $DEFAULT_CXXFLAGS" else - PY_CXXFLAGS="$CXXFLAGS" + PY_CXXFLAGS="$DEFAULT_CXXFLAGS" + OCT_CXXFLAGS="$DEFAULT_CXXFLAGS" + DEF_CXXFLAGS="$DEFAULT_CXXFLAGS" fi + + # add libm because it is used by several libraries and OpenCV itself { echo "$as_me:$LINENO: checking for pow in -lm" >&5 @@ -20390,27 +20165,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_m_pow=yes else echo "$as_me: failed program was:" >&5 @@ -20419,7 +20178,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_pow=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -20477,27 +20236,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 @@ -20506,7 +20249,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -20564,27 +20307,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pthread_pthread_create=yes else echo "$as_me: failed program was:" >&5 @@ -20593,7 +20320,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread_pthread_create=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -20628,7 +20355,8 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif @@ -20649,27 +20377,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20704,27 +20415,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 @@ -20775,27 +20469,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi @@ -20935,27 +20612,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 @@ -20964,7 +20625,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 @@ -20995,7 +20656,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include # define alloca _alloca # else -# if HAVE_ALLOCA_H +# ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX @@ -21031,27 +20692,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 @@ -21060,7 +20705,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 @@ -21180,27 +20825,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -21209,7 +20838,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -21345,27 +20974,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -21401,17 +21013,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -21514,27 +21119,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -21570,17 +21158,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -21711,27 +21292,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -21740,7 +21305,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -21800,27 +21365,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -21856,17 +21404,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -21963,9 +21504,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-carbon, continuing fi - - -if test x"$have_carbon" = "xyes"; then + if test x"$have_carbon" = "xyes"; then BUILD_CARBON_TRUE= BUILD_CARBON_FALSE='#' else @@ -22009,7 +21548,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -22060,7 +21599,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -22181,7 +21720,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -22278,9 +21817,7 @@ fi - - -if test x"$have_gtk" = "xyes"; then + if test x"$have_gtk" = "xyes"; then BUILD_GTK_TRUE= BUILD_GTK_FALSE='#' else @@ -22354,27 +21891,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -22410,17 +21930,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -22517,9 +22030,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-quicktime, continu fi - - -if test x"$have_quicktime" = "xyes"; then + if test x"$have_quicktime" = "xyes"; then BUILD_QUICKTIME_TRUE= BUILD_QUICKTIME_FALSE='#' else @@ -22528,6 +22039,201 @@ else fi +# GStreamer seems to be a nice solution for both reading and writing +# and even supports some cameras +GSTREAMER_CFLAGS="" +GSTREAMER_LIBS="" +if test x"$with_gstreamer" = "xno"; then + have_gstreamer=no +else + + if test x"$with_ffmpeg" = "xyes"; then + { { echo "$as_me:$LINENO: error: You cannot specify --with-gstreamer and --with-ffmpeg at the same time" >&5 +echo "$as_me: error: You cannot specify --with-gstreamer and --with-ffmpeg at the same time" >&2;} + { (exit 1); exit 1; }; } + fi + + # check if ./configure arguments are valid + if test x"$with_gstreamer" = "xauto"; then + with_gstreamer=yes + fi + if test x"$with_gstreamer" = "xyes"; then + + # pkg-config is needed for GTK+ + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test x"$PKG_CONFIG" == "xno"; then + { { echo "$as_me:$LINENO: error: You have to install pkg-config to compile OpenCV with GStreamer" >&5 +echo "$as_me: error: You have to install pkg-config to compile OpenCV with GStreamer" >&2;} + { (exit 1); exit 1; }; } + fi + + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { echo "$as_me:$LINENO: checking for \"gstreamer-0.10\"" >&5 +echo $ECHO_N "checking for \"gstreamer-0.10\"... $ECHO_C" >&6; } + + if $PKG_CONFIG --exists ""gstreamer-0.10"" ; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + succeeded=yes + + { echo "$as_me:$LINENO: checking GSTREAMER_CFLAGS" >&5 +echo $ECHO_N "checking GSTREAMER_CFLAGS... $ECHO_C" >&6; } + GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags ""gstreamer-0.10""` + { echo "$as_me:$LINENO: result: $GSTREAMER_CFLAGS" >&5 +echo "${ECHO_T}$GSTREAMER_CFLAGS" >&6; } + + { echo "$as_me:$LINENO: checking GSTREAMER_LIBS" >&5 +echo $ECHO_N "checking GSTREAMER_LIBS... $ECHO_C" >&6; } + GSTREAMER_LIBS=`$PKG_CONFIG --libs ""gstreamer-0.10""` + { echo "$as_me:$LINENO: result: $GSTREAMER_LIBS" >&5 +echo "${ECHO_T}$GSTREAMER_LIBS" >&6; } + else + GSTREAMER_CFLAGS="" + GSTREAMER_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GSTREAMER_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""gstreamer-0.10""` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + + have_gstreamer=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GSTREAMER +_ACEOF + + + else + have_gstreamer=no + fi + + + if test x"$have_gstreamer" = "xyes"; then + GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstbase-0.10" + with_ffmpeg=no + fi + else + # if we get here then --with-gstreamer was not called with 'yes','no' or 'auto' + { echo "$as_me:$LINENO: WARNING: unexpected arguments for option --with-gstreamer, continuing assuming 'no'" >&5 +echo "$as_me: WARNING: unexpected arguments for option --with-gstreamer, continuing assuming 'no'" >&2;} + have_gstreamer=no + fi +fi + + + if test x"$have_gstreamer" = "xyes"; then + BUILD_GSTREAMER_TRUE= + BUILD_GSTREAMER_FALSE='#' +else + BUILD_GSTREAMER_TRUE='#' + BUILD_GSTREAMER_FALSE= +fi + + # prefer XINE over FFMPEG for video reading because it is quick, has a cleaner API # and allows for easy seeking with some formats if test x"$with_xine" = "xno"; then @@ -22574,27 +22280,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -22630,17 +22319,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -22737,27 +22419,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_xine_xine_init=yes else echo "$as_me: failed program was:" >&5 @@ -22766,7 +22432,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_xine_xine_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -22799,9 +22465,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-xine, continuing a fi fi - - -if test x"$have_xine" = "xyes"; then + if test x"$have_xine" = "xyes"; then BUILD_XINE_TRUE= BUILD_XINE_FALSE='#' else @@ -22856,27 +22520,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -22912,17 +22559,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -23025,27 +22665,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_avcodec_decode_video=$ac_res else echo "$as_me: failed program was:" >&5 @@ -23054,7 +22678,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_avcodec_decode_video+set}" = set; then break @@ -23122,27 +22746,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_av_open_input_file=$ac_res else echo "$as_me: failed program was:" >&5 @@ -23151,7 +22759,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_av_open_input_file+set}" = set; then break @@ -23201,9 +22809,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-ffmpeg, continuing fi fi - - -if test x"$have_ffmpeg" = "xyes"; then + if test x"$have_ffmpeg" = "xyes"; then BUILD_FFMPEG_TRUE= BUILD_FFMPEG_FALSE='#' else @@ -23264,27 +22870,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -23320,17 +22909,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -23427,27 +23009,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_raw1394_raw1394_new_handle=yes else echo "$as_me: failed program was:" >&5 @@ -23456,7 +23022,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_raw1394_raw1394_new_handle=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -23508,27 +23074,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -23564,17 +23113,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -23671,27 +23213,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dc1394_control_dc1394_camera_on=yes else echo "$as_me: failed program was:" >&5 @@ -23700,7 +23226,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dc1394_control_dc1394_camera_on=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -23751,9 +23277,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-1394libs, continui fi fi - - -if test x"$have_dc1394" = "xyes"; then + if test x"$have_dc1394" = "xyes"; then BUILD_DC1394_TRUE= BUILD_DC1394_FALSE='#' else @@ -23808,27 +23332,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -23864,17 +23371,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -23977,27 +23477,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_linux_videodev2_h=yes else echo "$as_me: failed program was:" >&5 @@ -24035,9 +23518,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-v4l, continuing as fi fi - - -if test x"$have_v4l1or2" = "xyes"; then + if test x"$have_v4l1or2" = "xyes"; then BUILD_V4L_TRUE= BUILD_V4L_FALSE='#' else @@ -24094,27 +23575,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -24150,17 +23614,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -24231,9 +23688,7 @@ fi fi - - -if test x"$have_imageio" = "xyes"; then + if test x"$have_imageio" = "xyes"; then BUILD_IMAGEIO_TRUE= BUILD_IMAGEIO_FALSE='#' else @@ -24286,27 +23741,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -24342,17 +23780,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -24449,27 +23880,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_jpeg_jpeg_destroy_decompress=yes else echo "$as_me: failed program was:" >&5 @@ -24478,7 +23893,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_jpeg_jpeg_destroy_decompress=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -24534,27 +23949,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -24590,17 +23988,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -24697,27 +24088,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_z_gzopen=yes else echo "$as_me: failed program was:" >&5 @@ -24726,7 +24101,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_gzopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -24783,27 +24158,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -24839,17 +24197,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -24949,27 +24300,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -25005,17 +24339,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -25125,27 +24452,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_png12_png_read_image=yes else echo "$as_me: failed program was:" >&5 @@ -25154,7 +24465,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_png12_png_read_image=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -25238,27 +24549,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 @@ -25267,7 +24562,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` @@ -25322,27 +24617,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -25378,17 +24656,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -25485,27 +24756,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_tiff_TIFFReadRGBAStrip=yes else echo "$as_me: failed program was:" >&5 @@ -25514,7 +24769,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_tiff_TIFFReadRGBAStrip=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -25573,27 +24828,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -25629,17 +24867,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -25736,27 +24967,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_jasper_jas_image_readcmpt=yes else echo "$as_me: failed program was:" >&5 @@ -25765,7 +24980,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_jasper_jas_image_readcmpt=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -25823,27 +25038,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -25879,17 +25077,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -25986,27 +25177,11 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_IlmImf_ImfInputReadPixels=yes else echo "$as_me: failed program was:" >&5 @@ -26015,7 +25190,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_IlmImf_ImfInputReadPixels=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi @@ -26046,10 +25221,9 @@ LIBS="$SAVELIBS" ###################################################################### # SWIG wrappers -# currently there is only python. -# If additional wrapper languages / SWIG modules -# get available for OpenCV, we will have a --with-LANGUAGE switch -# for every wrapper language +# each language should have --with-LANGUAGE switch + +# check for python if test x"$with_python" = "xyes"; then { echo "$as_me:$LINENO: Checking for necessary tools to build python wrappers" >&5 echo "$as_me: Checking for necessary tools to build python wrappers" >&6;} @@ -26081,7 +25255,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -26341,27 +25515,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 @@ -26397,17 +25554,10 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -26487,9 +25637,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-python, continuing have_python=no fi fi - - -if test x"$have_python" = "xyes"; then + if test x"$have_python" = "xyes"; then BUILD_PYTHON_WRAPPERS_TRUE= BUILD_PYTHON_WRAPPERS_FALSE='#' else @@ -26498,6 +25646,301 @@ else fi +# check for octave +if test x"$with_octave" = "xyes"; then + { echo "$as_me:$LINENO: Checking for necessary tools to build octave wrappers" >&5 +echo "$as_me: Checking for necessary tools to build octave wrappers" >&6;} + + # find octave and mkoctfile + # Extract the first word of "octave", so it can be a program name with args. +set dummy octave; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_OCTAVE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OCTAVE in + [\\/]* | ?:[\\/]*) + ac_cv_path_OCTAVE="$OCTAVE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_OCTAVE="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +OCTAVE=$ac_cv_path_OCTAVE +if test -n "$OCTAVE"; then + { echo "$as_me:$LINENO: result: $OCTAVE" >&5 +echo "${ECHO_T}$OCTAVE" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + # Extract the first word of "mkoctfile", so it can be a program name with args. +set dummy mkoctfile; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_MKOCTFILE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MKOCTFILE in + [\\/]* | ?:[\\/]*) + ac_cv_path_MKOCTFILE="$MKOCTFILE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MKOCTFILE="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +MKOCTFILE=$ac_cv_path_MKOCTFILE +if test -n "$MKOCTFILE"; then + { echo "$as_me:$LINENO: result: $MKOCTFILE" >&5 +echo "${ECHO_T}$MKOCTFILE" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + + if test -z "$OCTAVE"; then + { echo "$as_me:$LINENO: WARNING: octave not found, disabling octave wrappers" >&5 +echo "$as_me: WARNING: octave not found, disabling octave wrappers" >&2;} + with_octave=no + fi + if test -z "$MKOCTFILE"; then + { echo "$as_me:$LINENO: WARNING: mkoctfile not found, disabling octave wrappers" >&5 +echo "$as_me: WARNING: mkoctfile not found, disabling octave wrappers" >&2;} + with_octave=no + fi +fi +if test x"$with_octave" = "xyes"; then + # check that octave version is at least 2.9.12 + cat > conftest.m <<'EOF' +[a,b,c]=sscanf([version()," "],"%i.%i.%i","C"); +exit(sum([a,b,c].*[1e5,1e3,1])<209012) +EOF + $OCTAVE --no-init-file conftest.m >& /dev/null || with_octave="no"; + rm -f conftest.m + + if test x"$with_octave" = "xno"; then + { echo "$as_me:$LINENO: WARNING: Octave version < 2.9.12, disabling octave wrappers" >&5 +echo "$as_me: WARNING: Octave version < 2.9.12, disabling octave wrappers" >&2;} + fi +fi +if test x"$with_octave" = "xyes"; then + # if not explicitly forbidden, check for swig also + if test x"$with_swig" = "xauto"; then + with_swig=yes + fi + + # check that we have octave headers + OLD_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -x c++" + if test "${ac_cv_header_octave_oct_h+set}" = set; then + { echo "$as_me:$LINENO: checking for octave/oct.h" >&5 +echo $ECHO_N "checking for octave/oct.h... $ECHO_C" >&6; } +if test "${ac_cv_header_octave_oct_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_octave_oct_h" >&5 +echo "${ECHO_T}$ac_cv_header_octave_oct_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking octave/oct.h usability" >&5 +echo $ECHO_N "checking octave/oct.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking octave/oct.h presence" >&5 +echo $ECHO_N "checking octave/oct.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: octave/oct.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: octave/oct.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: octave/oct.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: octave/oct.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: octave/oct.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: octave/oct.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: octave/oct.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: octave/oct.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: octave/oct.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: octave/oct.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: octave/oct.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------------------------------- ## +## Report this to opencvlibrary-devel@lists.sourceforge.net ## +## -------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for octave/oct.h" >&5 +echo $ECHO_N "checking for octave/oct.h... $ECHO_C" >&6; } +if test "${ac_cv_header_octave_oct_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_octave_oct_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_octave_oct_h" >&5 +echo "${ECHO_T}$ac_cv_header_octave_oct_h" >&6; } + +fi +if test $ac_cv_header_octave_oct_h = yes; then + have_octave=yes +else + + { echo "$as_me:$LINENO: WARNING: Octave headers not found, disabling octave wrappers" >&5 +echo "$as_me: WARNING: Octave headers not found, disabling octave wrappers" >&2;} + have_octave=no + +fi + + + + # restore the old CPPFLAGS + CPPFLAGS=$OLD_CPPFLAGS + + # find Octave arch + { echo "$as_me:$LINENO: checking for Octave arch" >&5 +echo $ECHO_N "checking for Octave arch... $ECHO_C" >&6; } + OCTAVE_ARCH=`$OCTAVE -q --eval 'strcat(octave_config_info("canonical_host_type"), "-", octave_config_info("api_version"))'|sed -e 's/ans = //'` + { echo "$as_me:$LINENO: result: $OCTAVE_ARCH" >&5 +echo "${ECHO_T}$OCTAVE_ARCH" >&6; } + OCTAVE_ARCH=$OCTAVE_ARCH + + +else + # check if ./configure arguments are valid + if test x"$with_octave" = "xno"; then + have_octave=no + else + # if we get here then --with-octave was not called with 'yes','no' or 'auto' + { echo "$as_me:$LINENO: WARNING: unexpected arguments for option --with-octave, continuing assuming 'no'" >&5 +echo "$as_me: WARNING: unexpected arguments for option --with-octave, continuing assuming 'no'" >&2;} + have_octave=no + fi +fi + if test x"$have_octave" = "xyes"; then + BUILD_OCTAVE_WRAPPERS_TRUE= + BUILD_OCTAVE_WRAPPERS_FALSE='#' +else + BUILD_OCTAVE_WRAPPERS_TRUE='#' + BUILD_OCTAVE_WRAPPERS_FALSE= +fi + + # check for swig itself SWIG="" if test x"$with_swig" = "xyes"; then @@ -26545,7 +25988,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -26683,7 +26126,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -26798,6 +26241,7 @@ echo "$as_me: SWIG runtime library directory is '$SWIG_RUNTIME_LIBS_DIR'" >&6;} fi + if test -n "$SWIG"; then @@ -26911,6 +26355,26 @@ echo "$as_me: error: SWIG version number unknown - cannot set flags for multi mo # AC_SUBST([SWIG]) -- already done by AC_PATH_SWIG() + # if octave wrappers are enabled, check that swig supports octave + if test x"$with_octave" = "xyes"; then + { echo "$as_me:$LINENO: checking if SWIG supports Octave" >&5 +echo $ECHO_N "checking if SWIG supports Octave... $ECHO_C" >&6; } +cat > conftest.i <&5 +echo "$as_me: error: SWIG doesn't support Octave modules" >&2;} + { (exit 1); exit 1; }; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + rm -f conftest.* + + # specify the flags for swig + SWIG_OCTAVE_OPT="-octave" + + + fi + # check for swig python library @@ -26992,9 +26456,7 @@ echo "$as_me: WARNING: unexpected arguments for option --with-swig, continuing a fi fi fi - - -if test x"$have_swig" = "xyes"; then + if test x"$have_swig" = "xyes"; then UPDATE_SWIG_WRAPPERS_TRUE= UPDATE_SWIG_WRAPPERS_FALSE='#' else @@ -27020,7 +26482,7 @@ fi -ac_config_files="$ac_config_files Makefile opencv.pc opencv.spec docs/Makefile data/Makefile cxcore/Makefile cxcore/include/Makefile cxcore/src/Makefile cv/Makefile cv/include/Makefile cv/src/Makefile cvaux/Makefile cvaux/include/Makefile cvaux/src/Makefile ml/Makefile ml/include/Makefile ml/src/Makefile otherlibs/Makefile otherlibs/highgui/Makefile apps/Makefile apps/haartraining/Makefile apps/haartraining/include/Makefile apps/haartraining/src/Makefile interfaces/Makefile interfaces/swig/Makefile interfaces/swig/filtered/Makefile interfaces/swig/general/Makefile interfaces/swig/python/Makefile tests/Makefile tests/python/Makefile tests/cv/Makefile tests/cv/src/Makefile tests/cxts/Makefile tests/cxcore/Makefile tests/cxcore/src/Makefile utils/Makefile samples/Makefile samples/c/Makefile samples/python/Makefile" +ac_config_files="$ac_config_files Makefile opencv.pc opencv.spec docs/Makefile data/Makefile cxcore/Makefile cxcore/include/Makefile cxcore/src/Makefile cv/Makefile cv/include/Makefile cv/src/Makefile cvaux/Makefile cvaux/include/Makefile cvaux/src/Makefile ml/Makefile ml/include/Makefile ml/src/Makefile otherlibs/Makefile otherlibs/highgui/Makefile apps/Makefile apps/haartraining/Makefile apps/haartraining/include/Makefile apps/haartraining/src/Makefile interfaces/Makefile interfaces/swig/Makefile interfaces/swig/filtered/Makefile interfaces/swig/general/Makefile interfaces/swig/python/Makefile interfaces/swig/octave/Makefile tests/Makefile tests/python/Makefile tests/octave/Makefile tests/cv/Makefile tests/cv/src/Makefile tests/cxts/Makefile tests/cxcore/Makefile tests/cxcore/src/Makefile utils/Makefile samples/Makefile samples/c/Makefile samples/python/Makefile samples/octave/Makefile" cat >confcache <<\_ACEOF @@ -27168,6 +26630,13 @@ echo "$as_me: error: conditional \"BUILD_QUICKTIME\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${BUILD_GSTREAMER_TRUE}" && test -z "${BUILD_GSTREAMER_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"BUILD_GSTREAMER\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"BUILD_GSTREAMER\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${BUILD_XINE_TRUE}" && test -z "${BUILD_XINE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_XINE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -27210,6 +26679,13 @@ echo "$as_me: error: conditional \"BUILD_PYTHON_WRAPPERS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${BUILD_OCTAVE_WRAPPERS_TRUE}" && test -z "${BUILD_OCTAVE_WRAPPERS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"BUILD_OCTAVE_WRAPPERS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"BUILD_OCTAVE_WRAPPERS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${UPDATE_SWIG_WRAPPERS_TRUE}" && test -z "${UPDATE_SWIG_WRAPPERS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"UPDATE_SWIG_WRAPPERS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -27241,7 +26717,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -27250,10 +26727,13 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -27477,19 +26957,28 @@ else as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -27505,7 +26994,7 @@ exec 6>&1 # values after options handling. ac_log=" This file was extended by opencv $as_me 1.1.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -27534,7 +27023,7 @@ current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions @@ -27558,7 +27047,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ opencv config.status 1.1.0 -configured by $0, generated by GNU Autoconf 2.60, +configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. @@ -27568,6 +27057,7 @@ gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -27700,8 +27190,10 @@ do "interfaces/swig/filtered/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/swig/filtered/Makefile" ;; "interfaces/swig/general/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/swig/general/Makefile" ;; "interfaces/swig/python/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/swig/python/Makefile" ;; + "interfaces/swig/octave/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/swig/octave/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "tests/python/Makefile") CONFIG_FILES="$CONFIG_FILES tests/python/Makefile" ;; + "tests/octave/Makefile") CONFIG_FILES="$CONFIG_FILES tests/octave/Makefile" ;; "tests/cv/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cv/Makefile" ;; "tests/cv/src/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cv/src/Makefile" ;; "tests/cxts/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cxts/Makefile" ;; @@ -27711,6 +27203,7 @@ do "samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;; "samples/c/Makefile") CONFIG_FILES="$CONFIG_FILES samples/c/Makefile" ;; "samples/python/Makefile") CONFIG_FILES="$CONFIG_FILES samples/python/Makefile" ;; + "samples/octave/Makefile") CONFIG_FILES="$CONFIG_FILES samples/octave/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -27825,6 +27318,7 @@ target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim @@ -27869,7 +27363,6 @@ ac_ct_CC!$ac_ct_CC$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim -CPP!$CPP$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -27911,6 +27404,8 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +CPP!$CPP$ac_delim +SED!$SED$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LN_S!$LN_S$ac_delim @@ -27928,6 +27423,8 @@ LIBTOOL!$LIBTOOL$ac_delim BUILD_APPS_TRUE!$BUILD_APPS_TRUE$ac_delim BUILD_APPS_FALSE!$BUILD_APPS_FALSE$ac_delim PY_CXXFLAGS!$PY_CXXFLAGS$ac_delim +OCT_CXXFLAGS!$OCT_CXXFLAGS$ac_delim +DEF_CXXFLAGS!$DEF_CXXFLAGS$ac_delim ALLOCA!$ALLOCA$ac_delim CARBON_CFLAGS!$CARBON_CFLAGS$ac_delim CARBON_LIBS!$CARBON_LIBS$ac_delim @@ -27944,6 +27441,10 @@ QUICKTIME_CFLAGS!$QUICKTIME_CFLAGS$ac_delim QUICKTIME_LIBS!$QUICKTIME_LIBS$ac_delim BUILD_QUICKTIME_TRUE!$BUILD_QUICKTIME_TRUE$ac_delim BUILD_QUICKTIME_FALSE!$BUILD_QUICKTIME_FALSE$ac_delim +GSTREAMER_CFLAGS!$GSTREAMER_CFLAGS$ac_delim +GSTREAMER_LIBS!$GSTREAMER_LIBS$ac_delim +BUILD_GSTREAMER_TRUE!$BUILD_GSTREAMER_TRUE$ac_delim +BUILD_GSTREAMER_FALSE!$BUILD_GSTREAMER_FALSE$ac_delim XINE_LIBS!$XINE_LIBS$ac_delim BUILD_XINE_TRUE!$BUILD_XINE_TRUE$ac_delim BUILD_XINE_FALSE!$BUILD_XINE_FALSE$ac_delim @@ -27971,9 +27472,15 @@ PYTHON_CSPEC!$PYTHON_CSPEC$ac_delim PYTHON_LSPEC!$PYTHON_LSPEC$ac_delim BUILD_PYTHON_WRAPPERS_TRUE!$BUILD_PYTHON_WRAPPERS_TRUE$ac_delim BUILD_PYTHON_WRAPPERS_FALSE!$BUILD_PYTHON_WRAPPERS_FALSE$ac_delim +OCTAVE!$OCTAVE$ac_delim +MKOCTFILE!$MKOCTFILE$ac_delim +OCTAVE_ARCH!$OCTAVE_ARCH$ac_delim +BUILD_OCTAVE_WRAPPERS_TRUE!$BUILD_OCTAVE_WRAPPERS_TRUE$ac_delim +BUILD_OCTAVE_WRAPPERS_FALSE!$BUILD_OCTAVE_WRAPPERS_FALSE$ac_delim SWIG!$SWIG$ac_delim SWIG_VERSION!$SWIG_VERSION$ac_delim SWIG_RUNTIME_LIBS_DIR!$SWIG_RUNTIME_LIBS_DIR$ac_delim +SWIG_OCTAVE_OPT!$SWIG_OCTAVE_OPT$ac_delim SWIG_PYTHON_OPT!$SWIG_PYTHON_OPT$ac_delim SWIG_PYTHON_LIBS!$SWIG_PYTHON_LIBS$ac_delim UPDATE_SWIG_WRAPPERS_TRUE!$UPDATE_SWIG_WRAPPERS_TRUE$ac_delim @@ -27983,7 +27490,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 70; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 84; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -28210,6 +27717,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -28263,6 +27775,7 @@ s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out @@ -28427,8 +27940,9 @@ echo "$as_me: executing $ac_file commands" >&6;} # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ @@ -28579,6 +28093,9 @@ fi General configuration ================================================ Compiler: ${CXX} CXXFLAGS: ${CXXFLAGS} + DEF_CXXFLAGS: ${DEF_CXXFLAGS} + PY_CXXFLAGS: ${PY_CXXFLAGS} + OCT_CXXFLAGS: ${OCT_CXXFLAGS} Install path: ${prefix} @@ -28601,6 +28118,7 @@ HighGUI configuration ================================================ Video I/O --------------------- Use QuickTime / Mac OS X: ${have_quicktime} Use xine: ${have_xine} + Use gstreamer: ${have_gstreamer} Use ffmpeg: ${have_ffmpeg} Use dc1394 & raw1394: ${have_dc1394} Use v4l: ${have_v4l} @@ -28609,6 +28127,7 @@ HighGUI configuration ================================================ Wrappers for other languages ========================================= SWIG ${SWIG} Python ${have_python} + Octave ${have_octave} Additional build settings ============================================ Build demo apps ${enable_apps} @@ -28619,6 +28138,9 @@ echo "${ECHO_T} General configuration ================================================ Compiler: ${CXX} CXXFLAGS: ${CXXFLAGS} + DEF_CXXFLAGS: ${DEF_CXXFLAGS} + PY_CXXFLAGS: ${PY_CXXFLAGS} + OCT_CXXFLAGS: ${OCT_CXXFLAGS} Install path: ${prefix} @@ -28641,6 +28163,7 @@ HighGUI configuration ================================================ Video I/O --------------------- Use QuickTime / Mac OS X: ${have_quicktime} Use xine: ${have_xine} + Use gstreamer: ${have_gstreamer} Use ffmpeg: ${have_ffmpeg} Use dc1394 & raw1394: ${have_dc1394} Use v4l: ${have_v4l} @@ -28649,6 +28172,7 @@ HighGUI configuration ================================================ Wrappers for other languages ========================================= SWIG ${SWIG} Python ${have_python} + Octave ${have_octave} Additional build settings ============================================ Build demo apps ${enable_apps} diff --git a/configure.in b/configure.in index 39be932..82ccfb6 100644 --- a/configure.in +++ b/configure.in @@ -10,16 +10,16 @@ m4_define([opencv_version], [opencv_major_version.opencv_minor_version. # See: http://www.gnu.org/software/libtool/manual.html#Versioning # # The string is of the form Current:Revision:Age. -# +# # The following lines are taken from the GNU Libtool Manual: # Here are a set of rules to help you update your library version information: -# +# # Start with version information of 0:0:0 for each libtool library. -# Update the version information only immediately before a public release of your software. +# Update the version information only immediately before a public release of your software. # More frequent updates are unnecessary, and only guarantee that the current interface number # gets larger faster. # -# 1) If the library source code has changed at all since the last update, +# 1) If the library source code has changed at all since the last update, # then increment revision (c:r:a becomes c:r+1:a). # 2) If any interfaces have been added, removed, or changed since the last update, # increment current, and set revision to 0. @@ -27,8 +27,8 @@ m4_define([opencv_version], [opencv_major_version.opencv_minor_version. # 4) If any interfaces have been removed since the last public release, then set age to 0. # # Never try to set the interface numbers so that they correspond to the release number of your package. -# This is an abuse that only fosters misunderstanding of the purpose of library versions. Instead, -# use the -release flag (see Release numbers), but be warned that every release of your package will +# This is an abuse that only fosters misunderstanding of the purpose of library versions. Instead, +# use the -release flag (see Release numbers), but be warned that every release of your package will # not be binary compatible with any other release. m4_define([opencv_lt_version], [2:0:0]) @@ -40,7 +40,7 @@ AC_CONFIG_AUX_DIR([autotools]) AC_CONFIG_MACRO_DIR([autotools/aclocal]) # put CVS revision of this configure.in into the resulting configure script -AC_REVISION($Revision: 1.46 $) +AC_REVISION($Revision: 1.58 $) # Detect the canonical host and target build environment AC_CANONICAL_HOST @@ -78,13 +78,13 @@ AC_PROG_LIBTOOL ###################################################################### # the following interpret 'with' and 'enable' switches. -# some of these switches trigger checks that can be found further +# some of these switches trigger checks that can be found further # below in this configure script # does the user want aggressive optimization? AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],[build debug version without optimization [no]])], - [debug=$enableval], + [debug=$enableval], [debug=no]) # does the user want to build demo applications? @@ -96,29 +96,41 @@ AM_CONDITIONAL([BUILD_APPS], [test x"$enable_apps" = x"yes"]) # the following checks reflect the dependencies of OpenCV on other -# libraries that do the actual work for video I/O or windowing +# libraries that do the actual work for video I/O or windowing # subsystem. On some platforms there are ambiguities that a user # can influence. There is also additional logic to be found in code # later code lines that tries to do sensible decisions on what to use # does the user want to compile python modules as well? -AC_ARG_WITH([swig], +AC_ARG_WITH([swig], [AS_HELP_STRING([--with-swig],[use swig wrapper generator [no]])], [with_swig=$withval], [with_swig=no]) # does the user want to compile python modules as well? -AC_ARG_WITH([python], +AC_ARG_WITH([python], [AS_HELP_STRING([--with-python],[use python for wrapping [yes]])], [with_python=$withval], [with_python=yes]) +# does the user want to compile octave modules as well? +AC_ARG_WITH([octave], + [AS_HELP_STRING([--with-octave],[use octave for wrapping [no]])], + [with_octave=$withval], + [with_octave=no]) + # does the user want OpenCV to use xine video libraries? AC_ARG_WITH([xine], [AS_HELP_STRING([--with-xine],[use xine libraries (see LICENSE) [no]])], [with_xine=$withval], [with_xine=no]) +# does the user want OpenCV to use the gstreamer multimedia framework? +AC_ARG_WITH([gstreamer], + [AS_HELP_STRING([--with-gstreamer],[use gstreamer multimedia framework (see LICENSE) [no]])], + [with_gstreamer=$withval], + [with_gstreamer=no]) + # does the user want OpenCV to use ffmpeg video libraries? AC_ARG_WITH([ffmpeg], [AS_HELP_STRING([--with-ffmpeg],[use ffmpeg libraries (see LICENSE) [automatic]])], @@ -137,6 +149,12 @@ AC_ARG_WITH([v4l], [with_v4l=$withval], [with_v4l=auto]) +# does the user want OpenCV to use the unicap library? +AC_ARG_WITH([unicap], + [AS_HELP_STRING([--with-unicap],[use unicap (see LICENSE) [no]])], + [with_unicap=$withval], + [with_unicap=no]) + # does the user want OpenCV to use image libraries from OS X 10.4? AC_ARG_WITH([imageio], [AS_HELP_STRING([--with-imageio],[use ImageIO libraries [automatic]])], @@ -181,6 +199,11 @@ if test x"$CXXFLAGS" = "x-g -O2" ; then CXXFLAGS="" fi +# set the default c++ flags for all the compilations +# we don't append CXXFLAGS, because it's done at compile time +# see http://www.gnu.org/software/libtool/manual/automake/Flag-Variables-Ordering.html +# for more information +DEFAULT_CXXFLAGS="" # see if the user wants aggressive optimizations of the code, # check whether to include debugging code @@ -189,7 +212,7 @@ if test x"$debug" = "xyes"; then AC_MSG_RESULT([yes]) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then CPPFLAGS="-DDEBUG -D_DEBUG $CPPFLAGS" - CXXFLAGS="-ggdb -O0 $CXXFLAGS" + DEFAULT_CXXFLAGS="-ggdb -O0 $DEFAULT_CXXFLAGS" fi else AC_MSG_RESULT([no]) @@ -198,41 +221,46 @@ else i*86-apple-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # apples g++ fails with '-march=i686' and there are no apple machines older than prescott/core anyway - CXXFLAGS="-g -march=prescott -ffast-math -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -march=prescott -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; i686-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # default to i686/pentiumpro -- people can override this - CXXFLAGS="-g -march=i686 -ffast-math -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -march=i686 -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; powerpc-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then # default to G3 processors -- people can override this - CXXFLAGS="-g -mcpu=G3 -mtune=G5 -fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-g -mcpu=G3 -mtune=G5 -fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; *-*-*) if test x"$ac_cv_c_compiler_gnu" = "xyes"; then - CXXFLAGS="-fomit-frame-pointer $CXXFLAGS" + DEFAULT_CXXFLAGS="-fomit-frame-pointer $DEFAULT_CXXFLAGS" fi ;; esac - + CPPFLAGS="-DNDEBUG $CPPFLAGS" - CXXFLAGS="-O3 $CXXFLAGS" + DEFAULT_CXXFLAGS="-O3 $DEFAULT_CXXFLAGS" fi if test x"$ac_cv_c_compiler_gnu" = "xyes"; then - PY_CXXFLAGS="-Wall -pipe $CXXFLAGS" - CXXFLAGS="-Wall -fno-rtti -pipe $CXXFLAGS" + PY_CXXFLAGS="-Wall -pipe $DEFAULT_CXXFLAGS" + OCT_CXXFLAGS="-fno-strict-aliasing -Wall -Wno-uninitialized -pipe $DEFAULT_CXXFLAGS" + DEF_CXXFLAGS="-Wall -fno-rtti -pipe $DEFAULT_CXXFLAGS" else - PY_CXXFLAGS="$CXXFLAGS" + PY_CXXFLAGS="$DEFAULT_CXXFLAGS" + OCT_CXXFLAGS="$DEFAULT_CXXFLAGS" + DEF_CXXFLAGS="$DEFAULT_CXXFLAGS" fi AC_SUBST(PY_CXXFLAGS) +AC_SUBST(OCT_CXXFLAGS) +AC_SUBST(DEF_CXXFLAGS) -# add libm because it is used by several libraries and OpenCV itself +# add libm because it is used by several libraries and OpenCV itself AC_CHECK_LIB(m,pow) AC_CHECK_LIB(dl,dlopen) AC_CHECK_LIB(pthread,pthread_create) @@ -251,7 +279,7 @@ AC_CHECK_FUNCS(lrint) ###################################################################### # HighGUI dependencies for windowing system -# honor user selection, +# honor user selection, # if no selection given check for Carbon first CARBON_CFLAGS="" CARBON_LIBS="" @@ -265,13 +293,13 @@ if test x"$with_carbon" = "xyes"; then have_carbon=yes ], [ - have_carbon=no + have_carbon=no with_carbon=no ]) # sanity checks if test x"$have_carbon" = "xyes"; then - + # if we asked for gtk, this is not ok if test x"$with_gtk" = "xyes"; then AC_MSG_ERROR([You cannot specify --with-carbon and --with-gtk at the same time]) @@ -292,7 +320,7 @@ AC_SUBST(CARBON_CFLAGS) AC_SUBST(CARBON_LIBS) AM_CONDITIONAL([BUILD_CARBON], [test x"$have_carbon" = "xyes"]) -# use GTK+ 2.x (or later) for windowing +# use GTK+ 2.x (or later) for windowing # if carbon not present or not wanted (--without-carbon) GTK_CFLAGS="" GTK_LIBS="" @@ -307,16 +335,16 @@ else with_gtk=yes fi if test x"$with_gtk" = "xyes"; then - + # pkg-config is needed for GTK+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test x"$PKG_CONFIG" == "xno"; then AC_MSG_ERROR([You have to install pkg-config to compile OpenCV with GTK+]) fi - - PKG_CHECK_MODULES(GTK, "gtk+-2.0 gdk-pixbuf-2.0", + + PKG_CHECK_MODULES(GTK, "gtk+-2.0 gdk-pixbuf-2.0", [ - have_gtk=yes + have_gtk=yes AC_DEFINE(HAVE_GTK,,[GTK+ 2.x toolkit]) ], [ have_gtk=no ]) @@ -379,7 +407,7 @@ if test x"$with_quicktime" = "xyes"; then if test x"$with_v4l" = "xyes"; then AC_MSG_ERROR([You cannot specify --with-quicktime and --with-v4l at the same time]) fi - + # header presence and usability seem to be enough AC_CHECK_HEADER([QuickTime/QuickTime.h], [ @@ -387,11 +415,11 @@ if test x"$with_quicktime" = "xyes"; then have_quicktime=yes ], [ have_quicktime=no ]) - + # specify quicktime libraries if test x"$have_quicktime" = "xyes"; then QUICKTIME_LIBS="-Xlinker -framework -Xlinker QuickTime -Xlinker -framework -Xlinker QuartzCore" - + # don't check alternatives if quicktime was found if test x"$with_ffmpeg" = "xauto"; then with_ffmpeg=no @@ -417,6 +445,70 @@ AC_SUBST(QUICKTIME_CFLAGS) AC_SUBST(QUICKTIME_LIBS) AM_CONDITIONAL([BUILD_QUICKTIME], [test x"$have_quicktime" = "xyes"]) +# GStreamer seems to be a nice solution for both reading and writing +# and even supports some cameras +GSTREAMER_CFLAGS="" +GSTREAMER_LIBS="" +if test x"$with_gstreamer" = "xno"; then + have_gstreamer=no +else + + if test x"$with_ffmpeg" = "xyes"; then + AC_MSG_ERROR([You cannot specify --with-gstreamer and --with-ffmpeg at the same time]) + fi + + # check if ./configure arguments are valid + if test x"$with_gstreamer" = "xauto"; then + with_gstreamer=yes + fi + if test x"$with_gstreamer" = "xyes"; then + + # pkg-config is needed for GTK+ + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x"$PKG_CONFIG" == "xno"; then + AC_MSG_ERROR([You have to install pkg-config to compile OpenCV with GStreamer]) + fi + + PKG_CHECK_MODULES(GSTREAMER, "gstreamer-0.10", + [ + have_gstreamer=yes + AC_DEFINE(HAVE_GSTREAMER,,[GStreamer multimedia framework]) + ], + [ have_gstreamer=no ]) + + if test x"$have_gstreamer" = "xyes"; then + GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstbase-0.10" + with_ffmpeg=no + fi + else + # if we get here then --with-gstreamer was not called with 'yes','no' or 'auto' + AC_MSG_WARN([unexpected arguments for option --with-gstreamer, continuing assuming 'no']) + have_gstreamer=no + fi +fi +AC_SUBST(GSTREAMER_CFLAGS) +AC_SUBST(GSTREAMER_LIBS) +AM_CONDITIONAL([BUILD_GSTREAMER], [test x"$have_gstreamer" = "xyes"]) + +# Check for the unicap library +UNICAP_PACKAGE_LIBS="" +UNICAP_PACKAGE_CFLAGS="" +UCIL_PACKAGE_LIBS="" +UCIL_PACKAGE_CFLAGS="" +if test x"$with_unicap" = "xno"; then + have_unicap=no +else + PKG_CHECK_MODULES(UNICAP_PACKAGE,libunicap) + PKG_CHECK_MODULES(UCIL_PACKAGE,libucil) + have_unicap=yes + AC_DEFINE(HAVE_UNICAP,,[Unicap video capture library]) +fi +AM_CONDITIONAL([BUILD_UNICAP], [test x"$have_unicap" = "xyes"]) +AC_SUBST(UNICAP_PACKAGE_LIBS) +AC_SUBST(UNICAP_PACKAGE_CFLAGS) +AC_SUBST(UCIL_PACKAGE_LIBS) +AC_SUBST(UCIL_PACKAGE_CFLAGS) + # prefer XINE over FFMPEG for video reading because it is quick, has a cleaner API # and allows for easy seeking with some formats if test x"$with_xine" = "xno"; then @@ -494,21 +586,21 @@ else with_1394libs=yes fi if test x"$with_1394libs" = "xyes"; then - + SAVELIBS="$LIBS" have_raw1394=no have_dc1394=no - + AC_CHECK_HEADER(libraw1394/raw1394.h, - AC_CHECK_LIB(raw1394, raw1394_new_handle, + AC_CHECK_LIB(raw1394, raw1394_new_handle, [ have_raw1394=yes LIBS="-lm -lraw1394 $LIBS" ])) - + if test x"$have_raw1394" = "xyes"; then AC_CHECK_HEADER(libdc1394/dc1394_control.h, - AC_CHECK_LIB(dc1394_control, dc1394_camera_on, + AC_CHECK_LIB(dc1394_control, dc1394_camera_on, [ have_dc1394=yes AC_DEFINE(HAVE_DC1394,,[IEEE1394 capturing support]) @@ -517,7 +609,7 @@ else IEEE1394LIBS="-lm -lraw1394 -ldc1394_control" ])) fi - + LIBS="$SAVELIBS" else # if we get here then --with-1394libs was not called with 'yes','no' or 'auto' @@ -528,7 +620,7 @@ fi AC_SUBST(IEEE1394LIBS) AM_CONDITIONAL([BUILD_DC1394], [test x"$have_dc1394" = "xyes"]) -# Video for Linux (V4L) +# Video for Linux (V4L) # we support version 1 and 2 currently if test x"$with_v4l" = "xno"; then have_v4l=no @@ -546,7 +638,7 @@ else have_v4l=yes have_v4l1or2=yes ], - [ + [ have_v4l=no have_v4l1or2=no ]) @@ -624,17 +716,17 @@ if test x"$have_imageio" = "xno" ; then LIBS="$LIBS -lz -lm" ])) - AC_CHECK_HEADER(png.h, + AC_CHECK_HEADER(png.h, [ AC_DEFINE(HAVE_PNG_H,,[png.h needs to be included]) have_png=yes ]) - AC_CHECK_HEADER([libpng/png.h], + AC_CHECK_HEADER([libpng/png.h], [ AC_DEFINE(HAVE_LIBPNG_PNG_H,,[libpng/png.h needs to be included]) have_png=yes ]) - + if test x"$have_png" = "xyes"; then AC_CHECK_LIB(png12, png_read_image, [ @@ -686,10 +778,9 @@ AC_SUBST(IMAGELIBS) ###################################################################### # SWIG wrappers -# currently there is only python. -# If additional wrapper languages / SWIG modules -# get available for OpenCV, we will have a --with-LANGUAGE switch -# for every wrapper language +# each language should have --with-LANGUAGE switch + +# check for python if test x"$with_python" = "xyes"; then AC_MSG_NOTICE([Checking for necessary tools to build python wrappers]) @@ -704,7 +795,7 @@ if test x"$with_python" = "xyes"; then if test x"$with_swig" = "xauto"; then with_swig=yes fi - + ### almost ok... just need to check if we have the Python headers ### # first, save the CPPFLAGS @@ -736,6 +827,75 @@ else fi AM_CONDITIONAL([BUILD_PYTHON_WRAPPERS], [test x"$have_python" = "xyes"]) +# check for octave +if test x"$with_octave" = "xyes"; then + AC_MSG_NOTICE([Checking for necessary tools to build octave wrappers]) + + # find octave and mkoctfile + AC_PATH_PROG(OCTAVE,octave) + AC_PATH_PROG(MKOCTFILE,mkoctfile) + + if test -z "$OCTAVE"; then + AC_MSG_WARN([octave not found, disabling octave wrappers]) + with_octave=no + fi + if test -z "$MKOCTFILE"; then + AC_MSG_WARN([mkoctfile not found, disabling octave wrappers]) + with_octave=no + fi + OCTAVE_INCFLAGS=`$MKOCTFILE -p INCFLAGS` + AC_SUBST(OCTAVE_INCFLAGS,[$OCTAVE_INCFLAGS]) +fi +if test x"$with_octave" = "xyes"; then + # check that octave version is at least 2.9.12 + cat > conftest.m <<'EOF' +[[a,b,c]]=sscanf([[version()," "]],"%i.%i.%i","C"); +exit(sum([[a,b,c]].*[[1e5,1e3,1]])<209012) +EOF + $OCTAVE --no-init-file conftest.m >& /dev/null || with_octave="no"; + rm -f conftest.m + + if test x"$with_octave" = "xno"; then + AC_MSG_WARN([Octave version < 2.9.12, disabling octave wrappers]) + fi +fi +if test x"$with_octave" = "xyes"; then + # if not explicitly forbidden, check for swig also + if test x"$with_swig" = "xauto"; then + with_swig=yes + fi + + # check that we have octave headers + OLD_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -x c++ $OCTAVE_INCFLAGS" + AC_CHECK_HEADER(octave/oct.h, + [have_octave=yes], + [ + AC_MSG_WARN([Octave headers not found, disabling octave wrappers]) + have_octave=no + ]) + + # restore the old CPPFLAGS + CPPFLAGS=$OLD_CPPFLAGS + + # find Octave arch + AC_MSG_CHECKING([for Octave arch]) + OCTAVE_ARCH=`$OCTAVE -q --eval 'strcat(octave_config_info("canonical_host_type"), "-", octave_config_info("api_version"))'|sed -e 's/ans = //'` + AC_MSG_RESULT([$OCTAVE_ARCH]) + AC_SUBST(OCTAVE_ARCH,[$OCTAVE_ARCH]) + +else + # check if ./configure arguments are valid + if test x"$with_octave" = "xno"; then + have_octave=no + else + # if we get here then --with-octave was not called with 'yes','no' or 'auto' + AC_MSG_WARN([unexpected arguments for option --with-octave, continuing assuming 'no']) + have_octave=no + fi +fi +AM_CONDITIONAL([BUILD_OCTAVE_WRAPPERS], [test x"$have_octave" = "xyes"]) + # check for swig itself SWIG="" if test x"$with_swig" = "xyes"; then @@ -749,10 +909,26 @@ if test x"$with_swig" = "xyes"; then AC_PATH_SWIG([1.2.24]) fi + if test -n "$SWIG"; then SWIG_ENABLE_CXX() SWIG_MULTI_MODULE_SUPPORT() + # if octave wrappers are enabled, check that swig supports octave + if test x"$with_octave" = "xyes"; then + AC_MSG_CHECKING([if SWIG supports Octave]) +cat > conftest.i <param[0].val[0] = state->param[0].val[1] = state->param[0].val[2] = state->param[0].val[3] = param1; - state->param[1].val[0] = state->param[1].val[1] = + state->param[1].val[0] = state->param[1].val[1] = state->param[1].val[2] = state->param[1].val[3] = param2; } else @@ -240,7 +240,7 @@ CV_INLINE void cvRand( CvRandState* state, CvArr* arr ) cvError( CV_StsNullPtr, "cvRand", "Null pointer to RNG state", "cvcompat.h", 0 ); return; } - cvRandArr( &state->state, arr, state->disttype, state->param[0], state->param[1] ); + cvRandArr( &state->state, arr, state->disttype, state->param[0], state->param[1] ); } #define cvRandNext( _state ) cvRandInt( &(_state)->state ) @@ -385,7 +385,7 @@ CV_INLINE void cvConvexHull( CvPoint* points, int num_points, { CvMat points1 = cvMat( 1, num_points, CV_32SC2, points ); CvMat hull1 = cvMat( 1, num_points, CV_32SC1, hull ); - + cvConvexHull2( &points1, &hull1, orientation, 0 ); *hullsize = hull1.cols; } @@ -438,7 +438,7 @@ CV_INLINE void cvFitLine3D( CvPoint3D32f* points, int count, int dist, cvFitLine( &mat, dist, _param, reps, aeps, line ); } -/* Fits a line into set of 2d points in a robust way (M-estimator technique) */ +/* Fits a line into set of 2d points in a robust way (M-estimator technique) */ CV_INLINE void cvFitLine2D( CvPoint2D32f* points, int count, int dist, void *param, float reps, float aeps, float* line ) { @@ -466,7 +466,7 @@ CV_INLINE void cvProject3D( CvPoint3D32f* points3D, int count, CvMat dst = cvMat( 1, count, CV_32FC2, points2D ); float m[6] = {0,0,0,0,0,0}; CvMat M = cvMat( 2, 3, CV_32F, m ); - + assert( (unsigned)xIndx < 3 && (unsigned)yIndx < 3 ); m[xIndx] = m[yIndx+3] = 1.f; @@ -504,7 +504,7 @@ CV_INLINE int cvHoughLines( CvArr* image, double rho, double theta, int threshold, float* lines, int linesNumber ) { - CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines ); + CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines ); cvHoughLines2( image, &linesMat, CV_HOUGH_STANDARD, rho, theta, threshold, 0, 0 ); @@ -517,7 +517,7 @@ CV_INLINE int cvHoughLinesP( CvArr* image, double rho, int lineLength, int lineGap, int* lines, int linesNumber ) { - CvMat linesMat = cvMat( 1, linesNumber, CV_32SC4, lines ); + CvMat linesMat = cvMat( 1, linesNumber, CV_32SC4, lines ); cvHoughLines2( image, &linesMat, CV_HOUGH_PROBABILISTIC, rho, theta, threshold, lineLength, lineGap ); @@ -529,7 +529,7 @@ CV_INLINE int cvHoughLinesSDiv( CvArr* image, double rho, int srn, double theta, int stn, int threshold, float* lines, int linesNumber ) { - CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines ); + CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines ); cvHoughLines2( image, &linesMat, CV_HOUGH_MULTI_SCALE, rho, theta, threshold, srn, stn ); @@ -763,7 +763,7 @@ CV_INLINE void cvUnDistortOnce( const CvArr* src, CvArr* dst, /* the two functions below have quite hackerish implementations, use with care - (or, which is better, switch to cvUndistortInitMap and cvRemap instead */ + (or, which is better, switch to cvUndistortInitMap and cvRemap instead */ CV_INLINE void cvUnDistortInit( const CvArr* CV_UNREFERENCED(src), CvArr* undistortion_map, const float* A, const float* k, @@ -791,7 +791,7 @@ CV_INLINE void cvUnDistort( const CvArr* src, CvArr* dst, assert( sz.width >= 8 ); a[0] = data.fl[0]; a[4] = data.fl[1]; a[2] = data.fl[2]; a[5] = data.fl[3]; - cvUnDistortOnce( src, dst, a, data.fl + 4, 1 ); + cvUnDistortOnce( src, dst, a, data.fl + 4, 1 ); } @@ -805,7 +805,7 @@ CV_INLINE float cvCalcEMD( const float* signature1, int size1, CvMat sign1 = cvMat( size1, dims + 1, CV_32FC1, (void*)signature1 ); CvMat sign2 = cvMat( size2, dims + 1, CV_32FC1, (void*)signature2 ); - return cvCalcEMD2( &sign1, &sign2, dist_type, dist_func, 0, 0, lower_bound, user_param ); + return cvCalcEMD2( &sign1, &sign2, dist_type, dist_func, 0, 0, lower_bound, user_param ); } @@ -828,7 +828,7 @@ CV_INLINE void cvStartScanGraph( CvGraph* graph, CvGraphScanner* scanner, int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS)) { CvGraphScanner* temp_scanner; - + if( !scanner ) cvError( CV_StsNullPtr, "cvStartScanGraph", "Null scanner pointer", "cvcompat.h", 0 ); @@ -898,9 +898,9 @@ CV_INLINE void cvPolyLineAA( CvArr* img, CvPoint** pts, int* npts, int contour typedef struct _CvPixelPosition8u { - unsigned char* currline; /* pointer to the start of the current pixel line */ - unsigned char* topline; /* pointer to the start of the top pixel line */ - unsigned char* bottomline; /* pointer to the start of the first line */ + uchar* currline; /* pointer to the start of the current pixel line */ + uchar* topline; /* pointer to the start of the top pixel line */ + uchar* bottomline; /* pointer to the start of the first line */ /* which is below the image */ int x; /* current x coordinate ( in pixels ) */ int width; /* width of the image ( in pixels ) */ @@ -914,9 +914,9 @@ typedef struct _CvPixelPosition8u /* this structure differs from the above only in data type */ typedef struct _CvPixelPosition8s { - char* currline; - char* topline; - char* bottomline; + schar* currline; + schar* topline; + schar* bottomline; int x; int width; int height; @@ -971,64 +971,64 @@ typedef struct _CvPixelPosition32f /* x, y - coordinates of the new position */ /* cs - number of the image channels */ #define CV_GET_CURRENT( pos, cs ) ((pos).currline + (pos).x * (cs)) - + /* Move by one pixel relatively to current position */ /* pos - position structure */ /* cs - number of the image channels */ - + /* left */ #define CV_MOVE_LEFT( pos, cs ) \ ( --(pos).x >= 0 ? (pos).currline + (pos).x*(cs) : 0 ) - + /* right */ #define CV_MOVE_RIGHT( pos, cs ) \ ( ++(pos).x < (pos).width ? (pos).currline + (pos).x*(cs) : 0 ) - + /* up */ #define CV_MOVE_UP( pos, cs ) \ (((pos).currline -= (pos).step) != (pos).topline ? (pos).currline + (pos).x*(cs) : 0 ) - + /* down */ #define CV_MOVE_DOWN( pos, cs ) \ (((pos).currline += (pos).step) != (pos).bottomline ? (pos).currline + (pos).x*(cs) : 0 ) - + /* left up */ #define CV_MOVE_LU( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_UP(pos, cs)) - + /* right up */ #define CV_MOVE_RU( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_UP(pos, cs)) - + /* left down */ #define CV_MOVE_LD( pos, cs ) ( CV_MOVE_LEFT(pos, cs), CV_MOVE_DOWN(pos, cs)) - + /* right down */ #define CV_MOVE_RD( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_DOWN(pos, cs)) - - - + + + /* Move by one pixel relatively to current position with wrapping when the position */ /* achieves image boundary */ /* pos - position structure */ /* cs - number of the image channels */ - + /* left */ #define CV_MOVE_LEFT_WRAP( pos, cs ) \ ((pos).currline + ( --(pos).x >= 0 ? (pos).x : ((pos).x = (pos).width-1))*(cs)) - + /* right */ #define CV_MOVE_RIGHT_WRAP( pos, cs ) \ ((pos).currline + ( ++(pos).x < (pos).width ? (pos).x : ((pos).x = 0))*(cs) ) - + /* up */ #define CV_MOVE_UP_WRAP( pos, cs ) \ ((((pos).currline -= (pos).step) != (pos).topline ? \ (pos).currline : ((pos).currline = (pos).bottomline - (pos).step)) + (pos).x*(cs) ) - + /* down */ #define CV_MOVE_DOWN_WRAP( pos, cs ) \ ((((pos).currline += (pos).step) != (pos).bottomline ? \ (pos).currline : ((pos).currline = (pos).topline + (pos).step)) + (pos).x*(cs) ) - + /* left up */ #define CV_MOVE_LU_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_UP_WRAP(pos, cs)) /* right up */ @@ -1037,7 +1037,7 @@ typedef struct _CvPixelPosition32f #define CV_MOVE_LD_WRAP( pos, cs ) ( CV_MOVE_LEFT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs)) /* right down */ #define CV_MOVE_RD_WRAP( pos, cs ) ( CV_MOVE_RIGHT_WRAP(pos, cs), CV_MOVE_DOWN_WRAP(pos, cs)) - + /* Numeric constants which used for moving in arbitrary direction */ #define CV_SHIFT_NONE 2 #define CV_SHIFT_LEFT 1 @@ -1048,7 +1048,7 @@ typedef struct _CvPixelPosition32f #define CV_SHIFT_RU 7 #define CV_SHIFT_LD 9 #define CV_SHIFT_RD 11 - + /* Move by one pixel in specified direction */ /* pos - position structure */ /* shift - direction ( it's value must be one of the CV_SHIFT_… constants ) */ @@ -1057,7 +1057,7 @@ typedef struct _CvPixelPosition32f ( (pos).currline += (pos).step_arr[(shift)>>2], (pos).x += ((shift)&3)-2, \ ((pos).currline != (pos).topline && (pos).currline != (pos).bottomline && \ (pos).x >= 0 && (pos).x < (pos).width) ? (pos).currline + (pos).x*(cs) : 0 ) - + /* Move by one pixel in specified direction with wrapping when the */ /* position achieves image boundary */ /* pos - position structure */ diff --git a/cv/include/cvtypes.h b/cv/include/cvtypes.h index 909fc67..e45cae2 100644 --- a/cv/include/cvtypes.h +++ b/cv/include/cvtypes.h @@ -101,7 +101,7 @@ typedef struct CvChainPtReader CV_SEQ_READER_FIELDS() char code; CvPoint pt; - char deltas[8][2]; + schar deltas[8][2]; } CvChainPtReader; @@ -166,7 +166,7 @@ CvSubdiv2DPoint; CvSubdiv2DEdge recent_edge; \ CvPoint2D32f topleft; \ CvPoint2D32f bottomright; - + typedef struct CvSubdiv2D { CV_SUBDIV2D_FIELDS() @@ -379,6 +379,8 @@ typedef struct CvAvgComp } CvAvgComp; +struct CvFeatureTree; + #endif /*_CVTYPES_H_*/ /* End of file. */ diff --git a/cv/src/Makefile.am b/cv/src/Makefile.am index fdbc2da..4a5d759 100644 --- a/cv/src/Makefile.am +++ b/cv/src/Makefile.am @@ -1,8 +1,13 @@ +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + EXTRA_DIST = cv.dsp cv.vcproj cv.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cv/include -I$(top_srcdir)/cxcore/include -I$(top_srcdir) -noinst_HEADERS = _cv.h _cvgeom.h _cvimgproc.h _cvipp.h _cvlist.h _cvmatrix.h +noinst_HEADERS = _cv.h _cvgeom.h _cvimgproc.h _cvipp.h _cvlist.h _cvmatrix.h \ + _cvkdtree.hpp + noinst_LTLIBRARIES = lib_cv.la lib_LTLIBRARIES = libcv.la @@ -21,7 +26,7 @@ lib_cv_la_SOURCES = \ cvpyrsegmentation.cpp cvrotcalipers.cpp cvsamplers.cpp cvsegmentation.cpp cvshapedescr.cpp \ cvsmooth.cpp cvsnakes.cpp cvsubdivision2d.cpp cvsumpixels.cpp \ cvswitcher.cpp cvtables.cpp cvtemplmatch.cpp cvthresh.cpp \ - cvundistort.cpp cvutils.cpp + cvundistort.cpp cvutils.cpp cvkdtree.cpp lib_cv_la_LDFLAGS = -no-undefined @LDFLAGS@ # real library diff --git a/cv/src/Makefile.in b/cv/src/Makefile.in index 76b7c9a..436693f 100644 --- a/cv/src/Makefile.in +++ b/cv/src/Makefile.in @@ -127,10 +127,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -153,8 +157,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -165,6 +171,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -183,11 +191,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -207,10 +220,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ @@ -274,6 +289,9 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ + +# use the default c++ flags +AM_CXXFLAGS = @DEF_CXXFLAGS@ EXTRA_DIST = cv.dsp cv.vcproj cv.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cv/include -I$(top_srcdir)/cxcore/include -I$(top_srcdir) noinst_HEADERS = _cv.h _cvgeom.h _cvimgproc.h _cvipp.h _cvlist.h _cvmatrix.h diff --git a/cv/src/_cvipp.h b/cv/src/_cvipp.h index 883d7d7..47fd1c6 100644 --- a/cv/src/_cvipp.h +++ b/cv/src/_cvipp.h @@ -732,9 +732,9 @@ IPCVAPI_EX( CvStatus, icvSqrIntegral_8u32s64f_C1R, int* pDst, int dstStep, double* pSqr, int sqrStep, CvSize roiSize, int val, double valSqr )) -IPCVAPI_EX( CvStatus, icvRectStdDev_32s32f_C1R, - "ippiRectStdDev_32s32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV), - ( const int* pSrc, int srcStep, +IPCVAPI_EX( CvStatus, icvRectStdDev_32f_C1R, + "ippiRectStdDev_32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV), + ( const float* pSrc, int srcStep, const double* pSqr, int sqrStep, float* pDst, int dstStep, CvSize roiSize, CvRect rect )) @@ -748,9 +748,9 @@ IPCVAPI_EX( CvStatus, icvHaarClassifierFree_32f, "ippiHaarClassifierFree_32f", CV_PLUGINS1(CV_PLUGIN_IPPCV), ( void *pState )) -IPCVAPI_EX( CvStatus, icvApplyHaarClassifier_32s32f_C1R, - "ippiApplyHaarClassifier_32s32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV), - ( const int* pSrc, int srcStep, const float* pNorm, +IPCVAPI_EX( CvStatus, icvApplyHaarClassifier_32f_C1R, + "ippiApplyHaarClassifier_32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV), + ( const float* pSrc, int srcStep, const float* pNorm, int normStep, uchar* pMask, int maskStep, CvSize roi, int *pPositive, float threshold, void *pState )) diff --git a/cv/src/cv.dsp b/cv/src/cv.dsp index 028c8a0..dee5d4c 100644 --- a/cv/src/cv.dsp +++ b/cv/src/cv.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=cv - Win32 Debug64 Itanium +CFG=cv - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,23 +13,19 @@ CFG=cv - Win32 Debug64 Itanium !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "cv.mak" CFG="cv - Win32 Debug64 Itanium" +!MESSAGE NMAKE /f "cv.mak" CFG="cv - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "cv - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "cv - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cv - Win32 Release64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cv - Win32 Debug64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cv - Win32 Release64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cv - Win32 Debug64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=xicl6.exe +CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -42,8 +38,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\CV_Rls" -# PROP Intermediate_Dir "..\..\_temp\CV_Rls" +# PROP Output_Dir "..\..\_temp\cv_Release" +# PROP Intermediate_Dir "..\..\_temp\cv_Release" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" LIB32=link.exe -lib @@ -56,7 +52,7 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcore.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cv100.pdb" /debug /machine:I386 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cv100.dll" /implib:"../../lib/cv.lib" /libpath:"..\..\lib" # SUBTRACT LINK32 /profile /pdb:none /map @@ -70,8 +66,8 @@ LINK32=xilink6.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\CV_Dbg" -# PROP Intermediate_Dir "..\..\_temp\CV_Dbg" +# PROP Output_Dir "..\..\_temp\cv_Debug" +# PROP Intermediate_Dir "..\..\_temp\cv_Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" LIB32=link.exe -lib @@ -84,141 +80,17 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcored.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cv100d.pdb" /debug /machine:I386 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cv100d.dll" /implib:"../../lib/cvd.lib" /libpath:"..\..\lib" # SUBTRACT LINK32 /pdb:none -!ELSEIF "$(CFG)" == "cv - Win32 Release64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cv___Win32_Release64" -# PROP BASE Intermediate_Dir "cv___Win32_Release64" -# PROP BASE Ignore_Export_Lib 1 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cv_Rls64" -# PROP Intermediate_Dir "..\..\_temp\cv_Rls64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /G6 /MD /W4 /Zi /O2 /Ob2 /I "..\..\cxcore\include" /I "." /I "..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "CVAPI_EXPORTS" /FR /Yu"_cv.h" /FD /Zm200 /c -# ADD CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "NDEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cv.h" /FD /Zm200 /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib cxcore.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cv100.dll" /implib:"../../lib/cv.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /profile /map -# ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcore_64.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cv100_64.dll" /implib:"../../lib/cv_64.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cv - Win32 Debug64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cv___Win32_Debug64" -# PROP BASE Intermediate_Dir "cv___Win32_Debug64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cv_Dbg64" -# PROP Intermediate_Dir "..\..\_temp\cv_Dbg64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /G6 /MDd /W4 /Gm /Zi /Od /I "..\..\cxcore\include" /I "." /I "..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "CVAPI_EXPORTS" /FR /Yu"_cv.h" /FD /GZ /Zm200 /c -# ADD CPP /nologo /MDd /W4 /Gm /Zi /Od /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "_DEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cv.h" /FD /Zm200 /Wp64 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib cxcored.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cv100d.dll" /implib:"../../lib/cvd.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcored_64.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cv100d_64.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cv100d_64.dll" /implib:"../../lib/cvd_64.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cv - Win32 Release64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cv___Win32_Release64_Itanium" -# PROP BASE Intermediate_Dir "cv___Win32_Release64_Itanium" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cv_RlsI7" -# PROP Intermediate_Dir "..\..\_temp\cv_RlsI7" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "NDEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cv.h" /FD /Zm200 /c -# ADD CPP /nologo /MD /w /W0 /Zi /O2 /Ob2 /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "NDEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cv.h" /FD /Zm200 /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib cxcore_i7.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cv100_i7.dll" /implib:"../../lib/cv_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcore_i7.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /out:"..\..\bin\cv100_i7.dll" /implib:"../../lib/cv_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cv - Win32 Debug64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cv___Win32_Debug64_Itanium" -# PROP BASE Intermediate_Dir "cv___Win32_Debug64_Itanium" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cv_DbgI7" -# PROP Intermediate_Dir "..\..\_temp\cv_DbgI7" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MDd /W4 /Gm /Zi /Od /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "_DEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cv.h" /FD /Zm200 /Wp64 /c -# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "..\..\cxcore\include" /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "_DEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cv.h" /FD /Zm200 /Qwd167 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib cxcored_i7.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cv100d_i7.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cv100d_i7.dll" /implib:"../../lib/cvd_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib cxcored_i7.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cv100d_i7.pdb" /debug /machine:IX86 /out:"..\..\bin\cv100d_i7.dll" /implib:"../../lib/cvd_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - !ENDIF # Begin Target # Name "cv - Win32 Release" # Name "cv - Win32 Debug" -# Name "cv - Win32 Release64" -# Name "cv - Win32 Debug64" -# Name "cv - Win32 Release64 Itanium" -# Name "cv - Win32 Debug64 Itanium" # Begin Group "Src" # PROP Default_Filter "" @@ -463,6 +335,10 @@ SOURCE=.\cvaccum.cpp # End Source File # Begin Source File +SOURCE=.\cvkdtree.cpp +# End Source File +# Begin Source File + SOURCE=.\cvsumpixels.cpp # End Source File # Begin Source File @@ -532,6 +408,10 @@ SOURCE=.\_cvipp.h # End Source File # Begin Source File +SOURCE=.\_cvkdtree.hpp +# End Source File +# Begin Source File + SOURCE=.\_cvlist.h # End Source File # Begin Source File diff --git a/cv/src/cv.vcproj b/cv/src/cv.vcproj index c2e81ea..e69de29 100644 --- a/cv/src/cv.vcproj +++ b/cv/src/cv.vcproj @@ -1,5430 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cv/src/cvcalibinit.cpp b/cv/src/cvcalibinit.cpp index 9f470dc..3c87e60 100644 --- a/cv/src/cvcalibinit.cpp +++ b/cv/src/cvcalibinit.cpp @@ -1,4 +1,4 @@ -/*M/////////////////////////////////////////////////////////////////////////////////////// +//M*////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // @@ -54,10 +54,22 @@ Reliability additions and modifications made by Philip Gruebele. pgruebele@cox.net + Some further improvements for detection of partially ocluded boards at non-ideal + lighting conditions have been made by Alex Bovyrin and Kurt Kolonige + \************************************************************************************/ #include "_cv.h" +//#define DEBUG_CHESSBOARD +#ifdef DEBUG_CHESSBOARD +#define PRINTF printf +#include "..//..//otherlibs/highgui/highgui.h" +#else +#define PRINTF(x,...) +#endif + + //===================================================================================== // Implementation for the enhanced calibration object detection //===================================================================================== @@ -89,9 +101,12 @@ CvCBCorner; /** This structure stores information about the chessboard quadrange.*/ typedef struct CvCBQuad { - int count; // Number of quad neibors + int count; // Number of quad neighbors int group_idx; // quad group ID - float edge_len; // quad size characteristic + int row, col; // row and column of this quad + bool ordered; // true if corners/neighbors are ordered counter-clockwise + float edge_len; // quad edge len, in pix^2 + // neighbors and corners are synced, i.e., neighbor 0 shares corner 0 CvCBCorner *corners[4]; // Coordinates of quad corners struct CvCBQuad *neighbors[4]; // Pointers of quad neighbors } @@ -104,6 +119,10 @@ CvCBQuad; static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners, CvMemStorage *storage, CvMat *image, int flags ); +static int +icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners, + CvMemStorage *storage, CvMat *image, CvMat *thresh_img, int dilation, int flags ); + static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count ); static int icvFindConnectedQuads( CvCBQuad *quads, int quad_count, @@ -116,21 +135,79 @@ static int icvCheckQuadGroup( CvCBQuad **quad_group, int count, static int icvCleanFoundConnectedQuads( int quad_count, CvCBQuad **quads, CvSize pattern_size ); +static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads, + int *all_count, CvCBQuad **all_quads, CvCBCorner **corners, + CvSize pattern_size, CvMemStorage* storage ); + +static void icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common); + +static int icvTrimCol(CvCBQuad **quads, int count, int col, int dir); + +static int icvTrimRow(CvCBQuad **quads, int count, int row, int dir); + +static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count, + CvCBQuad **all_quads, int all_count, CvCBCorner **corners); + +static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0); + +#if 0 +static void +icvCalcAffineTranf2D32f(CvPoint2D32f* pts1, CvPoint2D32f* pts2, int count, CvMat* affine_trans) +{ + int i, j; + int real_count = 0; + for( j = 0; j < count; j++ ) + { + if( pts1[j].x >= 0 ) real_count++; + } + if(real_count < 3) return; + CvMat* xy = cvCreateMat( 2*real_count, 6, CV_32FC1 ); + CvMat* uv = cvCreateMat( 2*real_count, 1, CV_32FC1 ); + //estimate affine transfromation + for( i = 0, j = 0; j < count; j++ ) + { + if( pts1[j].x >= 0 ) + { + CV_MAT_ELEM( *xy, float, i*2+1, 2 ) = CV_MAT_ELEM( *xy, float, i*2, 0 ) = pts2[j].x; + CV_MAT_ELEM( *xy, float, i*2+1, 3 ) = CV_MAT_ELEM( *xy, float, i*2, 1 ) = pts2[j].y; + CV_MAT_ELEM( *xy, float, i*2, 2 ) = CV_MAT_ELEM( *xy, float, i*2, 3 ) = CV_MAT_ELEM( *xy, float, i*2, 5 ) = \ + CV_MAT_ELEM( *xy, float, i*2+1, 0 ) = CV_MAT_ELEM( *xy, float, i*2+1, 1 ) = CV_MAT_ELEM( *xy, float, i*2+1, 4 ) = 0; + CV_MAT_ELEM( *xy, float, i*2, 4 ) = CV_MAT_ELEM( *xy, float, i*2+1, 5 ) = 1; + CV_MAT_ELEM( *uv, float, i*2, 0 ) = pts1[j].x; + CV_MAT_ELEM( *uv, float, i*2+1, 0 ) = pts1[j].y; + i++; + } + } + + cvSolve( xy, uv, affine_trans, CV_SVD ); + cvReleaseMat(&xy); + cvReleaseMat(&uv); +} +#endif + CV_IMPL int cvFindChessboardCorners( const void* arr, CvSize pattern_size, CvPoint2D32f* out_corners, int* out_corner_count, int flags ) { - const int min_dilations = 1; + const int min_dilations = 0; const int max_dilations = 3; int found = 0; CvMat* norm_img = 0; CvMat* thresh_img = 0; +#ifdef DEBUG_CHESSBOARD + IplImage *dbg_img = 0; + IplImage *dbg1_img = 0; + IplImage *dbg2_img = 0; +#endif CvMemStorage* storage = 0; +#define EXTRA_QUADS 10 // extra quad slots for additions CvCBQuad *quads = 0, **quad_group = 0; CvCBCorner *corners = 0, **corner_group = 0; + int expected_corners_num = (pattern_size.width/2+1)*(pattern_size.height/2+1); + if( out_corner_count ) *out_corner_count = 0; @@ -156,6 +233,12 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, CV_CALL( storage = cvCreateMemStorage(0) ); CV_CALL( thresh_img = cvCreateMat( img->rows, img->cols, CV_8UC1 )); +#ifdef DEBUG_CHESSBOARD + CV_CALL( dbg_img = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 3 )); + CV_CALL( dbg1_img = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 3 )); + CV_CALL( dbg2_img = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 3 )); +#endif + if( CV_MAT_CN(img->type) != 1 || (flags & CV_CALIB_CB_NORMALIZE_IMAGE) ) { // equalize the input image histogram - @@ -181,6 +264,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, // making it difficult to detect smaller squares. for( dilations = min_dilations; dilations <= max_dilations; dilations++ ) { + if (found) break; // already found it + // convert the input grayscale image to binary (black-n-white) if( flags & CV_CALIB_CB_ADAPTIVE_THRESH ) { @@ -190,7 +275,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, // convert to binary cvAdaptiveThreshold( img, thresh_img, 255, CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY, block_size, 0 ); - cvDilate( thresh_img, thresh_img, 0, dilations-1 ); + if (dilations > 0) + cvDilate( thresh_img, thresh_img, 0, dilations-1 ); } else { @@ -207,34 +293,120 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, cvDilate( thresh_img, thresh_img, 0, dilations ); } + +#ifdef DEBUG_CHESSBOARD + cvCvtColor(thresh_img,dbg_img,CV_GRAY2BGR); +#endif + // So we can find rectangles that go to the edge, we draw a white line around the image edge. // Otherwise FindContours will miss those clipped rectangle contours. // The border color will be the image mean, because otherwise we risk screwing up filters like cvSmooth()... cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1, - thresh_img->rows-1), CV_RGB(255,255,255), 3, 8); + thresh_img->rows-1), CV_RGB(255,255,255), 3, 8); CV_CALL( quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags )); + + + PRINTF("Quad count: %d/%d\n", quad_count, expected_corners_num); + + // Run multi-level quads extraction + // In case one-level binarization did not give enough number of quads + if( quad_count < expected_corners_num ) + { + CV_CALL( quad_count = icvGenerateQuadsEx( &quads, &corners, storage, img, thresh_img, dilations, flags )); + PRINTF("EX quad count: %d/%d\n", quad_count, expected_corners_num); + } + +#ifdef DEBUG_CHESSBOARD + cvCopy(dbg_img, dbg1_img); + cvNamedWindow("all_quads", 1); + // copy corners to temp array + for( i = 0; i < quad_count; i++ ) + { + for (int k=0; k<4; k++) + { + CvPoint2D32f pt1, pt2; + CvScalar color = CV_RGB(30,255,30); + pt1 = quads[i].corners[k]->pt; + pt2 = quads[i].corners[(k+1)%4]->pt; + pt2.x = (pt1.x + pt2.x)/2; + pt2.y = (pt1.y + pt2.y)/2; + if (k>0) + color = CV_RGB(200,200,0); + cvLine( dbg1_img, cvPointFrom32f(pt1), cvPointFrom32f(pt2), color, 3, 8); + } + } + + + cvShowImage("all_quads", (IplImage*)dbg1_img); + cvWaitKey(); +#endif + + if( quad_count <= 0 ) continue; // Find quad's neighbors CV_CALL( icvFindQuadNeighbors( quads, quad_count )); - CV_CALL( quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * quad_count)); - CV_CALL( corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * quad_count*4 )); + // allocate extra for adding in icvOrderFoundQuads + CV_CALL( quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * (quad_count+5))); + CV_CALL( corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * (quad_count+5)*4 )); for( group_idx = 0; ; group_idx++ ) { int count; CV_CALL( count = icvFindConnectedQuads( quads, quad_count, quad_group, group_idx, storage )); + int icount = count; if( count == 0 ) break; + // order the quad corners globally + // maybe delete or add some + PRINTF("Starting ordering of inner quads\n"); + count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners, + pattern_size, storage ); + PRINTF("Orig count: %d After ordering: %d\n", icount, count); + + +#ifdef DEBUG_CHESSBOARD + cvCopy(dbg_img,dbg2_img); + cvNamedWindow("connected_group", 1); + // copy corners to temp array + for( i = 0; i < quad_count; i++ ) + { + if (quads[i].group_idx == group_idx) + for (int k=0; k<4; k++) + { + CvPoint2D32f pt1, pt2; + CvScalar color = CV_RGB(30,255,30); + if (quads[i].ordered) + color = CV_RGB(255,30,30); + pt1 = quads[i].corners[k]->pt; + pt2 = quads[i].corners[(k+1)%4]->pt; + pt2.x = (pt1.x + pt2.x)/2; + pt2.y = (pt1.y + pt2.y)/2; + if (k>0) + color = CV_RGB(200,200,0); + cvLine( dbg2_img, cvPointFrom32f(pt1), cvPointFrom32f(pt2), color, 3, 8); + } + } + cvShowImage("connected_group", (IplImage*)dbg2_img); + cvWaitKey(); +#endif + + if (count == 0) + continue; // haven't found inner quads + + // If count is more than it should be, this will remove those quads // which cause maximum deviation from a nice square pattern. CV_CALL( count = icvCleanFoundConnectedQuads( count, quad_group, pattern_size )); + PRINTF("Connected group: %d orig count: %d cleaned: %d\n", group_idx, icount, count); + CV_CALL( count = icvCheckQuadGroup( quad_group, count, corner_group, pattern_size )); + PRINTF("Connected group: %d count: %d cleaned: %d\n", group_idx, icount, count); if( count > 0 || (out_corner_count && -count > *out_corner_count) ) { @@ -251,15 +423,19 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, if( count > 0 ) { found = 1; - EXIT; + break; } - } + } } cvFree( &quads ); cvFree( &corners ); + cvFree( &quad_group ); + cvFree( &corner_group ); + } + __END__; cvReleaseMemStorage( &storage ); @@ -267,13 +443,474 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size, cvReleaseMat( &thresh_img ); cvFree( &quads ); cvFree( &corners ); - cvFree( &quad_group ); - cvFree( &corner_group ); + return found; } +// +// order a group of connected quads +// order of corners: +// 0 is top left +// clockwise from there +// note: "top left" is nominal, depends on initial ordering of starting quad +// but all other quads are ordered consistently +// +// can change the number of quads in the group +// can add quads, so we need to have quad/corner arrays passed in +// + +static int +icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads, + int *all_count, CvCBQuad **all_quads, CvCBCorner **corners, + CvSize pattern_size, CvMemStorage* storage ) +{ + CvMemStorage* temp_storage = cvCreateChildMemStorage( storage ); + CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage ); + + // first find an interior quad + CvCBQuad *start = NULL; + for (int i=0; icount == 4) + { + start = quads[i]; + break; + } + } + + if (start == NULL) + return 0; // no 4-connected quad + + // start with first one, assign rows/cols + int row_min = 0, col_min = 0, row_max=0, col_max = 0; +#define HSIZE 20 + int col_hist[HSIZE*2]; + int row_hist[HSIZE*2]; // bad programming, should allow variable size + + for (int i=0; irow = 0; + start->col = 0; + start->ordered = true; + + // Recursively order the quads so that all position numbers (e.g., + // 0,1,2,3) are in the at the same relative corner (e.g., lower right). + + while( stack->total ) + { + CvCBQuad* q; + cvSeqPop( stack, &q ); + int col = q->col; + int row = q->row; + col_hist[col+HSIZE]++; + row_hist[row+HSIZE]++; + + // check min/max + if (row > row_max) row_max = row; + if (row < row_min) row_min = row; + if (col > col_max) col_max = col; + if (col < col_min) col_min = col; + + for(int i = 0; i < 4; i++ ) + { + CvCBQuad *neighbor = q->neighbors[i]; + switch(i) // adjust col, row for this quad + { // start at top left, go clockwise + case 0: + row--; col--; break; + case 1: + col += 2; break; + case 2: + row += 2; break; + case 3: + col -= 2; break; + } + + // just do inside quads + if (neighbor && neighbor->ordered == false && neighbor->count == 4) + { + PRINTF("col: %d row: %d\n", col, row); + icvOrderQuad(neighbor, q->corners[i], (i+2)%4); // set in order + neighbor->ordered = true; + neighbor->row = row; + neighbor->col = col; + cvSeqPush( stack, &neighbor ); + } + } + } + + cvReleaseMemStorage( &temp_storage ); + + for (int i=col_min; i<=col_max; i++) + PRINTF("HIST[%d] = %d\n", i, col_hist[i+HSIZE]); + + // analyze inner quad structure + int w = pattern_size.width - 1; + int h = pattern_size.height - 1; + int drow = row_max - row_min + 1; + int dcol = col_max - col_min + 1; + + // normalize pattern and found quad indices + if ((w > h && dcol < drow) || + (w < h && drow < dcol)) + { + h = pattern_size.width - 1; + w = pattern_size.height - 1; + } + + PRINTF("Size: %dx%d Pattern: %dx%d\n", dcol, drow, w, h); + + // check if there are enough inner quads + if (dcol < w || drow < h) // found enough inner quads? + { + PRINTF("Too few inner quad rows/cols\n"); + return 0; // no, return + } + + // too many columns, not very common + if (dcol == w+1) // too many, trim + { + PRINTF("Trimming cols\n"); + if (col_hist[col_max+HSIZE] > col_hist[col_min+HSIZE]) + { + PRINTF("Trimming left col\n"); + quad_count = icvTrimCol(quads,quad_count,col_min,-1); + } + else + { + PRINTF("Trimming right col\n"); + quad_count = icvTrimCol(quads,quad_count,col_max,+1); + } + } + + // too many rows, not very common + if (drow == h+1) // too many, trim + { + PRINTF("Trimming rows\n"); + if (row_hist[row_max+HSIZE] > row_hist[row_min+HSIZE]) + { + PRINTF("Trimming top row\n"); + quad_count = icvTrimRow(quads,quad_count,row_min,-1); + } + else + { + PRINTF("Trimming bottom row\n"); + quad_count = icvTrimRow(quads,quad_count,row_max,+1); + } + } + + + // check edges of inner quads + // if there is an outer quad missing, fill it in + // first order all inner quads + int found = 0; + for (int i=0; icount == 4) + { // ok, look at neighbors + int col = quads[i]->col; + int row = quads[i]->row; + for (int j=0; j<4; j++) + { + switch(j) // adjust col, row for this quad + { // start at top left, go clockwise + case 0: + row--; col--; break; + case 1: + col += 2; break; + case 2: + row += 2; break; + case 3: + col -= 2; break; + } + CvCBQuad *neighbor = quads[i]->neighbors[j]; + if (neighbor && !neighbor->ordered && // is it an inner quad? + col <= col_max && col >= col_min && + row <= row_max && row >= row_min) + { + // if so, set in order + PRINTF("Adding inner: col: %d row: %d\n", col, row); + found++; + icvOrderQuad(neighbor, quads[i]->corners[j], (j+2)%4); + neighbor->ordered = true; + neighbor->row = row; + neighbor->col = col; + } + } + } + } + + // if we have found inner quads, add corresponding outer quads, + // which are missing + if (found > 0) + { + PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found); + for (int i=0; icount < 4 && quads[i]->ordered) + { + int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners); + *all_count += added; + quad_count += added; + } + } + } + + + // final trimming of outer quads + if (dcol == w && drow == h) // found correct inner quads + { + PRINTF("Inner bounds ok, check outer quads\n"); + int rcount = quad_count; + for (int i=quad_count-1; i>=0; i--) // eliminate any quad not connected to + // an ordered quad + { + if (quads[i]->ordered == false) + { + bool outer = false; + for (int j=0; j<4; j++) // any neighbors that are ordered? + { + if (quads[i]->neighbors[j] && quads[i]->neighbors[j]->ordered) + outer = true; + } + if (!outer) // not an outer quad, eliminate + { + PRINTF("Removing quad %d\n", i); + icvRemoveQuadFromGroup(quads,rcount,quads[i]); + rcount--; + } + } + + } + return rcount; + } + + return 0; +} + + +// add an outer quad +// looks for the neighbor of that isn't present, +// tries to add it in. +// is ordered + +static int +icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count, + CvCBQuad **all_quads, int all_count, CvCBCorner **corners ) + +{ + int added = 0; + for (int i=0; i<4; i++) // find no-neighbor corners + { + if (!quad->neighbors[i]) // ok, create and add neighbor + { + int j = (i+2)%4; + PRINTF("Adding quad as neighbor 2\n"); + CvCBQuad *q = &(*all_quads)[all_count]; + memset( q, 0, sizeof(*q) ); + added++; + quads[quad_count] = q; + quad_count++; + + // set neighbor and group id + quad->neighbors[i] = q; + quad->count += 1; + q->neighbors[j] = quad; + q->group_idx = quad->group_idx; + q->count = 1; // number of neighbors + q->ordered = false; + q->edge_len = quad->edge_len; + + // make corners of new quad + // same as neighbor quad, but offset + CvPoint2D32f pt = quad->corners[i]->pt; + CvCBCorner* corner; + float dx = pt.x - quad->corners[j]->pt.x; + float dy = pt.y - quad->corners[j]->pt.y; + for (int k=0; k<4; k++) + { + corner = &(*corners)[all_count*4+k]; + pt = quad->corners[k]->pt; + memset( corner, 0, sizeof(*corner) ); + corner->pt = pt; + q->corners[k] = corner; + corner->pt.x += dx; + corner->pt.y += dy; + } + // have to set exact corner + q->corners[j] = quad->corners[i]; + + // now find other neighbor and add it, if possible + if (quad->neighbors[(i+3)%4] && + quad->neighbors[(i+3)%4]->ordered && + quad->neighbors[(i+3)%4]->neighbors[i] && + quad->neighbors[(i+3)%4]->neighbors[i]->ordered ) + { + CvCBQuad *qn = quad->neighbors[(i+3)%4]->neighbors[i]; + q->count = 2; + q->neighbors[(j+1)%4] = qn; + qn->neighbors[(i+1)%4] = q; + qn->count += 1; + // have to set exact corner + q->corners[(j+1)%4] = qn->corners[(i+1)%4]; + } + + all_count++; + } + } + return added; +} + + +// trimming routines + +static int +icvTrimCol(CvCBQuad **quads, int count, int col, int dir) +{ + int rcount = count; + // find the right quad(s) + for (int i=0; iordered) + PRINTF("index: %d cur: %d\n", col, quads[i]->col); +#endif + if (quads[i]->ordered && quads[i]->col == col) + { + if (dir == 1) + { + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[1]); + rcount--; + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[2]); + rcount--; + } + else + { + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[0]); + rcount--; + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[3]); + rcount--; + } + + } + } + return rcount; +} + +static int +icvTrimRow(CvCBQuad **quads, int count, int row, int dir) +{ + int rcount = count; + // find the right quad(s) + for (int i=0; iordered) + PRINTF("index: %d cur: %d\n", row, quads[i]->row); +#endif + if (quads[i]->ordered && quads[i]->row == row) + { + if (dir == 1) // remove from bottom + { + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[2]); + rcount--; + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[3]); + rcount--; + } + else // remove from top + { + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[0]); + rcount--; + icvRemoveQuadFromGroup(quads,rcount,quads[i]->neighbors[1]); + rcount--; + } + + } + } + return rcount; +} + + +// +// remove quad from quad group +// + +static void +icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0) +{ + // remove any references to this quad as a neighbor + for(int i = 0; i < count; i++ ) + { + CvCBQuad *q = quads[i]; + for(int j = 0; j < 4; j++ ) + { + if( q->neighbors[j] == q0 ) + { + q->neighbors[j] = 0; + q->count--; + for(int k = 0; k < 4; k++ ) + if( q0->neighbors[k] == q ) + { + q0->neighbors[k] = 0; + q0->count--; + break; + } + break; + } + } + } + + // remove the quad + for(int i = 0; i < count; i++ ) + { + CvCBQuad *q = quads[i]; + if (q == q0) + { + quads[i] = quads[count-1]; + break; + } + } +} + +// +// put quad into correct order, where has value +// + +static void +icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common) +{ + // find the corner + int tc; + for (tc=0; tc<4; tc++) + if (quad->corners[tc]->pt.x == corner->pt.x && + quad->corners[tc]->pt.y == corner->pt.y) + break; + + // set corner order + // shift + while (tc != common) + { + // shift by one + CvCBCorner *tempc; + CvCBQuad *tempq; + tempc = quad->corners[3]; + tempq = quad->neighbors[3]; + for (int i=3; i>0; i--) + { + quad->corners[i] = quad->corners[i-1]; + quad->neighbors[i] = quad->neighbors[i-1]; + } + quad->corners[0] = tempc; + quad->neighbors[0] = tempq; + tc++; + tc = tc%4; + } +} + + // if we found too many connect quads, remove those which probably do not belong. static int icvCleanFoundConnectedQuads( int quad_count, CvCBQuad **quad_group, CvSize pattern_size ) @@ -416,6 +1053,7 @@ icvFindConnectedQuads( CvCBQuad *quad, int quad_count, CvCBQuad **out_group, cvSeqPush( stack, &q ); out_group[count++] = q; q->group_idx = group_idx; + q->ordered = false; while( stack->total ) { @@ -428,6 +1066,7 @@ icvFindConnectedQuads( CvCBQuad *quad, int quad_count, CvCBQuad **out_group, cvSeqPush( stack, &neighbor ); out_group[count++] = neighbor; neighbor->group_idx = group_idx; + neighbor->ordered = false; } } } @@ -690,6 +1329,9 @@ icvCheckQuadGroup( CvCBQuad **quad_group, int quad_count, for( i = 0; i < corner_count; i++ ) out_corners[i] = corners[i]; result = -corner_count; + + if (result == -pattern_size.width*pattern_size.height) + result = -result; } cvFree( &corners ); @@ -697,6 +1339,9 @@ icvCheckQuadGroup( CvCBQuad **quad_group, int quad_count, return result; } + + + //===================================================================================== static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count ) @@ -829,6 +1474,10 @@ static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count ) //===================================================================================== +// returns corners in clockwise order +// corners don't necessarily start at same position on quad (e.g., +// top left corner) + static int icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners, CvMemStorage *storage, CvMat *image, int flags ) @@ -937,8 +1586,234 @@ icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners, cvEndFindContours( &scanner ); // allocate quad & corner buffers - CV_CALL( *out_quads = (CvCBQuad*)cvAlloc(root->total * sizeof((*out_quads)[0]))); - CV_CALL( *out_corners = (CvCBCorner*)cvAlloc(root->total * 4 * sizeof((*out_corners)[0]))); + CV_CALL( *out_quads = (CvCBQuad*)cvAlloc((EXTRA_QUADS+root->total) * sizeof((*out_quads)[0]))); + CV_CALL( *out_corners = (CvCBCorner*)cvAlloc((EXTRA_QUADS+root->total) * 4 * sizeof((*out_corners)[0]))); + + // Create array of quads structures + for( idx = 0; idx < root->total; idx++ ) + { + CvCBQuad* q = &(*out_quads)[quad_count]; + src_contour = *(CvSeq**)cvGetSeqElem( root, idx ); + if( (flags & CV_CALIB_CB_FILTER_QUADS) && src_contour->v_prev != (CvSeq*)board ) + continue; + + // reset group ID + memset( q, 0, sizeof(*q) ); + q->group_idx = -1; + assert( src_contour->total == 4 ); + for( i = 0; i < 4; i++ ) + { + CvPoint2D32f pt = cvPointTo32f(*(CvPoint*)cvGetSeqElem(src_contour, i)); + CvCBCorner* corner = &(*out_corners)[quad_count*4 + i]; + + memset( corner, 0, sizeof(*corner) ); + corner->pt = pt; + q->corners[i] = corner; + } + q->edge_len = FLT_MAX; + for( i = 0; i < 4; i++ ) + { + float dx = q->corners[i]->pt.x - q->corners[(i+1)&3]->pt.x; + float dy = q->corners[i]->pt.y - q->corners[(i+1)&3]->pt.y; + float d = dx*dx + dy*dy; + if( q->edge_len > d ) + q->edge_len = d; + } + quad_count++; + } + + __END__; + + if( cvGetErrStatus() < 0 ) + { + if( out_quads ) + cvFree( out_quads ); + if( out_corners ) + cvFree( out_corners ); + quad_count = 0; + } + + cvReleaseMemStorage( &temp_storage ); + return quad_count; +} + + +//===================================================================================== + +static int is_equal_quad( const void* _a, const void* _b, void* ) +{ + CvRect a = (*((CvContour**)_a))->rect; + CvRect b = (*((CvContour**)_b))->rect; + + int dx = MIN( b.x + b.width - 1, a.x + a.width - 1) - MAX( b.x, a.x); + int dy = MIN( b.y + b.height - 1, a.y + a.height - 1) - MAX( b.y, a.y); + int w = (a.width + b.width)>>1; + int h = (a.height + b.height)>>1; + + if( dx > w*0.75 && dy > h*0.75 && dx < w*1.25 && dy < h*1.25 ) return 1; + + return 0; +} + +static int +icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners, + CvMemStorage *storage, CvMat *image, CvMat *thresh_img, int dilations, int flags ) +{ + int l; + int quad_count = 0; + CvMemStorage *temp_storage = 0; + + if( out_quads ) + *out_quads = 0; + + if( out_corners ) + *out_corners = 0; + + CV_FUNCNAME( "icvGenerateQuads" ); + + __BEGIN__; + + CvSeq *src_contour = 0; + CvSeq *root, *root_tmp; + CvContourEx* board = 0; + CvContourScanner scanner; + int i, idx, min_size; + int step_level = 25; + + CV_ASSERT( out_corners && out_quads ); + + // empiric bound for minimal allowed perimeter for squares + min_size = cvRound( image->cols * image->rows * .03 * 0.01 * 0.92 ); + + // create temporary storage for contours and the sequence of pointers to found quadrangles + CV_CALL( temp_storage = cvCreateChildMemStorage( storage )); + CV_CALL( root_tmp = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvSeq*), temp_storage )); + CV_CALL( root = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvSeq*), temp_storage )); + + //perform contours slicing + cvEqualizeHist(image,image); + for(l = step_level; l < 256-step_level; l+= step_level) + { + cvThreshold( image, thresh_img, l, 255, CV_THRESH_BINARY ); + cvDilate( thresh_img, thresh_img, 0, dilations ); + + //draw frame to extract edge quads + cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1, + thresh_img->rows-1), CV_RGB(255,255,255), 3, 8); + + // initialize contour retrieving routine + CV_CALL( scanner = cvStartFindContours( thresh_img, temp_storage, sizeof(CvContourEx), + CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE )); + + // get all the contours one by one + while( (src_contour = cvFindNextContour( scanner )) != 0 ) + { + CvSeq *dst_contour = 0; + CvRect rect = ((CvContour*)src_contour)->rect; + + // reject contours with too small perimeter + if( CV_IS_SEQ_HOLE(src_contour) && rect.width*rect.height >= min_size ) + { + const int min_approx_level = 2, max_approx_level = MAX_CONTOUR_APPROX; + int approx_level; + for( approx_level = min_approx_level; approx_level <= max_approx_level; approx_level++ ) + { + dst_contour = cvApproxPoly( src_contour, sizeof(CvContour), temp_storage, + CV_POLY_APPROX_DP, (float)approx_level ); + // we call this again on its own output, because sometimes + // cvApproxPoly() does not simplify as much as it should. + dst_contour = cvApproxPoly( dst_contour, sizeof(CvContour), temp_storage, + CV_POLY_APPROX_DP, (float)approx_level ); + + if( dst_contour->total == 4 ) + break; + } + + // reject non-quadrangles + if( dst_contour->total == 4 && cvCheckContourConvexity(dst_contour) ) + { + CvPoint pt[4]; + double d1, d2, p = cvContourPerimeter(dst_contour); + double area = fabs(cvContourArea(dst_contour, CV_WHOLE_SEQ)); + double dx, dy; + + for( i = 0; i < 4; i++ ) + pt[i] = *(CvPoint*)cvGetSeqElem(dst_contour, i); + + //check border condition. if this is edge square we will add this as is + int edge_flag = 0, eps = 2; + for( i = 0; i < 4; i++ ) + if( pt[i].x <= eps || pt[i].y <= eps || + pt[i].x >= image->width - eps || + pt[i].y >= image->height - eps ) edge_flag = 1; + + dx = pt[0].x - pt[2].x; + dy = pt[0].y - pt[2].y; + d1 = sqrt(dx*dx + dy*dy); + + dx = pt[1].x - pt[3].x; + dy = pt[1].y - pt[3].y; + d2 = sqrt(dx*dx + dy*dy); + + // philipg. Only accept those quadrangles which are more square + // than rectangular and which are big enough + double d3, d4; + dx = pt[0].x - pt[1].x; + dy = pt[0].y - pt[1].y; + d3 = sqrt(dx*dx + dy*dy); + dx = pt[1].x - pt[2].x; + dy = pt[1].y - pt[2].y; + d4 = sqrt(dx*dx + dy*dy); + if( edge_flag || + (!(flags & CV_CALIB_CB_FILTER_QUADS) || + d3*4 > d4 && d4*4 > d3 && d3*d4 < area*1.5 && area > min_size && + d1 >= 0.15 * p && d2 >= 0.15 * p) ) + { + CvContourEx* parent = (CvContourEx*)(src_contour->v_prev); + parent->counter++; + if( !board || board->counter < parent->counter ) + board = parent; + dst_contour->v_prev = (CvSeq*)parent; + //for( i = 0; i < 4; i++ ) cvLine( debug_img, pt[i], pt[(i+1)&3], cvScalar(200,255,255), 1, CV_AA, 0 ); + cvSeqPush( root_tmp, &dst_contour ); + } + } + } + } + // finish contour retrieving + cvEndFindContours( &scanner ); + } + + + // Perform clustering of extracted quads + // Same quad can be extracted from different binarization levels + if( root_tmp->total ) + { + CvSeq* idx_seq = 0; + int n_quads = cvSeqPartition( root_tmp, temp_storage, &idx_seq, is_equal_quad, 0 ); + for( i = 0; i < n_quads; i++ ) + { + //extract biggest quad in group + int max_size = 0; + CvSeq* max_seq = 0; + for( int j = 0; j < root_tmp->total; j++ ) + { + int index = *(int*)cvGetSeqElem(idx_seq, j); + if(index!=i) continue; + CvContour* cnt = *(CvContour**)cvGetSeqElem(root_tmp, j); + if(cnt->rect.width > max_size) + { + max_size = cnt->rect.width; + max_seq = (CvSeq*)cnt; + } + } + cvSeqPush( root, &max_seq); + } + } + + // allocate quad & corner buffers + CV_CALL( *out_quads = (CvCBQuad*)cvAlloc((EXTRA_QUADS+root->total) * sizeof((*out_quads)[0]))); + CV_CALL( *out_corners = (CvCBCorner*)cvAlloc((EXTRA_QUADS+root->total) * 4 * sizeof((*out_corners)[0]))); // Create array of quads structures for( idx = 0; idx < root->total; idx++ ) diff --git a/cv/src/cvcalibration.cpp b/cv/src/cvcalibration.cpp index 320f103..491334d 100644 --- a/cv/src/cvcalibration.cpp +++ b/cv/src/cvcalibration.cpp @@ -1633,4 +1633,64 @@ cvCalibrateCamera2( const CvMat* obj_points, cvReleaseMat( &_err ); } + +void cvCalibrationMatrixValues( const CvMat *calibMatr, int imgWidth, int imgHeight, + double apertureWidth, double apertureHeight, double *fovx, double *fovy, + double *focalLength, CvPoint2D64f *principalPoint, double *pasp ) +{ + double alphax, alphay, mx, my; + + CV_FUNCNAME("cvCalibrationMatrixValues"); + __BEGIN__; + + /* Validate parameters. */ + + if(calibMatr == 0) + CV_ERROR(CV_StsNullPtr, "Some of parameters is a NULL pointer!"); + + if(!CV_IS_MAT(calibMatr)) + CV_ERROR(CV_StsUnsupportedFormat, "Input parameters must be a matrices!"); + + if(calibMatr->cols != 3 || calibMatr->rows != 3) + CV_ERROR(CV_StsUnmatchedSizes, "Size of matrices must be 3x3!"); + + alphax = cvmGet(calibMatr, 0, 0); + alphay = cvmGet(calibMatr, 1, 1); + assert(imgWidth != 0 && imgHeight != 0 && alphax != 0.0 && alphay != 0.0); + + /* Calculate pixel aspect ratio. */ + if(pasp) + *pasp = alphay / alphax; + + /* Calculate number of pixel per realworld unit. */ + + if(apertureWidth != 0.0 && apertureHeight != 0.0) { + mx = imgWidth / apertureWidth; + my = imgHeight / apertureHeight; + } else { + mx = 1.0; + my = *pasp; + } + + /* Calculate fovx and fovy. */ + + if(fovx) + *fovx = 2 * atan(imgWidth / (2 * alphax)) * 180.0 / CV_PI; + + if(fovy) + *fovy = 2 * atan(imgHeight / (2 * alphay)) * 180.0 / CV_PI; + + /* Calculate focal length. */ + + if(focalLength) + *focalLength = alphax / mx; + + /* Calculate principle point. */ + + if(principalPoint) + *principalPoint = cvPoint2D64f(cvmGet(calibMatr, 0, 2) / mx, cvmGet(calibMatr, 1, 2) / my); + + __END__; +} + /* End of file. */ diff --git a/cv/src/cvcontours.cpp b/cv/src/cvcontours.cpp index c7e1c1f..63652b9 100644 --- a/cv/src/cvcontours.cpp +++ b/cv/src/cvcontours.cpp @@ -72,8 +72,8 @@ cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader ) for( i = 0; i < 8; i++ ) { - reader->deltas[i][0] = (char) icvCodeDeltas[i].x; - reader->deltas[i][1] = (char) icvCodeDeltas[i].y; + reader->deltas[i][0] = (schar) icvCodeDeltas[i].x; + reader->deltas[i][1] = (schar) icvCodeDeltas[i].y; } __END__; @@ -84,7 +84,7 @@ cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader ) CV_IMPL CvPoint cvReadChainPoint( CvChainPtReader * reader ) { - char *ptr; + schar *ptr; int code; CvPoint pt = { 0, 0 }; @@ -96,7 +96,7 @@ cvReadChainPoint( CvChainPtReader * reader ) CV_ERROR( CV_StsNullPtr, "" ); pt = reader->pt; - + ptr = reader->ptr; if( ptr ) { @@ -109,7 +109,7 @@ cvReadChainPoint( CvChainPtReader * reader ) } reader->ptr = ptr; - reader->code = (char)code; + reader->code = (schar)code; assert( (code & ~7) == 0 ); reader->pt.x = pt.x + icvCodeDeltas[code].x; reader->pt.y = pt.y + icvCodeDeltas[code].y; @@ -152,8 +152,8 @@ typedef struct _CvContourScanner CvMemStoragePos initial_pos; /* starting storage pos */ CvMemStoragePos backup_pos; /* beginning of the latest approx. contour */ CvMemStoragePos backup_pos2; /* ending of the latest approx. contour */ - char *img0; /* image origin */ - char *img; /* current image row */ + schar *img0; /* image origin */ + schar *img; /* current image row */ int img_step; /* image step */ CvSize img_size; /* ROI size */ CvPoint offset; /* ROI offset: coordinates, added to each contour point */ @@ -185,13 +185,13 @@ _CvContourScanner; #define _CV_FIND_CONTOURS_FLAGS_EXTERNAL_ONLY 1 #define _CV_FIND_CONTOURS_FLAGS_HIERARCHIC 2 -/* +/* Initializes scanner structure. Prepare image for scanning ( clear borders and convert all pixels to 0-1. */ CV_IMPL CvContourScanner cvStartFindContours( void* _img, CvMemStorage* storage, - int header_size, int mode, + int header_size, int mode, int method, CvPoint offset ) { int y; @@ -230,8 +230,8 @@ cvStartFindContours( void* _img, CvMemStorage* storage, memset( scanner, 0, sizeof( *scanner )); scanner->storage1 = scanner->storage2 = storage; - scanner->img0 = (char *) img; - scanner->img = (char *) (img + step); + scanner->img0 = (schar *) img; + scanner->img = (schar *) (img + step); scanner->img_step = step; scanner->img_size.width = size.width - 1; /* exclude rightest column */ scanner->img_size.height = size.height - 1; /* exclude bottomost row */ @@ -328,7 +328,7 @@ cvStartFindContours( void* _img, CvMemStorage* storage, return scanner; } -/* +/* Final stage of contour processing. Three variants possible: 1. Contour, which was retrieved using border following, is added to @@ -345,16 +345,16 @@ cvStartFindContours( void* _img, CvMemStorage* storage, It's marked as "link to contour" and h_next pointer of it is set to new, substituting contour. - 3. The similar to 2, but when NULL pointer was assigned by + 3. The similar to 2, but when NULL pointer was assigned by icvSubstituteContour function. In this case, the function removes - retrieved contour completely if plane case and + retrieved contour completely if plane case and leaves header if hierarchical (but doesn't mark header as "link"). ------------------------------------------------------------------------ The 1st variant can be used to retrieve and store all the contours from the image - (with optional convertion from chains to contours using some approximation from + (with optional convertion from chains to contours using some approximation from restriced set of methods). Some characteristics of contour can be computed in the same pass. - + The usage scheme can look like: icvContourScanner scanner; @@ -367,7 +367,7 @@ cvStartFindContours( void* _img, CvMemStorage* storage, icvCreateMemStorage( &contour_storage, block_size/0 ); ... - + cvStartFindContours ( img, contour_storage, header_size, approx_method, @@ -395,7 +395,7 @@ cvStartFindContours( void* _img, CvMemStorage* storage, Second variant is more complex and can be used when someone wants store not the retrieved contours but transformed ones. (e.g. approximated with some non-default algorithm ). - + The scheme can be the as following: icvContourScanner scanner; @@ -410,7 +410,7 @@ cvStartFindContours( void* _img, CvMemStorage* storage, icvCreateMemStorage( &temp_storage, block_size/0 ); ... - + icvStartFindContours8uC1R ( , temp_storage, header_size, approx_method, @@ -455,13 +455,13 @@ cvStartFindContours( void* _img, CvMemStorage* storage, ... } - new_storage variable is not needed here. + new_storage variable is not needed here. Two notes. 1. Second and third method can interleave. I.e. it is possible to remain contours that satisfy with some criteria and reject others. In hierarchic case the resulting tree is the part of original tree with - some nodes absent. But in the resulting tree the contour1 is a child + some nodes absent. But in the resulting tree the contour1 is a child (may be indirect) of contour2 iff in the original tree the contour1 is a child (may be indirect) of contour2. */ @@ -519,7 +519,7 @@ cvSubstituteContour( CvContourScanner scanner, CvSeq * new_contour ) } -/* +/* marks domain border with +/- and stores the contour into CvSeq. method: <0 - chain @@ -527,16 +527,16 @@ cvSubstituteContour( CvContourScanner scanner, CvSeq * new_contour ) >0 - simple approximation */ static CvStatus -icvFetchContour( char *ptr, +icvFetchContour( schar *ptr, int step, - CvPoint pt, - CvSeq* contour, + CvPoint pt, + CvSeq* contour, int _method ) { - const char nbd = 2; + const schar nbd = 2; int deltas[16]; CvSeqWriter writer; - char *i0 = ptr, *i1, *i3, *i4 = 0; + schar *i0 = ptr, *i1, *i3, *i4 = 0; int prev_s = -1, s, s_end; int method = _method - 1; @@ -565,7 +565,7 @@ icvFetchContour( char *ptr, if( s == s_end ) /* single pixel domain */ { - *i0 = (char) (nbd | -128); + *i0 = (schar) (nbd | -128); if( method >= 0 ) { CV_WRITE_SEQ_ELEM( pt, writer ); @@ -592,7 +592,7 @@ icvFetchContour( char *ptr, /* check "right" bound */ if( (unsigned) (s - 1) < (unsigned) s_end ) { - *i3 = (char) (nbd | -128); + *i3 = (schar) (nbd | -128); } else if( *i3 == 1 ) { @@ -601,7 +601,7 @@ icvFetchContour( char *ptr, if( method < 0 ) { - char _s = (char) s; + schar _s = (schar) s; CV_WRITE_SEQ_ELEM( _s, writer ); } @@ -641,15 +641,15 @@ icvFetchContour( char *ptr, -/* +/* trace contour until certain point is met. returns 1 if met, 0 else. */ static int -icvTraceContour( char *ptr, int step, char *stop_ptr, int is_hole ) +icvTraceContour( schar *ptr, int step, schar *stop_ptr, int is_hole ) { int deltas[16]; - char *i0 = ptr, *i1, *i3, *i4; + schar *i0 = ptr, *i1, *i3, *i4; int s, s_end; /* initialize local state */ @@ -698,17 +698,17 @@ icvTraceContour( char *ptr, int step, char *stop_ptr, int is_hole ) static CvStatus -icvFetchContourEx( char* ptr, +icvFetchContourEx( schar* ptr, int step, - CvPoint pt, + CvPoint pt, CvSeq* contour, - int _method, + int _method, int nbd, CvRect* _rect ) { int deltas[16]; CvSeqWriter writer; - char *i0 = ptr, *i1, *i3, *i4; + schar *i0 = ptr, *i1, *i3, *i4; CvRect rect; int prev_s = -1, s, s_end; int method = _method - 1; @@ -742,7 +742,7 @@ icvFetchContourEx( char* ptr, if( s == s_end ) /* single pixel domain */ { - *i0 = (char) (nbd | 0x80); + *i0 = (schar) (nbd | 0x80); if( method >= 0 ) { CV_WRITE_SEQ_ELEM( pt, writer ); @@ -770,16 +770,16 @@ icvFetchContourEx( char* ptr, /* check "right" bound */ if( (unsigned) (s - 1) < (unsigned) s_end ) { - *i3 = (char) (nbd | 0x80); + *i3 = (schar) (nbd | 0x80); } else if( *i3 == 1 ) { - *i3 = (char) nbd; + *i3 = (schar) nbd; } if( method < 0 ) { - char _s = (char) s; + schar _s = (schar) s; CV_WRITE_SEQ_ELEM( _s, writer ); } else if( s != prev_s || method == 0 ) @@ -834,8 +834,8 @@ icvFetchContourEx( char* ptr, CvSeq * cvFindNextContour( CvContourScanner scanner ) { - char *img0; - char *img; + schar *img0; + schar *img; int step; int width, height; int x, y; @@ -1041,7 +1041,7 @@ cvFindNextContour( CvContourScanner scanner ) scanner->pt.x = x + 1; scanner->pt.y = y; scanner->lnbd = lnbd; - scanner->img = (char *) img; + scanner->img = (schar *) img; scanner->nbd = nbd; contour = l_cinfo->contour; @@ -1077,8 +1077,8 @@ cvFindNextContour( CvContourScanner scanner ) } -/* - The function add to tree the last retrieved/substituted contour, +/* + The function add to tree the last retrieved/substituted contour, releases temp_storage, restores state of dst_storage (if needed), and returns pointer to root of the contour tree */ CV_IMPL CvSeq * @@ -1211,13 +1211,13 @@ icvFindContoursInInterval( const CvArr* src, tmp_prev = &(tmp); tmp_prev->next = 0; tmp_prev->link = 0; - + // First line. None of runs is binded tmp.pt.y = 0; i = 0; CV_WRITE_SEQ_ELEM( tmp, writer ); upper_line = (CvLinkedRunPoint*)CV_GET_WRITTEN_ELEM( writer ); - + tmp_prev = upper_line; for( j = 0; j < img_size.width; ) { @@ -1247,7 +1247,7 @@ icvFindContoursInInterval( const CvArr* src, upper_total = runs->total - 1; last_elem = tmp_prev; tmp_prev->next = 0; - + for( i = 1; i < img_size.height; i++ ) { //------// Find runs in next line @@ -1373,7 +1373,7 @@ icvFindContoursInInterval( const CvArr* src, upper_run = upper_run->next->next; } } - break; + break; } }// k, n @@ -1507,15 +1507,15 @@ icvFindContoursInInterval( const CvArr* src, // Notes: //F*/ CV_IMPL int -cvFindContours( void* img, CvMemStorage* storage, - CvSeq** firstContour, int cntHeaderSize, - int mode, +cvFindContours( void* img, CvMemStorage* storage, + CvSeq** firstContour, int cntHeaderSize, + int mode, int method, CvPoint offset ) { CvContourScanner scanner = 0; CvSeq *contour = 0; int count = -1; - + CV_FUNCNAME( "cvFindContours" ); __BEGIN__; @@ -1545,7 +1545,7 @@ cvFindContours( void* img, CvMemStorage* storage, } while( contour != 0 ); - *firstContour = cvEndFindContours( &scanner ); + *firstContour = cvEndFindContours( &scanner ); } __END__; diff --git a/cv/src/cvconvhull.cpp b/cv/src/cvconvhull.cpp index ddbea5c..45d9595 100644 --- a/cv/src/cvconvhull.cpp +++ b/cv/src/cvconvhull.cpp @@ -202,7 +202,7 @@ icvCalcAndWritePtIndices( CvPoint** pointer, int* stack, int start, int end, CV_FUNCNAME( "icvCalcAndWritePtIndices" ); __BEGIN__; - + int i, incr = start < end ? 1 : -1; int idx, first_idx = ptseq->first->start_index; @@ -232,9 +232,9 @@ cvConvexHull2( const CvArr* array, void* hull_storage, CvPoint** pointer = 0; CvPoint2D32f** pointerf = 0; int* stack = 0; - + CV_FUNCNAME( "cvConvexHull2" ); - + hull.s = 0; __BEGIN__; @@ -497,7 +497,7 @@ finish_hull: hull.c->rect = cvBoundingRect( ptseq, ptseq->header_size < (int)sizeof(CvContour) || &ptseq->flags == &contour_header.flags ); - + /*if( ptseq != (CvSeq*)&contour_header ) hullseq->v_prev = ptseq;*/ } @@ -519,7 +519,7 @@ cvConvexityDefects( const CvArr* array, CvMemStorage* storage ) { CvSeq* defects = 0; - + CV_FUNCNAME( "cvConvexityDefects" ); __BEGIN__; @@ -571,7 +571,7 @@ cvConvexityDefects( const CvArr* array, else { CvMat* mat = (CvMat*)hull; - + if( !CV_IS_MAT( hull )) CV_ERROR(CV_StsBadArg, "Convex hull is neither sequence nor matrix"); @@ -582,7 +582,7 @@ cvConvexityDefects( const CvArr* array, if( mat->cols + mat->rows - 1 > ptseq->total ) CV_ERROR( CV_StsBadSize, "Convex hull is larger than the point sequence" ); - + CV_CALL( hull = cvMakeSeqHeaderForArray( CV_SEQ_KIND_CURVE|CV_MAT_TYPE(mat->type)|CV_SEQ_FLAG_CLOSED, sizeof(CvContour), CV_ELEM_SIZE(mat->type), mat->data.ptr, @@ -669,7 +669,7 @@ cvConvexityDefects( const CvArr* array, dx0 = (double)hull_next->x - (double)hull_cur->x; dy0 = (double)hull_next->y - (double)hull_cur->y; - assert( dx0 != 0 || dy0 != 0 ); + assert( dx0 != 0 || dy0 != 0 ); scale = 1./sqrt(dx0*dx0 + dy0*dy0); defect.start = hull_cur; @@ -680,12 +680,12 @@ cvConvexityDefects( const CvArr* array, /* go through ptseq to achieve next hull point */ CV_NEXT_SEQ_ELEM( sizeof(CvPoint), ptseq_reader ); - if( ptseq_reader.ptr == (char*)hull_next ) + if( ptseq_reader.ptr == (schar*)hull_next ) break; else { CvPoint* cur = (CvPoint*)ptseq_reader.ptr; - + /* compute distance from current point to hull edge */ double dx = (double)cur->x - (double)hull_cur->x; double dy = (double)cur->y - (double)hull_cur->y; @@ -758,14 +758,14 @@ cvCheckContourConvexity( const CvArr* array ) EXIT; cvStartReadSeq( contour, &reader, 0 ); - + flag = 1; if( CV_SEQ_ELTYPE( contour ) == CV_32SC2 ) { CvPoint *prev_pt = (CvPoint*)reader.prev_elem; CvPoint *cur_pt = (CvPoint*)reader.ptr; - + int dx0 = cur_pt->x - prev_pt->x; int dy0 = cur_pt->y - prev_pt->y; @@ -806,7 +806,7 @@ cvCheckContourConvexity( const CvArr* array ) CvPoint2D32f *prev_pt = (CvPoint2D32f*)reader.prev_elem; CvPoint2D32f *cur_pt = (CvPoint2D32f*)reader.ptr; - + float dx0 = cur_pt->x - prev_pt->x; float dy0 = cur_pt->y - prev_pt->y; diff --git a/cv/src/cvgeometry.cpp b/cv/src/cvgeometry.cpp index 4091c10..0b3648c 100644 --- a/cv/src/cvgeometry.cpp +++ b/cv/src/cvgeometry.cpp @@ -351,5 +351,270 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist ) } -/* End of file. */ +#define CV_VERYSMALLDOUBLE 1.0e-10 + +CV_IMPL void +cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ, + CvMat *matrixQx, CvMat *matrixQy, CvMat *matrixQz, + CvPoint3D64f *eulerAngles) +{ + CvMat *tmpMatrix1 = 0; + CvMat *tmpMatrix2 = 0; + CvMat *tmpMatrixM = 0; + CvMat *tmpMatrixR = 0; + CvMat *tmpMatrixQ = 0; + CvMat *tmpMatrixQx = 0; + CvMat *tmpMatrixQy = 0; + CvMat *tmpMatrixQz = 0; + double tmpEulerAngleX, tmpEulerAngleY, tmpEulerAngleZ; + + CV_FUNCNAME("cvRQDecomp3x3"); + __BEGIN__; + + /* Validate parameters. */ + if(matrixM == 0 || matrixR == 0 || matrixQ == 0) + CV_ERROR(CV_StsNullPtr, "Some of parameters is a NULL pointer!"); + + if(!CV_IS_MAT(matrixM) || !CV_IS_MAT(matrixR) || !CV_IS_MAT(matrixQ)) + CV_ERROR(CV_StsUnsupportedFormat, "Input parameters must be a matrices!"); + + if(matrixM->cols != 3 || matrixM->rows != 3 || matrixR->cols != 3 || matrixR->rows != 3 || matrixQ->cols != 3 || matrixQ->rows != 3) + CV_ERROR(CV_StsUnmatchedSizes, "Size of matrices must be 3x3!"); + + CV_CALL(tmpMatrix1 = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrix2 = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixM = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixR = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixQ = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixQx = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixQy = cvCreateMat(3, 3, CV_64F)); + CV_CALL(tmpMatrixQz = cvCreateMat(3, 3, CV_64F)); + + cvCopy(matrixM, tmpMatrixM); + + /* Find Givens rotation Q_x for x axis. */ + /* + ( 1 0 0 ) + Qx = ( 0 c -s ), cos = -m33/sqrt(m32^2 + m33^2), cos = m32/sqrt(m32^2 + m33^2) + ( 0 s c ) + */ + + double x, y, z, c, s; + x = cvmGet(tmpMatrixM, 2, 1); + y = cvmGet(tmpMatrixM, 2, 2); + z = x * x + y * y; + assert(z != 0); // Prevent division by zero. + c = -y / sqrt(z); + s = x / sqrt(z); + + cvSetIdentity(tmpMatrixQx); + cvmSet(tmpMatrixQx, 1, 1, c); + cvmSet(tmpMatrixQx, 1, 2, -s); + cvmSet(tmpMatrixQx, 2, 1, s); + cvmSet(tmpMatrixQx, 2, 2, c); + + tmpEulerAngleX = acos(c) * 180.0 / CV_PI; + + /* Multiply M on the right by Q_x. */ + + cvMatMul(tmpMatrixM, tmpMatrixQx, tmpMatrixR); + cvCopy(tmpMatrixR, tmpMatrixM); + + assert(cvmGet(tmpMatrixM, 2, 1) < CV_VERYSMALLDOUBLE && cvmGet(tmpMatrixM, 2, 1) > -CV_VERYSMALLDOUBLE); // Should actually be zero. + + if(cvmGet(tmpMatrixM, 2, 1) != 0.0) + cvmSet(tmpMatrixM, 2, 1, 0.0); // Rectify arithmetic precision error. + + /* Find Givens rotation for y axis. */ + /* + ( c 0 s ) + Qy = ( 0 1 0 ), cos = m33/sqrt(m31^2 + m33^2), cos = m31/sqrt(m31^2 + m33^2) + (-s 0 c ) + */ + + x = cvmGet(tmpMatrixM, 2, 0); + y = cvmGet(tmpMatrixM, 2, 2); + z = x * x + y * y; + assert(z != 0); // Prevent division by zero. + c = y / sqrt(z); + s = x / sqrt(z); + + cvSetIdentity(tmpMatrixQy); + cvmSet(tmpMatrixQy, 0, 0, c); + cvmSet(tmpMatrixQy, 0, 2, s); + cvmSet(tmpMatrixQy, 2, 0, -s); + cvmSet(tmpMatrixQy, 2, 2, c); + + tmpEulerAngleY = acos(c) * 180.0 / CV_PI; + + /* Multiply M*Q_x on the right by Q_y. */ + + cvMatMul(tmpMatrixM, tmpMatrixQy, tmpMatrixR); + cvCopy(tmpMatrixR, tmpMatrixM); + + assert(cvmGet(tmpMatrixM, 2, 0) < CV_VERYSMALLDOUBLE && cvmGet(tmpMatrixM, 2, 0) > -CV_VERYSMALLDOUBLE); // Should actually be zero. + + if(cvmGet(tmpMatrixM, 2, 0) != 0.0) + cvmSet(tmpMatrixM, 2, 0, 0.0); // Rectify arithmetic precision error. + + /* Find Givens rotation for z axis. */ + /* + ( c -s 0 ) + Qz = ( s c 0 ), cos = -m22/sqrt(m21^2 + m22^2), cos = m21/sqrt(m21^2 + m22^2) + ( 0 0 1 ) + */ + + x = cvmGet(tmpMatrixM, 1, 0); + y = cvmGet(tmpMatrixM, 1, 1); + z = x * x + y * y; + assert(z != 0); // Prevent division by zero. + c = -y / sqrt(z); + s = x / sqrt(z); + + cvSetIdentity(tmpMatrixQz); + cvmSet(tmpMatrixQz, 0, 0, c); + cvmSet(tmpMatrixQz, 0, 1, -s); + cvmSet(tmpMatrixQz, 1, 0, s); + cvmSet(tmpMatrixQz, 1, 1, c); + + tmpEulerAngleZ = acos(c) * 180.0 / CV_PI; + + /* Multiply M*Q_x*Q_y on the right by Q_z. */ + + cvMatMul(tmpMatrixM, tmpMatrixQz, tmpMatrixR); + + assert(cvmGet(tmpMatrixR, 1, 0) < CV_VERYSMALLDOUBLE && cvmGet(tmpMatrixR, 1, 0) > -CV_VERYSMALLDOUBLE); // Should actually be zero. + + if(cvmGet(tmpMatrixR, 1, 0) != 0.0) + cvmSet(tmpMatrixR, 1, 0, 0.0); // Rectify arithmetic precision error. + + /* Calulate orthogonal matrix. */ + /* + Q = QzT * QyT * QxT + */ + + cvTranspose(tmpMatrixQz, tmpMatrix1); + cvTranspose(tmpMatrixQy, tmpMatrix2); + cvMatMul(tmpMatrix1, tmpMatrix2, tmpMatrixQ); + cvCopy(tmpMatrixQ, tmpMatrix1); + cvTranspose(tmpMatrixQx, tmpMatrix2); + cvMatMul(tmpMatrix1, tmpMatrix2, tmpMatrixQ); + + /* Solve decomposition ambiguity. */ + /* + Diagonal entries of R should be positive, so swap signs if necessary. + */ + + if(cvmGet(tmpMatrixR, 0, 0) < 0.0) { + cvmSet(tmpMatrixR, 0, 0, -1.0 * cvmGet(tmpMatrixR, 0, 0)); + cvmSet(tmpMatrixQ, 0, 0, -1.0 * cvmGet(tmpMatrixQ, 0, 0)); + cvmSet(tmpMatrixQ, 0, 1, -1.0 * cvmGet(tmpMatrixQ, 0, 1)); + cvmSet(tmpMatrixQ, 0, 2, -1.0 * cvmGet(tmpMatrixQ, 0, 2)); + } + if(cvmGet(tmpMatrixR, 1, 1) < 0.0) { + cvmSet(tmpMatrixR, 0, 1, -1.0 * cvmGet(tmpMatrixR, 0, 1)); + cvmSet(tmpMatrixR, 1, 1, -1.0 * cvmGet(tmpMatrixR, 1, 1)); + cvmSet(tmpMatrixQ, 1, 0, -1.0 * cvmGet(tmpMatrixQ, 1, 0)); + cvmSet(tmpMatrixQ, 1, 1, -1.0 * cvmGet(tmpMatrixQ, 1, 1)); + cvmSet(tmpMatrixQ, 1, 2, -1.0 * cvmGet(tmpMatrixQ, 1, 2)); + } + + /* Save R and Q matrices. */ + + cvCopy(tmpMatrixR, matrixR); + cvCopy(tmpMatrixQ, matrixQ); + + if(matrixQx && CV_IS_MAT(matrixQx) && matrixQx->cols == 3 || matrixQx->rows == 3) + cvCopy(tmpMatrixQx, matrixQx); + if(matrixQy && CV_IS_MAT(matrixQy) && matrixQy->cols == 3 || matrixQy->rows == 3) + cvCopy(tmpMatrixQy, matrixQy); + if(matrixQz && CV_IS_MAT(matrixQz) && matrixQz->cols == 3 || matrixQz->rows == 3) + cvCopy(tmpMatrixQz, matrixQz); + + /* Save Euler angles. */ + + if(eulerAngles) + *eulerAngles = cvPoint3D64f(tmpEulerAngleX, tmpEulerAngleY, tmpEulerAngleZ); + + __END__; + + cvReleaseMat(&tmpMatrix1); + cvReleaseMat(&tmpMatrix2); + cvReleaseMat(&tmpMatrixM); + cvReleaseMat(&tmpMatrixR); + cvReleaseMat(&tmpMatrixQ); + cvReleaseMat(&tmpMatrixQx); + cvReleaseMat(&tmpMatrixQy); + cvReleaseMat(&tmpMatrixQz); + +} + +CV_IMPL void +cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr, + CvMat *rotMatr, CvMat *posVect, + CvMat *rotMatrX, CvMat *rotMatrY, + CvMat *rotMatrZ, CvPoint3D64f *eulerAngles) +{ + CvMat *tmpProjMatr = 0; + CvMat *tmpMatrixD = 0; + CvMat *tmpMatrixV = 0; + CvMat *tmpMatrixM = 0; + + CV_FUNCNAME("cvDecomposeProjectionMatrix"); + __BEGIN__; + + /* Validate parameters. */ + if(projMatr == 0 || calibMatr == 0 || rotMatr == 0 || posVect == 0) + CV_ERROR(CV_StsNullPtr, "Some of parameters is a NULL pointer!"); + + if(!CV_IS_MAT(projMatr) || !CV_IS_MAT(calibMatr) || !CV_IS_MAT(rotMatr) || !CV_IS_MAT(posVect)) + CV_ERROR(CV_StsUnsupportedFormat, "Input parameters must be a matrices!"); + + if(projMatr->cols != 4 || projMatr->rows != 3) + CV_ERROR(CV_StsUnmatchedSizes, "Size of projection matrix must be 3x4!"); + + if(calibMatr->cols != 3 || calibMatr->rows != 3 || rotMatr->cols != 3 || rotMatr->rows != 3) + CV_ERROR(CV_StsUnmatchedSizes, "Size of calibration and rotation matrices must be 3x3!"); + + if(posVect->cols != 1 || posVect->rows != 4) + CV_ERROR(CV_StsUnmatchedSizes, "Size of position vector must be 4x1!"); + + CV_CALL(tmpProjMatr = cvCreateMat(4, 4, CV_64F)); + CV_CALL(tmpMatrixD = cvCreateMat(4, 4, CV_64F)); + CV_CALL(tmpMatrixV = cvCreateMat(4, 4, CV_64F)); + CV_CALL(tmpMatrixM = cvCreateMat(3, 3, CV_64F)); + + /* Compute position vector. */ + + cvSetZero(tmpProjMatr); // Add zero row to make matrix square. + int i, k; + for(i = 0; i < 3; i++) + for(k = 0; k < 4; k++) + cvmSet(tmpProjMatr, i, k, cvmGet(projMatr, i, k)); + + CV_CALL(cvSVD(tmpProjMatr, tmpMatrixD, NULL, tmpMatrixV, CV_SVD_MODIFY_A + CV_SVD_V_T)); + + /* Save position vector. */ + + for(i = 0; i < 4; i++) + cvmSet(posVect, i, 0, cvmGet(tmpMatrixV, 3, i)); // Solution is last row of V. + + /* Compute calibration and rotation matrices via RQ decomposition. */ + + cvGetCols(projMatr, tmpMatrixM, 0, 3); // M is first square matrix of P. + + assert(cvDet(tmpMatrixM) != 0.0); // So far only finite cameras could be decomposed, so M has to be nonsingular [det(M) != 0]. + + CV_CALL(cvRQDecomp3x3(tmpMatrixM, calibMatr, rotMatr, rotMatrX, rotMatrY, rotMatrZ, eulerAngles)); + + __END__; + + cvReleaseMat(&tmpProjMatr); + cvReleaseMat(&tmpMatrixD); + cvReleaseMat(&tmpMatrixV); + cvReleaseMat(&tmpMatrixM); + +} + +/* End of file. */ diff --git a/cv/src/cvhaar.cpp b/cv/src/cvhaar.cpp index 4d6e124..762d445 100644 --- a/cv/src/cvhaar.cpp +++ b/cv/src/cvhaar.cpp @@ -116,8 +116,8 @@ struct CvHidHaarClassifierCascade /* IPP functions for object detection */ icvHaarClassifierInitAlloc_32f_t icvHaarClassifierInitAlloc_32f_p = 0; icvHaarClassifierFree_32f_t icvHaarClassifierFree_32f_p = 0; -icvApplyHaarClassifier_32s32f_C1R_t icvApplyHaarClassifier_32s32f_C1R_p = 0; -icvRectStdDev_32s32f_C1R_t icvRectStdDev_32s32f_C1R_p = 0; +icvApplyHaarClassifier_32f_C1R_t icvApplyHaarClassifier_32f_C1R_p = 0; +icvRectStdDev_32f_C1R_t icvRectStdDev_32f_C1R_p = 0; const int icv_object_win_border = 1; const float icv_stage_threshold_bias = 0.0001f; @@ -335,15 +335,11 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade ) } } - // - // NOTE: Currently, OpenMP is implemented and IPP modes are incompatible. - // -#ifndef _OPENMP { int can_use_ipp = icvHaarClassifierInitAlloc_32f_p != 0 && icvHaarClassifierFree_32f_p != 0 && - icvApplyHaarClassifier_32s32f_C1R_p != 0 && - icvRectStdDev_32s32f_C1R_p != 0 && + icvApplyHaarClassifier_32f_C1R_p != 0 && + icvRectStdDev_32f_C1R_p != 0 && !out->has_tilted_features && !out->is_tree && out->is_stump_based; if( can_use_ipp ) @@ -398,7 +394,6 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade ) } } } -#endif cascade->hid_cascade = out; assert( (char*)haar_node_ptr - (char*)out <= datasize ); @@ -870,12 +865,8 @@ cvHaarDetectObjects( const CvArr* _img, CvSeq* result_seq = 0; CvMemStorage* temp_storage = 0; CvAvgComp* comps = 0; - int i; - -#ifdef _OPENMP CvSeq* seq_thread[CV_MAX_THREADS] = {0}; - int max_threads = 0; -#endif + int i, max_threads = 0; CV_FUNCNAME( "cvHaarDetectObjects" ); @@ -910,17 +901,6 @@ cvHaarDetectObjects( const CvArr* _img, CV_CALL( sqsum = cvCreateMat( img->rows + 1, img->cols + 1, CV_64FC1 )); CV_CALL( temp_storage = cvCreateChildMemStorage( storage )); -#ifdef _OPENMP - max_threads = cvGetNumThreads(); - for( i = 0; i < max_threads; i++ ) - { - CvMemStorage* temp_storage_thread; - CV_CALL( temp_storage_thread = cvCreateMemStorage(0)); - CV_CALL( seq_thread[i] = cvCreateSeq( 0, sizeof(CvSeq), - sizeof(CvRect), temp_storage_thread )); - } -#endif - if( !cascade->hid_cascade ) CV_CALL( icvCreateHidHaarClassifierCascade(cascade) ); @@ -931,17 +911,32 @@ cvHaarDetectObjects( const CvArr* _img, seq2 = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvAvgComp), temp_storage ); result_seq = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvAvgComp), storage ); + max_threads = cvGetNumThreads(); + if( max_threads > 1 ) + for( i = 0; i < max_threads; i++ ) + { + CvMemStorage* temp_storage_thread; + CV_CALL( temp_storage_thread = cvCreateMemStorage(0)); + CV_CALL( seq_thread[i] = cvCreateSeq( 0, sizeof(CvSeq), + sizeof(CvRect), temp_storage_thread )); + } + else + seq_thread[0] = seq; + if( CV_MAT_CN(img->type) > 1 ) { cvCvtColor( img, temp, CV_BGR2GRAY ); img = temp; } + if( flags & CV_HAAR_FIND_BIGGEST_OBJECT ) + flags &= ~(CV_HAAR_SCALE_IMAGE|CV_HAAR_DO_CANNY_PRUNING); + if( flags & CV_HAAR_SCALE_IMAGE ) { CvSize win_size0 = cascade->orig_window_size; int use_ipp = cascade->hid_cascade->ipp_stages != 0 && - icvApplyHaarClassifier_32s32f_C1R_p != 0; + icvApplyHaarClassifier_32f_C1R_p != 0; if( use_ipp ) CV_CALL( norm_img = cvCreateMat( img->rows, img->cols, CV_32FC1 )); @@ -949,13 +944,13 @@ cvHaarDetectObjects( const CvArr* _img, for( factor = 1; ; factor *= scale_factor ) { - int positive = 0; - int x, y; + int strip_count, strip_size; + int ystep = factor > 2. ? 1 : 2; CvSize win_size = { cvRound(win_size0.width*factor), cvRound(win_size0.height*factor) }; CvSize sz = { cvRound( img->cols/factor ), cvRound( img->rows/factor ) }; CvSize sz1 = { sz.width - win_size0.width, sz.height - win_size0.height }; - CvRect rect1 = { icv_object_win_border, icv_object_win_border, + CvRect equ_rect = { icv_object_win_border, icv_object_win_border, win_size0.width - icv_object_win_border*2, win_size0.height - icv_object_win_border*2 }; CvMat img1, sum1, sqsum1, norm1, tilted1, mask1; @@ -980,52 +975,114 @@ cvHaarDetectObjects( const CvArr* _img, cvResize( img, &img1, CV_INTER_LINEAR ); cvIntegral( &img1, &sum1, &sqsum1, _tilted ); - if( use_ipp && icvRectStdDev_32s32f_C1R_p( sum1.data.i, sum1.step, - sqsum1.data.db, sqsum1.step, norm1.data.fl, norm1.step, sz1, rect1 ) < 0 ) - use_ipp = 0; + if( max_threads > 1 ) + { + strip_count = MAX(MIN(sz1.height/ystep, max_threads*3), 1); + strip_size = (sz1.height + strip_count - 1)/strip_count; + strip_size = (strip_size / ystep)*ystep; + } + else + { + strip_count = 1; + strip_size = sz1.height; + } - if( use_ipp ) + if( !use_ipp ) + cvSetImagesForHaarClassifierCascade( cascade, &sum1, &sqsum1, 0, 1. ); + else { - positive = mask1.cols*mask1.rows; - cvSet( &mask1, cvScalarAll(255) ); - for( i = 0; i < cascade->count; i++ ) + for( i = 0; i <= sz.height; i++ ) { - if( icvApplyHaarClassifier_32s32f_C1R_p(sum1.data.i, sum1.step, - norm1.data.fl, norm1.step, mask1.data.ptr, mask1.step, - sz1, &positive, cascade->hid_cascade->stage_classifier[i].threshold, - cascade->hid_cascade->ipp_stages[i]) < 0 ) - { - use_ipp = 0; - break; - } - if( positive <= 0 ) - break; + const int* isum = (int*)(sum1.data.ptr + sum1.step*i); + float* fsum = (float*)isum; + const int FLT_DELTA = -(1 << 24); + int j; + for( j = 0; j <= sz.width; j++ ) + fsum[j] = (float)(isum[j] + FLT_DELTA); } } - if( !use_ipp ) + #ifdef _OPENMP + #pragma omp parallel for num_threads(max_threads), schedule(dynamic) + #endif + for( i = 0; i < strip_count; i++ ) { - cvSetImagesForHaarClassifierCascade( cascade, &sum1, &sqsum1, 0, 1. ); - for( y = 0, positive = 0; y < sz1.height; y++ ) - for( x = 0; x < sz1.width; x++ ) + int thread_id = cvGetThreadNum(); + int positive = 0; + int y1 = i*strip_size, y2 = (i+1)*strip_size/* - ystep + 1*/; + CvSize ssz; + int x, y, j; + if( i == strip_count - 1 || y2 > sz1.height ) + y2 = sz1.height; + ssz = cvSize(sz1.width, y2 - y1); + + if( use_ipp ) + { + icvRectStdDev_32f_C1R_p( + (float*)(sum1.data.ptr + y1*sum1.step), sum1.step, + (double*)(sqsum1.data.ptr + y1*sqsum1.step), sqsum1.step, + (float*)(norm1.data.ptr + y1*norm1.step), norm1.step, ssz, equ_rect ); + + positive = (ssz.width/ystep)*((ssz.height + ystep-1)/ystep); + memset( mask1.data.ptr + y1*mask1.step, ystep == 1, mask1.height*mask1.step); + + if( ystep > 1 ) { - mask1.data.ptr[mask1.step*y + x] = - cvRunHaarClassifierCascade( cascade, cvPoint(x,y), 0 ) > 0; - positive += mask1.data.ptr[mask1.step*y + x]; + for( y = y1, positive = 0; y < y2; y += ystep ) + for( x = 0; x < ssz.width; x += ystep ) + mask1.data.ptr[mask1.step*y + x] = (uchar)1; } - } - if( positive > 0 ) - { - for( y = 0; y < sz1.height; y++ ) - for( x = 0; x < sz1.width; x++ ) - if( mask1.data.ptr[mask1.step*y + x] != 0 ) + for( j = 0; j < cascade->count; j++ ) + { + if( icvApplyHaarClassifier_32f_C1R_p( + (float*)(sum1.data.ptr + y1*sum1.step), sum1.step, + (float*)(norm1.data.ptr + y1*norm1.step), norm1.step, + mask1.data.ptr + y1*mask1.step, mask1.step, ssz, &positive, + cascade->hid_cascade->stage_classifier[j].threshold, + cascade->hid_cascade->ipp_stages[j]) < 0 ) { - CvRect obj_rect = { cvRound(x*factor), cvRound(y*factor), - win_size.width, win_size.height }; - cvSeqPush( seq, &obj_rect ); + positive = 0; + break; } + if( positive <= 0 ) + break; + } + } + else + { + for( y = y1, positive = 0; y < y2; y += ystep ) + for( x = 0; x < ssz.width; x += ystep ) + { + mask1.data.ptr[mask1.step*y + x] = + cvRunHaarClassifierCascade( cascade, cvPoint(x,y), 0 ) > 0; + positive += mask1.data.ptr[mask1.step*y + x]; + } + } + + if( positive > 0 ) + { + for( y = y1; y < y2; y += ystep ) + for( x = 0; x < ssz.width; x += ystep ) + if( mask1.data.ptr[mask1.step*y + x] != 0 ) + { + CvRect obj_rect = { cvRound(x*factor), cvRound(y*factor), + win_size.width, win_size.height }; + cvSeqPush( seq_thread[thread_id], &obj_rect ); + } + } } + + // gather the results + if( max_threads > 1 ) + for( i = 0; i < max_threads; i++ ) + { + CvSeq* s = seq_thread[i]; + int j, total = s->total; + CvSeqBlock* b = s->first; + for( j = 0; j < total; j += b->count, b = b->next ) + cvSeqPushMulti( seq, b->data, b->count ); + } } } else @@ -1124,11 +1181,12 @@ cvHaarDetectObjects( const CvArr* _img, for( pass = 0; pass < npass; pass++ ) { -#ifdef _OPENMP - #pragma omp parallel for num_threads(max_threads), schedule(dynamic) -#endif + #ifdef _OPENMP + #pragma omp parallel for num_threads(max_threads), schedule(dynamic) + #endif for( int _iy = start_y; _iy < end_y; _iy++ ) { + int thread_id = cvGetThreadNum(); int iy = cvRound(_iy*ystep); int _ix, _xstep = 1; uchar* mask_row = temp->data.ptr + temp->step * iy; @@ -1162,11 +1220,7 @@ cvHaarDetectObjects( const CvArr* _img, else { CvRect rect = cvRect(ix,iy,win_size.width,win_size.height); -#ifndef _OPENMP - cvSeqPush( seq, &rect ); -#else - cvSeqPush( seq_thread[omp_get_thread_num()], &rect ); -#endif + cvSeqPush( seq_thread[thread_id], &rect ); } } if( result < 0 ) @@ -1181,11 +1235,7 @@ cvHaarDetectObjects( const CvArr* _img, if( pass == npass - 1 ) { CvRect rect = cvRect(ix,iy,win_size.width,win_size.height); -#ifndef _OPENMP - cvSeqPush( seq, &rect ); -#else - cvSeqPush( seq_thread[omp_get_thread_num()], &rect ); -#endif + cvSeqPush( seq_thread[thread_id], &rect ); } } else @@ -1197,17 +1247,16 @@ cvHaarDetectObjects( const CvArr* _img, cascade->hid_cascade->count = cascade->count; } -#ifdef _OPENMP - // gather the results - for( i = 0; i < max_threads; i++ ) - { - CvSeq* s = seq_thread[i]; - int j, total = s->total; - CvSeqBlock* b = s->first; - for( j = 0; j < total; j += b->count, b = b->next ) - cvSeqPushMulti( seq, b->data, b->count ); - } -#endif + // gather the results + if( max_threads > 1 ) + for( i = 0; i < max_threads; i++ ) + { + CvSeq* s = seq_thread[i]; + int j, total = s->total; + CvSeqBlock* b = s->first; + for( j = 0; j < total; j += b->count, b = b->next ) + cvSeqPushMulti( seq, b->data, b->count ); + } if( find_biggest_object ) { @@ -1462,13 +1511,12 @@ cvHaarDetectObjects( const CvArr* _img, __END__; -#ifdef _OPENMP - for( i = 0; i < max_threads; i++ ) - { - if( seq_thread[i] ) - cvReleaseMemStorage( &seq_thread[i]->storage ); - } -#endif + if( max_threads > 1 ) + for( i = 0; i < max_threads; i++ ) + { + if( seq_thread[i] ) + cvReleaseMemStorage( &seq_thread[i]->storage ); + } cvReleaseMemStorage( &temp_storage ); cvReleaseMat( &sum ); diff --git a/cv/src/cvlinefit.cpp b/cv/src/cvlinefit.cpp index aaf22db..4095c80 100644 --- a/cv/src/cvlinefit.cpp +++ b/cv/src/cvlinefit.cpp @@ -190,7 +190,7 @@ icvFitLine3D_wods( CvPoint3D32f * points, int count, float *weights, float *line CvMat _det = cvMat( 3, 3, CV_32F, det ); CvMat _evc = cvMat( 3, 3, CV_32F, evc ); CvMat _evl = cvMat( 3, 1, CV_32F, evl ); - cvEigenVV( &_det, &_evc, &_evl, 0 ); + cvEigenVV( &_det, &_evc, &_evl, 0 ); i = evl[0] < evl[1] ? (evl[0] < evl[2] ? 0 : 2) : (evl[1] < evl[2] ? 1 : 2); } #else @@ -331,7 +331,7 @@ icvWeightWelsch( float *d, int count, float *w, float _c ) } -/* Takes an array of 2D points, type of distance (including user-defined +/* Takes an array of 2D points, type of distance (including user-defined distance specified by callbacks, fills the array of four floats with line parameters A, B, C, D, where (A, B) is the normalized direction vector, (C, D) is the point that belongs to the line. */ @@ -339,15 +339,17 @@ parameters A, B, C, D, where (A, B) is the normalized direction vector, static CvStatus icvFitLine2D( CvPoint2D32f * points, int count, int dist, float _param, float reps, float aeps, float *line ) { + double EPS = count*FLT_EPSILON; void (*calc_weights) (float *, int, float *) = 0; void (*calc_weights_param) (float *, int, float *, float) = 0; float *w; /* weights */ float *r; /* square distances */ - int i, j; + int i, j, k; float _line[6], _lineprev[6]; - int first = 1; float rdelta = reps != 0 ? reps : 1.0f; float adelta = aeps != 0 ? aeps : 0.01f; + double min_err = DBL_MAX, err = 0; + CvRNG rng = cvRNG(-1); memset( line, 0, 4*sizeof(line[0]) ); @@ -387,99 +389,116 @@ static CvStatus icvFitLine2D( CvPoint2D32f * points, int count, int dist, w = (float *) cvAlloc( count * sizeof( float )); r = (float *) cvAlloc( count * sizeof( float )); - for( i = 0; i < count; i++ ) - w[i] = 1.0f; - - icvFitLine2D_wods( points, count, 0, _line ); - for( i = 0; i < 100; i++ ) + for( k = 0; k < 20; k++ ) { - double sum_w = 0; - - if( first ) - { - first = 0; - } - else + int first = 1; + for( i = 0; i < count; i++ ) + w[i] = 0.f; + + for( i = 0; i < MIN(count,10); ) { - double t = _line[0] * _lineprev[0] + _line[1] * _lineprev[1]; - t = MAX(t,-1.); - t = MIN(t,1.); - if( fabs(acos(t)) < adelta ) + j = cvRandInt(&rng) % count; + if( w[j] < FLT_EPSILON ) { - float x, y, d; - - x = (float) fabs( _line[2] - _lineprev[2] ); - y = (float) fabs( _line[3] - _lineprev[3] ); - - d = x > y ? x : y; - if( d < rdelta ) - goto _exit_; + w[j] = 1.f; + i++; } } - /* calculate distances */ - if( icvCalcDist2D( points, count, _line, r ) < FLT_EPSILON*count ) - break; - /* calculate weights */ - if( calc_weights ) - { - calc_weights( r, count, w ); - } - else if( calc_weights_param ) + icvFitLine2D_wods( points, count, w, _line ); + for( i = 0; i < 30; i++ ) { - calc_weights_param( r, count, w, _param ); - } - else - goto _exit_; + double sum_w = 0; - for( j = 0; j < count; j++ ) - sum_w += w[j]; + if( first ) + { + first = 0; + } + else + { + double t = _line[0] * _lineprev[0] + _line[1] * _lineprev[1]; + t = MAX(t,-1.); + t = MIN(t,1.); + if( fabs(acos(t)) < adelta ) + { + float x, y, d; + + x = (float) fabs( _line[2] - _lineprev[2] ); + y = (float) fabs( _line[3] - _lineprev[3] ); + + d = x > y ? x : y; + if( d < rdelta ) + break; + } + } + /* calculate distances */ + err = icvCalcDist2D( points, count, _line, r ); + if( err < EPS ) + break; + + /* calculate weights */ + if( calc_weights ) + calc_weights( r, count, w ); + else + calc_weights_param( r, count, w, _param ); - if( fabs(sum_w) > FLT_EPSILON ) - { - sum_w = 1./sum_w; for( j = 0; j < count; j++ ) - w[j] = (float)(w[j]*sum_w); + sum_w += w[j]; + + if( fabs(sum_w) > FLT_EPSILON ) + { + sum_w = 1./sum_w; + for( j = 0; j < count; j++ ) + w[j] = (float)(w[j]*sum_w); + } + else + { + for( j = 0; j < count; j++ ) + w[j] = 1.f; + } + + /* save the line parameters */ + memcpy( _lineprev, _line, 4 * sizeof( float )); + + /* Run again... */ + icvFitLine2D_wods( points, count, w, _line ); } - else + + if( err < min_err ) { - for( j = 0; j < count; j++ ) - w[j] = 1.f; + min_err = err; + memcpy( line, _line, 4 * sizeof(line[0])); + if( err < EPS ) + break; } - - /* save the line parameters */ - memcpy( _lineprev, _line, 4 * sizeof( float )); - - /* Run again... */ - icvFitLine2D_wods( points, count, w, _line ); } -_exit_: - memcpy( line, _line, 4 * sizeof(line[0])); cvFree( &w ); cvFree( &r ); return CV_OK; } -/* Takes an array of 3D points, type of distance (including user-defined -distance specified by callbacks, fills the array of four floats with line -parameters A, B, C, D, E, F, where (A, B, C) is the normalized direction vector, +/* Takes an array of 3D points, type of distance (including user-defined +distance specified by callbacks, fills the array of four floats with line +parameters A, B, C, D, E, F, where (A, B, C) is the normalized direction vector, (D, E, F) is the point that belongs to the line. */ static CvStatus icvFitLine3D( CvPoint3D32f * points, int count, int dist, float _param, float reps, float aeps, float *line ) { + double EPS = count*FLT_EPSILON; void (*calc_weights) (float *, int, float *) = 0; void (*calc_weights_param) (float *, int, float *, float) = 0; float *w; /* weights */ float *r; /* square distances */ - int i, j; + int i, j, k; float _line[6], _lineprev[6]; - int first = 1; float rdelta = reps != 0 ? reps : 1.0f; float adelta = aeps != 0 ? aeps : 0.01f; + double min_err = DBL_MAX, err = 0; + CvRNG rng = cvRNG(-1); memset( line, 0, 6*sizeof(line[0]) ); @@ -520,82 +539,97 @@ icvFitLine3D( CvPoint3D32f * points, int count, int dist, w = (float *) cvAlloc( count * sizeof( float )); r = (float *) cvAlloc( count * sizeof( float )); - for( i = 0; i < count; i++ ) - w[i] = 1.0f; - - icvFitLine3D_wods( points, count, 0, _line ); - for( i = 0; i < 100; i++ ) + for( k = 0; k < 20; k++ ) { - double sum_w = 0; + int first = 1; + for( i = 0; i < count; i++ ) + w[i] = 0.f; - if( first ) + for( i = 0; i < MIN(count,10); ) { - first = 0; - } - else - { - double t = _line[0] * _lineprev[0] + _line[1] * _lineprev[1] + _line[2] * _lineprev[2]; - t = MAX(t,-1.); - t = MIN(t,1.); - if( fabs(acos(t)) < adelta ) + j = cvRandInt(&rng) % count; + if( w[j] < FLT_EPSILON ) { - float x, y, z, ax, ay, az, dx, dy, dz, d; - - x = _line[3] - _lineprev[3]; - y = _line[4] - _lineprev[4]; - z = _line[5] - _lineprev[5]; - ax = _line[0] - _lineprev[0]; - ay = _line[1] - _lineprev[1]; - az = _line[2] - _lineprev[2]; - dx = (float) fabs( y * az - z * ay ); - dy = (float) fabs( z * ax - x * az ); - dz = (float) fabs( x * ay - y * ax ); - - d = dx > dy ? (dx > dz ? dx : dz) : (dy > dz ? dy : dz); - if( d < rdelta ) - goto _exit_; + w[j] = 1.f; + i++; } } - /* calculate distances */ - if( icvCalcDist3D( points, count, _line, r ) < FLT_EPSILON*count ) - break; - /* calculate weights */ - if( calc_weights ) - { - calc_weights( r, count, w ); - } - else if( calc_weights_param ) + icvFitLine3D_wods( points, count, w, _line ); + for( i = 0; i < 30; i++ ) { - calc_weights_param( r, count, w, _param ); - } - else - goto _exit_; + double sum_w = 0; - for( j = 0; j < count; j++ ) - sum_w += w[j]; + if( first ) + { + first = 0; + } + else + { + double t = _line[0] * _lineprev[0] + _line[1] * _lineprev[1] + _line[2] * _lineprev[2]; + t = MAX(t,-1.); + t = MIN(t,1.); + if( fabs(acos(t)) < adelta ) + { + float x, y, z, ax, ay, az, dx, dy, dz, d; + + x = _line[3] - _lineprev[3]; + y = _line[4] - _lineprev[4]; + z = _line[5] - _lineprev[5]; + ax = _line[0] - _lineprev[0]; + ay = _line[1] - _lineprev[1]; + az = _line[2] - _lineprev[2]; + dx = (float) fabs( y * az - z * ay ); + dy = (float) fabs( z * ax - x * az ); + dz = (float) fabs( x * ay - y * ax ); + + d = dx > dy ? (dx > dz ? dx : dz) : (dy > dz ? dy : dz); + if( d < rdelta ) + break; + } + } + /* calculate distances */ + if( icvCalcDist3D( points, count, _line, r ) < FLT_EPSILON*count ) + break; + + /* calculate weights */ + if( calc_weights ) + calc_weights( r, count, w ); + else + calc_weights_param( r, count, w, _param ); - if( fabs(sum_w) > FLT_EPSILON ) - { - sum_w = 1./sum_w; for( j = 0; j < count; j++ ) - w[j] = (float)(w[j]*sum_w); + sum_w += w[j]; + + if( fabs(sum_w) > FLT_EPSILON ) + { + sum_w = 1./sum_w; + for( j = 0; j < count; j++ ) + w[j] = (float)(w[j]*sum_w); + } + else + { + for( j = 0; j < count; j++ ) + w[j] = 1.f; + } + + /* save the line parameters */ + memcpy( _lineprev, _line, 6 * sizeof( float )); + + /* Run again... */ + icvFitLine3D_wods( points, count, w, _line ); } - else + + if( err < min_err ) { - for( j = 0; j < count; j++ ) - w[j] = 1.f; + min_err = err; + memcpy( line, _line, 6 * sizeof(line[0])); + if( err < EPS ) + break; } - - /* save the line parameters */ - memcpy( _lineprev, _line, 6 * sizeof( float )); - - /* Run again... */ - icvFitLine3D_wods( points, count, w, _line ); } -_exit_: + // Return... - memcpy( line, _line, 6 * sizeof(line[0])); cvFree( &w ); cvFree( &r ); return CV_OK; @@ -606,12 +640,12 @@ CV_IMPL void cvFitLine( const CvArr* array, int dist, double param, double reps, double aeps, float *line ) { - char* buffer = 0; + schar* buffer = 0; CV_FUNCNAME( "cvFitLine" ); __BEGIN__; - char* points = 0; + schar* points = 0; union { CvContour contour; CvSeq seq; } header; CvSeqBlock block; CvSeq* ptseq = (CvSeq*)array; @@ -658,7 +692,7 @@ cvFitLine( const CvArr* array, int dist, double param, } else { - CV_CALL( buffer = points = (char*)cvAlloc( ptseq->total*CV_ELEM_SIZE(type) )); + CV_CALL( buffer = points = (schar*)cvAlloc( ptseq->total*CV_ELEM_SIZE(type) )); CV_CALL( cvCvtSeqToArray( ptseq, points, CV_WHOLE_SEQ )); if( CV_MAT_DEPTH(type) != CV_32F ) diff --git a/cv/src/cvlkpyramid.cpp b/cv/src/cvlkpyramid.cpp index c3847c9..a08d4bd 100644 --- a/cv/src/cvlkpyramid.cpp +++ b/cv/src/cvlkpyramid.cpp @@ -452,7 +452,7 @@ cvCalcOpticalFlowPyrLK( const void* arrA, const void* arrB, int pt_status; CvPoint2D32f u; CvPoint prev_minJ = { -1, -1 }, prev_maxJ = { -1, -1 }; - double Gxx = 0, Gxy = 0, Gyy = 0, D = 0; + double Gxx = 0, Gxy = 0, Gyy = 0, D = 0, minEig = 0; float prev_mx = 0, prev_my = 0; int j, x, y; int threadIdx = cvGetThreadNum(); @@ -577,6 +577,11 @@ cvCalcOpticalFlowPyrLK( const void* arrA, const void* arrB, pt_status = 0; break; } + + // Adi Shavit - 2008.05 + if( flags & CV_LKFLOW_GET_MIN_EIGENVALS ) + minEig = (Gyy + Gxx - sqrt((Gxx-Gyy)*(Gxx-Gyy) + 4.*Gxy*Gxy))/(2*jsz.height*jsz.width); + D = 1. / D; prev_minJ = minJ; @@ -608,20 +613,25 @@ cvCalcOpticalFlowPyrLK( const void* arrA, const void* arrB, { /* calc error */ double err = 0; - - for( y = 0; y < jsz.height; y++ ) + if( flags & CV_LKFLOW_GET_MIN_EIGENVALS ) + err = minEig; + else { - const float* pi = patchI + - (y + minJ.y - minI.y + 1)*isz.width + minJ.x - minI.x + 1; - const float* pj = patchJ + y*jsz.width; - - for( x = 0; x < jsz.width; x++ ) + for( y = 0; y < jsz.height; y++ ) { - double t = pi[x] - pj[x]; - err += t * t; + const float* pi = patchI + + (y + minJ.y - minI.y + 1)*isz.width + minJ.x - minI.x + 1; + const float* pj = patchJ + y*jsz.width; + + for( x = 0; x < jsz.width; x++ ) + { + double t = pi[x] - pj[x]; + err += t * t; + } } + err = sqrt(err); } - error[i] = (float)sqrt(err); + error[i] = (float)err; } } // end of point processing loop (i) } diff --git a/cv/src/cvsmooth.cpp b/cv/src/cvsmooth.cpp index 9c57774..d111433 100644 --- a/cv/src/cvsmooth.cpp +++ b/cv/src/cvsmooth.cpp @@ -1029,22 +1029,22 @@ icvMedianBlur_8u_CnR_Om( uchar* src, int src_step, uchar* dst, int dst_step, \****************************************************************************************/ static void -icvBilateralFiltering( const CvMat* src, CvMat* dst, - double sigma_color, double sigma_space ) +icvBilateralFiltering_8u( const CvMat* src, CvMat* dst, int d, + double sigma_color, double sigma_space ) { CvMat* temp = 0; float* color_weight = 0; float* space_weight = 0; int* space_ofs = 0; - CV_FUNCNAME( "icvBilateralFiltering" ); + CV_FUNCNAME( "icvBilateralFiltering_8u" ); __BEGIN__; double gauss_color_coeff = -0.5/(sigma_color*sigma_color); double gauss_space_coeff = -0.5/(sigma_space*sigma_space); int cn = CV_MAT_CN(src->type); - int i, j, k, maxk, radius, d; + int i, j, k, maxk, radius; CvSize size = cvGetMatSize(src); if( CV_MAT_TYPE(src->type) != CV_8UC1 && @@ -1058,7 +1058,10 @@ icvBilateralFiltering( const CvMat* src, CvMat* dst, if( sigma_space <= 0 ) sigma_space = 1; - radius = cvRound(sigma_space*1.5); + if( d == 0 ) + radius = cvRound(sigma_space*1.5); + else + radius = d/2; radius = MAX(radius, 1); d = radius*2 + 1; @@ -1139,6 +1142,153 @@ icvBilateralFiltering( const CvMat* src, CvMat* dst, cvFree( &space_ofs ); } + +static void icvBilateralFiltering_32f( const CvMat* src, CvMat* dst, int d, + double sigma_color, double sigma_space ) +{ + CvMat* temp = 0; + float* space_weight = 0; + int* space_ofs = 0; + float *expLUT = 0; + + CV_FUNCNAME( "icvBilateralFiltering_32f" ); + + __BEGIN__; + + double gauss_color_coeff = -0.5/(sigma_color*sigma_color); + double gauss_space_coeff = -0.5/(sigma_space*sigma_space); + int cn = CV_MAT_CN(src->type); + int i, j, k, maxk, radius; + double minValSrc=-1, maxValSrc=1; + const int kExpNumBinsPerChannel = 1 << 12; + int kExpNumBins = 0; + float lastExpVal = 1.f; + int temp_step; + float len, scale_index; + CvMat src_reshaped; + + CvSize size = cvGetMatSize(src); + + if( CV_MAT_TYPE(src->type) != CV_32FC1 && + CV_MAT_TYPE(src->type) != CV_32FC3 || + !CV_ARE_TYPES_EQ(src, dst) ) + CV_ERROR( CV_StsUnsupportedFormat, + "Both source and destination must be 32-bit float, single-channel or 3-channel images" ); + + if( sigma_color <= 0 ) + sigma_color = 1; + if( sigma_space <= 0 ) + sigma_space = 1; + + if( d == 0 ) + radius = cvRound(sigma_space*1.5); + else + radius = d/2; + radius = MAX(radius, 1); + d = radius*2 + 1; + // compute the min/max range for the input image (even if multichannel) + + CV_CALL( cvReshape( src, &src_reshaped, 1 ) ); + CV_CALL( cvMinMaxLoc(&src_reshaped, &minValSrc, &maxValSrc) ); + + // temporary copy of the image with borders for easy processing + CV_CALL( temp = cvCreateMat( src->rows + radius*2, + src->cols + radius*2, src->type )); + temp_step = temp->step/sizeof(float); + CV_CALL( cvCopyMakeBorder( src, temp, cvPoint(radius,radius), IPL_BORDER_REPLICATE )); + // allocate lookup tables + CV_CALL( space_weight = (float*)cvAlloc(d*d*sizeof(space_weight[0]))); + CV_CALL( space_ofs = (int*)cvAlloc(d*d*sizeof(space_ofs[0]))); + + // assign a length which is slightly more than needed + len = (float)(maxValSrc - minValSrc) * cn; + kExpNumBins = kExpNumBinsPerChannel * cn; + CV_CALL( expLUT = (float*)cvAlloc((kExpNumBins+2) * sizeof(expLUT[0]))); + scale_index = kExpNumBins/len; + + // initialize the exp LUT + for( i = 0; i < kExpNumBins+2; i++ ) + { + if( lastExpVal > 0.f ) + { + double val = i / scale_index; + expLUT[i] = (float)exp(val * val * gauss_color_coeff); + lastExpVal = expLUT[i]; + } + else + expLUT[i] = 0.f; + } + + // initialize space-related bilateral filter coefficients + for( i = -radius, maxk = 0; i <= radius; i++ ) + for( j = -radius; j <= radius; j++ ) + { + double r = sqrt((double)i*i + (double)j*j); + if( r > radius ) + continue; + space_weight[maxk] = (float)exp(r*r*gauss_space_coeff); + space_ofs[maxk++] = i*temp_step + j*cn; + } + + for( i = 0; i < size.height; i++ ) + { + const float* sptr = temp->data.fl + (i+radius)*temp_step + radius*cn; + float* dptr = (float*)(dst->data.ptr + i*dst->step); + + if( cn == 1 ) + { + for( j = 0; j < size.width; j++ ) + { + float sum = 0, wsum = 0; + float val0 = sptr[j]; + for( k = 0; k < maxk; k++ ) + { + float val = sptr[j + space_ofs[k]]; + float alpha = (float)(fabs(val - val0)*scale_index); + int idx = cvFloor(alpha); + alpha -= idx; + float w = space_weight[k]*(expLUT[idx] + alpha*(expLUT[idx+1] - expLUT[idx])); + sum += val*w; + wsum += w; + } + dptr[j] = (float)(sum/wsum); + } + } + else + { + assert( cn == 3 ); + for( j = 0; j < size.width*3; j += 3 ) + { + float sum_b = 0, sum_g = 0, sum_r = 0, wsum = 0; + float b0 = sptr[j], g0 = sptr[j+1], r0 = sptr[j+2]; + for( k = 0; k < maxk; k++ ) + { + const float* sptr_k = sptr + j + space_ofs[k]; + float b = sptr_k[0], g = sptr_k[1], r = sptr_k[2]; + float alpha = (float)((fabs(b - b0) + fabs(g - g0) + fabs(r - r0))*scale_index); + int idx = cvFloor(alpha); + alpha -= idx; + float w = space_weight[k]*(expLUT[idx] + alpha*(expLUT[idx+1] - expLUT[idx])); + sum_b += b*w; sum_g += g*w; sum_r += r*w; + wsum += w; + } + wsum = 1.f/wsum; + b0 = sum_b*wsum; + g0 = sum_g*wsum; + r0 = sum_r*wsum; + dptr[j] = b0; dptr[j+1] = g0; dptr[j+2] = r0; + } + } + } + + __END__; + + cvReleaseMat( &temp ); + cvFree( &space_weight ); + cvFree( &space_ofs ); + cvFree( &expLUT ); +} + //////////////////////////////// IPP smoothing functions ///////////////////////////////// icvFilterMedian_8u_C1R_t icvFilterMedian_8u_C1R_p = 0; @@ -1352,7 +1502,25 @@ cvSmooth( const void* srcarr, void* dstarr, int smooth_type, CV_CALL( gaussian_filter.process( src, dst )); } else if( smooth_type == CV_BILATERAL ) - CV_CALL( icvBilateralFiltering( src, dst, param1, param2 )); + { + if( param2 != 0 && (param2 != param1 || param1 % 2 == 0) ) + CV_ERROR( CV_StsBadSize, "Bilateral filter only supports square windows of odd size" ); + + switch( src_type ) + { + case CV_32FC1: + case CV_32FC3: + CV_CALL( icvBilateralFiltering_32f( src, dst, param1, param3, param4 )); + break; + case CV_8UC1: + case CV_8UC3: + CV_CALL( icvBilateralFiltering_8u( src, dst, param1, param3, param4 )); + break; + default: + CV_ERROR( CV_StsUnsupportedFormat, + "Unknown/unsupported format: bilateral filter only supports 8uC1, 8uC3, 32fC1 and 32fC3 formats" ); + } + } __END__; diff --git a/cvaux/Makefile.in b/cvaux/Makefile.in index 82913f1..01c79ee 100644 --- a/cvaux/Makefile.in +++ b/cvaux/Makefile.in @@ -80,10 +80,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -106,8 +110,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -118,6 +124,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -136,11 +144,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -160,10 +173,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/cvaux/include/Makefile.in b/cvaux/include/Makefile.in index 6ad2018..656d492 100644 --- a/cvaux/include/Makefile.in +++ b/cvaux/include/Makefile.in @@ -84,10 +84,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -110,8 +114,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -122,6 +128,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -140,11 +148,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -164,10 +177,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/cvaux/include/cvaux.h b/cvaux/include/cvaux.h index 7311cef..6e1b950 100644 --- a/cvaux/include/cvaux.h +++ b/cvaux/include/cvaux.h @@ -1117,9 +1117,56 @@ CVAPI(void) cvDeleteMoire( IplImage* img ); * Background/foreground segmentation * \****************************************************************************************/ -#define CV_BG_MODEL_FGD 0 -#define CV_BG_MODEL_MOG 1 -#define CV_BG_MODEL_FGD_SIMPLE 2 +/* We discriminate between foreground and background pixels + * by building and maintaining a model of the background. + * Any pixel which does not fit this model is then deemed + * to be foreground. + * + * At present we support two core background models, + * one of which has two variations: + * + * o CV_BG_MODEL_FGD: latest and greatest algorithm, described in + * + * Foreground Object Detection from Videos Containing Complex Background. + * Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian. + * ACM MM2003 9p + * http://muq.org/~cynbe/bib/foreground-object-detection-from-videos-containing-complex-background.pdf + * + * o CV_BG_MODEL_FGD_SIMPLE: + * A code comment describes this as a simplified version of the above, + * but the code is in fact currently identical. (Cynbe 2008-05-25) + * + * o CV_BG_MODEL_MOG: "Mixture of Gaussians", older algorithm, described in + * + * Moving target classification and tracking from real-time video. + * A Lipton, H Fujijoshi, R Patil + * Proceedings IEEE Workshop on Application of Computer Vision pp 8-14 1998 + * http://www.vision.cs.chubu.ac.jp/04/pdf/VSAM02.pdf + * + * Learning patterns of activity using real-time tracking + * C Stauffer and W Grimson August 2000 + * IEEE Transactions on Pattern Analysis and Machine Intelligence 22(8):747-757 + * http://people.csail.mit.edu/people/stauffer/Home/_papers/vsam-pami-tracking.ps + * + * Additional background may be found on the Wiki page + * + * http://opencvlibrary.sourceforge.net/VideoSurveillance + * + * which in particular recommends the Intel semi-popular overview article + * + * Computer Vision Workload Analysis: Case Study of Video Surveillance Systems + * Chen et al, Intel Technology Journal V09:02 , 2005 12p + * http://developer.intel.com/technology/itj/2005/volume09issue02/art02_computer_vision/vol09_art02.pdf + * + * which has both a good overview of the blobtracker software in particular, + * and also many references to introductory (and advanced) papers on computer vision. + * + */ + + +#define CV_BG_MODEL_FGD 0 +#define CV_BG_MODEL_MOG 1 /* "Mixture of Gaussians". */ +#define CV_BG_MODEL_FGD_SIMPLE 2 struct CvBGStatModel; @@ -1172,11 +1219,9 @@ CVAPI(int) cvChangeDetection( IplImage* prev_frame, /* Interface of ACM MM2003 algorithm - (Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian. - "Foreground Object Detection from Videos Containing Complex Background. ACM MM2003") */ -/* default paremeters of foreground detection algorithm */ +/* Default parameters of foreground detection algorithm: */ #define CV_BGFG_FGD_LC 128 #define CV_BGFG_FGD_N1C 15 #define CV_BGFG_FGD_N2C 25 @@ -1185,11 +1230,12 @@ CVAPI(int) cvChangeDetection( IplImage* prev_frame, #define CV_BGFG_FGD_N1CC 25 #define CV_BGFG_FGD_N2CC 40 -/* BG reference image update parameter */ +/* Background reference image update parameter: */ #define CV_BGFG_FGD_ALPHA_1 0.1f /* stat model update parameter - 0.002f ~ 1K frame(~45sec), 0.005 ~ 18sec (if 25fps and absolutely static BG) */ + * 0.002f ~ 1K frame(~45sec), 0.005 ~ 18sec (if 25fps and absolutely static BG) + */ #define CV_BGFG_FGD_ALPHA_2 0.005f /* start value for alpha parameter (to fast initiate statistic model) */ @@ -1203,10 +1249,42 @@ CVAPI(int) cvChangeDetection( IplImage* prev_frame, #define CV_BGFG_FGD_BG_UPDATE_TRESH 0.5f +/* See the above-referenced Li/Huang/Gu/Tian paper + * for a full description of these background-model + * tuning parameters. + * + * Nomenclature: 'c' == "color", a three-component red/green/blue vector. + * We use histograms of these to model the range of + * colors we've seen at a given background pixel. + * + * 'cc' == "color co-occurrence", a six-component vector giving + * RGB color for both this frame and preceding frame. + * We use histograms of these to model the range of + * color CHANGES we've seen at a given background pixel. + */ typedef struct CvFGDStatModelParams { - int Lc, N1c, N2c, Lcc, N1cc, N2cc, is_obj_without_holes, perform_morphing; - float alpha1, alpha2, alpha3, delta, T, minArea; + int Lc; /* Quantized levels per 'color' component. Power of two, typically 32, 64 or 128. */ + int N1c; /* Number of color vectors used to model normal background color variation at a given pixel. */ + int N2c; /* Number of color vectors retained at given pixel. Must be > N1c, typically ~ 5/3 of N1c. */ + /* Used to allow the first N1c vectors to adapt over time to changing background. */ + + int Lcc; /* Quantized levels per 'color co-occurrence' component. Power of two, typically 16, 32 or 64. */ + int N1cc; /* Number of color co-occurrence vectors used to model normal background color variation at a given pixel. */ + int N2cc; /* Number of color co-occurrence vectors retained at given pixel. Must be > N1cc, typically ~ 5/3 of N1cc. */ + /* Used to allow the first N1cc vectors to adapt over time to changing background. */ + + int is_obj_without_holes;/* If TRUE we ignore holes within foreground blobs. Defaults to TRUE. */ + int perform_morphing; /* Number of erode-dilate-erode foreground-blob cleanup iterations. */ + /* These erase one-pixel junk blobs and merge almost-touching blobs. Default value is 1. */ + + float alpha1; /* How quickly we forget old background pixel values seen. Typically set to 0.1 */ + float alpha2; /* "Controls speed of feature learning". Depends on T. Typical value circa 0.005. */ + float alpha3; /* Alternate to alpha2, used (e.g.) for quicker initial convergence. Typical value 0.1. */ + + float delta; /* Affects color and color co-occurrence quantization, typically set to 2. */ + float T; /* "A percentage value which determines when new features can be recognized as new background." (Typically 0.9).*/ + float minArea; /* Discard foreground blobs whose bounding box is smaller than this threshold. */ } CvFGDStatModelParams; @@ -1253,11 +1331,15 @@ CVAPI(CvBGStatModel*) cvCreateFGDStatModel( IplImage* first_frame, /* Interface of Gaussian mixture algorithm - (P. KadewTraKuPong and R. Bowden, + "An improved adaptive background mixture model for real-time tracking with shadow detection" - in Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001.") + P. KadewTraKuPong and R. Bowden, + Proc. 2nd European Workshp on Advanced Video-Based Surveillance Systems, 2001." + http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf */ +/* Note: "MOG" == "Mixture Of Gaussians": */ + #define CV_BGFG_MOG_MAX_NGAUSSIANS 500 /* default parameters of gaussian background detection algorithm */ diff --git a/cvaux/include/cvaux.hpp b/cvaux/include/cvaux.hpp index 6de0605..37ae897 100644 --- a/cvaux/include/cvaux.hpp +++ b/cvaux/include/cvaux.hpp @@ -112,7 +112,7 @@ public: { return m_back_project; } float query( int* bin ) const - { return m_hist ? cvGetRealND(m_hist->bins, bin) : 0.f; } + { return m_hist ? (float)cvGetRealND(m_hist->bins, bin) : 0.f; } protected: diff --git a/cvaux/include/cvmat.hpp b/cvaux/include/cvmat.hpp index 0c24ce9..5defb59 100644 --- a/cvaux/include/cvmat.hpp +++ b/cvaux/include/cvmat.hpp @@ -1814,27 +1814,27 @@ inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_T_& b, const _CvMAT_MUL_& a ) { return _CvMAT_MUL_ADD_( a.a, a.b, -a.alpha, &b.a, b.alpha, a.t_ab + 4 ); } -/* mmuladd = mat_scaled_shited * mat */ +/* mmuladd = mat_scaled_shifted * mat */ inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const CvMAT& b ) { return _CvMAT_MUL_ADD_( a.a, &b, a.alpha, &b, a.beta, 0 ); } -/* mmuladd = mat * mat_scaled_shited */ +/* mmuladd = mat * mat_scaled_shifted */ inline _CvMAT_MUL_ADD_ operator * ( const CvMAT& b, const _CvMAT_SCALE_SHIFT_& a ) { return _CvMAT_MUL_ADD_( &b, a.a, a.alpha, &b, a.beta, 0 ); } -/* mmuladd = mat_scaled_shited * mat_scaled */ +/* mmuladd = mat_scaled_shifted * mat_scaled */ inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_SCALE_& b ) { return _CvMAT_MUL_ADD_( a.a, b.a, a.alpha*b.alpha, b.a, a.beta*b.alpha, 0 ); } -/* mmuladd = mat_scaled * mat_scaled_shited */ +/* mmuladd = mat_scaled * mat_scaled_shifted */ inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_& b, const _CvMAT_SCALE_SHIFT_& a ) { return _CvMAT_MUL_ADD_( b.a, a.a, a.alpha*b.alpha, b.a, a.beta*b.alpha, 0 ); } -/* mmuladd = mat_scaled_shited * (mat^t) */ +/* mmuladd = mat_scaled_shifted * (mat^t) */ inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_T_& b ) { return _CvMAT_MUL_ADD_( a.a, &b.a, a.alpha*b.alpha, &b.a, a.beta*b.alpha, 6 ); } -/* mmuladd = (mat^t) * mat_scaled_shited */ +/* mmuladd = (mat^t) * mat_scaled_shifted */ inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_T_& b, const _CvMAT_SCALE_SHIFT_& a ) { return _CvMAT_MUL_ADD_( &b.a, a.a, a.alpha*b.alpha, &b.a, a.beta*b.alpha, 5 ); } diff --git a/cvaux/include/cvvidsurv.hpp b/cvaux/include/cvvidsurv.hpp index 9f31ef5..8e49210 100644 --- a/cvaux/include/cvvidsurv.hpp +++ b/cvaux/include/cvvidsurv.hpp @@ -43,7 +43,7 @@ #ifndef __CVVIDEOSURVEILLANCE_H__ #define __CVVIDEOSURVEILLANCE_H__ -/* turn off the functionality until cvaux/src/Makefile.am gets updated */ +/* Turn off the functionality until cvaux/src/Makefile.am gets updated: */ //#if _MSC_VER >= 1200 #include @@ -76,14 +76,14 @@ struct CvDefParam class CV_EXPORTS CvVSModule { -private: /* internal data */ +private: /* Internal data: */ CvDefParam* m_pParamList; char* m_pModuleTypeName; char* m_pModuleName; char* m_pNickName; protected: int m_Wnd; -public: /* constructor and destructor */ +public: /* Constructor and destructor: */ CvVSModule() { m_pNickName = NULL; @@ -106,7 +106,7 @@ public: /* constructor and destructor */ if(m_pModuleTypeName)free(m_pModuleTypeName); if(m_pModuleName)free(m_pModuleName); } -private: /* internal functions */ +private: /* Internal functions: */ void FreeParam(CvDefParam** pp) { CvDefParam* p = pp[0]; @@ -254,7 +254,7 @@ public: /* EXTERNAL INTERFACE */ void SetParamStr(char* name, char* str) { CvDefParam* p = m_pParamList; - for(;p;p=p->next) + for(; p; p=p->next) { if(cv_stricmp(p->pName,name) != 0) continue; if(p->pStr) @@ -265,8 +265,8 @@ public: /* EXTERNAL INTERFACE */ p->pStr[0] = p->Str; } } - /* convert to double and set */ - if(str)SetParam(name,atof(str)); + /* Convert to double and set: */ + if(str) SetParam(name,atof(str)); } void TransferParamsFromChild(CvVSModule* pM, char* prefix = NULL) { @@ -336,7 +336,7 @@ public: /* EXTERNAL INTERFACE */ else pM->SetParam(N,GetParam(tmp)); } - }/* transfer next param */ + }/* Transfer next parameter */ pM->ParamUpdate(); }/* Transfer params */ @@ -359,10 +359,11 @@ public: /* EXTERNAL INTERFACE */ } void SetNickName(char* pStr) { - if(m_pNickName) free(m_pNickName); + m_pNickName = NULL; + if(pStr) m_pNickName = strdup(pStr); } @@ -407,9 +408,9 @@ class CV_EXPORTS CvFGDetector: public CvVSModule { public: virtual IplImage* GetMask() = 0; - /* process current image */ + /* Process current image: */ virtual void Process(IplImage* pImg) = 0; - /* release foreground detector */ + /* Release foreground detector: */ virtual void Release() = 0; }; inline void cvReleaseFGDetector(CvFGDetector** ppT ) @@ -427,7 +428,7 @@ struct CvBlob { float x,y; /* blob position */ float w,h; /* blob sizes */ - int ID; /* blbo ID */ + int ID; /* blob ID */ }; inline CvBlob cvBlob(float x,float y, float w, float h) @@ -470,7 +471,7 @@ public: virtual CvBlob* GetBlobByID(int BlobID) { int i; - for(i=0;itotal;++i) + for(i=0; itotal; ++i) if(BlobID == CV_BLOB_ID(GetBlob(i))) return GetBlob(i); return NULL; @@ -482,7 +483,7 @@ public: virtual void DelBlobByID(int BlobID) { int i; - for(i=0;itotal;++i) + for(i=0; itotal; ++i) { if(BlobID == CV_BLOB_ID(GetBlob(i))) { @@ -563,7 +564,7 @@ public: virtual CvBlobTrack* GetBlobTrackByID(int TrackID) { int i; - for(i=0;itotal;++i) + for(i=0; itotal; ++i) { CvBlobTrack* pP = GetBlobTrack(i); if(pP && pP->TrackID == TrackID) @@ -580,7 +581,7 @@ public: virtual void DelBlobTrackByID(int TrackID) { int i; - for(i=0;itotal;++i) + for(i=0; itotal; ++i) { CvBlobTrack* pP = GetBlobTrack(i); if(TrackID == pP->TrackID) @@ -623,15 +624,15 @@ protected: class CV_EXPORTS CvBlobDetector: public CvVSModule { public: - /* try to detect new blob entrance based on foreground mask */ + /* Try to detect new blob entrance based on foreground mask. */ /* pFGMask - image of foreground mask */ - /* pNewBlob - pointer to CvBlob structure which will bew filled if new blob entrance detected */ + /* pNewBlob - pointer to CvBlob structure which will be filled if new blob entrance detected */ /* pOldBlobList - pointer to blob list which already exist on image */ virtual int DetectNewBlob(IplImage* pImg, IplImage* pImgFG, CvBlobSeq* pNewBlobList, CvBlobSeq* pOldBlobList) = 0; /* release blob detector */ virtual void Release()=0; }; -/* release any blob detector*/ +/* Release any blob detector: */ inline void cvReleaseBlobDetector(CvBlobDetector** ppBD) { ppBD[0]->Release(); @@ -639,7 +640,7 @@ inline void cvReleaseBlobDetector(CvBlobDetector** ppBD) } /* END BLOB DETECTOR INTERFACE */ -/* declaration of constructors of implemented modules */ +/* Declarations of constructors of implemented modules: */ CV_EXPORTS CvBlobDetector* cvCreateBlobDetectorSimple(); CV_EXPORTS CvBlobDetector* cvCreateBlobDetectorCC(); @@ -665,20 +666,20 @@ public: ~CvObjectDetector() {}; /* - * Releases the current detector and loads new detector from file + * Release the current detector and load new detector from file * (if detector_file_name is not 0) - * Returns true on success + * Return true on success: */ bool Load( const char* /*detector_file_name*/ = 0 ) { return false; } - /* Returns min detector window size */ + /* Return min detector window size: */ CvSize GetMinWindowSize() const { return cvSize(0,0); } - /* Returns max border */ + /* Return max border: */ int GetMaxBorderSize() const { return 0; } /* - * Detects the objects on the image and pushes the detected + * Detect the object on the image and push the detected * blobs into which must be the sequence of s */ void Detect( const CvArr* /*img*/, /* out */ CvBlobSeq* /*detected_blob_seq*/ = 0 ) {}; @@ -702,8 +703,8 @@ CV_INLINE CvRect cvRectIntersection( const CvRect r1, const CvRect r2 ) /* * CvImageDrawer * - * Draws on an image the specified ROIs from the source image and - * given blobs as ellipses or rectangles + * Draw on an image the specified ROIs from the source image and + * given blobs as ellipses or rectangles: */ struct CvDrawShape @@ -740,7 +741,7 @@ protected: -/* Trajectory generation module */ +/* Trajectory generation module: */ class CV_EXPORTS CvBlobTrackGen: public CvVSModule { public: @@ -756,7 +757,7 @@ inline void cvReleaseBlobTrackGen(CvBlobTrackGen** pBTGen) *pBTGen = 0; } -/* declaration of constructors of implemented modules */ +/* Declarations of constructors of implemented modules: */ CV_EXPORTS CvBlobTrackGen* cvCreateModuleBlobTrackGen1(); CV_EXPORTS CvBlobTrackGen* cvCreateModuleBlobTrackGenYML(); @@ -767,26 +768,31 @@ class CV_EXPORTS CvBlobTracker: public CvVSModule { public: CvBlobTracker(){SetTypeName("BlobTracker");}; + /* Add new blob to track it and assign to this blob personal ID */ - /* pBlob - pinter to structure with blob parameters (ID is ignored)*/ + /* pBlob - pointer to structure with blob parameters (ID is ignored)*/ /* pImg - current image */ /* pImgFG - current foreground mask */ - /* return pointer to new added blob */ + /* Return pointer to new added blob: */ virtual CvBlob* AddBlob(CvBlob* pBlob, IplImage* pImg, IplImage* pImgFG = NULL ) = 0; - /* return number of currently tracked blobs */ + + /* Return number of currently tracked blobs: */ virtual int GetBlobNum() = 0; - /* return pointer to specified by index blob */ + + /* Return pointer to specified by index blob: */ virtual CvBlob* GetBlob(int BlobIndex) = 0; - /* delete blob by its index */ + /* Delete blob by its index: */ virtual void DelBlob(int BlobIndex) = 0; - /* process current image and track all existed blobs */ + + /* Process current image and track all existed blobs: */ virtual void Process(IplImage* pImg, IplImage* pImgFG = NULL) = 0; - /* release blob tracker */ + + /* Release blob tracker: */ virtual void Release() = 0; - /* Process on blob (for multi hypothesis tracing) */ + /* Process one blob (for multi hypothesis tracing): */ virtual void ProcessBlob(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { CvBlob* pB; @@ -798,11 +804,13 @@ public: pBlob[0] = pB[0]; pBlob->ID = ID; }; - /* get confidence/wieght/probability (0-1) for blob */ + + /* Get confidence/wieght/probability (0-1) for blob: */ virtual double GetConfidence(int /*BlobIndex*/, CvBlob* /*pBlob*/, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { return 1; }; + virtual double GetConfidenceList(CvBlobSeq* pBlobList, IplImage* pImg, IplImage* pImgFG = NULL) { int b,bN = pBlobList->GetBlobNum(); @@ -815,8 +823,10 @@ public: } return W; }; + virtual void UpdateBlob(int /*BlobIndex*/, CvBlob* /*pBlob*/, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL){}; - /* update all blob models */ + + /* Update all blob models: */ virtual void Update(IplImage* pImg, IplImage* pImgFG = NULL) { int i; @@ -828,7 +838,7 @@ public: }; - /* return pinter to blob by its unique ID */ + /* Return pointer to blob by its unique ID: */ virtual int GetBlobIndexByID(int BlobID) { int i; @@ -839,24 +849,33 @@ public: } return -1; }; - /* return pinter to blob by its unique ID */ + + /* Return pointer to blob by its unique ID: */ virtual CvBlob* GetBlobByID(int BlobID){return GetBlob(GetBlobIndexByID(BlobID));}; - /* delete blob by its ID */ + + /* Delete blob by its ID: */ virtual void DelBlobByID(int BlobID){DelBlob(GetBlobIndexByID(BlobID));}; - /* Set new parameters for specified (by index) blob */ + + /* Set new parameters for specified (by index) blob: */ virtual void SetBlob(int /*BlobIndex*/, CvBlob* /*pBlob*/){}; - /* Set new parameters for specified (by ID) blob */ + + /* Set new parameters for specified (by ID) blob: */ virtual void SetBlobByID(int BlobID, CvBlob* pBlob) { SetBlob(GetBlobIndexByID(BlobID),pBlob); }; /* =============== MULTI HYPOTHESIS INTERFACE ================== */ - /* return number of position hyposetis of currently tracked blob */ + + /* Return number of position hyposetis of currently tracked blob: */ virtual int GetBlobHypNum(int /*BlobIdx*/){return 1;}; - /* return pointer to specified blob hypothesis by index blob */ + + /* Return pointer to specified blob hypothesis by index blob: */ virtual CvBlob* GetBlobHyp(int BlobIndex, int /*hypothesis*/){return GetBlob(BlobIndex);}; - /* Set new parameters for specified (by index) blob hyp (can be called several times for each hyp )*/ + + /* Set new parameters for specified (by index) blob hyp + * (can be called several times for each hyp ): + */ virtual void SetBlobHyp(int /*BlobIndex*/, CvBlob* /*pBlob*/){}; }; inline void cvReleaseBlobTracker(CvBlobTracker**ppT ) @@ -873,7 +892,8 @@ public: virtual void Init(CvBlob* pBlobInit, IplImage* pImg, IplImage* pImgFG = NULL) = 0; virtual CvBlob* Process(CvBlob* pBlobPrev, IplImage* pImg, IplImage* pImgFG = NULL) = 0; virtual void Release() = 0; - /*not required methods */ + + /* Non-required methods: */ virtual void SkipProcess(CvBlob* /*pBlobPrev*/, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL){}; virtual void Update(CvBlob* /*pBlob*/, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL){}; virtual void SetCollision(int /*CollisionFlag*/){}; /* call in case of blob collision situation*/ @@ -891,9 +911,9 @@ inline void cvReleaseBlobTrackerOne(CvBlobTrackerOne **ppT ) CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerList(CvBlobTrackerOne* (*create)()); /*BLOB TRACKER ONE INTERFACE */ -/* declaration of constructors of implemented modules */ +/* Declarations of constructors of implemented modules: */ -/* some declaration for specific MeanShift tracker */ +/* Some declarations for specific MeanShift tracker: */ #define PROFILE_EPANECHNIKOV 0 #define PROFILE_DOG 1 struct CvBlobTrackerParamMS @@ -908,42 +928,54 @@ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS1(CvBlobTrackerParamMS* param); CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS2(CvBlobTrackerParamMS* param); CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS1ByList(); -/* some declaration for specific Liklyhood tracker */ +/* Some declarations for specific Likelihood tracker: */ struct CvBlobTrackerParamLH { int HistType; /* see Prob.h */ int ScaleAfter; }; -/* no scale optimization */ +/* Without scale optimization: */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerLHR(CvBlobTrackerParamLH* /*param*/ = NULL); -/* scale optimization */ + +/* With scale optimization: */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerLHRS(CvBlobTrackerParamLH* /*param*/ = NULL); -/* simple blob tracker based on connected component tracking */ +/* Simple blob tracker based on connected component tracking: */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerCC(); -/* connected component tracking and MSPF resolver for collision */ + +/* Connected component tracking and mean-shift particle filter collion-resolver: */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerCCMSPF(); -/* blob tracker that integrate MS and CC */ + +/* Blob tracker that integrates meanshift and connected components: */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSFG(); CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSFGS(); -/* MS without CC */ + +/* Meanshift without connected-components */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS(); -/* particle filtering using bahata... coefficient */ + +/* Particle filtering via Bhattacharya coefficient, which */ +/* is roughly the dot-product of two probability densities. */ +/* See: Real-Time Tracking of Non-Rigid Objects using Mean Shift */ +/* Comanicius, Ramesh, Meer, 2000, 8p */ +/* http://citeseer.ist.psu.edu/321441.html */ CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSPF(); /* =========== tracker integrators trackers =============*/ -/* integrator based on Partical Filtering method */ + +/* Integrator based on Particle Filtering method: */ //CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerIPF(); -/* rule based integrator */ + +/* Rule based integrator: */ //CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerIRB(); -/* integrator based on data fusion used particle filtering */ + +/* Integrator based on data fusion using particle filtering: */ //CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerIPFDF(); -/* Trajectory postprocessing module */ +/* Trajectory postprocessing module: */ class CV_EXPORTS CvBlobTrackPostProc: public CvVSModule { public: @@ -953,7 +985,7 @@ public: virtual CvBlob* GetBlob(int index) = 0; virtual void Release() = 0; - /* additional functionality */ + /* Additional functionality: */ virtual CvBlob* GetBlobByID(int BlobID) { int i; @@ -973,18 +1005,19 @@ inline void cvReleaseBlobTrackPostProc(CvBlobTrackPostProc** pBTPP) *pBTPP = 0; } -/* Trajectory generation module */ +/* Trajectory generation module: */ class CV_EXPORTS CvBlobTrackPostProcOne: public CvVSModule { public: virtual CvBlob* Process(CvBlob* pBlob) = 0; virtual void Release() = 0; }; -/* create blob traking post processing module based on simle module */ + +/* Create blob tracking post processing module based on simle module: */ CV_EXPORTS CvBlobTrackPostProc* cvCreateBlobTrackPostProcList(CvBlobTrackPostProcOne* (*create)()); -/* declaration of constructors of implemented modules */ +/* Declarations of constructors of implemented modules: */ CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcKalman(); CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcTimeAverRect(); CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcTimeAverExp(); @@ -1003,7 +1036,7 @@ CV_EXPORTS CvBlobTrackPredictor* cvCreateModuleBlobTrackPredictKalman(); -/* Trajectory analyser module */ +/* Trajectory analyser module: */ class CV_EXPORTS CvBlobTrackAnalysis: public CvVSModule { public: @@ -1025,7 +1058,7 @@ inline void cvReleaseBlobTrackAnalysis(CvBlobTrackAnalysis** pBTPP) *pBTPP = 0; } -/* feature vector generation module */ +/* Feature-vector generation module: */ class CV_EXPORTS CvBlobTrackFVGen : public CvVSModule { public: @@ -1034,14 +1067,14 @@ public: virtual void Release() = 0; virtual int GetFVSize() = 0; virtual int GetFVNum() = 0; - virtual float* GetFV(int index, int* pFVID) = 0; /* pointer to FV, if return 0 then FV does not created */ - virtual float* GetFVVar(){return NULL;}; /* returned pointer to array of variation of values of FV, if return 0 then FVVar is not exist */ - virtual float* GetFVMin() = 0; /* returned pointer to array of minimal values of FV, if return 0 then FVrange is not exist */ - virtual float* GetFVMax() = 0; /* returned pointer to array of maximal values of FV, if return 0 then FVrange is not exist */ + virtual float* GetFV(int index, int* pFVID) = 0; /* Returns pointer to FV, if return 0 then FV not created */ + virtual float* GetFVVar(){return NULL;}; /* Returns pointer to array of variation of values of FV, if returns 0 then FVVar does not exist. */ + virtual float* GetFVMin() = 0; /* Returns pointer to array of minimal values of FV, if returns 0 then FVrange does not exist */ + virtual float* GetFVMax() = 0; /* Returns pointer to array of maximal values of FV, if returns 0 then FVrange does not exist */ }; -/* Trajectory Analyser module */ +/* Trajectory Analyser module: */ class CV_EXPORTS CvBlobTrackAnalysisOne { public: @@ -1052,38 +1085,47 @@ public: virtual void Release() = 0; }; -/* create blob traking post processing module based on simle module */ +/* Create blob tracking post processing module based on simle module: */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateBlobTrackAnalysisList(CvBlobTrackAnalysisOne* (*create)()); -/* declaration of constructors of implemented modules */ -/* based on histogramm analysis of 2D FV (x,y)*/ +/* Declarations of constructors of implemented modules: */ + +/* Based on histogram analysis of 2D FV (x,y): */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistP(); -/* based on histogramm analysis of 4D FV (x,y,vx,vy)*/ + +/* Based on histogram analysis of 4D FV (x,y,vx,vy): */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistPV(); -/* based on histogramm analysis of 5D FV (x,y,vx,vy,state)*/ + +/* Based on histogram analysis of 5D FV (x,y,vx,vy,state): */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistPVS(); -/* based on histogramm analysis of 4D FV (startpos,stoppos)*/ + +/* Based on histogram analysis of 4D FV (startpos,stoppos): */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistSS(); -/* based on SVM classifier analysis of 2D FV (x,y)*/ + + +/* Based on SVM classifier analysis of 2D FV (x,y): */ //CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMP(); -/* based on SVM classifier analysis of 4D FV (x,y,vx,vy)*/ + +/* Based on SVM classifier analysis of 4D FV (x,y,vx,vy): */ //CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMPV(); -/* based on SVM classifier analysis of 5D FV (x,y,vx,vy,state)*/ + +/* Based on SVM classifier analysis of 5D FV (x,y,vx,vy,state): */ //CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMPVS(); -/* based on SVM classifier analysis of 4D FV (startpos,stoppos)*/ + +/* Based on SVM classifier analysis of 4D FV (startpos,stoppos): */ //CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMSS(); -/* track analysis based on distance between tracks */ +/* Track analysis based on distance between tracks: */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisTrackDist(); -/* analizer based on reation Road and height map*/ +/* Analyzer based on reation Road and height map: */ //CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysis3DRoadMap(); -/* analizer that make OR desicion using set of analizers */ +/* Analyzer that makes OR decision using set of analyzers: */ CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisIOR(); -/* estimator of human height */ +/* Estimator of human height: */ class CV_EXPORTS CvBlobTrackAnalysisHeight: public CvBlobTrackAnalysis { public: @@ -1093,7 +1135,7 @@ public: -/* AUTO BLOB TRACKER INTERFACE - pipeline of 3 modules */ +/* AUTO BLOB TRACKER INTERFACE -- pipeline of 3 modules: */ class CV_EXPORTS CvBlobTrackerAuto: public CvVSModule { public: @@ -1104,8 +1146,8 @@ public: virtual IplImage* GetFGMask(){return NULL;}; virtual float GetState(int BlobID) = 0; virtual char* GetStateDesc(int BlobID) = 0; - /* return 0 if trajectory is normal - return >0 if trajectory abnormal */ + /* return 0 if trajectory is normal; + * return >0 if trajectory abnormal. */ virtual void Release() = 0; }; inline void cvReleaseBlobTrackerAuto(CvBlobTrackerAuto** ppT) @@ -1116,29 +1158,37 @@ inline void cvReleaseBlobTrackerAuto(CvBlobTrackerAuto** ppT) /* END AUTO BLOB TRACKER INTERFACE */ -/* creation function and data for specific BlobTRackerAuto modules */ -/* parameters of blobtracker auto ver1 */ +/* Constructor functions and data for specific BlobTRackerAuto modules: */ + +/* Parameters of blobtracker auto ver1: */ struct CvBlobTrackerAutoParam1 { - int FGTrainFrames; /* number of frames are needed for FG detector to train */ - CvFGDetector* pFG; /* FGDetector module, if this filed is NULL the Process FG mask is used */ - CvBlobDetector* pBD; /* existed blob detector module - if this filed is NULL default blobdetector module will be created */ - CvBlobTracker* pBT; /* existed blob tracking module - if this filed is NULL default blobtracker module will be created */ - CvBlobTrackGen* pBTGen; /* existed blob trajectory generator, - if this filed is NULL no any generator is used */ - CvBlobTrackPostProc* pBTPP; /* existed blob trajectory postprocessing module - if this filed is NULL no any postprocessing is used */ + int FGTrainFrames; /* Number of frames needed for FG (foreground) detector to train. */ + + CvFGDetector* pFG; /* FGDetector module. If this field is NULL the Process FG mask is used. */ + + CvBlobDetector* pBD; /* Selected blob detector module. */ + /* If this field is NULL default blobdetector module will be created. */ + + CvBlobTracker* pBT; /* Selected blob tracking module. */ + /* If this field is NULL default blobtracker module will be created. */ + + CvBlobTrackGen* pBTGen; /* Selected blob trajectory generator. */ + /* If this field is NULL no generator is used. */ + + CvBlobTrackPostProc* pBTPP; /* Selected blob trajectory postprocessing module. */ + /* If this field is NULL no postprocessing is done. */ + int UsePPData; - CvBlobTrackAnalysis* pBTA; /* existed blob trajectory analysis module */ - /* if this filed is NULL no any analysis is made */ + + CvBlobTrackAnalysis* pBTA; /* Selected blob trajectory analysis module. */ + /* If this field is NULL no track analysis is done. */ }; -/* create blob tracker auto ver1 */ +/* Create blob tracker auto ver1: */ CV_EXPORTS CvBlobTrackerAuto* cvCreateBlobTrackerAuto1(CvBlobTrackerAutoParam1* param = NULL); -/* simple loader for many auto trackers by its type */ +/* Simple loader for many auto trackers by its type : */ inline CvBlobTrackerAuto* cvCreateBlobTrackerAuto(int type, void* param) { if(type == 0) return cvCreateBlobTrackerAuto1((CvBlobTrackerAutoParam1*)param); @@ -1161,7 +1211,7 @@ struct CvTracksTimePos FILE *file);*/ -/* Create functions */ +/* Constructor functions: */ CV_EXPORTS void cvCreateTracks_One(CvBlobTrackSeq *TS); CV_EXPORTS void cvCreateTracks_Same(CvBlobTrackSeq *TS1, CvBlobTrackSeq *TS2); @@ -1173,9 +1223,11 @@ class CV_EXPORTS CvProb { public: virtual ~CvProb() {}; - /* calculate probability value */ + + /* Calculate probability value: */ virtual double Value(int* /*comp*/, int /*x*/ = 0, int /*y*/ = 0){return -1;}; - /* update histograpp Pnew = (1-W)*Pold + W*Padd*/ + + /* Update histograpp Pnew = (1-W)*Pold + W*Padd*/ /* W weight of new added prob */ /* comps - matrix of new fetature vectors used to update prob */ virtual void AddFeature(float W, int* comps, int x =0, int y = 0) = 0; @@ -1185,7 +1237,7 @@ public: inline void cvReleaseProb(CvProb** ppProb){ppProb[0]->Release();ppProb[0]=NULL;} /* HIST API */ -/* some Prob */ +/* Some Prob: */ CV_EXPORTS CvProb* cvCreateProbS(int dim, CvSize size, int sample_num); CV_EXPORTS CvProb* cvCreateProbMG(int dim, CvSize size, int sample_num); CV_EXPORTS CvProb* cvCreateProbMG2(int dim, CvSize size, int sample_num); @@ -1206,13 +1258,14 @@ inline CvProb* cvCreateProb(int type, int dim, CvSize size = cvSize(1,1), void* -/* noise types defenition */ +/* Noise type definitions: */ #define CV_NOISE_NONE 0 #define CV_NOISE_GAUSSIAN 1 #define CV_NOISE_UNIFORM 2 #define CV_NOISE_SPECKLE 3 #define CV_NOISE_SALT_AND_PEPPER 4 -/* Add some noise to image */ + +/* Add some noise to image: */ /* pImg - (input) image without noise */ /* pImg - (output) image with noise */ /* noise_type - type of added noise */ @@ -1227,36 +1280,42 @@ CV_EXPORTS void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandSt /*================== GENERATOR OF TEST VIDEO SEQUENCE ===================== */ typedef void CvTestSeq; -/* pConfigfile - name of file (yml or xml) with description of test sequence */ +/* pConfigfile - Name of file (yml or xml) with description of test sequence */ /* videos - array of names of test videos described in "pConfigfile" file */ /* numvideos - size of "videos" array */ CV_EXPORTS CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float Scale = 1, int noise_type = CV_NOISE_NONE, double noise_ampl = 0); CV_EXPORTS void cvReleaseTestSeq(CvTestSeq** ppTestSeq); -/* generete next frame from test video seq and return pointer to it */ +/* Generate next frame from test video seq and return pointer to it: */ CV_EXPORTS IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq); -/* return pointer to current foreground mask */ + +/* Return pointer to current foreground mask: */ CV_EXPORTS IplImage* cvTestSeqGetFGMask(CvTestSeq* pTestSeq); -/* return pointer to current image */ + +/* Return pointer to current image: */ CV_EXPORTS IplImage* cvTestSeqGetImage(CvTestSeq* pTestSeq); -/* return frame size of result test video */ + +/* Return frame size of result test video: */ CV_EXPORTS CvSize cvTestSeqGetImageSize(CvTestSeq* pTestSeq); -/* return number of frames result test video */ + +/* Return number of frames result test video: */ CV_EXPORTS int cvTestSeqFrameNum(CvTestSeq* pTestSeq); -/* return number of existed objects - this is general number of any objects. -for example number of trajectories may be equal or less than returned value*/ +/* Return number of existing objects. + * This is general number of any objects. + * For example number of trajectories may be equal or less than returned value: + */ CV_EXPORTS int cvTestSeqGetObjectNum(CvTestSeq* pTestSeq); -/* return 0 if there is not position for current defined on current frame */ -/* return 1 if there is object position and pPos was filled */ +/* Return 0 if there is not position for current defined on current frame */ +/* Return 1 if there is object position and pPos was filled */ CV_EXPORTS int cvTestSeqGetObjectPos(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pPos); CV_EXPORTS int cvTestSeqGetObjectSize(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pSize); -/* add noise to finile image */ +/* Add noise to final image: */ CV_EXPORTS void cvTestSeqAddNoise(CvTestSeq* pTestSeq, int noise_type = CV_NOISE_NONE, double noise_ampl = 0); -/* add Intensity variation */ + +/* Add Intensity variation: */ CV_EXPORTS void cvTestSeqAddIntensityVariation(CvTestSeq* pTestSeq, float DI_per_frame, float MinI, float MaxI); CV_EXPORTS void cvTestSeqSetFrame(CvTestSeq* pTestSeq, int n); diff --git a/cvaux/src/Makefile.am b/cvaux/src/Makefile.am index 2a11b13..28dd9a4 100644 --- a/cvaux/src/Makefile.am +++ b/cvaux/src/Makefile.am @@ -1,3 +1,6 @@ +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + EXTRA_DIST = cvaux.dsp cvaux.vcproj cvaux.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cvaux/include -I$(top_srcdir)/cxcore/include -I$(top_srcdir)/cv/include -I$(top_srcdir)/cv/src -I$(top_srcdir) diff --git a/cvaux/src/Makefile.in b/cvaux/src/Makefile.in index efede7a..b6d7f69 100644 --- a/cvaux/src/Makefile.in +++ b/cvaux/src/Makefile.in @@ -133,10 +133,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -159,8 +163,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -171,6 +177,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -189,11 +197,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -213,10 +226,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ @@ -280,6 +295,9 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ + +# use the default c++ flags +AM_CXXFLAGS = @DEF_CXXFLAGS@ EXTRA_DIST = cvaux.dsp cvaux.vcproj cvaux.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cvaux/include -I$(top_srcdir)/cxcore/include -I$(top_srcdir)/cv/include -I$(top_srcdir)/cv/src -I$(top_srcdir) noinst_HEADERS = _cvaux.h _cvfacedetection.h _cvvectrack.h _cvvm.h diff --git a/cvaux/src/_cvfacedetection.h b/cvaux/src/_cvfacedetection.h index b8ed4da..8c41be4 100644 --- a/cvaux/src/_cvfacedetection.h +++ b/cvaux/src/_cvfacedetection.h @@ -102,7 +102,7 @@ inline void FaceFeature::SetWeight(double dWeight) class FaceTemplate { public: - FaceTemplate(long lFeatureCount) {m_lFeturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];}; + FaceTemplate(long lFeatureCount) {m_lFeaturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];}; virtual ~FaceTemplate(); inline long GetCount(); @@ -111,13 +111,13 @@ public: protected: FaceFeature * m_lpFeaturesList; private: - long m_lFeturesCount; + long m_lFeaturesCount; };//class FaceTemplate inline long FaceTemplate::GetCount() { - return m_lFeturesCount; + return m_lFeaturesCount; }//inline long FaceTemplate::GetCount() @@ -229,8 +229,8 @@ public: virtual double GetWeight() = 0; protected: FaceFeature * m_lpIdealFace;//ideal face definition - long m_lFaceFeaturesNumber; //total number of diferent face fetures - long * m_lplFaceFeaturesCount;//number of each fetures fouded for this face + long m_lFaceFeaturesNumber; //total number of diferent face features + long * m_lplFaceFeaturesCount;//number of each features fouded for this face FaceFeature ** m_lppFoundedFaceFeatures;//founded features of curen face double m_dWeight; }; diff --git a/cvaux/src/cv3dtracker.cpp b/cvaux/src/cv3dtracker.cpp index 69005b5..aa8a0e3 100644 --- a/cvaux/src/cv3dtracker.cpp +++ b/cvaux/src/cv3dtracker.cpp @@ -141,7 +141,8 @@ CV_IMPL CvBool cv3dTrackerCalibrateCameras(int num_cameras, if (samples[c]->nChannels == 3) { // convert to gray - if (gray_img == NULL || !CV_ARE_SIZES_EQ(gray_img, samples[c])) + if (gray_img == NULL || gray_img->width != samples[c]->width || + gray_img->height != samples[c]->height ) { if (gray_img != NULL) cvReleaseImage(&gray_img); @@ -158,7 +159,8 @@ CV_IMPL CvBool cv3dTrackerCalibrateCameras(int num_cameras, img = samples[c]; } - if (tmp_img == NULL || !CV_ARE_SIZES_EQ(tmp_img, samples[c])) + if (tmp_img == NULL || tmp_img->width != samples[c]->width || + tmp_img->height != samples[c]->height ) { if (tmp_img != NULL) cvReleaseImage(&tmp_img); diff --git a/cvaux/src/cvaux.dsp b/cvaux/src/cvaux.dsp index e349a3c..f115cd8 100644 --- a/cvaux/src/cvaux.dsp +++ b/cvaux/src/cvaux.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=cvaux - Win32 Debug64 Itanium +CFG=cvaux - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,23 +13,19 @@ CFG=cvaux - Win32 Debug64 Itanium !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "cvaux.mak" CFG="cvaux - Win32 Debug64 Itanium" +!MESSAGE NMAKE /f "cvaux.mak" CFG="cvaux - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "cvaux - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "cvaux - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cvaux - Win32 Release64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cvaux - Win32 Debug64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cvaux - Win32 Release64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cvaux - Win32 Debug64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=xicl6.exe +CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -42,8 +38,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cvaux_Rls" -# PROP Intermediate_Dir "..\..\_temp\cvaux_Rls" +# PROP Output_Dir "..\..\_temp\cvaux_Release" +# PROP Intermediate_Dir "..\..\_temp\cvaux_Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" LIB32=link.exe -lib @@ -56,7 +52,7 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 cv.lib cxcore.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /pdb:"..\..\bin/cvaux100.pdb" /debug /machine:I386 /nodefaultlib:"libmmd.lib" /out:"..\..\bin/cvaux100.dll" /implib:"..\..\lib/cvaux.lib" /libpath:"..\..\lib" # SUBTRACT LINK32 /profile /pdb:none @@ -70,8 +66,8 @@ LINK32=xilink6.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cvaux_Dbg" -# PROP Intermediate_Dir "..\..\_temp\cvaux_Dbg" +# PROP Output_Dir "..\..\_temp\cvaux_Debug" +# PROP Intermediate_Dir "..\..\_temp\cvaux_Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" LIB32=link.exe -lib @@ -85,142 +81,17 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 cvd.lib cxcored.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /pdb:"..\..\bin/cvaux100d.pdb" /debug /machine:I386 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin/cvaux100d.dll" /implib:"..\..\lib/cvauxd.lib" /pdbtype:sept /libpath:"..\..\lib" # SUBTRACT LINK32 /pdb:none -!ELSEIF "$(CFG)" == "cvaux - Win32 Release64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cvaux___Win32_Release64" -# PROP BASE Intermediate_Dir "cvaux___Win32_Release64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cvaux_Rls64" -# PROP Intermediate_Dir "..\..\_temp\cvaux_Rls64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "NDEBUG" /D "CVAPI_EXPORTS" /D "WIN32" /D "_WINDOWS" /Yu"_cvaux.h" /FD /Zm200 /c -# ADD CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "." /I ".." /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "NDEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /Yu"_cvaux.h" /FD /Zm200 /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 cv.lib cxcore.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin/cvaux100.dll" /implib:"..\..\lib/cvaux.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /profile -# ADD LINK32 cv_64.lib cxcore_64.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin/cvaux100_64.dll" /implib:"..\..\lib/cvaux_64.lib" /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cvaux - Win32 Debug64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cvaux___Win32_Debug64" -# PROP BASE Intermediate_Dir "cvaux___Win32_Debug64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cvaux_Dbg64" -# PROP Intermediate_Dir "..\..\_temp\cvaux_Dbg64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MDd /W4 /Gm /Zi /Od /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "_DEBUG" /D "CVAPI_EXPORTS" /D "WIN32" /D "_WINDOWS" /FR /Yu"_cvaux.h" /FD /GZ /Zm200 /c -# SUBTRACT BASE CPP /X -# ADD CPP /nologo /MDd /W4 /Gm /Zi /Od /I "." /I ".." /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cvaux.h" /FD /Zm200 /Wp64 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 cvd.lib cxcored.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin/cvaux100d.dll" /implib:"..\..\lib/cvauxd.lib" /pdbtype:sept /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 cvd_64.lib cxcored_64.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /pdb:"..\..\bin/cvaux100d_64.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin/cvaux100d_64.dll" /implib:"..\..\lib/cvauxd_64.lib" /pdbtype:sept /libpath:"..\..\lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cvaux - Win32 Release64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cvaux___Win32_Release64_Itanium" -# PROP BASE Intermediate_Dir "cvaux___Win32_Release64_Itanium" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cvaux_RlsI7" -# PROP Intermediate_Dir "..\..\_temp\cvaux_RlsI7" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "NDEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /Yu"_cvaux.h" /FD /Zm200 /c -# ADD CPP /nologo /MD /w /W0 /Zi /O2 /Ob2 /I "." /I ".." /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "NDEBUG" /D "WIN32" /D "WIN64" /Yu"_cvaux.h" /FD /Zm200 /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 cv_i7.lib cxcore_i7.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin/cvaux100_i7.dll" /implib:"..\..\lib/cvaux_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 cv_i7.lib cxcore_i7.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /debug /machine:IX86 /out:"..\..\bin/cvaux100_i7.dll" /implib:"..\..\lib/cvaux_i7.lib" /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cvaux - Win32 Debug64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cvaux___Win32_Debug64_Itanium" -# PROP BASE Intermediate_Dir "cvaux___Win32_Debug64_Itanium" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cvaux_DbgI7" -# PROP Intermediate_Dir "..\..\_temp\cvaux_DbgI7" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MDd /W4 /Gm /Zi /Od /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cvaux.h" /FD /Zm200 /Wp64 /c -# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "." /I ".." /I "../include" /I "../../cxcore/include" /I "../../cv/include" /I "../../cv/src" /D "CVAPI_EXPORTS" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cvaux.h" /FD /Zm200 /Qwd167 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 cvd_i7.lib cxcored_i7.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /pdb:"..\..\bin/cvaux100d_i7.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin/cvaux100d_i7.dll" /implib:"..\..\lib/cvauxd_i7.lib" /pdbtype:sept /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 cvd_i7.lib cxcored_i7.lib kernel32.lib user32.lib gdi32.lib /nologo /dll /pdb:"..\..\bin/cvaux100d_i7.pdb" /debug /machine:IX86 /out:"..\..\bin/cvaux100d_i7.dll" /implib:"..\..\lib/cvauxd_i7.lib" /pdbtype:sept /libpath:"..\..\lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - !ENDIF # Begin Target # Name "cvaux - Win32 Release" # Name "cvaux - Win32 Debug" -# Name "cvaux - Win32 Release64" -# Name "cvaux - Win32 Debug64" -# Name "cvaux - Win32 Release64 Itanium" -# Name "cvaux - Win32 Debug64 Itanium" # Begin Group "Src" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" diff --git a/cvaux/src/cvaux.vcproj b/cvaux/src/cvaux.vcproj index f7724b7..e69de29 100644 --- a/cvaux/src/cvaux.vcproj +++ b/cvaux/src/cvaux.vcproj @@ -1,2930 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvaux/src/cvbgfg_acmmm2003.cpp b/cvaux/src/cvbgfg_acmmm2003.cpp index 7a7d864..bcb03b3 100644 --- a/cvaux/src/cvbgfg_acmmm2003.cpp +++ b/cvaux/src/cvbgfg_acmmm2003.cpp @@ -38,6 +38,15 @@ // //M*/ + +// This file implements the foreground/background pixel +// discrimination algorithm described in +// +// Foreground Object Detection from Videos Containing Complex Background +// Li, Huan, Gu, Tian 2003 9p +// http://muq.org/~cynbe/bib/foreground-object-detection-from-videos-containing-complex-background.pdf + + #include "_cvaux.h" #include @@ -48,9 +57,12 @@ static double* _cv_max_element( double* start, double* end ) { double* p = start++; - for( ; start != end; start++ ) - if( *p < *start ) - p = start; + + for( ; start != end; ++start) { + + if (*p < *start) p = start; + } + return p; } @@ -58,7 +70,7 @@ static void CV_CDECL icvReleaseFGDStatModel( CvFGDStatModel** model ); static int CV_CDECL icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ); -// Function cvCreateFGDStatModel initializes foreground detection process +// Function cvCreateFGDStatModel initializes foreground detection process // parameters: // first_frame - frame from video sequence // parameters - (optional) if NULL default parameters of the algorithm will be used @@ -81,23 +93,28 @@ cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters ) if (first_frame->nChannels != 3) CV_ERROR( CV_StsBadArg, "first_frame must have 3 color channels" ); - //init parameters + // Initialize parameters: if( parameters == NULL ) { - params.Lc = CV_BGFG_FGD_LC; - params.N1c = CV_BGFG_FGD_N1C; - params.N2c = CV_BGFG_FGD_N2C; - params.Lcc = CV_BGFG_FGD_LCC; - params.N1cc = CV_BGFG_FGD_N1CC; - params.N2cc = CV_BGFG_FGD_N2CC; - params.delta = CV_BGFG_FGD_DELTA; - params.alpha1 = CV_BGFG_FGD_ALPHA_1; - params.alpha2 = CV_BGFG_FGD_ALPHA_2; - params.alpha3 = CV_BGFG_FGD_ALPHA_3; - params.T = CV_BGFG_FGD_T; + params.Lc = CV_BGFG_FGD_LC; + params.N1c = CV_BGFG_FGD_N1C; + params.N2c = CV_BGFG_FGD_N2C; + + params.Lcc = CV_BGFG_FGD_LCC; + params.N1cc = CV_BGFG_FGD_N1CC; + params.N2cc = CV_BGFG_FGD_N2CC; + + params.delta = CV_BGFG_FGD_DELTA; + + params.alpha1 = CV_BGFG_FGD_ALPHA_1; + params.alpha2 = CV_BGFG_FGD_ALPHA_2; + params.alpha3 = CV_BGFG_FGD_ALPHA_3; + + params.T = CV_BGFG_FGD_T; params.minArea = CV_BGFG_FGD_MINAREA; + params.is_obj_without_holes = 1; - params.perform_morphing = 1; + params.perform_morphing = 1; } else { @@ -111,8 +128,8 @@ cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters ) p_model->update = (CvUpdateBGStatModel)icvUpdateFGDStatModel;; p_model->params = params; - //init storages - pixel_count = first_frame->width*first_frame->height; + // Initialize storage pools: + pixel_count = first_frame->width * first_frame->height; buf_size = pixel_count*sizeof(p_model->pixel_stat[0]); CV_CALL( p_model->pixel_stat = (CvBGPixelStat*)cvAlloc(buf_size) ); @@ -126,19 +143,20 @@ cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters ) CV_CALL( p_model->pixel_stat[0].cctable = (CvBGPixelCCStatTable*)cvAlloc(buf_size) ); memset( p_model->pixel_stat[0].cctable, 0, buf_size ); - for( i = 0, k = 0; i < first_frame->height; i++ ) - for( j = 0; j < first_frame->width; j++, k++ ) + for( i = 0, k = 0; i < first_frame->height; i++ ) { + for( j = 0; j < first_frame->width; j++, k++ ) { p_model->pixel_stat[k].ctable = p_model->pixel_stat[0].ctable + k*params.N2c; p_model->pixel_stat[k].cctable = p_model->pixel_stat[0].cctable + k*params.N2cc; } + } - //init temporary images + // Init temporary images: CV_CALL( p_model->Ftd = cvCreateImage(cvSize(first_frame->width, first_frame->height), IPL_DEPTH_8U, 1)); CV_CALL( p_model->Fbd = cvCreateImage(cvSize(first_frame->width, first_frame->height), IPL_DEPTH_8U, 1)); CV_CALL( p_model->foreground = cvCreateImage(cvSize(first_frame->width, first_frame->height), IPL_DEPTH_8U, 1)); - CV_CALL( p_model->background = cvCloneImage(first_frame)); + CV_CALL( p_model->background = cvCloneImage(first_frame)); CV_CALL( p_model->prev_frame = cvCloneImage(first_frame)); CV_CALL( p_model->storage = cvCreateMemStorage()); @@ -205,16 +223,29 @@ cvChangeDetection( IplImage* prev_frame, int i, j, b, x, y, thres; const int PIXELRANGE=256; - if( !prev_frame || !curr_frame || !change_mask || - prev_frame->nChannels != 3 || curr_frame->nChannels != 3 || change_mask->nChannels != 1 || - prev_frame->depth != IPL_DEPTH_8U || curr_frame->depth != IPL_DEPTH_8U || change_mask->depth != IPL_DEPTH_8U || - !CV_ARE_SIZES_EQ( prev_frame, curr_frame ) || !CV_ARE_SIZES_EQ( prev_frame, change_mask ) ) return 0; + if( !prev_frame + || !curr_frame + || !change_mask + || prev_frame->nChannels != 3 + || curr_frame->nChannels != 3 + || change_mask->nChannels != 1 + || prev_frame->depth != IPL_DEPTH_8U + || curr_frame->depth != IPL_DEPTH_8U + || change_mask->depth != IPL_DEPTH_8U + || prev_frame->width != curr_frame->width + || prev_frame->height != curr_frame->height + || prev_frame->width != change_mask->width + || prev_frame->height != change_mask->height + ){ + return 0; + } cvZero ( change_mask ); // All operations per colour for (b=0 ; bnChannels ; b++) { - // create histogram + + // Create histogram: long HISTOGRAM[PIXELRANGE]; for (i=0 ; istorage); cvZero(model->foreground); - //form FG pixels candidates using image differencing with adaptive threshold [P.Rosin, Thresholding for change detection, ICCV, 1998 ] + // From foreground pixel candidates using image differencing + // with adaptive thresholding. The algorithm is from: + // + // Thresholding for Change Detection + // Paul L. Rosin 1998 6p + // http://www.cis.temple.edu/~latecki/Courses/CIS750-03/Papers/thresh-iccv.pdf + // cvChangeDetection( prev_frame, curr_frame, model->Ftd ); cvChangeDetection( model->background, curr_frame, model->Fbd ); @@ -319,23 +357,31 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) { if( ((uchar*)model->Fbd->imageData)[i*mask_step+j] || ((uchar*)model->Ftd->imageData)[i*mask_step+j] ) { - float Pb=0, Pv=0, Pvb=0; + float Pb = 0; + float Pv = 0; + float Pvb = 0; + CvBGPixelStat* stat = model->pixel_stat + i * model->Ftd->width + j; - CvBGPixelCStatTable* ctable = stat->ctable; + + CvBGPixelCStatTable* ctable = stat->ctable; CvBGPixelCCStatTable* cctable = stat->cctable; - uchar* curr_data = (uchar*)(curr_frame->imageData)+i*curr_frame->widthStep+j*3; - uchar* prev_data = (uchar*)(prev_frame->imageData)+i*prev_frame->widthStep+j*3; + uchar* curr_data = (uchar*)(curr_frame->imageData) + i*curr_frame->widthStep + j*3; + uchar* prev_data = (uchar*)(prev_frame->imageData) + i*prev_frame->widthStep + j*3; int val = 0; - // is it a motion pixel? + + // Is it a motion pixel? if( ((uchar*)model->Ftd->imageData)[i*mask_step+j] ) { - if( !stat->is_trained_dyn_model ) val = 1; - else - { - //compare with stored CCt vectors - for( k = 0; PV_CC(k) > model->params.alpha2 && k < model->params.N1cc; k++ ) + if( !stat->is_trained_dyn_model ) { + + val = 1; + + } else { + + // Compare with stored CCt vectors: + for( k = 0; PV_CC(k) > model->params.alpha2 && k < model->params.N1cc; k++ ) { if ( abs( V_CC(k,0) - prev_data[0]) <= deltaCC && abs( V_CC(k,1) - prev_data[1]) <= deltaCC && @@ -354,8 +400,8 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } else if( stat->is_trained_st_model ) { - //compare with stored Ct vectors - for( k = 0; PV_C(k) > model->params.alpha2 && k < model->params.N1c; k++ ) + // Compare with stored Ct vectors: + for( k = 0; PV_C(k) > model->params.alpha2 && k < model->params.N1c; k++ ) { if ( abs( V_C(k,0) - curr_data[0]) <= deltaC && abs( V_C(k,1) - curr_data[1]) <= deltaC && @@ -368,24 +414,28 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) Pb = stat->Pbc; if( 2 * Pvb * Pb <= Pv ) val = 1; } - //update FG + + // Update foreground: ((uchar*)model->foreground->imageData)[i*mask_step+j] = (uchar)(val*255); FG_pixels_count += val; - }// end if( change detection... - }//for j... - } //for i... + + } // end if( change detection... + } // for j... + } // for i... //end BG/FG classification - //foreground segmentation - //smooth FG map + // Foreground segmentation. + // Smooth foreground map: if( model->params.perform_morphing ){ - cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_OPEN, 1 ); - cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_CLOSE, 1 ); + cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_OPEN, model->params.perform_morphing ); + cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_CLOSE, model->params.perform_morphing ); } if( model->params.minArea > 0 || model->params.is_obj_without_holes ){ - //filter small regions + + // Discard under-size foreground regions: + // cvFindContours( model->foreground, model->storage, &first_seq, sizeof(CvContour), CV_RETR_LIST ); for( seq = first_seq; seq; seq = seq->h_next ) { @@ -393,7 +443,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) if( cnt->rect.width * cnt->rect.height < model->params.minArea || (model->params.is_obj_without_holes && CV_IS_SEQ_HOLE(seq)) ) { - //delete small contour + // Delete under-size contour: prev_seq = seq->h_prev; if( prev_seq ) { @@ -414,12 +464,13 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) model->foreground_regions = first_seq; cvZero(model->foreground); cvDrawContours(model->foreground, first_seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1); - } - else{ + + } else { + model->foreground_regions = NULL; } - //check ALL BG update condition + // Check ALL BG update condition: if( ((float)FG_pixels_count/(model->Ftd->width*model->Ftd->height)) > CV_BGFG_FGD_BG_UPDATE_TRESH ) { for( i = 0; i < model->Ftd->height; i++ ) @@ -431,7 +482,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } - //update BG model + // Update background model: for( i = 0; i < model->Ftd->height; i++ ) { for( j = 0; j < model->Ftd->width; j++ ) @@ -456,7 +507,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) stat->Pbcc += alpha; } - // find best Vi match + // Find best Vi match: for(k = 0; PV_CC(k) && k < model->params.N2cc; k++ ) { // Exponential decay of memory @@ -488,7 +539,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) if( indx < 0 ) - {//N2th elem in the table is replaced by a new features + { // Replace N2th elem in the table by new feature: indx = model->params.N2cc - 1; PV_CC(indx) = alpha; PVB_CC(indx) = alpha; @@ -500,7 +551,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } } else - {//update + { // Update: PV_CC(indx) += alpha; if( !((uchar*)model->foreground->imageData)[i*mask_step+j] ) { @@ -536,7 +587,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) if( sum1 > model->params.T ) stat->is_trained_dyn_model = 1; diff = sum1 - stat->Pbcc * sum2; - //update stat table + // Update stat table: if( diff > model->params.T ) { //printf("once off change at motion mode\n"); @@ -550,7 +601,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } } - //case of stational pixel + // Handle "stationary" pixel: if( !((uchar*)model->Ftd->imageData)[i*mask_step+j] ) { float alpha = stat->is_trained_st_model ? model->params.alpha2 : model->params.alpha3; @@ -627,7 +678,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } } - //check "once-off" changes + // Check "once-off" changes: float sum1=0, sum2=0; for( k = 0; PV_C(k) && k < model->params.N1c; k++ ) { @@ -637,7 +688,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) diff = sum1 - stat->Pbc * sum2; if( sum1 > model->params.T ) stat->is_trained_st_model = 1; - //update stat table + // Update stat table: if( diff > model->params.T ) { //printf("once off change at stat mode\n"); @@ -648,9 +699,9 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } stat->Pbc = 1 - stat->Pbc; } - }//if !(change detection) at pixel (i,j) + } // if !(change detection) at pixel (i,j) - //update the reference BG image + // Update the reference BG image: if( !((uchar*)model->foreground->imageData)[i*mask_step+j]) { uchar* ptr = ((uchar*)model->background->imageData) + i*model->background->widthStep+j*3; @@ -658,7 +709,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) if( !((uchar*)model->Ftd->imageData)[i*mask_step+j] && !((uchar*)model->Fbd->imageData)[i*mask_step+j] ) { - //apply IIR filter + // Apply IIR filter: for( l = 0; l < 3; l++ ) { int a = cvRound(ptr[l]*(1 - model->params.alpha1) + model->params.alpha1*curr_data[l]); @@ -669,7 +720,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } else { - //background change is detected + // Background change detected: for( l = 0; l < 3; l++ ) { //((uchar*)model->background->imageData)[i*model->background->widthStep+j*3+l] = curr_data[l]; @@ -677,10 +728,10 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model ) } } } - }//j - }//i + } // j + } // i - //keep prev frame + // Keep previous frame: cvCopy( curr_frame, model->prev_frame ); return region_count; diff --git a/cvaux/src/cvbgfg_gaussmix.cpp b/cvaux/src/cvbgfg_gaussmix.cpp index 46998db..f4655cd 100644 --- a/cvaux/src/cvbgfg_gaussmix.cpp +++ b/cvaux/src/cvbgfg_gaussmix.cpp @@ -39,11 +39,14 @@ //M*/ -//This is based on the "An Improved Adaptive Background Mixture Model for -//Real-time Tracking and Shadow Detection" by P. KaewTraKulPong and R. Bowden -//The windowing method is used, but not the shadow detection. I make some of my -//own modifications which make more sense. There are some errors in some of their -//equations. +// This is based on the "An Improved Adaptive Background Mixture Model for +// Real-time Tracking with Shadow Detection" by P. KaewTraKulPong and R. Bowden +// http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf +// +// The windowing method is used, but not the shadow detection. I make some of my +// own modifications which make more sense. There are some errors in some of their +// equations. +// //IplImage values of image that are useful //int nSize; /* sizeof(IplImage) */ //int depth; /* pixel depth in bits: IPL_DEPTH_8U ...*/ @@ -106,7 +109,7 @@ static void icvUpdatePartialNoMatch( double* src_pixel, int nChannels, static void icvGetSortKey( const int nChannels, double* sort_key, const CvGaussBGPoint* g_point, const CvGaussBGStatModelParams *bg_model_params ); -static void icvBackgroundTest( const int nChannels, int n, int p, int *match, CvGaussBGModel* bg_model ); +static void icvBackgroundTest( const int nChannels, int n, int i, int j, int *match, CvGaussBGModel* bg_model ); static void CV_CDECL icvReleaseGaussianBGModel( CvGaussBGModel** bg_model ); static int CV_CDECL icvUpdateGaussianBGModel( IplImage* curr_frame, CvGaussBGModel* bg_model ); @@ -144,14 +147,16 @@ cvCreateGaussianBGModel( IplImage* first_frame, CvGaussBGStatModelParams* parame //init parameters if( parameters == NULL ) - { - params.win_size = CV_BGFG_MOG_WINDOW_SIZE; - params.bg_threshold = CV_BGFG_MOG_BACKGROUND_THRESHOLD; + { /* These constants are defined in cvaux/include/cvaux.h: */ + params.win_size = CV_BGFG_MOG_WINDOW_SIZE; + params.bg_threshold = CV_BGFG_MOG_BACKGROUND_THRESHOLD; + params.std_threshold = CV_BGFG_MOG_STD_THRESHOLD; - params.weight_init = CV_BGFG_MOG_WEIGHT_INIT; + params.weight_init = CV_BGFG_MOG_WEIGHT_INIT; + params.variance_init = CV_BGFG_MOG_SIGMA_INIT*CV_BGFG_MOG_SIGMA_INIT; - params.minArea = CV_BGFG_MOG_MINAREA; - params.n_gauss = CV_BGFG_MOG_NGAUSSIANS; + params.minArea = CV_BGFG_MOG_MINAREA; + params.n_gauss = CV_BGFG_MOG_NGAUSSIANS; } else { @@ -304,7 +309,7 @@ icvUpdateGaussianBGModel( IplImage* curr_frame, CvGaussBGModel* bg_model ) } icvGetSortKey( nChannels, sort_key, g_point, &bg_model_params ); icvInsertionSortGaussians( g_point, sort_key, (CvGaussBGStatModelParams *)&bg_model_params ); - icvBackgroundTest( nChannels, n, p, match, bg_model ); + icvBackgroundTest( nChannels, n, i, j, match, bg_model ); } } @@ -567,7 +572,7 @@ static void icvGetSortKey( const int nChannels, double* sort_key, const CvGaussB } -static void icvBackgroundTest( const int nChannels, int n, int p, int *match, CvGaussBGModel* bg_model ) +static void icvBackgroundTest( const int nChannels, int n, int i, int j, int *match, CvGaussBGModel* bg_model ) { int m, b; uchar pixelValue = (uchar)255; // will switch to 0 if match found @@ -575,7 +580,7 @@ static void icvBackgroundTest( const int nChannels, int n, int p, int *match, Cv CvGaussBGPoint* g_point = bg_model->g_point; for( m = 0; m < nChannels; m++) - bg_model->background->imageData[p+m] = (unsigned char)(g_point[n].g_values[0].mean[m]+0.5); + bg_model->background->imageData[ bg_model->background->widthStep*i + j*nChannels + m] = (unsigned char)(g_point[n].g_values[0].mean[m]+0.5); for( b = 0; b < bg_model->params.n_gauss; b++) { @@ -586,7 +591,7 @@ static void icvBackgroundTest( const int nChannels, int n, int p, int *match, Cv break; } - bg_model->foreground->imageData[p/nChannels] = pixelValue; + bg_model->foreground->imageData[ bg_model->foreground->widthStep*i + j] = pixelValue; } /* End of file. */ diff --git a/cvaux/src/cveigenobjects.cpp b/cvaux/src/cveigenobjects.cpp index 645e130..041aa98 100644 --- a/cvaux/src/cveigenobjects.cpp +++ b/cvaux/src/cveigenobjects.cpp @@ -1037,14 +1037,14 @@ icvEigenDecomposite_8u32fR( uchar * obj, int objStep, int nEigObjs, // an object) using previously calculated eigen objects basis, mean (averaged) // object and decomposition coefficients of the restored object // Context: -// Parameters: nEigObjs - number of eigen objects -// eigens - array of pointers to eigen objects -// eigStep - eigen objects step (in bytes) -// coeffs - previousely calculated decomposition coefficients -// avg - pointer to averaged object -// avgStep - its step (in bytes) -// rest - pointer to restored object -// restStep - its step (in bytes) +// Parameters: nEigObjs - Number of eigen objects +// eigens - Array of pointers to eigen objects +// eigStep - Eigen objects step (in bytes) +// coeffs - Previously calculated decomposition coefficients +// avg - Pointer to averaged object +// avgStep - Its step (in bytes) +// rest - Pointer to restored object +// restStep - Its step (in bytes) // size - ROI size of each object // // Returns: CV status diff --git a/cvaux/src/cvface.h b/cvaux/src/cvface.h index fec5d62..66f2263 100644 --- a/cvaux/src/cvface.h +++ b/cvaux/src/cvface.h @@ -64,10 +64,10 @@ public: virtual bool CheckElem(void * lpCandidat,void * lpIdeal) = 0; virtual double GetWeight() = 0; protected: - FaceFeature * m_lpIdealFace;//ideal face definition - long m_lFaceFeaturesNumber; //total number of diferent face fetures - long * m_lplFaceFeaturesCount;//number of each fetures fouded for this face - FaceFeature ** m_lppFoundedFaceFeatures;//founded features of curen face + FaceFeature * m_lpIdealFace; // Ideal face definition. + long m_lFaceFeaturesNumber; // Total number of different face features . + long * m_lplFaceFeaturesCount; // Count of each feature found on this face. + FaceFeature ** m_lppFoundedFaceFeatures; // Features found on current face. double m_dWeight; }; diff --git a/cvaux/src/vs/bgfg_estimation.cpp b/cvaux/src/vs/bgfg_estimation.cpp index a16fbec..65ae78b 100644 --- a/cvaux/src/vs/bgfg_estimation.cpp +++ b/cvaux/src/vs/bgfg_estimation.cpp @@ -39,8 +39,8 @@ //M*/ #include "_cvaux.h" -//Function cvCreateBGStatModel creates and returns initialized BG model -// parameters: +// Function cvCreateBGStatModel creates and returns initialized BG model. +// Parameters: // first_frame - frame from video sequence // model_type – type of BG model (CV_BG_MODEL_MOG, CV_BG_MODEL_FGD,…) // parameters - (optional) if NULL the default parameters of the algorithm will be used @@ -63,7 +63,7 @@ class CvFGDetectorBase:public CvFGDetector protected: CvBGStatModel* m_pFG; int m_FGType; - void* m_pFGParam; /* foreground params */ + void* m_pFGParam; /* Foreground parameters. */ CvFGDStatModelParams m_ParamFGD; CvGaussBGStatModelParams m_ParamMOG; char* m_SaveName; @@ -132,21 +132,23 @@ public: AddParam("ObjWithoutHoles",&m_ParamFGD.is_obj_without_holes); AddParam("Morphology",&m_ParamFGD.perform_morphing); } - else if( m_FGType == CV_BG_MODEL_MOG ) + else if( m_FGType == CV_BG_MODEL_MOG ) // "MOG" == "Mixture Of Gaussians" { if(m_pFGParam) { m_ParamMOG = *(CvGaussBGStatModelParams*)m_pFGParam; } else - { - m_ParamMOG.win_size = CV_BGFG_MOG_WINDOW_SIZE; - m_ParamMOG.bg_threshold = CV_BGFG_MOG_BACKGROUND_THRESHOLD; + { // These constants are all from cvaux/include/cvaux.h + m_ParamMOG.win_size = CV_BGFG_MOG_WINDOW_SIZE; + m_ParamMOG.bg_threshold = CV_BGFG_MOG_BACKGROUND_THRESHOLD; + m_ParamMOG.std_threshold = CV_BGFG_MOG_STD_THRESHOLD; - m_ParamMOG.weight_init = CV_BGFG_MOG_WEIGHT_INIT; + m_ParamMOG.weight_init = CV_BGFG_MOG_WEIGHT_INIT; + m_ParamMOG.variance_init = CV_BGFG_MOG_SIGMA_INIT*CV_BGFG_MOG_SIGMA_INIT; - m_ParamMOG.minArea = CV_BGFG_MOG_MINAREA; - m_ParamMOG.n_gauss = CV_BGFG_MOG_NGAUSSIANS; + m_ParamMOG.minArea = CV_BGFG_MOG_MINAREA; + m_ParamMOG.n_gauss = CV_BGFG_MOG_NGAUSSIANS; } AddParam("NG",&m_ParamMOG.n_gauss); } @@ -165,7 +167,8 @@ public: { return m_pFG?m_pFG->foreground:NULL; }; - /* process current image */ + + /* Process current image: */ virtual void Process(IplImage* pImg) { if(m_pFG == NULL) @@ -190,7 +193,8 @@ public: cvUpdateBGStatModel( pImg, m_pFG ); } }; - /* release foreground detector */ + + /* Release foreground detector: */ virtual void Release() { SaveState(0); diff --git a/cvaux/src/vs/blobtrackanalysis.cpp b/cvaux/src/vs/blobtrackanalysis.cpp index fc24653..7649d57 100644 --- a/cvaux/src/vs/blobtrackanalysis.cpp +++ b/cvaux/src/vs/blobtrackanalysis.cpp @@ -65,7 +65,7 @@ public: ~CvBlobTrackAnalysisList() { int i; - for(i=m_TrackAnalyserList.GetBlobNum();i>0;--i) + for(i=m_TrackAnalyserList.GetBlobNum(); i>0; --i) { DefTrackAnalyser* pF = (DefTrackAnalyser*)m_TrackAnalyserList.GetBlob(i-1); pF->pFilter->Release(); @@ -75,7 +75,7 @@ public: { DefTrackAnalyser* pF = (DefTrackAnalyser*)m_TrackAnalyserList.GetBlobByID(CV_BLOB_ID(pBlob)); if(pF == NULL) - { /* create new filter */ + { /* Create new filter: */ DefTrackAnalyser F; F.state = 0; F.blob = pBlob[0]; @@ -92,21 +92,21 @@ public: virtual void Process(IplImage* pImg, IplImage* pFG) { int i; - for(i=m_TrackAnalyserList.GetBlobNum();i>0;--i) + for(i=m_TrackAnalyserList.GetBlobNum(); i>0; --i) { DefTrackAnalyser* pF = (DefTrackAnalyser*)m_TrackAnalyserList.GetBlob(i-1); if(pF->m_LastFrame == m_Frame) - {/* process */ + { /* Process: */ int ID = CV_BLOB_ID(pF); pF->state = pF->pFilter->Process(&(pF->blob), pImg, pFG); CV_BLOB_ID(pF) = ID; } else - {/* delete blob filter */ + { /* Delete blob filter: */ pF->pFilter->Release(); m_TrackAnalyserList.DelBlob(i-1); } - }/* next blob */ + } /* Next blob. */ m_Frame++; }; float GetState(int BlobID) diff --git a/cvaux/src/vs/blobtrackanalysishist.cpp b/cvaux/src/vs/blobtrackanalysishist.cpp index 7a4efa2..07d87a1 100644 --- a/cvaux/src/vs/blobtrackanalysishist.cpp +++ b/cvaux/src/vs/blobtrackanalysishist.cpp @@ -43,6 +43,7 @@ #define MAX_FV_SIZE 5 #define BLOB_NUM 5 + typedef struct DefBlobFVN { CvBlob blob; @@ -50,7 +51,8 @@ typedef struct DefBlobFVN int state; int LastFrame; int FrameNum; -}DefBlobFVN; +} DefBlobFVN; + class CvBlobTrackFVGenN: public CvBlobTrackFVGen { private: @@ -81,7 +83,7 @@ public: int i; assert(dim <= MAX_FV_SIZE); m_Dim = dim; - for(i=0;iblob = pBlob[0]; - /* shift */ - for(i=(BLOB_NUM-1);i>0;--i) + /* Shift: */ + for(i=(BLOB_NUM-1); i>0; --i) { pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1]; } @@ -127,21 +130,21 @@ public: pFVBlob->BlobSeq[0] = pBlob[0]; if(m_Dim>0) - {/* calc FV position */ + { /* Calculate FV position: */ FV[0] = CV_BLOB_X(pBlob); FV[1] = CV_BLOB_Y(pBlob); } if(m_Dim<=2) - { /* add new FV if position is enought */ + { /* Add new FV if position is enough: */ *(int*)(FV+m_Dim) = CV_BLOB_ID(pBlob); cvSeqPush( m_pFVSeq, FV ); } else if(pFVBlob->FrameNum > BLOB_NUM) - { /* calc velocity for more complex FV */ + { /* Calculate velocity for more complex FV: */ float AverVx = 0; float AverVy = 0; - { /* average velocity */ + { /* Average velocity: */ CvBlob* pBlobSeq = pFVBlob->BlobSeq; int i; for(i=1;i4) - { /* state duration */ + { /* State duration: */ float T = (CV_BLOB_WX(pBlob)+CV_BLOB_WY(pBlob))*0.01f; if( fabs(AverVx) < T && fabs(AverVy) < T) @@ -165,27 +168,30 @@ public: else pFVBlob->state=0; FV[4] = (float)pFVBlob->state; - }/* state duration */ - /* add new FV */ + } /* State duration. */ + + /* Add new FV: */ *(int*)(FV+m_Dim) = CV_BLOB_ID(pBlob); cvSeqPush( m_pFVSeq, FV ); - }/* if velocity is calculated */ + + } /* If velocity is calculated. */ pFVBlob->FrameNum++; pFVBlob->LastFrame = m_Frame; }; /* AddBlob */ + void Process(IplImage* pImg, IplImage* /*pFG*/) { int i; if(!m_ClearFlag) Clear(); - for(i=m_BlobList.GetBlobNum();i>0;--i) - { /* delete unused blob */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Delete unused blob: */ DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlob(i-1); if(pFVBlob->LastFrame < m_Frame) { m_BlobList.DelBlob(i-1); } - }/* check next blob in list */ + } /* Check next blob in list. */ m_FVMin[0] = 0; m_FVMin[1] = 0; @@ -212,6 +218,7 @@ public: { return m_pFVSeq->total; }; + virtual float* GetFV(int index, int* pFVID) { float* pFV = (float*)cvGetSeqElem( m_pFVSeq, index ); @@ -289,10 +296,10 @@ public: BlobNew.FrameNum = 0; m_BlobList.AddBlob((CvBlob*)&BlobNew); pFVBlob = (DefBlobFVN*)m_BlobList.GetBlobByID(CV_BLOB_ID(pBlob)); - }/* add new record if need */ + } /* Add new record if necessary. */ - /* shift */ - for(i=(BLOB_NUM-1);i>0;--i) + /* Shift: */ + for(i=(BLOB_NUM-1); i>0; --i) { pFVBlob->BlobSeq[i] = pFVBlob->BlobSeq[i-1]; } @@ -300,13 +307,13 @@ public: pFVBlob->BlobSeq[0] = pBlob[0]; if(pFVBlob->FrameNum > BLOB_NUM) - {/* average velocity */ + { /* Average velocity: */ CvBlob* pBlobSeq = pFVBlob->BlobSeq; float T = (CV_BLOB_WX(pBlob)+CV_BLOB_WY(pBlob))*0.01f; float AverVx = 0; float AverVy = 0; int i; - for(i=1;istate == 5) - { /* object is stoped */ + { /* Object is stopped: */ float FV[MAX_FV_SIZE]; FV[0] = pFVBlob->blob.x; FV[1] = pFVBlob->blob.y; @@ -329,7 +336,7 @@ public: FV[3] = pFVBlob->BlobSeq[0].y; *(int*)(FV+m_Dim) = CV_BLOB_ID(pBlob); cvSeqPush( m_pFVSeq, FV ); - } /* object is stoped */ + } /* Object is stopped. */ pFVBlob->FrameNum++; pFVBlob->LastFrame = m_Frame; @@ -341,7 +348,7 @@ public: if(!m_ClearFlag) Clear(); for(i=m_BlobList.GetBlobNum();i>0;--i) - { /* delete unused blob */ + { /* Delete unused blob: */ DefBlobFVN* pFVBlob = (DefBlobFVN*)m_BlobList.GetBlob(i-1); if(pFVBlob->LastFrame < m_Frame) { @@ -354,9 +361,9 @@ public: cvSeqPush( m_pFVSeq, FV ); m_BlobList.DelBlob(i-1); } - }/* check next blob in list */ + } /* Check next blob in list. */ - /* set max min range */ + /* Set max min range: */ m_FVMin[0] = 0; m_FVMin[1] = 0; m_FVMin[2] = 0; @@ -379,19 +386,22 @@ public: { return m_pFVSeq->total; }; + virtual float* GetFV(int index, int* pFVID) { float* pFV = (float*)cvGetSeqElem( m_pFVSeq, index ); if(pFVID)pFVID[0] = *(int*)(pFV+m_Dim); return pFV; }; + virtual float* GetFVMin(){return m_FVMin;}; /* returned pointer to array of minimal values of FV, if return 0 then FVrange is not exist */ virtual float* GetFVMax(){return m_FVMax;}; /* returned pointer to array of maximal values of FV, if return 0 then FVrange is not exist */ virtual float* GetFVVar(){return m_FVVar;}; /* returned pointer to array of maximal values of FV, if return 0 then FVrange is not exist */ };/* CvBlobTrackFVGenSS */ + CvBlobTrackFVGen* cvCreateFVGenSS(){return (CvBlobTrackFVGen*)new CvBlobTrackFVGenSS;} -/*======================= TRAJECTORY ANALAZER MODULES =====================*/ +/*======================= TRAJECTORY ANALYZER MODULES =====================*/ /* Trajectory Analyser module */ #define SPARSE 0 #define ND 1 @@ -411,7 +421,7 @@ public: int m_Max; DefMat(int dim = 0, int* sizes = NULL, int type = SPARSE) { - /* create sparse or ND matrix but not both */ + /* Create sparse or ND matrix but not both: */ m_pSparseNode = NULL; m_pSparse = NULL; m_pND = NULL; @@ -451,7 +461,7 @@ public: { type = ND; } - }/* define matrix type */ + } /* Define matrix type. */ if(type == SPARSE) { @@ -500,7 +510,7 @@ public: cvReleaseFileStorage(&fs); } AfterLoad(); - }/* Load */ + } /* Load. */ void Load(CvFileStorage* fs, CvFileNode* node, char* name) { @@ -520,13 +530,14 @@ public: printf("WARNING!!! Can't load %s matrix\n",name); } AfterLoad(); - }/* Load */ + } /* Load. */ + void AfterLoad() { m_Volume = 0; m_Max = 0; if(m_pSparse) - {/* calculate Volume of loaded hist */ + { /* Calculate Volume of loaded hist: */ CvSparseMatIterator mat_iterator; CvSparseNode* node = cvInitSparseMatIterator( m_pSparse, &mat_iterator ); @@ -537,9 +548,10 @@ public: m_Volume += val; if(m_Max < val)m_Max = val; } - }/* calculate Volume of loaded hist */ + } /* Calculate Volume of loaded hist. */ + if(m_pND) - {/* calculate Volume of loaded hist */ + { /* Calculate Volume of loaded hist: */ CvMat mat; double max_val; double vol; @@ -550,20 +562,23 @@ public: cvMinMaxLoc( &mat, NULL, &max_val); m_Max = cvRound(max_val); /* MUST BE WRITTEN LATER */ - }/* calculate Volume of loaded hist */ - }/* AfterLoad */ + } /* Calculate Volume of loaded hist. */ + } /* AfterLoad. */ + int* GetPtr(int* indx) { if(m_pSparse) return (int*)cvPtrND( m_pSparse, indx, NULL, 1, NULL); if(m_pND) return (int*)cvPtrND( m_pND, indx, NULL, 1, NULL); return NULL; - }/* GetPtr */ + } /* GetPtr. */ + int GetVal(int* indx) { int* p = GetPtr(indx); if(p)return p[0]; return -1; - }/* GetVal */ + } /* GetVal. */ + int Add(int* indx, int val) { int NewVal; @@ -574,7 +589,8 @@ public: m_Volume += val; if(m_Max < NewVal)m_Max = NewVal; return NewVal; - }/* Add */ + } /* Add. */ + void Add(DefMat* pMatAdd) { int* pIDXS = NULL; @@ -583,7 +599,8 @@ public: { Add(pIDXS,Val); } - }/* Add */ + } /* Add. */ + int SetMax(int* indx, int val) { int NewVal; @@ -597,7 +614,8 @@ public: NewVal = pVal[0]; if(m_Max < NewVal)m_Max = NewVal; return NewVal; - }/* Add */ + } /* Add. */ + int GetNext(int** pIDXS, int init = 0) { int Val = 0; @@ -614,7 +632,8 @@ public: if(pVal)Val = pVal[0]; pIDXS[0] = CV_NODE_IDX( m_pSparse, m_pSparseNode ); } - }/* sparce matrix */ + }/* Sparse matrix. */ + if(m_pND) { int i; @@ -644,10 +663,14 @@ public: pIDXS[0] = m_IDXs; Val = GetVal(m_IDXs); } - }/* get next ND */ - }/* sparce matrix */ + + } /* Get next ND. */ + + } /* Sparse matrix. */ + return Val; - };/* GetNext */ + + }; /* GetNext. */ }; #define FV_NUM 10 @@ -662,7 +685,7 @@ typedef struct DefTrackFG } DefTrackFG; class CvBlobTrackAnalysisHist : public CvBlobTrackAnalysis { - /*---------------- internal functions --------------------*/ + /*---------------- Internal functions: --------------------*/ private: int m_BinNumParam; int m_SmoothRadius; @@ -696,21 +719,22 @@ private: m_HistVolumeSaved = m_HistMat.m_Volume; } void AllocData() - {/* AllocData */ + { /* AllocData: */ m_pFVi = (int*)cvAlloc(sizeof(int)*m_Dim); m_pFViVar = (int*)cvAlloc(sizeof(int)*m_Dim); m_pFViVarRes = (int*)cvAlloc(sizeof(int)*m_Dim); m_Sizes = (int*)cvAlloc(sizeof(int)*m_Dim); - { /* create init sparce matrix */ + { /* Create init sparce matrix: */ int i; for(i=0;i0;--i) { @@ -722,7 +746,8 @@ private: cvFree(&m_pFViVar); cvFree(&m_pFViVarRes); cvFree(&m_Sizes); - }/* FreeData */ + } /* FreeData. */ + virtual void ParamUpdate() { if(m_BinNum != m_BinNumParam) @@ -749,7 +774,7 @@ public: m_SmoothRadius = 1; AddParam("SmoothRadius",&m_SmoothRadius); - CommentParam("AbnormalThreshold","Radius (in bins) for histogramm smothing"); + CommentParam("AbnormalThreshold","Radius (in bins) for histogram smoothing"); m_SmoothKernel = "L"; AddParam("SmoothKernel",&m_SmoothKernel); @@ -761,15 +786,16 @@ public: CommentParam("BinNum","Number of bin for each dimention of feature vector"); AllocData(); - }/* constructor */ + } /* Constructor. */ + ~CvBlobTrackAnalysisHist() { SaveHist(); FreeData(); m_pFVGen->Release(); - }/* destructor */ + } /* Destructor. */ - /*----------------- interface --------------------*/ + /*----------------- Interface: --------------------*/ virtual void AddBlob(CvBlob* pBlob) { DefTrackFG* pF = (DefTrackFG*)m_TrackFGList.GetBlobByID(CV_BLOB_ID(pBlob)); @@ -796,7 +822,7 @@ public: m_pFVGen->Process(pImg, pFG); int SK = m_SmoothKernel[0]; - for(i=0;iGetFVNum();++i) + for(i=0; iGetFVNum(); ++i) { int BlobID = 0; float* pFV = m_pFVGen->GetFV(i,&BlobID); @@ -809,9 +835,9 @@ public: pF->LastFrame = m_Frame; - {/* binarize FV */ + { /* Binarize FV: */ int j; - for(j=0;jstate = 0; - { /* calc state */ + { /* Calculate state: */ float T = m_HistMat.m_Max*m_AbnormalThreshold; /* calc threshold */ if(m_TrackNum>0) T = 256.0f * m_TrackNum*m_AbnormalThreshold; @@ -838,7 +864,7 @@ public: if(pF->state>1)pF->state=1; } - {/* if new FV then add it to trajectory histogramm */ + { /* If it is a new FV then add it to trajectory histogram: */ int i,flag = 1; int r = m_SmoothRadius; @@ -846,23 +872,24 @@ public: // for(i=0;i=m_BinNum) good= 0; dist += m_pFViVar[i]*m_pFViVar[i]; - }/* calc next dimention */ + }/* Calculate next dimension. */ if(SK=='G' || SK=='g') { @@ -876,30 +903,30 @@ public: } else { - HistAdd = 255; /* flat smothing */ + HistAdd = 255; /* Flat smoothing. */ } if(good && HistAdd>0) - {/* update hist */ + { /* Update histogram: */ assert(pF->pHist); pF->pHist->SetMax(m_pFViVarRes, HistAdd); - }/* update hist */ + } /* Update histogram. */ - for(i=0;i0;--i) - {/* add histogramm and delete blob from list */ + for(i=m_TrackFGList.GetBlobNum(); i>0; --i) + { /* Add histogram and delete blob from list: */ DefTrackFG* pF = (DefTrackFG*)m_TrackFGList.GetBlob(i-1); if(pF->LastFrame+3 < m_Frame && pF->pHist) { @@ -914,14 +941,15 @@ public: m_Frame++; if(m_Wnd) - {/* debug output */ + { /* Debug output: */ int* idxs = NULL; int Val = 0; IplImage* pI = cvCloneImage(pImg); cvZero(pI); - for(Val = m_HistMat.GetNext(&idxs,1);idxs;Val=m_HistMat.GetNext(&idxs,0)) - {/* draw all elements */ + + for(Val = m_HistMat.GetNext(&idxs,1); idxs; Val=m_HistMat.GetNext(&idxs,0)) + { /* Draw all elements: */ float vf; int x,y; @@ -947,7 +975,7 @@ public: int y = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum); cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED); } - }/* draw all elements */ + } /* Draw all elements. */ for(i=m_TrackFGList.GetBlobNum();i>0;--i) { @@ -957,7 +985,7 @@ public: if(pHist==NULL) continue; for(Val = pHist->GetNext(&idxs,1);idxs;Val=pHist->GetNext(&idxs,0)) - {/* draw all elements */ + { /* Draw all elements: */ float vf; int x,y; @@ -983,30 +1011,34 @@ public: int y = cvRound((float)(pI->height-1)*(float)idxs[3] / (float)m_BinNum); cvCircle(pI, cvPoint(x,y), cvRound(vf*pI->height/(m_BinNum*2)),CV_RGB(0,0,255),CV_FILLED); } - }/* draw all elements */ - }/* next track */ + } /* Draw all elements. */ + } /* Next track. */ //cvNamedWindow("Hist",0); //cvShowImage("Hist", pI); cvReleaseImage(&pI); } }; + float GetState(int BlobID) { DefTrackFG* pF = (DefTrackFG*)m_TrackFGList.GetBlobByID(BlobID); return pF?pF->state:0.0f; }; - /* return 0 if trajectory is normal - return >0 if trajectory abnormal */ + + /* Return 0 if trajectory is normal; + rreturn >0 if trajectory abnormal. */ virtual char* GetStateDesc(int BlobID) { if(GetState(BlobID)>0.5) return "abnormal"; return NULL; } + virtual void SetFileName(char* DataBaseName) { if(m_HistMat.m_Volume!=m_HistVolumeSaved)SaveHist(); m_DataFileName[0] = 0; + if(DataBaseName) { strncpy(m_DataFileName,DataBaseName,1000); @@ -1014,12 +1046,14 @@ public: } LoadHist(); }; + virtual void SaveState(CvFileStorage* fs) { int b, bN = m_TrackFGList.GetBlobNum(); cvWriteInt(fs,"BlobNum",bN); cvStartWriteStruct(fs,"BlobList",CV_NODE_SEQ); - for(b=0;btag)) { int b, bN = pBLN->data.seq->total; - for(b=0;bGetFVVar(); int i; cvZero(pW); - for(i=0;irows;++i) - {/* draw all elements */ + + for(i=0; irows; ++i) + { /* Draw all elements: */ float* pFV = (float*)(m_pTrainData->data.ptr + m_pTrainData->step*i); int x = cvRound(pFV[0]*pFVVar[0]); int y = cvRound(pFV[1]*pFVVar[1]); @@ -1167,14 +1206,15 @@ private: ((float*)(pW->imageData + y*pW->widthStep))[x] = r; if(r>MaxVal)MaxVal=r; - }/* next point */ + } /* Next point. */ + if(MaxVal>0)cvConvertScale(pW,pI,255/MaxVal,0); cvNamedWindow("SVMData",0); cvShowImage("SVMData",pI); cvSaveImage("SVMData.bmp",pI); cvReleaseImage(&pW); cvReleaseImage(&pI); - }/* prepare for debug */ + } /* Prepare for debug. */ if(m_pStatModel && m_Wnd && m_Dim == 2) { @@ -1185,8 +1225,9 @@ private: m_pStatImg = cvCreateImage(m_ImgSize,IPL_DEPTH_8U,1); } cvZero(m_pStatImg); - for(y=0;yheight;y+=1)for(x=0;xwidth;x+=1) - {/* draw all elements */ + + for(y=0; yheight; y+=1) for(x=0; xwidth; x+=1) + { /* Draw all elements: */ float res; uchar* pData = (uchar*)m_pStatImg->imageData + x + y*m_pStatImg->widthStep; CvMat FVmat; @@ -1194,11 +1235,12 @@ private: cvInitMatHeader( &FVmat, 1, 2, CV_32F, xy ); res = cvStatModelPredict( m_pStatModel, &FVmat, NULL ); pData[0]=((res>0.5)?255:0); - }/* next point */ + } /* Next point. */ + cvNamedWindow("SVMMask",0); cvShowImage("SVMMask",m_pStatImg); cvSaveImage("SVMMask.bmp",m_pStatImg); - }/* prepare for debug */ + } /* Prepare for debug. */ #endif }; void SaveStatModel() @@ -1243,7 +1285,8 @@ public: AddParam("RBFWidth",&m_RBFWidth); CommentParam("RBFWidth","Parameters that tunes RBF kernel function width."); - }/* constructor */ + } /* Constructor. */ + ~CvBlobTrackAnalysisSVM() { int i; @@ -1256,9 +1299,9 @@ public: } if(m_pStatImg)cvReleaseImage(&m_pStatImg); cvFree(&m_pFV); - }/* destructor */ + } /* Destructor. */ - /*----------------- interface --------------------*/ + /*----------------- Interface: --------------------*/ virtual void AddBlob(CvBlob* pBlob) { DefTrackSVM* pF = (DefTrackSVM*)m_Tracks.GetBlobByID(CV_BLOB_ID(pBlob)); @@ -1266,7 +1309,7 @@ public: m_pFVGen->AddBlob(pBlob); if(pF == NULL) - { /* create new record */ + { /* Create new record: */ DefTrackSVM F; F.state = 0; F.blob = pBlob[0]; @@ -1287,6 +1330,7 @@ public: pF->blob = pBlob[0]; pF->LastFrame = m_Frame; }; + virtual void Process(IplImage* pImg, IplImage* pFG) { int i; @@ -1295,13 +1339,14 @@ public: m_pFVGen->Process(pImg, pFG); m_ImgSize = cvSize(pImg->width,pImg->height); - for(i=m_pFVGen->GetFVNum();i>0;--i) + for(i=m_pFVGen->GetFVNum(); i>0; --i) { int BlobID = 0; float* pFV = m_pFVGen->GetFV(i,&BlobID); DefTrackSVM* pF = (DefTrackSVM*)m_Tracks.GetBlobByID(BlobID); + if(pF && pFV) - {/* process */ + { /* Process: */ float dx,dy; CvMat FVmat; @@ -1310,10 +1355,11 @@ public: if(m_pStatModel) { int j; - for(j=0;jstate = cvStatModelPredict( m_pStatModel, &FVmat, NULL )<0.5; pF->state = 1.f; @@ -1323,55 +1369,58 @@ public: dy = (pF->blob.y - pF->BlobLast.y); if(pF->BlobLast.x<0 || (dx*dx+dy*dy) >= 2*2) - { /* add feature vector to train data base */ + { /* Add feature vector to train data base: */ pF->BlobLast = pF->blob; cvSeqPush(pF->pFVSeq,pFV); } - }/* process one blob */ - }/* next FV */ + } /* Process one blob. */ + } /* Next FV. */ - for(i=m_Tracks.GetBlobNum();i>0;--i) - {/* check each blob record */ + for(i=m_Tracks.GetBlobNum(); i>0; --i) + { /* Check each blob record: */ DefTrackSVM* pF = (DefTrackSVM*)m_Tracks.GetBlob(i-1); + if(pF->LastFrame+3 < m_Frame ) - {/* retrain stat model and delete blob filter */ + { /* Retrain stat model and delete blob filter: */ int mult = 1+m_Dim; int old_height = m_pTrainData?m_pTrainData->height:0; int height = old_height + pF->pFVSeq->total*mult; CvMat* pTrainData = cvCreateMat(height, m_Dim, CV_32F); int j; if(m_pTrainData && pTrainData) - { /* create new train data matrix */ + { /* Create new train data matrix: */ int h = pTrainData->height; pTrainData->height = MIN(pTrainData->height, m_pTrainData->height); cvCopy(m_pTrainData,pTrainData); pTrainData->height = h; } - for(j=0;jpFVSeq->total;++j) - {/* copy new data to train data */ + + for(j=0; jpFVSeq->total; ++j) + { /* Copy new data to train data: */ float* pFVVar = m_pFVGen->GetFVVar(); float* pFV = (float*)cvGetSeqElem(pF->pFVSeq,j); int k; - for(k=0;k0) - {/* variate */ - for(t=0;tpMem); m_TrackNum++; m_Tracks.DelBlob(i-1); - }/* end delete */ - }/* next track */ - /* retraind data each 1 minute if new data exist */ + } /* End delete. */ + } /* Next track. */ + + /* Retrain data each 1 minute if new data exist: */ if(m_Frame%(25*60) == 0 && m_pTrainData && m_pTrainData->rows > m_LastTrainDataSize) { RetrainStatModel(); @@ -1392,40 +1442,44 @@ public: m_Frame++; if(m_Wnd && m_Dim==2) - {/* debug output */ + { /* Debug output: */ int x,y; IplImage* pI = cvCloneImage(pImg); if(m_pStatModel && m_pStatImg) - for(y=0;yheight;y+=2) + + for(y=0; yheight; y+=2) { uchar* pStatData = (uchar*)m_pStatImg->imageData + y*m_pStatImg->widthStep; uchar* pData = (uchar*)pI->imageData + y*pI->widthStep; + for(x=0;xwidth;x+=2) - {/* draw all elements */ + { /* Draw all elements: */ int d = pStatData[x]; d = (d<<8) | (d^0xff); *(ushort*)(pData + x*3) = (ushort)d; } - }/* next line */ + } /* Next line. */ //cvNamedWindow("SVMMap",0); //cvShowImage("SVMMap", pI); cvReleaseImage(&pI); - }/* debug output */ + } /* Debug output. */ }; float GetState(int BlobID) { DefTrackSVM* pF = (DefTrackSVM*)m_Tracks.GetBlobByID(BlobID); return pF?pF->state:0.0f; }; - /* return 0 if trajectory is normal - return >0 if trajectory abnormal */ + + /* Return 0 if trajectory is normal; + return >0 if trajectory abnormal. */ virtual char* GetStateDesc(int BlobID) { if(GetState(BlobID)>0.5) return "abnormal"; return NULL; } + virtual void SetFileName(char* DataBaseName) { if(m_pTrainData)SaveStatModel(); @@ -1441,14 +1495,17 @@ public: virtual void Release(){ delete this; }; -}; /* CvBlobTrackAnalysisSVM */ +}; /* CvBlobTrackAnalysisSVM. */ CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMP() {return (CvBlobTrackAnalysis*) new CvBlobTrackAnalysisSVM(cvCreateFVGenP);} + CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMPV() {return (CvBlobTrackAnalysis*) new CvBlobTrackAnalysisSVM(cvCreateFVGenPV);} + CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMPVS() {return (CvBlobTrackAnalysis*) new CvBlobTrackAnalysisSVM(cvCreateFVGenPVS);} + CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisSVMSS() {return (CvBlobTrackAnalysis*) new CvBlobTrackAnalysisSVM(cvCreateFVGenSS);} diff --git a/cvaux/src/vs/blobtrackanalysisior.cpp b/cvaux/src/vs/blobtrackanalysisior.cpp index 7dd8482..48b374a 100644 --- a/cvaux/src/vs/blobtrackanalysisior.cpp +++ b/cvaux/src/vs/blobtrackanalysisior.cpp @@ -54,41 +54,47 @@ protected: } m_Ans[MAX_ANS]; int m_AnNum; char m_Desc[MAX_DESC]; + public: CvBlobTrackAnalysisIOR() { m_AnNum = 0; } + ~CvBlobTrackAnalysisIOR() { }; + virtual void AddBlob(CvBlob* pBlob) { int i; - for(i=0;iAddBlob(pBlob); - }/* next analizer */ + } /* Next analyzer. */ }; + virtual void Process(IplImage* pImg, IplImage* pFG) { int i; #ifdef _OPENMP #pragma omp parallel for #endif - for(i=0;iProcess(pImg, pFG); - }/* next analizer */ + } /* Next analyzer. */ }; + float GetState(int BlobID) { int state = 0; int i; - for(i=0;iGetState(BlobID) > 0.5); - }/* next analizer */ + } /* Next analyzer. */ + return (float)state; }; @@ -97,9 +103,11 @@ public: int rest = MAX_DESC-1; int i; m_Desc[0] = 0; - for(i=0;iGetStateDesc(BlobID); + if(str && strlen(m_Ans[i].pName) + strlen(str)+4 < (size_t)rest) { strcat(m_Desc,m_Ans[i].pName); @@ -108,15 +116,18 @@ public: strcat(m_Desc,"\n"); rest = MAX_DESC - (int)strlen(m_Desc) - 1; } - }/* next analizer */ + } /* Next analyzer. */ + if(m_Desc[0]!=0)return m_Desc; + return NULL; }; + virtual void SetFileName(char* /*DataBaseName*/) { }; - int AddAnalizer(CvBlobTrackAnalysis* pA, char* pName) + int AddAnalyzer(CvBlobTrackAnalysis* pA, char* pName) { if(m_AnNumRelease(); - }/* next analizer */ + } /* Next analyzer. */ + delete this; }; -}; /* CvBlobTrackAnalysisIOR */ +}; /* CvBlobTrackAnalysisIOR. */ CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisIOR() { @@ -150,10 +162,10 @@ CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisIOR() CvBlobTrackAnalysis* pA = NULL; pA = cvCreateModuleBlobTrackAnalysisHistPVS(); - pIOR->AddAnalizer(pA, "HIST"); + pIOR->AddAnalyzer(pA, "HIST"); //pA = (CvBlobTrackAnalysis*)cvCreateModuleBlobTrackAnalysisHeightScale(); - //pIOR->AddAnalizer(pA, "SCALE"); + //pIOR->AddAnalyzer(pA, "SCALE"); return (CvBlobTrackAnalysis*)pIOR; }/* cvCreateCvBlobTrackAnalysisIOR */ diff --git a/cvaux/src/vs/blobtrackanalysistrackdist.cpp b/cvaux/src/vs/blobtrackanalysistrackdist.cpp index 33fbeb4..e2cdddd 100644 --- a/cvaux/src/vs/blobtrackanalysistrackdist.cpp +++ b/cvaux/src/vs/blobtrackanalysistrackdist.cpp @@ -77,6 +77,7 @@ public: { DefTrackPoint p = {x,y,r,0}; int Num = GetPointNum(); + if(Num > 0) { DefTrackPoint* pPrev = GetPoint(Num-1); @@ -85,20 +86,22 @@ public: float dy = y-pPrev->y; p.vx = Alpha*dx+(1-Alpha)*pPrev->vx; p.vy = Alpha*dy+(1-Alpha)*pPrev->vy; - p.v = Alpha*dx+(1-Alpha)*pPrev->v; + p.v = Alpha*dx+(1-Alpha)*pPrev->v; } AddPoint(&p); } + inline void AddPoint(DefTrackPoint* pB) - {/* add point and recal last velocities */ + { /* Add point and recalculate last velocities: */ int wnd=3; int Num; int i; cvSeqPush(m_pSeq,pB); Num = GetPointNum(); - for(i=MAX(0,Num-wnd-1);ivy = (p1->y - p0->y) / dt; p->v = (float)sqrt(p->vx*p->vx+p->vy*p->vy); } - }/* next updating point */ + } /* Next updating point. */ #if 0 if(0) - { /* debug */ + { /* Debug: */ int i; printf("Blob %d: ",ID); - for(i=0;ivx,p->vy,p->v); @@ -140,16 +144,17 @@ private: CvSeq* m_pSeq; }; -/* fill array pIdxPairs by pair of index of correspondent blobs */ -/* return number of pairs */ -/* pIdxPairs must have size not less that 2*(pSeqNum+pSeqTNum) */ -/* pTmp is pointer to memory which size is pSeqNum*pSeqTNum*16 */ +/* Fill array pIdxPairs by pair of index of correspondent blobs. */ +/* Return number of pairs. */ +/* pIdxPairs must have size not less that 2*(pSeqNum+pSeqTNum) */ +/* pTmp is pointer to memory which size is pSeqNum*pSeqTNum*16 */ typedef struct DefMatch { - int Idx; /* prev best blob index */ - int IdxT; /* prev best template blob index */ - double D; /* blob to blob distance sum */ -}DefMatch; + int Idx; /* Previous best blob index. */ + int IdxT; /* Previous best template blob index. */ + double D; /* Blob to blob distance sum. */ +} DefMatch; + static int cvTrackMatch(DefTrackRec* pSeq, int MaxLen, DefTrackRec* pSeqT, int* pIdxPairs, void* pTmp) { int NumPair = 0; @@ -157,18 +162,18 @@ static int cvTrackMatch(DefTrackRec* pSeq, int MaxLen, DefTrackRec* pSeqT, int* int Num = pSeq->GetPointNum(); int NumT = pSeqT->GetPointNum(); int i,it; - int i0=0; /* last point in the track sequence */ + int i0=0; /* Last point in the track sequence. */ if(MaxLen > 0 && Num > MaxLen) - {/* set new point seq len and new last point in this seq */ + { /* Set new point seq len and new last point in this seq: */ Num = MaxLen; i0 = pSeq->GetPointNum() - Num; } - for(i=0;iGetPoint(i+i0); DefTrackPoint* pBT = pSeqT->GetPoint(it); DefMatch* pMT_cur = pMT + i*NumT + it; @@ -184,40 +189,44 @@ static int cvTrackMatch(DefTrackRec* pSeq, int MaxLen, DefTrackRec* pSeqT, int* if(i==0) continue; - for(iDI=0;iDI<3;++iDI) + for(iDI=0; iDI<3; ++iDI) { int i_prev = i+DI[iDI][0]; int it_prev = it+DI[iDI][1]; + if(i_prev >= 0 && it_prev>=0) { double D_cur = D+pMT[NumT*i_prev+it_prev].D; + if(pMT_cur->D > D_cur || (pMT_cur->Idx<0) ) - {/* set new best local way */ + { /* Set new best local way: */ pMT_cur->D = D_cur; pMT_cur->Idx = i_prev; pMT_cur->IdxT = it_prev; } } - }/* check next direction */ - }/* fill next colum from table */ - }/*fill next row */ + } /* Check next direction. */ + } /* Fill next colum from table. */ + } /* Fill next row. */ - { /* back tracking */ - /* find best end in template */ + { /* Back tracking. */ + /* Find best end in template: */ int it_best = 0; DefMatch* pMT_best = pMT + (Num-1)*NumT; i = Num-1; /* set current i to last position */ - for(it=1;itD > pMT_new->D) { pMT_best->D = pMT_new->D; it_best = it; } - }/* find best end template point */ + } /* Find best end template point. */ - /* back tracking whole sequence */ + /* Back tracking whole sequence: */ for(it = it_best;i>=0 && it>=0;) { DefMatch* pMT_new = pMT + it + i*NumT; @@ -228,10 +237,10 @@ static int cvTrackMatch(DefTrackRec* pSeq, int MaxLen, DefTrackRec* pSeqT, int* it = pMT_new->IdxT; i = pMT_new->Idx; } - }/* end back tracing */ + } /* End back tracing. */ return NumPair; -}/* cvTrackMatch */ +} /* cvTrackMatch. */ typedef struct DefTrackForDist { @@ -245,11 +254,11 @@ typedef struct DefTrackForDist class CvBlobTrackAnalysisTrackDist : public CvBlobTrackAnalysis { - /*---------------- internal functions --------------------*/ + /*---------------- Internal functions: --------------------*/ private: - char* m_pDebugAVIName; /* for debuf purpose */ - //CvVideoWriter* m_pDebugAVI; /* for debuf purpose */ - IplImage* m_pDebugImg; /* for debuf purpose */ + char* m_pDebugAVIName; /* For debugging. */ + //CvVideoWriter* m_pDebugAVI; /* For debugging. */ + IplImage* m_pDebugImg; /* For debugging. */ char m_DataFileName[1024]; CvBlobSeq m_Tracks; @@ -269,7 +278,8 @@ private: m_pTempData = cvAlloc(Size); if(m_pTempData) m_TempDataSize = Size; return m_pTempData; - }/* ReallocTempData */ + } /* ReallocTempData. */ + public: CvBlobTrackAnalysisTrackDist():m_Tracks(sizeof(DefTrackForDist)),m_TrackDataBase(sizeof(DefTrackForDist)) { @@ -299,25 +309,27 @@ public: AddParam("VelThreshold",&m_VelThreshold); CommentParam("VelThreshold","Minimal allowed relative difference between blob speed"); - }/* constructor */ + } /* Constructor. */ + ~CvBlobTrackAnalysisTrackDist() { int i; - for(i=m_Tracks.GetBlobNum();i>0;--i) + for(i=m_Tracks.GetBlobNum(); i>0; --i) { DefTrackForDist* pF = (DefTrackForDist*)m_Tracks.GetBlob(i-1); delete pF->pTrack; } if(m_pDebugImg) cvReleaseImage(&m_pDebugImg); //if(m_pDebugAVI) cvReleaseVideoWriter(&m_pDebugAVI); - }/* destructor */ + } /* Destructor. */ - /*----------------- interface --------------------*/ + /*----------------- Interface: --------------------*/ virtual void AddBlob(CvBlob* pBlob) { DefTrackForDist* pF = (DefTrackForDist*)m_Tracks.GetBlobByID(CV_BLOB_ID(pBlob)); + if(pF == NULL) - { /* create new TRack record */ + { /* Create new TRack record: */ DefTrackForDist F; F.state = 0; F.blob = pBlob[0]; @@ -333,21 +345,25 @@ public: pF->blob = pBlob[0]; pF->LastFrame = m_Frame; }; + virtual void Process(IplImage* pImg, IplImage* /*pFG*/) { int i; double MinTv = pImg->width/1440.0; /* minimal threshold for speed difference */ double MinTv2 = MinTv*MinTv; - for(i=m_Tracks.GetBlobNum();i>0;--i) + + for(i=m_Tracks.GetBlobNum(); i>0; --i) { DefTrackForDist* pF = (DefTrackForDist*)m_Tracks.GetBlob(i-1); pF->state = 0; + if(pF->LastFrame == m_Frame || pF->LastFrame+1 == m_Frame) - {/* process one blob trajectory */ + { /* Process one blob trajectory: */ int NumEq = 0; int it; - for(it=m_TrackDataBase.GetBlobNum();it>0;--it) - {/* check template */ + + for(it=m_TrackDataBase.GetBlobNum(); it>0; --it) + { /* Check template: */ DefTrackForDist* pFT = (DefTrackForDist*)m_TrackDataBase.GetBlob(it-1); int Num = pF->pTrack->GetPointNum(); int NumT = pFT->pTrack->GetPointNum(); @@ -361,14 +377,14 @@ public: if(i==it) continue; - /* match track */ + /* Match track: */ PairNum = cvTrackMatch( pF->pTrack, m_TraceLen, pFT->pTrack, pPairIdx, pTmpData ); Equal = MAX(1,cvRound(PairNum*0.1)); UseVel = 3*pF->pTrack->GetPointNum() > m_TraceLen; UsePos = 10*pF->pTrack->GetPointNum() > m_TraceLen; - { /* check continues */ + { /* Check continues: */ float D; int DI = pPairIdx[0*2+0]-pPairIdx[(PairNum-1)*2+0]; int DIt = pPairIdx[0*2+1]-pPairIdx[(PairNum-1)*2+1]; @@ -378,10 +394,10 @@ public: if(fabs(D)>m_VelThreshold)Equal=0; if(fabs(D)>m_VelThreshold*0.5)Equal/=2; } - }/* check continues */ + } /* Check continues. */ - for(k=0;Equal>0 && k0 && kpTrack->GetPoint(j); @@ -390,7 +406,7 @@ public: double dy = pB->y-pBT->y; double dvx = pB->vx - pBT->vx; double dvy = pB->vy - pBT->vy; - //double dv = pB->v - pBT->v; + //double dv = pB->v - pBT->v; double D = dx*dx+dy*dy; double Td = pBT->r*m_PosThreshold; double dv2 = dvx*dvx+dvy*dvy; @@ -401,28 +417,28 @@ public: if(Tv2 < MinTv2) Tv2 = MinTv2; if(Tvm < MinTv) Tvm = MinTv; - /* check trajectory position */ + /* Check trajectory position: */ if(UsePos && D > Td*Td) { Equal--; } else - /* check trajectory velacity */ - /* don't consider tails of trajectory becasue its unnstable for velosity calculation */ + /* Check trajectory velocity. */ + /* Don't consider trajectory tail because its unstable for velocity computation. */ if(UseVel && j>5 && jt>5 && dv2 > Tv2 ) { Equal--; } - }/* compare with threshold */ + } /* Compare with threshold. */ if(Equal>0) { NumEq++; pFT->close++; } - }/* next template */ + } /* Next template. */ - { /* calc state */ + { /* Calculate state: */ float T = m_TrackDataBase.GetBlobNum() * m_AbnormalThreshold; /* calc threshold */ if(T>0) @@ -436,18 +452,18 @@ public: {// if abnormal blob printf("Abnormal blob(%d) %d < %f, state=%f\n",CV_BLOB_ID(pF),NumEq,T, pF->state); }*/ - }/* calc state */ - }/* process one blob trajectory */ + } /* Calculate state. */ + } /* Process one blob trajectory. */ else - {/* move track to trcaks data base */ + { /* Move track to tracks data base: */ m_TrackDataBase.AddBlob((CvBlob*)pF); m_Tracks.DelBlob(i-1); } - }/* next blob */ + } /* Next blob. */ if(m_Wnd) - {/* debug output */ + { /* Debug output: */ int i; if(m_pDebugImg==NULL) @@ -455,8 +471,8 @@ public: else cvCopyImage(pImg, m_pDebugImg); - for(i=m_TrackDataBase.GetBlobNum();i>0;--i) - {/* draw all elements from trackdata base */ + for(i=m_TrackDataBase.GetBlobNum(); i>0; --i) + { /* Draw all elements in track data base: */ int j; DefTrackForDist* pF = (DefTrackForDist*)m_TrackDataBase.GetBlob(i-1); CvScalar color = CV_RGB(0,0,0); @@ -470,17 +486,17 @@ public: color = CV_RGB(0,0,128); } - for(j=pF->pTrack->GetPointNum();j>0;j--) + for(j=pF->pTrack->GetPointNum(); j>0; j--) { DefTrackPoint* pB = pF->pTrack->GetPoint(j-1); int r = 0;//MAX(cvRound(pB->r),1); cvCircle(m_pDebugImg, cvPoint(cvRound(pB->x),cvRound(pB->y)), r, color); } pF->close = 0; - }/* draw all elements from trackdata base */ + } /* Draw all elements in track data base. */ - for(i=m_Tracks.GetBlobNum();i>0;--i) - {/* draw all elements for all trajectories */ + for(i=m_Tracks.GetBlobNum(); i>0; --i) + { /* Draw all elements for all trajectories: */ DefTrackForDist* pF = (DefTrackForDist*)m_Tracks.GetBlob(i-1); int j; int c = cvRound(pF->state*255); @@ -495,36 +511,39 @@ public: 0, 0, 360, CV_RGB(c,255-c,0), cvRound(1+(0*c)/255) ); - for(j=pF->pTrack->GetPointNum();j>0;j--) + for(j=pF->pTrack->GetPointNum(); j>0; j--) { DefTrackPoint* pB = pF->pTrack->GetPoint(j-1); if(pF->pTrack->GetPointNum()-j > m_TraceLen) break; cvCircle(m_pDebugImg, cvPoint(cvRound(pB->x),cvRound(pB->y)), 0, color); } pF->close = 0; - }/* draw all elements for all trajectories */ + + } /* Draw all elements for all trajectories. */ //cvNamedWindow("Tracks",0); //cvShowImage("Tracks", m_pDebugImg); - }/* debug output */ + } /* Debug output. */ #if 0 if(m_pDebugImg && m_pDebugAVIName) { if(m_pDebugAVI==NULL) - {/* create avi file for writing */ + { /* Create avi file for writing: */ m_pDebugAVI = cvCreateVideoWriter( m_pDebugAVIName, CV_FOURCC('x','v','i','d'), 25, cvSize(m_pDebugImg->width,m_pDebugImg->height)); + if(m_pDebugAVI == NULL) { printf("WARNING!!! Can not create AVI file %s for writing\n",m_pDebugAVIName); } - }/* create avi file for writing */ + } /* Create avi file for writing. */ + if(m_pDebugAVI)cvWriteFrame( m_pDebugAVI, m_pDebugImg ); - }/* write debug window to AVI file */ + } /* Write debug window to AVI file. */ #endif m_Frame++; }; @@ -533,13 +552,15 @@ public: DefTrackForDist* pF = (DefTrackForDist*)m_Tracks.GetBlobByID(BlobID); return pF?pF->state:0.0f; }; - /* return 0 if trajectory is normal - return >0 if trajectory abnormal */ + + /* Return 0 if trajectory is normal; + return >0 if trajectory abnormal. */ virtual char* GetStateDesc(int BlobID) { if(GetState(BlobID)>0.5) return "abnormal"; return NULL; } + virtual void SetFileName(char* DataBaseName) { m_DataFileName[0] = 0; @@ -551,7 +572,6 @@ public: }; virtual void Release(){ delete this; }; - }; diff --git a/cvaux/src/vs/blobtrackgen1.cpp b/cvaux/src/vs/blobtrackgen1.cpp index e431891..39ed66f 100644 --- a/cvaux/src/vs/blobtrackgen1.cpp +++ b/cvaux/src/vs/blobtrackgen1.cpp @@ -48,11 +48,11 @@ typedef struct DefBlobTrack int FrameBegin; int FrameLast; int Saved; /* flag */ -}DefBlobTrack; +} DefBlobTrack; static void SaveTrack(DefBlobTrack* pTrack, char* pFileName, int norm = 0) -{/* save blob track */ +{ /* Save blob track: */ int j; FILE* out = NULL; CvBlobSeq* pS = pTrack->pSeq; @@ -64,26 +64,28 @@ static void SaveTrack(DefBlobTrack* pTrack, char* pFileName, int norm = 0) out = fopen(pFileName,"at"); if(out == NULL) { - printf("Warning! Can not open %s file for track output\n",pFileName); + printf("Warning! Cannot open %s file for track output\n", pFileName); return; } fprintf(out,"%d",pTrack->FrameBegin); - if(pS)for(j=0;jGetBlobNum();++j) + if(pS) for(j=0; jGetBlobNum(); ++j) { CvBlob* pB = pS->GetBlob(j); fprintf(out,", %.1f, %.1f", CV_BLOB_X(pB),CV_BLOB_Y(pB)); + if(CV_BLOB_WX(pB0)>0) fprintf(out,", %.2f",CV_BLOB_WX(pB)/(norm?CV_BLOB_WX(pB0):1)); + if(CV_BLOB_WY(pB0)>0) fprintf(out,", %.2f",CV_BLOB_WY(pB)/(norm?CV_BLOB_WY(pB0):1)); } fprintf(out,"\n"); fclose(out); pTrack->Saved = 1; -}/* save blob track */ +} /* Save blob track. */ class CvBlobTrackGen1:public CvBlobTrackGen { @@ -95,6 +97,7 @@ public: m_Frame = 0; m_pFileName = NULL; }; + ~CvBlobTrackGen1() { int i; @@ -102,22 +105,26 @@ public: { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i-1); if(!pTrack->Saved) - {/* save track */ + { /* Save track: */ SaveTrack(pTrack, m_pFileName, m_BlobSizeNorm); - }/* save track */ + } /* Save track. */ - /* delete sequence */ + /* Delete sequence: */ delete pTrack->pSeq; + pTrack->pSeq = NULL; - }/* check next track */ - }/* destructor */ + + } /* Check next track. */ + } /* Destructor. */ void SetFileName(char* pFileName){m_pFileName = pFileName;}; + void AddBlob(CvBlob* pBlob) { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlobByID(CV_BLOB_ID(pBlob)); + if(pTrack==NULL) - {/* add new track */ + { /* Add new track: */ DefBlobTrack Track; Track.blob = pBlob[0]; Track.FrameBegin = m_Frame; @@ -125,21 +132,24 @@ public: Track.Saved = 0; m_TrackList.AddBlob((CvBlob*)&Track); pTrack = (DefBlobTrack*)m_TrackList.GetBlobByID(CV_BLOB_ID(pBlob)); - }/* add new track */ + } /* Add new track. */ assert(pTrack); pTrack->FrameLast = m_Frame; assert(pTrack->pSeq); pTrack->pSeq->AddBlob(pBlob); }; + void Process(IplImage* /*pImg*/ = NULL, IplImage* /*pFG*/ = NULL) { int i; - for(i=m_TrackList.GetBlobNum();i>0;--i) + + for(i=m_TrackList.GetBlobNum(); i>0; --i) { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i-1); + if(pTrack->FrameLast < m_Frame && !pTrack->Saved) - {/* save track */ + { /* Save track: */ SaveTrack(pTrack, m_pFileName, m_BlobSizeNorm); if(pTrack->Saved) { /* delete sequence */ @@ -147,20 +157,22 @@ public: pTrack->pSeq = NULL; m_TrackList.DelBlob(i-1); } - }/* save track */ - }/* check next track */ + } /* Save track. */ + } /* Check next track. */ m_Frame++; } + void Release() { delete this; } + protected: int m_Frame; char* m_pFileName; CvBlobSeq m_TrackList; int m_BlobSizeNorm; -}; /* class CvBlobTrackGen1 */ +}; /* class CvBlobTrackGen1 */ CvBlobTrackGen* cvCreateModuleBlobTrackGen1() diff --git a/cvaux/src/vs/blobtrackgenyml.cpp b/cvaux/src/vs/blobtrackgenyml.cpp index e1987cd..eaaa711 100644 --- a/cvaux/src/vs/blobtrackgenyml.cpp +++ b/cvaux/src/vs/blobtrackgenyml.cpp @@ -47,7 +47,7 @@ typedef struct DefBlobTrack int FrameBegin; int FrameLast; int Saved; /* flag */ -}DefBlobTrack; +} DefBlobTrack; class CvBlobTrackGenYML:public CvBlobTrackGen { @@ -64,14 +64,16 @@ protected: char video_name[1024]; char* struct_name = NULL; CvFileStorage* storage = cvOpenFileStorage(m_pFileName,NULL,CV_STORAGE_WRITE_TEXT); + if(storage==NULL) { - printf("WARNING!!! Can not open %s file for trajectories writing",m_pFileName); + printf("WARNING!!! Cannot open %s file for trajectory output.", m_pFileName); } - for(i=0;i<1024 && m_pFileName[i]!='.' && m_pFileName[i]!=0;++i)video_name[i]=m_pFileName[i]; + for(i=0; i<1024 && m_pFileName[i]!='.' && m_pFileName[i]!=0; ++i) video_name[i]=m_pFileName[i]; video_name[i] = 0; - for(;i>0;i--) + + for(;i>0; i--) { if(video_name[i-1] == '\\') break; if(video_name[i-1] == '/') break; @@ -80,7 +82,8 @@ protected: struct_name = video_name + i; cvStartWriteStruct(storage, struct_name, CV_NODE_SEQ); - for(i=0;iGetBlobNum();++j) + + for(j=0; jGetBlobNum(); ++j) { CvBlob* pB = pSeq->GetBlob(j); p.x = pB->w/(m_Size.width-1); @@ -132,7 +136,9 @@ protected: cvEndWriteStruct( storage ); } cvReleaseFileStorage(&storage); - }/* Save All */ + + } /* Save All */ + public: CvBlobTrackGenYML():m_TrackList(sizeof(DefBlobTrack)) { @@ -140,25 +146,29 @@ public: m_pFileName = NULL; m_Size = cvSize(2,2); }; + ~CvBlobTrackGenYML() { int i; SaveAll(); - for(i=m_TrackList.GetBlobNum();i>0;--i) + + for(i=m_TrackList.GetBlobNum(); i>0; --i) { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i-1); - /* delete sequence */ + /* Delete sequence: */ delete pTrack->pSeq; pTrack->pSeq = NULL; - }/* check next track */ - }/* destructor */ + } /* Check next track. */ + + } /* Destructor. */ void SetFileName(char* pFileName){m_pFileName = pFileName;}; void AddBlob(CvBlob* pBlob) { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlobByID(CV_BLOB_ID(pBlob)); + if(pTrack==NULL) - {/* add new track */ + { /* Add new track: */ DefBlobTrack Track; Track.blob = pBlob[0]; Track.FrameBegin = m_Frame; @@ -166,7 +176,7 @@ public: Track.Saved = 0; m_TrackList.AddBlob((CvBlob*)&Track); pTrack = (DefBlobTrack*)m_TrackList.GetBlobByID(CV_BLOB_ID(pBlob)); - }/* add new track */ + } /* Add new track. */ assert(pTrack); pTrack->FrameLast = m_Frame; @@ -177,21 +187,26 @@ public: { int i; m_Size = cvSize(pImg->width,pImg->height); - for(i=m_TrackList.GetBlobNum();i>0;--i) + + for(i=m_TrackList.GetBlobNum(); i>0; --i) { DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i-1); + if(pTrack->FrameLast < m_Frame && !pTrack->Saved) - {/* save track */ + { /* Save track: */ SaveAll(); - }/* save track */ - }/* check next track */ + } /* Save track. */ + + } /* Check next track. */ + m_Frame++; } + void Release() { delete this; } -}; /* class CvBlobTrackGenYML */ +}; /* class CvBlobTrackGenYML */ CvBlobTrackGen* cvCreateModuleBlobTrackGenYML() diff --git a/cvaux/src/vs/blobtrackingauto.cpp b/cvaux/src/vs/blobtrackingauto.cpp index b8662d7..3c500d9 100644 --- a/cvaux/src/vs/blobtrackingauto.cpp +++ b/cvaux/src/vs/blobtrackingauto.cpp @@ -51,7 +51,7 @@ The track is lost when integral of foreground mask image by blob area has low va /* list of Blob Detection modules */ CvBlobDetector* cvCreateBlobDetectorSimple(); -/* get frequency for each module time working estimation */ +/* Get frequency for each module time working estimation: */ static double FREQ = 1000*cvGetTickFrequency(); #if 1 @@ -85,12 +85,12 @@ static double FREQ = 1000*cvGetTickFrequency(); #define TIME_END(_name_) #endif -/* special extended blob structure for auto blob tracking */ +/* Special extended blob structure for auto blob tracking: */ typedef struct CvBlobTrackAuto { CvBlob blob; int BadFrames; -}CvBlobTrackAuto; +} CvBlobTrackAuto; class CvBlobTrackerAuto1: public CvBlobTrackerAuto { @@ -103,27 +103,29 @@ public: virtual IplImage* GetFGMask(){return m_pFGMask;}; float GetState(int BlobID){return m_pBTA?m_pBTA->GetState(BlobID):0;}; char* GetStateDesc(int BlobID){return m_pBTA?m_pBTA->GetStateDesc(BlobID):NULL;}; - /* return 0 if trajectory is normal - return >0 if trajectory abnormal */ + /* Return 0 if trajectory is normal; + return >0 if trajectory abnormal. */ void Process(IplImage* pImg, IplImage* pMask = NULL); void Release(){delete this;}; + private: IplImage* m_pFGMask; int m_FGTrainFrames; - CvFGDetector* m_pFG; /* pointer to foreground mask detector modelu */ - CvBlobTracker* m_pBT; /* pointer to Blob tracker module */ + CvFGDetector* m_pFG; /* Pointer to foreground mask detector module. */ + CvBlobTracker* m_pBT; /* Pointer to Blob tracker module. */ int m_BTDel; int m_BTReal; - CvBlobDetector* m_pBD; /* pointer to Blob detector module */ + CvBlobDetector* m_pBD; /* Pointer to Blob detector module. */ int m_BDDel; CvBlobTrackGen* m_pBTGen; CvBlobTrackPostProc* m_pBTPostProc; int m_UsePPData; - CvBlobTrackAnalysis* m_pBTA; /* blob trajectory analyser */ + CvBlobTrackAnalysis* m_pBTA; /* Blob trajectory analyser. */ CvBlobSeq m_BlobList; int m_FrameCount; int m_NextBlobID; char* m_TimesFile; + public: virtual void SaveState(CvFileStorage* fs) { @@ -131,6 +133,7 @@ public: cvWriteInt(fs,"NextBlobID",m_NextBlobID); m_BlobList.Write(fs,"BlobList"); }; + virtual void LoadState(CvFileStorage* fs, CvFileNode* node) { CvFileNode* BlobListNode = cvGetFileNodeByName(fs,node,"BlobList"); @@ -149,7 +152,7 @@ CvBlobTrackerAuto* cvCreateBlobTrackerAuto1(CvBlobTrackerAutoParam1* param) return (CvBlobTrackerAuto*)new CvBlobTrackerAuto1(param); } -/* Constructor of auto blob tracker*/ +/* Constructor of auto blob tracker: */ CvBlobTrackerAuto1::CvBlobTrackerAuto1(CvBlobTrackerAutoParam1* param):m_BlobList(sizeof(CvBlobTrackAuto)) { m_BlobList.AddFormat("i"); @@ -176,26 +179,27 @@ CvBlobTrackerAuto1::CvBlobTrackerAuto1(CvBlobTrackerAutoParam1* param):m_BlobLis m_pBTPostProc = param?param->pBTPP:NULL; m_UsePPData = param?param->UsePPData:0; - /* create default sub modules */ + /* Create default submodules: */ if(m_pBD==NULL) { m_pBD = cvCreateBlobDetectorSimple(); m_BDDel = 1; } + if(m_pBT==NULL) { m_pBT = cvCreateBlobTrackerMS(); m_BTDel = 1; } -}/* CvBlobTrackerAuto1::CvBlobTrackerAuto1 */ +} /* CvBlobTrackerAuto1::CvBlobTrackerAuto1 */ -/* Destructor of auto blob tracker */ +/* Destructor for auto blob tracker: */ CvBlobTrackerAuto1::~CvBlobTrackerAuto1() { if(m_BDDel)m_pBD->Release(); if(m_BTDel)m_pBT->Release(); -}/* Destructor of auto blob tracker */ +} void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) { @@ -203,7 +207,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) int i; IplImage* pFG = pMask; - /* increase frame counter */ + /* Bump frame counter: */ m_FrameCount++; if(m_TimesFile) @@ -212,6 +216,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) static double TimeSum = 0; static int Count = 0; Count++; + if(Count%100==0) { time_t ltime; @@ -227,15 +232,18 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) } } - /* update BG model */ + /* Update BG model: */ TIME_BEGIN() + if(m_pFG) - {/* if FG detector is needed */ + { /* If FG detector is needed: */ m_pFG->Process(pImg); pFG = m_pFG->GetMask(); - }/* if FG detector is needed */ + } /* If FG detector is needed. */ + TIME_END("FGDetector",-1) - m_pFGMask = pFG; /* for external use */ + + m_pFGMask = pFG; /* For external use. */ /*if(m_pFG && m_pFG->GetParam("DebugWnd") == 1) {// debug foreground result @@ -247,14 +255,15 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) } }*/ - /* track blobs */ + /* Track blobs: */ TIME_BEGIN() if(m_pBT) { int i; m_pBT->Process(pImg, pFG); - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Update data of tracked blob list: */ CvBlob* pB = m_BlobList.GetBlob(i-1); int BlobID = CV_BLOB_ID(pB); int i = m_pBT->GetBlobIndexByID(BlobID); @@ -265,12 +274,13 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) } TIME_END("BlobTracker",CurBlobNum) - /* this part should be removed */ + /* This part should be removed: */ if(m_BTReal && m_pBT) - {/* update blob list (detect new blob for real blob tracker )*/ + { /* Update blob list (detect new blob for real blob tracker): */ int i; - for(i=m_pBT->GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + + for(i=m_pBT->GetBlobNum(); i>0; --i) + { /* Update data of tracked blob list: */ CvBlob* pB = m_pBT->GetBlob(i-1); if(pB && m_BlobList.GetBlobByID(CV_BLOB_ID(pB)) == NULL ) { @@ -279,56 +289,58 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) NewB.BadFrames = 0; m_BlobList.AddBlob((CvBlob*)&NewB); } - }/* next blob */ - /*delete blobs */ - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + } /* Next blob. */ + + /* Delete blobs: */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Update tracked-blob list: */ CvBlob* pB = m_BlobList.GetBlob(i-1); if(pB && m_pBT->GetBlobByID(CV_BLOB_ID(pB)) == NULL ) { m_BlobList.DelBlob(i-1); } - }/* next blob */ - }/* update blob list */ + } /* Next blob. */ + } /* Update bloblist. */ TIME_BEGIN() if(m_pBTPostProc) - {/* post processing module */ + { /* Post-processing module: */ int i; - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Update tracked-blob list: */ CvBlob* pB = m_BlobList.GetBlob(i-1); m_pBTPostProc->AddBlob(pB); } m_pBTPostProc->Process(); - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Update tracked-blob list: */ CvBlob* pB = m_BlobList.GetBlob(i-1); int BlobID = CV_BLOB_ID(pB); CvBlob* pBN = m_pBTPostProc->GetBlobByID(BlobID); if(pBN && m_UsePPData && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH) - { /* set new data for tracker */ + { /* Set new data for tracker: */ m_pBT->SetBlobByID(BlobID, pBN ); } if(pBN) - {/* update blob list by result from postprocessing */ + { /* Update blob list with results from postprocessing: */ pB[0] = pBN[0]; } } - }/* post processing module */ + } /* Post-processing module. */ + TIME_END("PostProcessing",CurBlobNum) - /* Blob deleter (experimental and simple)*/ + /* Blob deleter (experimental and simple): */ TIME_BEGIN() if(pFG) - {/* Blob deleter */ + { /* Blob deleter: */ int i; if(!m_BTReal)for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* check all blobs from list */ + { /* Check all blobs on list: */ CvBlobTrackAuto* pB = (CvBlobTrackAuto*)(m_BlobList.GetBlob(i-1)); int Good = 0; int w=pFG->width; @@ -363,41 +375,44 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) { pB->BadFrames++; } - }/* next blob */ + } /* Next blob: */ - /* check error count */ - for(i=0;iBadFrames>3) - {/* delete such object */ - /* from tracker */ + { /* Delete such objects */ + /* from tracker... */ m_pBT->DelBlobByID(CV_BLOB_ID(pB)); - /* from local list */ + + /* ... and from local list: */ m_BlobList.DelBlob(i); i--; } - }/* check error count for next blob */ - }/* Blob deleter */ + } /* Check error count for next blob. */ + } /* Blob deleter. */ + TIME_END("BlobDeleter",m_BlobList.GetBlobNum()) - /* Update blobs */ + /* Update blobs: */ TIME_BEGIN() if(m_pBT) m_pBT->Update(pImg, pFG); TIME_END("BlobTrackerUpdate",CurBlobNum) - /* detect new blob */ + /* Detect new blob: */ TIME_BEGIN() if(!m_BTReal && m_pBD && pFG && (m_FrameCount > m_FGTrainFrames) ) - {/* detect new blob */ + { /* Detect new blob: */ static CvBlobSeq NewBlobList; CvBlobTrackAuto NewB; NewBlobList.Clear(); if(m_pBD->DetectNewBlob(pImg, pFG, &NewBlobList, &m_BlobList)) - {/* add new blob to tracker and blob list */ + { /* Add new blob to tracker and blob list: */ int i; IplImage* pMask = pFG; @@ -407,10 +422,11 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) cvErode(pFG,pMask,NULL,2); }*/ - for(i=0;iID = m_NextBlobID; + if(pBN && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH) { CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pMask ); @@ -422,35 +438,40 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask) m_NextBlobID++; } } - }/* add next blob from list of detected blob */ + } /* Add next blob from list of detected blob. */ if(pMask != pFG) cvReleaseImage(&pMask); - }/* create and add new blobs and trackers */ - }/* detect new blob */ + } /* Create and add new blobs and trackers. */ + + } /* Detect new blob. */ + TIME_END("BlobDetector",-1) TIME_BEGIN() if(m_pBTGen) - {/* run tracj generator */ - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* update data of tracked blob list */ + { /* Run track generator: */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Update data of tracked blob list: */ CvBlob* pB = m_BlobList.GetBlob(i-1); m_pBTGen->AddBlob(pB); } m_pBTGen->Process(pImg, pFG); - }/* run tracj generator */ + } /* Run track generator: */ TIME_END("TrajectoryGeneration",-1) TIME_BEGIN() if(m_pBTA) - {/* trajectory analysis module */ + { /* Trajectory analysis module: */ int i; - for(i=m_BlobList.GetBlobNum();i>0;i--) + for(i=m_BlobList.GetBlobNum(); i>0; i--) m_pBTA->AddBlob(m_BlobList.GetBlob(i-1)); + m_pBTA->Process(pImg, pFG); - }/* trajectory analysis module */ + + } /* Trajectory analysis module. */ + TIME_END("TrackAnalysis",m_BlobList.GetBlobNum()) -}/* CvBlobTrackerAuto1::Process */ +} /* CvBlobTrackerAuto1::Process */ diff --git a/cvaux/src/vs/blobtrackingcc.cpp b/cvaux/src/vs/blobtrackingcc.cpp index 15d61ce..fe6b424 100644 --- a/cvaux/src/vs/blobtrackingcc.cpp +++ b/cvaux/src/vs/blobtrackingcc.cpp @@ -41,7 +41,7 @@ #include "_cvaux.h" static float CalcAverageMask(CvBlob* pBlob, IplImage* pImgFG ) -{/* calc summ of mask */ +{ /* Calculate sum of mask: */ double Area, Aver = 0; CvRect r; CvMat mat; @@ -57,6 +57,7 @@ static float CalcAverageMask(CvBlob* pBlob, IplImage* pImgFG ) if(r.y<0){r.height += r.y;r.y = 0;} if((r.x+r.width)>=pImgFG->width){r.width=pImgFG->width-r.x-1;} if((r.y+r.height)>=pImgFG->height){r.height=pImgFG->height-r.y-1;} + if(r.width>0 && r.height>0) { double Sum = cvSum(cvGetSubRect(pImgFG,&mat,r)).val[0]/255.0; @@ -64,7 +65,7 @@ static float CalcAverageMask(CvBlob* pBlob, IplImage* pImgFG ) Aver = Sum/Area; } return (float)Aver; -}/* calc summ of mask */ +} /* Calculate sum of mask. */ /*============== BLOB TRACKERCC CLASS DECLARATION =============== */ @@ -76,7 +77,8 @@ typedef struct DefBlobTracker int Collision; CvBlobSeq* pBlobHyp; float AverFG; -}DefBlobTracker; +} DefBlobTracker; + void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* storage); class CvBlobTrackerCC : public CvBlobTracker @@ -90,7 +92,7 @@ private: char* m_ConfidenceTypeStr; CvBlobSeq m_BlobList; CvBlobSeq m_BlobListNew; -// int m_LastID; +// int m_LastID; CvMemStorage* m_pMem; int m_ClearHyp; IplImage* m_pImg; @@ -98,12 +100,12 @@ private: public: CvBlobTrackerCC():m_BlobList(sizeof(DefBlobTracker)) { -// m_LastID = 0; +// m_LastID = 0; m_ClearHyp = 0; m_pMem = cvCreateMemStorage(); m_Collision = 1; /* if 1 then collistion will be detected and processed */ AddParam("Collision",&m_Collision); - CommentParam("Collision", "if 1 then collision cases are processed in special way"); + CommentParam("Collision", "If 1 then collision cases are processed in special way"); m_AlphaSize = 0.02f; AddParam("AlphaSize",&m_AlphaSize); @@ -111,11 +113,11 @@ public: m_AlphaPos = 1.0f; AddParam("AlphaPos",&m_AlphaPos); - CommentParam("AlphaPos", "Pos update speed (0..1)"); + CommentParam("AlphaPos", "Position update speed (0..1)"); m_Alpha = 0.001f; AddParam("Alpha", &m_Alpha); - CommentParam("Alpha","Coefficient for model histogramm updating (0 - hist is not upated)"); + CommentParam("Alpha","Coefficient for model histogram updating (0 - hist is not updated)"); m_ConfidenceType=0; m_ConfidenceTypeStr = "NearestBlob"; @@ -124,12 +126,13 @@ public: SetModuleName("CC"); }; + ~CvBlobTrackerCC() { if(m_pMem)cvReleaseMemStorage(&m_pMem); }; - /* blob functions*/ + /* Blob functions: */ virtual int GetBlobNum() {return m_BlobList.GetBlobNum();}; virtual CvBlob* GetBlob(int BlobIndex){return m_BlobList.GetBlob(BlobIndex);}; virtual void SetBlob(int BlobIndex, CvBlob* pBlob) @@ -137,6 +140,7 @@ public: CvBlob* pB = m_BlobList.GetBlob(BlobIndex); if(pB) pB[0] = pBlob[0]; }; + virtual CvBlob* GetBlobByID(int BlobID){return m_BlobList.GetBlobByID(BlobID);}; virtual void DelBlob(int BlobIndex) { @@ -171,17 +175,18 @@ public: /* return pointer to new added blob */ virtual CvBlob* AddBlob(CvBlob* pB, IplImage* /*pImg*/, IplImage* pImgFG = NULL ) { - assert(pImgFG); /* this tracker use only foreground mask */ + assert(pImgFG); /* This tracker uses only foreground mask. */ DefBlobTracker NewB; NewB.blob = pB[0]; // CV_BLOB_ID(&NewB) = m_LastID; NewB.pBlobHyp = new CvBlobSeq; - NewB.pPredictor = cvCreateModuleBlobTrackPredictKalman(); /* module for predict position */ + NewB.pPredictor = cvCreateModuleBlobTrackPredictKalman(); /* Module for position prediction. */ NewB.pPredictor->Update(pB); NewB.AverFG = pImgFG?CalcAverageMask(pB,pImgFG):0; m_BlobList.AddBlob((CvBlob*)&NewB); return m_BlobList.GetBlob(m_BlobList.GetBlobNum()-1); }; + virtual void Process(IplImage* pImg, IplImage* pImgFG = NULL) { CvSeq* cnts; @@ -193,7 +198,7 @@ public: if(m_BlobList.GetBlobNum() <= 0 ) return; - /* clear blob list for new blobs */ + /* Clear bloblist for new blobs: */ m_BlobListNew.Clear(); assert(m_pMem); @@ -201,22 +206,24 @@ public: assert(pImgFG); - /* find CC */ + /* Find CC: */ #if 0 - {// by contur clastring + { // By contour clustering: cvFindBlobsByCCClasters(pImgFG, &m_BlobListNew, m_pMem); } #else - {/* one contour - one blob */ + { /* One contour - one blob: */ IplImage* pBin = cvCloneImage(pImgFG); assert(pBin); cvThreshold(pBin,pBin,128,255,CV_THRESH_BINARY); cvFindContours(pBin, m_pMem, &cnts, sizeof(CvContour), CV_RETR_EXTERNAL); - /* process each contours*/ - for(cnt = cnts;cnt;cnt=cnt->h_next) + + /* Process each contour: */ + for(cnt = cnts; cnt; cnt=cnt->h_next) { CvBlob NewBlob; - /* image moments */ + + /* Image moments: */ double M00,X,Y,XX,YY; CvMoments m; CvRect r = ((CvContour*)cnt)->rect; @@ -231,19 +238,20 @@ public: YY = (cvGetSpatialMoment( &m, 0, 2 )/M00) - Y*Y; NewBlob = cvBlob(r.x+(float)X,r.y+(float)Y,(float)(4*sqrt(XX)),(float)(4*sqrt(YY))); m_BlobListNew.AddBlob(&NewBlob); - }/* next contour */ + } /* Next contour. */ + cvReleaseImage(&pBin); } #endif - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* predict new blob position */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Predict new blob position: */ CvBlob* pB=NULL; DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(i-1); - /* update predictor by previouse value of blob*/ + /* Update predictor by previous value of blob: */ pBT->pPredictor->Update(&(pBT->blob)); - /* predict current position */ + /* Predict current position: */ pB = pBT->pPredictor->Predict(); if(pB) @@ -254,35 +262,45 @@ public: { pBT->BlobPredict = pBT->blob; } - }/* predict new blob position */ + } /* Predict new blob position. */ if(m_Collision) - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* predict collision */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Predict collision. */ int Collision = 0; int j; DefBlobTracker* pF = (DefBlobTracker*)m_BlobList.GetBlob(i-1); - for(j=m_BlobList.GetBlobNum();j>0;--j) - {/* predict collision */ + + for(j=m_BlobList.GetBlobNum(); j>0; --j) + { /* Predict collision: */ CvBlob* pB1; CvBlob* pB2; DefBlobTracker* pF2 = (DefBlobTracker*)m_BlobList.GetBlob(j-1); if(i==j) continue; pB1 = &pF->BlobPredict; pB2 = &pF2->BlobPredict; + if( fabs(pB1->x-pB2->x)<0.6*(pB1->w+pB2->w) && fabs(pB1->y-pB2->y)<0.6*(pB1->h+pB2->h) ) Collision = 1; + pB1 = &pF->blob; pB2 = &pF2->blob; + if( fabs(pB1->x-pB2->x)<0.6*(pB1->w+pB2->w) && fabs(pB1->y-pB2->y)<0.6*(pB1->h+pB2->h) ) Collision = 1; + if(Collision) break; - }/* check next blob to cross current*/ + + } /* Check next blob to cross current. */ + pF->Collision = Collision; - }/* predict collision */ - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* find a neighbour on cur frame for each blob from prev frame */ + } /* Predict collision. */ + + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Find a neighbour on current frame + * for each blob from previous frame: + */ CvBlob* pB = m_BlobList.GetBlob(i-1); DefBlobTracker* pBT = (DefBlobTracker*)pB; //int BlobID = CV_BLOB_ID(pB); @@ -291,17 +309,17 @@ public: //int j; if(pBT->pBlobHyp->GetBlobNum()>0) - {/* track all hypothesis */ + { /* Track all hypotheses: */ int h,hN = pBT->pBlobHyp->GetBlobNum(); - for(h=0;hpBlobHyp->GetBlob(h); int BlobID = CV_BLOB_ID(pB); CvBlob* pBBest = NULL; double DistBest = -1; - for(j=0;jpBlobHyp->DelBlob(h); h--; hN--; } - }/* next hyp*/ - }/* track all hypothesis */ - }/* track next blob */ + } /* Next hypothysis. */ + } /* Track all hypotheses. */ + } /* Track next blob. */ m_ClearHyp = 1; - }/* Process */ + } /* Process. */ virtual void ProcessBlob(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { @@ -348,12 +367,12 @@ public: BlobID = pB->ID; if(m_Collision && pBT->Collision) - {/* tracking in collision */ + { /* Tracking in collision: */ pB[0]=pBT->BlobPredict; CV_BLOB_ID(pB)=BlobID; - }/* tracking in collision */ + } /* Tracking in collision. */ else - {/* not collision tracking */ + { /* Non-collision tracking: */ CvBlob* pBBest = GetNearestBlob(pB); if(pBBest) { @@ -367,7 +386,7 @@ public: pB->y = y; CV_BLOB_ID(pB) = BlobID; } - }/* not collision tracking */ + } /* Non-collision tracking. */ pBlob[0] = pB[0]; pBlob->ID = ID; @@ -375,7 +394,7 @@ public: virtual double GetConfidence(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* pImgFG = NULL) { - /* define koefficients in exp by exp(-XT*K)=VT */ + /* Define coefficients in exp by exp(-XT*K)=VT: */ static double _KS = -log(0.1)/pow(0.5,2); /* XT = 1, VT = 0.1 - when size is Larger in 2 times Confidence is smoller in 10 times */ static double _KP = -log(0.1)/pow(m_pImg->width*0.02,2); /* XT = 0.02*ImgWidth, VT = 0.1*/ DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex); @@ -394,17 +413,17 @@ public: ds2 = dw*dw+dh*dh; if(!pBT->Collision) - { /* Confidence for size by nearest blob */ + { /* Confidence for size by nearest blob: */ W*=exp(-_KS*ds2); } if(m_ConfidenceType==0 && !pBT->Collision) - { /* confinence by nearest blob */ + { /* Confidence by nearest blob: */ W*=exp(-_KP*dp2); } if(m_ConfidenceType==1 && pBT->AverFG>0) - {/* calc summ of mask */ + { /* Calculate sum of mask: */ float Aver = CalcAverageMask(pBlob, pImgFG ); if(Aver < pBT->AverFG) { @@ -412,16 +431,17 @@ public: if(diff < 0.1f) diff = 0.1f; W *= diff; } - }/* calc summ of mask */ + } /* Calculate sum of mask. */ if(m_ConfidenceType==2) - {/* calc BCoeff */ + { /* Calculate BCoeff: */ float S = 0.2f; float Aver = CalcAverageMask(pBlob, pImgFG ); double B = sqrt(Aver*pBT->AverFG)+sqrt((1-Aver)*(1-pBT->AverFG)); W *= exp((B-1)/(2*S)); - }/* calc summ of mask */ + } /* Calculate sum of mask. */ + return W; }; @@ -444,7 +464,7 @@ public: CvBlobTracker::ParamUpdate(); - for(i=0;i<3;++i) + for(i=0; i<3; ++i) { if(cv_stricmp(m_ConfidenceTypeStr,pCT[i])==0) { @@ -453,29 +473,33 @@ public: } SetParamStr("ConfidenceType",pCT[m_ConfidenceType]); } - /* =============== MULTI HYPOTHESIS INTERFACE ================== */ - /* return number of position hyposetis of currently tracked blob */ + + /* =============== MULTI HYPOTHESIS INTERFACE ================== */ + /* Return number of position hypotheses of currently tracked blob: */ virtual int GetBlobHypNum(int BlobIdx) { DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIdx); assert(pBT->pBlobHyp); return pBT->pBlobHyp->GetBlobNum(); - };/* CvBlobtrackerList::GetBlobHypNum() */ + }; /* CvBlobtrackerList::GetBlobHypNum() */ - /* return pointer to specified blob hypothesis by index blob */ + /* Return pointer to specified blob hypothesis by index blob: */ virtual CvBlob* GetBlobHyp(int BlobIndex, int hypothesis) { DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex); assert(pBT->pBlobHyp); return pBT->pBlobHyp->GetBlob(hypothesis); - };/* CvBlobtrackerList::GetBlobHyp() */ - /* Set new parameters for specified (by index) blob hyp (can be called several times for each hyp )*/ + }; /* CvBlobtrackerList::GetBlobHyp() */ + + /* Set new parameters for specified (by index) blob hypothesis + * (can be called several times for each hypothesis): + */ virtual void SetBlobHyp(int BlobIndex, CvBlob* pBlob) { if(m_ClearHyp) - {/* clear all hypothesis */ + { /* Clear all hypotheses: */ int b, bN = m_BlobList.GetBlobNum(); - for(b=0;bpBlobHyp); @@ -483,7 +507,7 @@ public: } m_ClearHyp = 0; } - {/* add hypothesis */ + { /* Add hypothesis: */ DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex); assert(pBT->pBlobHyp); pBT->pBlobHyp->AddBlob(pBlob); @@ -502,8 +526,8 @@ private: BlobID = pB->ID; - for(j=m_BlobListNew.GetBlobNum();j>0;--j) - {/* find best CC */ + for(j=m_BlobListNew.GetBlobNum(); j>0; --j) + { /* Find best CC: */ double Dist = -1; CvBlob* pBNew = m_BlobListNew.GetBlob(j-1); double dx = fabs(CV_BLOB_X(pB)-CV_BLOB_X(pBNew)); @@ -516,8 +540,11 @@ private: DistBest = Dist; pBBest = pBNew; } - }/* find best CC */ + + } /* Find best CC. */ + return pBBest; + }; /* GetNearestBlob */ }; diff --git a/cvaux/src/vs/blobtrackingccwithcr.cpp b/cvaux/src/vs/blobtrackingccwithcr.cpp index 2e06eb1..a436aa6 100644 --- a/cvaux/src/vs/blobtrackingccwithcr.cpp +++ b/cvaux/src/vs/blobtrackingccwithcr.cpp @@ -40,6 +40,28 @@ #include "_cvaux.h" +/* Blob (foreground-pixel connected-component) tracking with collision resolution. + * + * For entrypoints into the literature see: + * + * A Tutorial on Particle Filters for Online Nonlinear/Non-Gaussian Bayesian Tracking + * Arulampalam &t al, 2001, 15p + * http://www-clmc.usc.edu/publications/A/arulampalam-TSP2002.pdf + * + * Particle Filters for Positioning, Navigation, and Tracking + * Gustafsson et al, 2002 12p + * http://www.control.isy.liu.se/~fredrik/reports/01SPpf4pos.pdf + * + * Particle Filtering in High Clutter Environments + * Korhonen et al, 2005 4p + * http://www.cs.uku.fi/finsig05/papers/paper26_FINSIG05.pdf + * + * Appearance Models for Occlusion Handling + * Andrew Senior &t al, 8p 2001 + * http://www.research.ibm.com/peoplevision/PETS2001.pdf + * + */ + /*============== BLOB TRACKERCC CLASS DECLARATION =============== */ typedef struct DefBlobTrackerCR { @@ -50,8 +72,10 @@ typedef struct DefBlobTrackerCR int Collision; CvBlobSeq* pBlobHyp; CvBlobTrackerOne* pResolver; -}DefBlobTrackerCR; +} DefBlobTrackerCR; + void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* storage); + class CvBlobTrackerCCCR : public CvBlobTracker { private: @@ -87,12 +111,13 @@ public: } SetParam("SizeVar",0); }; + ~CvBlobTrackerCCCR() { if(m_pMem)cvReleaseMemStorage(&m_pMem); }; - /* blob functions*/ + /* Blob functions: */ virtual int GetBlobNum() {return m_BlobList.GetBlobNum();}; virtual CvBlob* GetBlob(int BlobIndex){return m_BlobList.GetBlob(BlobIndex);}; virtual void SetBlob(int BlobIndex, CvBlob* pBlob) @@ -100,6 +125,7 @@ public: CvBlob* pB = m_BlobList.GetBlob(BlobIndex); if(pB) pB[0] = pBlob[0]; }; + virtual CvBlob* GetBlobByID(int BlobID){return m_BlobList.GetBlobByID(BlobID);}; virtual void DelBlob(int BlobIndex) { @@ -109,6 +135,7 @@ public: delete pBT->pBlobHyp; m_BlobList.DelBlob(BlobIndex); }; + virtual void DelBlobByID(int BlobID) { DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlobByID(BlobID); @@ -117,13 +144,14 @@ public: delete pBT->pBlobHyp; m_BlobList.DelBlobByID(BlobID); }; + virtual void Release(){delete this;}; /* Add new blob to track it and assign to this blob personal ID */ /* pBlob - pinter to structure with blob parameters (ID is ignored)*/ /* pImg - current image */ /* pImgFG - current foreground mask */ - /* return pointer to new added blob */ + /* Return pointer to new added blob: */ virtual CvBlob* AddBlob(CvBlob* pB, IplImage* pImg, IplImage* pImgFG = NULL ) { DefBlobTrackerCR NewB; @@ -142,6 +170,7 @@ public: m_BlobList.AddBlob((CvBlob*)&NewB); return m_BlobList.GetBlob(m_BlobList.GetBlobNum()-1); }; + virtual void Process(IplImage* pImg, IplImage* pImgFG = NULL) { CvSeq* cnts; @@ -151,23 +180,25 @@ public: if(m_BlobList.GetBlobNum() <= 0 ) return; - /* clear blob list for new blobs */ + /* Clear blob list for new blobs: */ m_BlobListNew.Clear(); assert(m_pMem); cvClearMemStorage(m_pMem); assert(pImgFG); - {/* one contour - one blob */ + { /* One contour - one blob: */ IplImage* pBin = cvCloneImage(pImgFG); assert(pBin); cvThreshold(pBin,pBin,128,255,CV_THRESH_BINARY); cvFindContours(pBin, m_pMem, &cnts, sizeof(CvContour), CV_RETR_EXTERNAL); - /* process each contours*/ - for(cnt = cnts;cnt;cnt=cnt->h_next) + + /* Process each contour: */ + for(cnt = cnts; cnt; cnt=cnt->h_next) { CvBlob NewBlob; - /* image moments */ + + /* Image moments: */ double M00,X,Y,XX,YY; CvMoments m; CvRect r = ((CvContour*)cnt)->rect; @@ -182,15 +213,18 @@ public: YY = (cvGetSpatialMoment( &m, 0, 2 )/M00) - Y*Y; NewBlob = cvBlob(r.x+(float)X,r.y+(float)Y,(float)(4*sqrt(XX)),(float)(4*sqrt(YY))); m_BlobListNew.AddBlob(&NewBlob); - }/* next contour */ + + } /* Next contour. */ + cvReleaseImage(&pBin); } - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* predict new blob position */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Predict new blob position. */ CvBlob* pB = NULL; DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1); - /*update predictor */ + + /* Update predictor. */ pBT->pPredictor->Update(&(pBT->blob)); pB = pBT->pPredictor->Predict(); if(pB) @@ -198,35 +232,37 @@ public: pBT->BlobPredict = pB[0]; } pBT->BlobPrev = pBT->blob; - }/* predict new blob position */ + } /* Predict new blob position. */ if(m_BlobList.GetBlobNum()>0 && m_BlobListNew.GetBlobNum()>0) - {/* resolve new blob to old */ + { /* Resolve new blob to old: */ int i,j; int NOld = m_BlobList.GetBlobNum(); int NNew = m_BlobListNew.GetBlobNum(); - for(i=0;iCollision = 0; pF->pBlobHyp->Clear(); - }/* set 0 collision */ + } /* Set 0 collision. */ - /* create correspondance records */ - for(j=0;jBlobPredict); + if( fabs(pB1->x-pB2->x)<0.5*(pB1->w+pB2->w) && fabs(pB1->y-pB2->y)<0.5*(pB1->h+pB2->h) ) Intersection = 1; + if(Intersection) { if(pFLast) @@ -236,17 +272,17 @@ public: pFLast = pF; pF->pBlobHyp->AddBlob(pB1); } - }/* check intersection */ - }/* check next new blob */ - }/* resolve new blob to old */ + } /* Check intersection. */ + } /* Check next new blob. */ + } /* Resolve new blob to old. */ - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* track each blob */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Track each blob. */ CvBlob* pB = m_BlobList.GetBlob(i-1); DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)pB; int BlobID = CV_BLOB_ID(pB); - //CvBlob* pBBest = NULL; - //double DistBest = -1; + //CvBlob* pBBest = NULL; + //double DistBest = -1; int j; if(pBT->pResolver) @@ -255,29 +291,29 @@ public: } if(pBT->Collision) - {/* tracking in collision */ + { /* Tracking in collision: */ if(pBT->pResolver) { pB[0] = pBT->pResolver->Process(&(pBT->BlobPredict),pImg, pImgFG)[0]; } - }/* tracking in collision */ + } /* Tracking in collision. */ else - {/* not collision tracking */ + { /* Non-collision tracking: */ CvBlob NewCC = pBT->BlobPredict; if(pBT->pBlobHyp->GetBlobNum()==1) - {/* one blob to one CC */ + { /* One blob to one CC: */ NewCC = pBT->pBlobHyp->GetBlob(0)[0]; } else - {/* one blob several CC */ + { /* One blob several CC: */ CvBlob* pBBest = NULL; double DistBest = -1; double CMax = 0; for(j=pBT->pBlobHyp->GetBlobNum();j>0;--j) - {/* find best CC */ + { /* Find best CC: */ CvBlob* pBNew = pBT->pBlobHyp->GetBlob(j-1); if(pBT->pResolver) - {/* choose CC by confidence */ + { /* Choose CC by confidence: */ // double dx = fabs(CV_BLOB_X(pB)-CV_BLOB_X(pBNew)); // double dy = fabs(CV_BLOB_Y(pB)-CV_BLOB_Y(pBNew)); double C = pBT->pResolver->GetConfidence(pBNew,pImg, pImgFG); @@ -288,7 +324,7 @@ public: } } else - { /* chose CC by distance */ + { /* Choose CC by distance: */ double dx = fabs(CV_BLOB_X(pB)-CV_BLOB_X(pBNew)); double dy = fabs(CV_BLOB_Y(pB)-CV_BLOB_Y(pBNew)); double Dist = sqrt(dx*dx+dy*dy); @@ -298,29 +334,29 @@ public: pBBest = pBNew; } } - }/* find best CC */ + } /* Find best CC. */ if(pBBest) NewCC = pBBest[0]; - }/* one blob several CC */ + } /* One blob several CC. */ pB->x = NewCC.x; pB->y = NewCC.y; pB->w = (m_AlphaSize)*NewCC.w+(1-m_AlphaSize)*pB->w; pB->h = (m_AlphaSize)*NewCC.h+(1-m_AlphaSize)*pB->h; pBT->pResolver->SkipProcess(&(pBT->BlobPredict),pImg, pImgFG); - }/* not collision tracking */ + } /* Non-collision tracking. */ pBT->pResolver->Update(pB, pImg, pImgFG); CV_BLOB_ID(pB)=BlobID; - }/* track next blob */ + } /* Track next blob. */ if(m_Wnd) { IplImage* pI = cvCloneImage(pImg); int i; - for(i=m_BlobListNew.GetBlobNum();i>0;--i) - {/* draw each new CC */ + for(i=m_BlobListNew.GetBlobNum(); i>0; --i) + { /* Draw each new CC: */ CvBlob* pB = m_BlobListNew.GetBlob(i-1); CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB)); int x = cvRound(CV_BLOB_RX(pB)), y = cvRound(CV_BLOB_RY(pB)); @@ -333,8 +369,8 @@ public: CV_RGB(255,255,0), 1 ); } - for(i=m_BlobList.GetBlobNum();i>0;--i) - {/* draw each new CC */ + for(i=m_BlobList.GetBlobNum(); i>0; --i) + { /* Draw each new CC: */ DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1); CvBlob* pB = &(pF->BlobPredict); CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB)); @@ -362,13 +398,15 @@ public: cvReleaseImage(&pI); } - }/* Process */ + } /* Process. */ + virtual void SaveState(CvFileStorage* fs) { int b,bN = m_BlobList.GetBlobNum(); cvWriteInt(fs,"BlobNum",m_BlobList.GetBlobNum()); cvStartWriteStruct(fs,"BlobList",CV_NODE_SEQ); - for(b=0;btag)) return; bN = pBlobListNode->data.seq->total; - for(b=0;btag)) cvReadRawData( fs, pSeqNode, &pF->BlobPredict, "ffffi" ); + pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "BlobPrev"); if(CV_NODE_IS_SEQ(pSeqNode->tag)) cvReadRawData( fs, pSeqNode, &pF->BlobPrev, "ffffi" ); + pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "BlobHyp"); if(pSeqNode) pF->pBlobHyp->Load(fs,pSeqNode); @@ -434,11 +477,12 @@ public: pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "Predictor"); if(pSeqNode) pF->pPredictor->LoadState(fs,pSeqNode); + pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "Resolver"); if(pSeqNode) pF->pResolver->LoadState(fs,pSeqNode); - }/* read next blob */ - }/* CCwithCR LoadState */ + } /* Read next blob. */ + } /* CCwithCR LoadState */ //void SetCollision(int Collision){m_Collision = Collision;}; }; diff --git a/cvaux/src/vs/blobtrackingkalman.cpp b/cvaux/src/vs/blobtrackingkalman.cpp index 857934e..78bf620 100644 --- a/cvaux/src/vs/blobtrackingkalman.cpp +++ b/cvaux/src/vs/blobtrackingkalman.cpp @@ -41,9 +41,10 @@ #include "_cvaux.h" /*======================= KALMAN FILTER AS TRACKER =========================*/ -/* state vector is (x,y,w,h,dx,dy,dw,dh)*/ -/* mesurment is (x,y,w,h) */ - /* dinamic matrix A */ +/* State vector is (x,y,w,h,dx,dy,dw,dh). */ +/* Measurement is (x,y,w,h) */ + +/* Dynamic matrix A: */ const float A8[] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, @@ -52,21 +53,23 @@ const float A8[] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}; -/* measurement matrix H */ + +/* Measurement matrix H: */ const float H8[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}; -/* matices for zero size velosity */ -/* dinamic matrix A */ +/* Matices for zero size velocity: */ +/* Dynamic matrix A: */ const float A6[] = { 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}; -/* measurement matrix H */ + +/* Measurement matrix H: */ const float H6[] = { 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -81,6 +84,7 @@ private: CvBlob m_Blob; CvKalman* m_pKalman; int m_Frame; + public: CvBlobTrackerOneKalman() { @@ -96,10 +100,12 @@ public: cvZero(m_pKalman->state_post); cvZero(m_pKalman->state_pre); } + ~CvBlobTrackerOneKalman() { cvReleaseKalman(&m_pKalman); } + virtual void Init(CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { m_Blob = pBlob[0]; @@ -108,14 +114,16 @@ public: m_pKalman->state_post->data.fl[2] = CV_BLOB_WX(pBlob); m_pKalman->state_post->data.fl[3] = CV_BLOB_WY(pBlob); } + virtual CvBlob* Process(CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { CvBlob* pBlobRes = &m_Blob; float Z[4]; CvMat Zmat = cvMat(4,1,CV_32F,Z); m_Blob = pBlob[0]; + if(m_Frame < 2) - {/* first call */ + { /* First call: */ m_pKalman->state_post->data.fl[0+4] = CV_BLOB_X(pBlob)-m_pKalman->state_post->data.fl[0]; m_pKalman->state_post->data.fl[1+4] = CV_BLOB_Y(pBlob)-m_pKalman->state_post->data.fl[1]; if(m_pKalman->DP>6) @@ -130,7 +138,7 @@ public: memcpy(m_pKalman->state_pre->data.fl,m_pKalman->state_post->data.fl,sizeof(float)*STATE_NUM); } else - {/* another call */ + { /* Another call: */ Z[0] = CV_BLOB_X(pBlob); Z[1] = CV_BLOB_Y(pBlob); Z[2] = CV_BLOB_WX(pBlob); @@ -150,7 +158,7 @@ public: { delete this; } -}; /* class CvBlobTrackerOneKalman */ +}; /* class CvBlobTrackerOneKalman */ static CvBlobTrackerOne* cvCreateModuleBlobTrackerOneKalman() { diff --git a/cvaux/src/vs/blobtrackinglist.cpp b/cvaux/src/vs/blobtrackinglist.cpp index d2e370b..bc49905 100644 --- a/cvaux/src/vs/blobtrackinglist.cpp +++ b/cvaux/src/vs/blobtrackinglist.cpp @@ -47,15 +47,17 @@ #define PIX_HIST_COL_QUANTS 64 //quantization level in rgb-space #define PIX_HIST_DELTA_IN_PIX_VAL (PIX_HIST_DELTA * 256 / PIX_HIST_COL_QUANTS) //allowed difference in rgb-space -//structures for background statistics estimation +// Structures for background statistics estimation: typedef struct CvPixHistBin{ float bin_val; uchar cols[3]; -}CvPixHistBin; +} CvPixHistBin; + typedef struct CvPixHist{ CvPixHistBin bins[PIX_HIST_BIN_NUM_2]; -}CvPixHist; -//class for background statistics estimation +} CvPixHist; + +// Class for background statistics estimation: class CvBGEstimPixHist { private: @@ -63,26 +65,30 @@ private: int m_width; int m_height; - //function for update color histogram for one pixel + // Function for update color histogram for one pixel: void update_hist_elem(int x, int y, uchar* cols ) { - //find closest bin + // Find closest bin: int dist = 0, min_dist = 2147483647, indx = -1; for( int k = 0; k < PIX_HIST_BIN_NUM_2; k++ ){ + uchar* hist_cols = m_PixHists[y*m_width+x].bins[k].cols; + m_PixHists[y*m_width+x].bins[k].bin_val *= (1-PIX_HIST_ALPHA); - int l; + + int l; for( l = 0; l < 3; l++ ){ int val = abs( hist_cols[l] - cols[l] ); if( val > PIX_HIST_DELTA_IN_PIX_VAL ) break; dist += val; } + if( l == 3 && dist < min_dist ){ min_dist = dist; indx = k; } } - if( indx < 0 ){//N2th elem in the table is replaced by a new features + if( indx < 0 ){ // N2th elem in the table is replaced by a new feature. indx = PIX_HIST_BIN_NUM_2 - 1; m_PixHists[y*m_width+x].bins[indx].bin_val = PIX_HIST_ALPHA; for(int l = 0; l < 3; l++ ){ @@ -93,13 +99,13 @@ private: //add vote! m_PixHists[y*m_width+x].bins[indx].bin_val += PIX_HIST_ALPHA; } - //re-sort bins by BIN_VAL + // Re-sort bins by BIN_VAL: { int k; for(k = 0; k < indx; k++ ){ if( m_PixHists[y*m_width+x].bins[k].bin_val <= m_PixHists[y*m_width+x].bins[indx].bin_val ){ CvPixHistBin tmp1, tmp2 = m_PixHists[y*m_width+x].bins[indx]; - //shift elements + // Shift elements: for(int l = k; l <= indx; l++ ){ tmp1 = m_PixHists[y*m_width+x].bins[l]; m_PixHists[y*m_width+x].bins[l] = tmp2; @@ -109,9 +115,9 @@ private: } } } - }//void update_hist(...) + } // void update_hist(...) - //function for calculation difference between histograms + // Function for calculation difference between histograms: float get_hist_diff(int x1, int y1, int x2, int y2) { float dist = 0; @@ -134,16 +140,15 @@ public: m_height = img_size.height; bg_image = cvCreateImage(img_size, IPL_DEPTH_8U, 3 ); - }/* constructor */ + } /* Constructor. */ ~CvBGEstimPixHist() { cvReleaseImage(&bg_image); cvFree(&m_PixHists); - }/* destructor */ + } /* Destructor. */ - - //function for update histograms and bg_image + // Function to update histograms and bg_image: void update_hists( IplImage* pImg ) { for( int i = 0; i < pImg->height; i++ ){ @@ -154,10 +159,10 @@ public: ((uchar*)(bg_image->imageData))[i*bg_image->widthStep+3*j+2] = m_PixHists[i*m_width+j].bins[0].cols[2]; } } - //cvNamedWindow("RoadMap2",0); - //cvShowImage("RoadMap2", bg_image); + // cvNamedWindow("RoadMap2",0); + // cvShowImage("RoadMap2", bg_image); } -};/* CvBGEstimPixHist */ +}; /* CvBGEstimPixHist */ @@ -185,6 +190,7 @@ private: CvBGEstimPixHist* m_pBGImage; IplImage* m_pImgFG; IplImage* m_pImgReg; /* mask for multiblob confidence calculation */ + public: CvBlobTrackerList(CvBlobTrackerOne* (*create)()):m_BlobTrackerList(sizeof(DefBlobTrackerL)) { @@ -209,6 +215,7 @@ public: AddParam("BGImageUsing", &m_BGImageUsing); CommentParam("BGImageUsing","Weight of using BG image in update hist model (0 - BG dies not use 1 - use)"); } + ~CvBlobTrackerList() { int i; @@ -220,8 +227,9 @@ public: m_BlobTrackerList.DelBlob(i-1); } }; + CvBlob* AddBlob(CvBlob* pBlob, IplImage* pImg, IplImage* pImgFG ) - {/* create new tracker */ + { /* Create new tracker: */ DefBlobTrackerL F; F.blob = pBlob[0]; // F.blob.ID = m_LastID++; @@ -235,6 +243,7 @@ public: m_BlobTrackerList.AddBlob((CvBlob*)&F); return m_BlobTrackerList.GetBlob(m_BlobTrackerList.GetBlobNum()-1); }; + void DelBlob(int BlobIndex) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIndex); @@ -244,6 +253,7 @@ public: delete pF->pBlobHyp; m_BlobTrackerList.DelBlob(BlobIndex); } + void DelBlobByID(int BlobID) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlobByID(BlobID); @@ -260,7 +270,7 @@ public: if(pImgFG) { if(m_pImgFG) cvCopyImage(pImgFG,m_pImgFG); - else m_pImgFG = cvCloneImage(pImgFG); + else m_pImgFG = cvCloneImage(pImgFG); } if(m_pBGImage==NULL && m_BGImageUsing>0) @@ -269,24 +279,26 @@ public: } if(m_Collision) - for(i=m_BlobTrackerList.GetBlobNum();i>0;--i) - {/* update predictor */ + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) + { /* Update predictor: */ DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); pF->pPredictor->Update((CvBlob*)pF); - }/* update predictor */ + } /* Update predictor. */ if(m_pBGImage && m_pImgFG) - {/* wheighting mask mask */ + { /* Weighting mask mask: */ int x,y,yN=pImg->height,xN=pImg->width; IplImage* pImgBG = NULL; m_pBGImage->update_hists(pImg); pImgBG = m_pBGImage->bg_image; - for(y=0;yimageData + y*pImg->widthStep; unsigned char* pBG = (unsigned char*)pImgBG->imageData + y*pImgBG->widthStep; unsigned char* pFG = (unsigned char*)m_pImgFG->imageData +y*m_pImgFG->widthStep; - for(x=0;x0;--i) - {/* predict position */ + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) + { /* Predict position. */ DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); CvBlob* pB = pF->pPredictor->Predict(); if(pB) @@ -318,16 +330,17 @@ public: pF->BlobPredict.w = pF->blob.w; pF->BlobPredict.h = pF->blob.h; } - }/* predict position */ + } /* Predict position. */ if(m_Collision) - for(i=m_BlobTrackerList.GetBlobNum();i>0;--i) - {/* predict collision */ + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) + { /* Predict collision. */ int Collision = 0; int j; DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); - for(j=m_BlobTrackerList.GetBlobNum();j>0;--j) - {/* predict collision */ + + for(j=m_BlobTrackerList.GetBlobNum(); j>0; --j) + { /* Predict collision. */ CvBlob* pB1; CvBlob* pB2; DefBlobTrackerL* pF2 = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(j-1); @@ -341,16 +354,18 @@ public: if( fabs(pB1->x-pB2->x)<0.5*(pB1->w+pB2->w) && fabs(pB1->y-pB2->y)<0.5*(pB1->h+pB2->h) ) Collision = 1; if(Collision) break; - }/* check next blob to cross current*/ + } /* Check next blob to cross current. */ + pF->Collision = Collision; pF->pTracker->SetCollision(Collision); - }/* predict collision */ - for(i=m_BlobTrackerList.GetBlobNum();i>0;--i) - {/* track each blob */ + } /* Predict collision. */ + + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) + { /* Track each blob. */ DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); if(pF->pBlobHyp->GetBlobNum()>0) - {/* track all hypothesis */ + { /* Track all hypothesis. */ int h,hN = pF->pBlobHyp->GetBlobNum(); for(h=0;hh = MAX(CV_BLOB_MINH,pNewBlob->h); CV_BLOB_ID(pB) = BlobID; } - }/* next hyp*/ + } /* Next hypothesis. */ + + } /* Track all hypotheses. */ - }/* track all hypothesis */ pF->Frame++; - }/* next blob */ + + } /* Next blob. */ #if 0 - for(i=m_BlobTrackerList.GetBlobNum();i>0;--i) - {/* update predictor */ + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) + { /* Update predictor: */ DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); if((m_Collision && !pF->Collision) || !m_Collision) { pF->pPredictor->Update((CvBlob*)pF); } else - {/* pravilnyp putem idete tovarischy!!! */ + { /* pravilnyp putem idete tovarischy!!! */ pF->pPredictor->Update(&(pF->BlobPredict)); } - }/* update predictor */ + } /* Update predictor. */ #endif m_ClearHyp = 1; }; @@ -403,6 +420,7 @@ public: } pBlob->ID = ID; }; + virtual double GetConfidence(int BlobIndex, CvBlob* pBlob, IplImage* pImg, IplImage* pImgFG = NULL) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIndex); @@ -410,6 +428,7 @@ public: if(pF->pTracker==NULL) return 0; return pF->pTracker->GetConfidence(pBlob?pBlob:(&pF->blob), pImg, pImgFG, NULL); }; + virtual double GetConfidenceList(CvBlobSeq* pBlobList, IplImage* pImg, IplImage* pImgFG = NULL) { double W = 1; @@ -423,7 +442,7 @@ public: cvSet(m_pImgReg,cvScalar(255)); - for(b=0;bGetBlob(b); DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlobByID(pB->ID); @@ -440,6 +459,7 @@ public: } return W; }; + virtual void UpdateBlob(int BlobIndex, CvBlob* pBlob, IplImage* pImg, IplImage* /*pImgFG*/ = NULL) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIndex); @@ -451,6 +471,7 @@ public: int GetBlobNum(){return m_BlobTrackerList.GetBlobNum();}; CvBlob* GetBlob(int index){return m_BlobTrackerList.GetBlob(index);}; + void SetBlob(int BlobIndex, CvBlob* pBlob) { CvBlob* pB = m_BlobTrackerList.GetBlob(BlobIndex); @@ -464,32 +485,33 @@ public: void Release(){delete this;}; - /* additional functionality */ + /* Additional functionality: */ CvBlob* GetBlobByID(int BlobID){return m_BlobTrackerList.GetBlobByID(BlobID);} /* =============== MULTI HYPOTHESIS INTERFACE ================== */ - /* return number of position hyposetis of currently tracked blob */ + /* Return number of position hypotheses of currently tracked blob: */ virtual int GetBlobHypNum(int BlobIdx) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIdx); assert(pF->pBlobHyp); return pF->pBlobHyp->GetBlobNum(); - };/* CvBlobtrackerList::GetBlobHypNum() */ + }; /* CvBlobtrackerList::GetBlobHypNum() */ - /* return pointer to specified blob hypothesis by index blob */ + /* Return pointer to specified blob hypothesis by index blob: */ virtual CvBlob* GetBlobHyp(int BlobIndex, int hypothesis) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIndex); assert(pF->pBlobHyp); return pF->pBlobHyp->GetBlob(hypothesis); - };/* CvBlobtrackerList::GetBlobHyp() */ + }; /* CvBlobtrackerList::GetBlobHyp() */ + /* Set new parameters for specified (by index) blob hyp (can be called several times for each hyp )*/ virtual void SetBlobHyp(int BlobIndex, CvBlob* pBlob) { if(m_ClearHyp) - {/* clear all hypothesis */ + { /* Clear all hypotheses: */ int b, bN = m_BlobTrackerList.GetBlobNum(); - for(b=0;bpBlobHyp); @@ -497,26 +519,26 @@ public: } m_ClearHyp = 0; } - {/* add hypothesis */ + { /* Add hypothesis: */ DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(BlobIndex); assert(pF->pBlobHyp); pF->pBlobHyp->AddBlob(pBlob); } - }; /*CvBlobtrackerList::SetBlobHyp*/ + }; /* CvBlobtrackerList::SetBlobHyp */ private: public: void ParamUpdate() { int i; - for(i=m_BlobTrackerList.GetBlobNum();i>0;--i) + for(i=m_BlobTrackerList.GetBlobNum(); i>0; --i) { DefBlobTrackerL* pF = (DefBlobTrackerL*)m_BlobTrackerList.GetBlob(i-1); TransferParamsToChild(pF->pTracker); pF->pTracker->ParamUpdate(); } } -}; /* CvBlobTrackerList */ +}; /* CvBlobTrackerList */ CvBlobTracker* cvCreateBlobTrackerList(CvBlobTrackerOne* (*create)()) { diff --git a/cvaux/src/vs/blobtrackingmsfg.cpp b/cvaux/src/vs/blobtrackingmsfg.cpp index 1475992..951376d 100644 --- a/cvaux/src/vs/blobtrackingmsfg.cpp +++ b/cvaux/src/vs/blobtrackingmsfg.cpp @@ -66,10 +66,12 @@ public: m_HistVolume = 0; Resize(BinNum); } + ~DefHist() { if(m_pHist)cvReleaseMat(&m_pHist); } + void Resize(int BinNum) { if(m_pHist)cvReleaseMat(&m_pHist); @@ -80,15 +82,16 @@ public: } m_HistVolume = 0; } + void Update(DefHist* pH, float W) - {/* update hist */ + { /* Update histogram: */ double Vol, WM, WC; Vol = 0.5*(m_HistVolume + pH->m_HistVolume); WM = Vol*(1-W)/m_HistVolume; WC = Vol*(W)/pH->m_HistVolume; cvAddWeighted(m_pHist, WM, pH->m_pHist,WC,0,m_pHist); m_HistVolume = (float)cvSum(m_pHist).val[0]; - }/* update hist */ + } /* Update histogram: */ }; class CvBlobTrackerOneMSFG:public CvBlobTrackerOne @@ -96,6 +99,7 @@ class CvBlobTrackerOneMSFG:public CvBlobTrackerOne protected: int m_BinNumTotal; /* protected only for parralel MSPF */ CvSize m_ObjSize; + void ReAllocKernel(int w, int h) { int x,y; @@ -109,7 +113,8 @@ protected: if(m_KernelMeanShift) cvReleaseMat(&m_KernelMeanShift); m_KernelHist = cvCreateMat(h, w, DefHistTypeMat); m_KernelMeanShift = cvCreateMat(h, w, DefHistTypeMat); - for(y=0;y= 0 && index < pHist->m_pHist->cols); + if(UsePrecalculatedKernel) { K = pKernelData[x]; @@ -236,11 +249,15 @@ private: } Volume += K; ((DefHistType*)(pHist->m_pHist->data.ptr))[index] += K; - }/* next column */ - }/* next row */ - }/* if m_Dim == 3 */ + + } /* Next column. */ + } /* Next row. */ + } /* if m_Dim == 3. */ + pHist->m_HistVolume = Volume; - };/*CollectHist*/ + + }; /* CollectHist */ + double calcBhattacharyya(DefHist* pHM = NULL, DefHist* pHC = NULL, DefHist* pHT = NULL) { if(pHM==NULL) pHM = &m_HistModel; @@ -249,12 +266,12 @@ private: if(pHC->m_HistVolume*pHM->m_HistVolume > 0) { #if 0 - // use CV functions + // Use CV functions: cvMul(pHM->m_pHist,pHC->m_pHist,pHT->m_pHist); cvPow(pHT->m_pHist,pHT->m_pHist,0.5); return cvSum(pHT->m_pHist).val[0] / sqrt(pHC->m_HistVolume*pHM->m_HistVolume); #else - // Do computations manually and let autovectorizer do the job + // Do computations manually and let autovectorizer do the job: DefHistType *hm, *hc, *ht; double sum; int size; @@ -271,42 +288,45 @@ private: #endif } return 0; - } /* calcBhattacharyyaCoefficient */ + } /* calcBhattacharyyaCoefficient. */ + protected: - //double GetBhattacharyya(IplImage* pImg, IplImage* pImgFG, float x, float y, DefHist* pHist=NULL) + // double GetBhattacharyya(IplImage* pImg, IplImage* pImgFG, float x, float y, DefHist* pHist=NULL) double GetBhattacharyya(IplImage* pImg, IplImage* pImgFG, CvBlob* pBlob, DefHist* pHist=NULL, int /*thread_number*/ = 0) { if(pHist==NULL)pHist = &m_HistTemp; CollectHist(pImg, pImgFG, pBlob, pHist); return calcBhattacharyya(&m_HistModel, pHist, pHist); } + void UpdateModelHist(IplImage* pImg, IplImage* pImgFG, CvBlob* pBlob) { if(m_Alpha>0 && !m_Collision) - {/* update hist */ + { /* Update histogram: */ CollectHist(pImg, pImgFG, pBlob, &m_HistCandidate); m_HistModel.Update(&m_HistCandidate, m_Alpha); - }/* update hist */ - }/* UpdateModelHist*/ + } /* Update histogram. */ + + } /* UpdateModelHist */ public: CvBlobTrackerOneMSFG() { - /* add several parameters for external use */ + /* Add several parameters for external use: */ m_FGWeight = 2; AddParam("FGWeight", &m_FGWeight); CommentParam("FGWeight","Weight of FG mask using (0 - mask will not be used for tracking)"); m_Alpha = 0.01f; AddParam("Alpha", &m_Alpha); - CommentParam("Alpha","Coefficient for model histogramm updating (0 - hist is not upated)"); + CommentParam("Alpha","Coefficient for model histogram updating (0 - hist is not upated)"); m_IterNum = 10; AddParam("IterNum", &m_IterNum); CommentParam("IterNum","Maximal number of iteration in meanshift operation"); - /* init internal data */ + /* Initialize internal data: */ m_Collision = 0; // m_BinBit=0; m_Dim = 0; @@ -319,6 +339,7 @@ public: m_KernelMeanShift = NULL; ReAllocHist(3,5); /* 3D hist, each dim has 2^5 bins*/ } + ~CvBlobTrackerOneMSFG() { /* @@ -329,7 +350,8 @@ public: if(m_KernelHist) cvReleaseMat(&m_KernelHist); if(m_KernelMeanShift) cvReleaseMat(&m_KernelMeanShift); } - /* interface */ + + /* Interface: */ virtual void Init(CvBlob* pBlobInit, IplImage* pImg, IplImage* pImgFG = NULL) { int w = cvRound(CV_BLOB_WX(pBlobInit)); @@ -346,6 +368,7 @@ public: CollectHist(pImg, pImgFG, pBlobInit, &m_HistModel); m_Blob = pBlobInit[0]; }; + virtual CvBlob* Process(CvBlob* pBlobPrev, IplImage* pImg, IplImage* pImgFG = NULL) { int iter; @@ -355,7 +378,7 @@ public: m_Blob = pBlobPrev[0]; } - {/* check blob size and realloc kernels if it is necessary */ + { /* Check blob size and realloc kernels if it is necessary: */ int w = cvRound(m_Blob.w); int h = cvRound(m_Blob.h); if( w != m_ObjSize.width || h!=m_ObjSize.height) @@ -363,10 +386,10 @@ public: ReAllocKernel(w,h); /* after this ( w != m_ObjSize.width || h!=m_ObjSize.height) shoiuld be false */ } - }/* check blob size and realloc kernels if it is necessary */ + } /* Check blob size and realloc kernels if it is necessary: */ - for(iter=0;iterwidth); assert(m_ObjSize.height < pImg->height); - /*calc shift vector */ - for(y=0;yheight;++y) + + /* Calculate shift vector: */ + for(y=0; yheight; ++y) { unsigned char* pImgData = &CV_IMAGE_ELEM(pImg,unsigned char,y,0); unsigned char* pMaskData = pImgFG?(&CV_IMAGE_ELEM(pImgFG,unsigned char,y,0)):NULL; - for(x=0;xwidth;++x,pImgData+=3) + + for(x=0; xwidth; ++x, pImgData+=3) { int xk = cvRound(x-(m_Blob.x-m_Blob.w*0.5)); int yk = cvRound(y-(m_Blob.y-m_Blob.h*0.5)); @@ -410,8 +435,10 @@ public: if(m_HistModel.m_HistVolume>0) HM = ((DefHistType*)m_HistModel.m_pHist->data.ptr)[index]/m_HistModel.m_HistVolume; + if(m_HistCandidate.m_HistVolume>0) HC = ((DefHistType*)m_HistCandidate.m_pHist->data.ptr)[index]/m_HistCandidate.m_HistVolume; + K = *(DefHistType*)CV_MAT_ELEM_PTR_FAST(m_KernelMeanShift[0],yk,xk,sizeof(DefHistType)); if(HC>0) @@ -430,8 +457,9 @@ public: CV_IMAGE_ELEM(pWFG,uchar,y,x) = (uchar)Vi; } - }/* next column */ - }/* next row */ + } /* Next column. */ + } /* Next row. */ + //cvNamedWindow("MSFG_W",0); //cvShowImage("MSFG_W",pW); //cvNamedWindow("MSFG_WFG",0); @@ -442,11 +470,13 @@ public: //cvSaveImage("MSFG_W.bmp",pW); //cvSaveImage("MSFG_WFG.bmp",pWFG); //cvSaveImage("MSFG_FG.bmp",pImgFG); - }/* debug */ + + } /* Debug. */ - /* calc new pos by meanshift */ - /* calc new pos */ + /* Calculate new position by meanshift: */ + + /* Calculate new position: */ if(m_Dim == 3) { int x0 = cvRound(m_Blob.x - m_ObjSize.width*0.5); @@ -456,18 +486,20 @@ public: assert(m_ObjSize.width < pImg->width); assert(m_ObjSize.height < pImg->height); - /* crop blob bounds */ + /* Crop blob bounds: */ if((x0+m_ObjSize.width)>=pImg->width) x0=pImg->width-m_ObjSize.width-1; if((y0+m_ObjSize.height)>=pImg->height) y0=pImg->height-m_ObjSize.height-1; if(x0<0){ x0=0;} if(y0<0){ y0=0;} - /*calc shift vector */ - for(y=0;y0) HM = ((DefHistType*)m_HistModel.m_pHist->data.ptr)[index]/m_HistModel.m_HistVolume; + if(m_HistCandidate.m_HistVolume>0) HC = ((DefHistType*)m_HistCandidate.m_pHist->data.ptr)[index]/m_HistCandidate.m_HistVolume; @@ -493,8 +526,8 @@ public: sum += K; newx += K*x; newy += K*y; - }/* next column */ - }/* next row */ + } /* Next column. */ + } /* Next row. */ if(sum > 0) { @@ -504,11 +537,12 @@ public: newx += x0; newy += y0; - }/* if m_Dim == 3 */ - /* calc new pos be meanshift */ + } /* if m_Dim == 3. */ + + /* Calculate new position by meanshift: */ for(;;) - {/* iterate using bahattcharrya coefficient */ + { /* Iterate using bahattcharrya coefficient: */ double B1; CvBlob B = m_Blob; // CvPoint NewCenter = cvPoint(cvRound(newx),cvRound(newy)); @@ -520,15 +554,15 @@ public: newx = 0.5f*(newx+m_Blob.x); newy = 0.5f*(newy+m_Blob.y); if(fabs(newx-m_Blob.x)<0.1 && fabs(newy-m_Blob.y)<0.1) break; - }/* iterate using bahattcharrya coefficient */ + } /* Iterate using bahattcharrya coefficient. */ if(fabs(newx-m_Blob.x)<0.5 && fabs(newy-m_Blob.y)<0.5) break; m_Blob.x = newx; m_Blob.y = newy; - }/* next iteration */ + } /* Next iteration. */ while(!m_Collision && m_FGWeight>0) - { /* update size if no collision */ + { /* Update size if no collision. */ float Alpha = 0.04f; CvBlob NewBlob; double M00,X,Y,XX,YY; @@ -561,21 +595,25 @@ public: m_Blob.w = MAX(NewBlob.w,5); m_Blob.h = MAX(NewBlob.h,5); break; - }/* update size if no collision */ + + } /* Update size if no collision. */ return &m_Blob; - }; /* CvBlobTrackerOneMSFG::Process */ + + }; /* CvBlobTrackerOneMSFG::Process */ + virtual double GetConfidence(CvBlob* pBlob, IplImage* pImg, IplImage* /*pImgFG*/ = NULL, IplImage* pImgUnusedReg = NULL) { double S = 0.2; double B = GetBhattacharyya(pImg, pImgUnusedReg, pBlob, &m_HistTemp); return exp((B-1)/(2*S)); - };/*CvBlobTrackerOneMSFG::*/ + + }; /*CvBlobTrackerOneMSFG::*/ virtual void Update(CvBlob* pBlob, IplImage* pImg, IplImage* pImgFG = NULL) - { /* update hist */ + { /* Update histogram: */ UpdateModelHist(pImg, pImgFG, pBlob?pBlob:&m_Blob); - }/*CvBlobTrackerOneMSFG::*/ + } /*CvBlobTrackerOneMSFG::*/ virtual void Release(){delete this;}; virtual void SetCollision(int CollisionFlag) @@ -602,7 +640,7 @@ public: } }; -}; /*CvBlobTrackerOneMSFG*/ +}; /*CvBlobTrackerOneMSFG*/ #if 0 void CvBlobTrackerOneMSFG::CollectHist(IplImage* pImg, IplImage* pMask, CvBlob* pBlob, DefHist* pHist) @@ -630,20 +668,23 @@ void CvBlobTrackerOneMSFG::CollectHist(IplImage* pImg, IplImage* pMask, CvBlob* if(m_Dim == 3) { - for(y=0;y= 0 && index < pHist->m_pHist->cols); + if(UsePrecalculatedKernel) { K = pKernelData[x]; @@ -662,23 +703,28 @@ void CvBlobTrackerOneMSFG::CollectHist(IplImage* pImg, IplImage* pMask, CvBlob* } Volume += K; ((DefHistType*)(pHist->m_pHist->data.ptr))[index] += K; - }/* next column */ - }/* next row */ - }/* if m_Dim == 3 */ + + } /* Next column. */ + } /* Next row. */ + } /* if m_Dim == 3. */ + pHist->m_HistVolume = Volume; -};/*CollectHist*/ + +}; /* CollectHist */ #endif CvBlobTrackerOne* cvCreateBlobTrackerOneMSFG() { return (CvBlobTrackerOne*) new CvBlobTrackerOneMSFG; } + CvBlobTracker* cvCreateBlobTrackerMSFG() { return cvCreateBlobTrackerList(cvCreateBlobTrackerOneMSFG); } -/* Create specific tracker without FG usin - just simple mean-shift tracker*/ +/* Create specific tracker without FG + * usin - just simple mean-shift tracker: */ class CvBlobTrackerOneMS:public CvBlobTrackerOneMSFG { public: @@ -693,6 +739,7 @@ CvBlobTrackerOne* cvCreateBlobTrackerOneMS() { return (CvBlobTrackerOne*) new CvBlobTrackerOneMS; } + CvBlobTracker* cvCreateBlobTrackerMS() { return cvCreateBlobTrackerList(cvCreateBlobTrackerOneMS); @@ -703,7 +750,7 @@ typedef struct DefParticle CvBlob blob; float Vx,Vy; double W; -}DefParticle; +} DefParticle; class CvBlobTrackerOneMSPF:public CvBlobTrackerOneMS { @@ -732,6 +779,7 @@ public: cvWriteStruct(fs,"ParticlesPredicted",m_pParticlesPredicted,"ffffiffd",m_ParticleNum); cvWriteStruct(fs,"ParticlesResampled",m_pParticlesResampled,"ffffiffd",m_ParticleNum); }; + virtual void LoadState(CvFileStorage* fs, CvFileNode* node) { //CvMat* pM; @@ -775,6 +823,7 @@ public: } #endif } + ~CvBlobTrackerOneMSPF() { if(m_pParticlesResampled)cvFree(&m_pParticlesResampled); @@ -783,6 +832,7 @@ public: if(m_HistForParalel) delete[] m_HistForParalel; #endif } + private: void Realloc() { @@ -790,19 +840,20 @@ private: if(m_pParticlesPredicted)cvFree(&m_pParticlesPredicted); m_pParticlesPredicted = (DefParticle*)cvAlloc(sizeof(DefParticle)*m_ParticleNum); m_pParticlesResampled = (DefParticle*)cvAlloc(sizeof(DefParticle)*m_ParticleNum); - };/* Realloc*/ + }; /* Realloc*/ + void DrawDebug(IplImage* pImg, IplImage* /*pImgFG*/) { int k; - for(k=0;k<2;++k) + for(k=0; k<2; ++k) { DefParticle* pBP = k?m_pParticlesResampled:m_pParticlesPredicted; - //const char* name = k?"MSPF resampled particle":"MSPF Predicted particle"; + //const char* name = k?"MSPF resampled particle":"MSPF Predicted particle"; IplImage* pI = cvCloneImage(pImg); int h,hN = m_ParticleNum; CvBlob C = cvBlob(0,0,0,0); double WS = 0; - for(h=0;h m_ImgSize.width*0.5f) { m_pParticlesPredicted[p].blob.w = m_ImgSize.width*0.5f; } + if(m_pParticlesPredicted[p].blob.h > m_ImgSize.height*0.5f) { m_pParticlesPredicted[p].blob.h = m_ImgSize.height*0.5f; } + if(m_pParticlesPredicted[p].blob.w < 1 ) { m_pParticlesPredicted[p].blob.w = 1; } + if(m_pParticlesPredicted[p].blob.h < 1) { m_pParticlesPredicted[p].blob.h = 1; } - }/* "prediction" of particle */ - }/* Prediction */ + } /* "Prediction" of particle. */ + } /* Prediction */ void UpdateWeightsMS(IplImage* pImg, IplImage* /*pImgFG*/) { @@ -913,7 +974,7 @@ private: if( m_HistForParalel[0].m_pHist==NULL || m_HistForParalel[0].m_pHist->cols != m_BinNumTotal) { int t; - for(t=0;t= T)break; } + if(p2>=m_ParticleNum)p2=m_ParticleNum-1; m_pParticlesResampled[p] = m_pParticlesPredicted[p2]; m_pParticlesResampled[p].W = 1; - }/* find next particle */ - } /* resample particle */ + + } /* Find next particle. */ + } /* Resample particle. */ public: @@ -992,7 +1061,9 @@ public: m_pParticlesResampled[i] = PP; } m_Blob = pBlobInit[0]; - } /* CvBlobTrackerOneMSPF::Init*/ + + } /* CvBlobTrackerOneMSPF::Init*/ + virtual CvBlob* Process(CvBlob* pBlobPrev, IplImage* pImg, IplImage* pImgFG = NULL) { int p; @@ -1003,15 +1074,15 @@ public: m_Blob = pBlobPrev[0]; - {/* check blob size and realloc kernels if it is necessary */ + { /* Check blob size and realloc kernels if it is necessary: */ int w = cvRound(m_Blob.w); int h = cvRound(m_Blob.h); if( w != m_ObjSize.width || h!=m_ObjSize.height) { ReAllocKernel(w,h); - /* after this ( w != m_ObjSize.width || h!=m_ObjSize.height) shoiuld be false */ + /* After this ( w != m_ObjSize.width || h!=m_ObjSize.height) should be false. */ } - }/* check blob size and realloc kernels if it is necessary */ + } /* Check blob size and realloc kernels if it is necessary. */ Prediction(); @@ -1034,14 +1105,16 @@ public: fprintf(stderr, "PF Resampling, %d ticks\n", (int)ticks); #endif - {/* find average result */ + { /* Find average result: */ float x = 0; float y = 0; float w = 0; float h = 0; float Sum = 0; + DefParticle* pP = m_pParticlesResampled; - for(p=0;p0) { m_Blob.x = x / Sum; @@ -1057,7 +1131,7 @@ public: m_Blob.w = w / Sum; m_Blob.h = h / Sum; } - }/* find average result */ + } /* Find average result. */ if(m_Wnd) { @@ -1065,11 +1139,13 @@ public: } return &m_Blob; - }/* CvBlobTrackerOneMSPF::Process */ + + } /* CvBlobTrackerOneMSPF::Process */ + virtual void SkipProcess(CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL) { int p; - for(p=0;p>m_ByteShift) + (((_pData)[1]>>(m_ByteShift))<>m_ByteShift)<<(m_BinBit*2))) void calcKernelEpanechnikov(CvMat* pK) -{/* allocate kernel for histogramm creation */ +{ /* Allocate kernel for histogramm creation: */ int x,y; int w = pK->width; int h = pK->height; float x0 = 0.5f*(w-1); float y0 = 0.5f*(h-1); - for(y=0;ywidth; @@ -172,7 +179,7 @@ private: if(m_Dim == 3) { - for(y=0;y=pImg->width) continue; if((x0+x)<0)continue; + if(pMaskData==NULL || pMaskData[x]>128) { DefHistType K = pKernelData[x]; @@ -193,22 +202,28 @@ private: assert(index >= 0 && index < pHist->cols); Volume += K; ((DefHistType*)(pHist->data.ptr))[index] += K; - }/* only masked pixels */ - }/* next column */ - }/* next row */ - }/* if m_Dim == 3 */ + + } /* Only masked pixels. */ + } /* Next column. */ + } /* Next row. */ + } /* if m_Dim == 3. */ + if(pHistVolume)pHistVolume[0] = Volume; - };/*calcHist*/ + + }; /* calcHist */ + double calcBhattacharyya() { cvMul(m_HistCandidate,m_HistModel,m_HistTemp); cvPow(m_HistTemp,m_HistTemp,0.5); return cvSum(m_HistTemp).val[0] / sqrt(m_HistCandidateVolume*m_HistModelVolume); - } /* calcBhattacharyyaCoefficient */ + } /* calcBhattacharyyaCoefficient */ + void calcWeights(IplImage* pImg, IplImage* pImgFG, CvPoint Center) { cvZero(m_Weights); - /* calc new pos */ + + /* Calculate new position: */ if(m_Dim == 3) { int x0 = Center.x - m_KernelMeanShiftSize.width/2; @@ -218,8 +233,8 @@ private: assert(m_Weights->width == m_KernelMeanShiftSize.width); assert(m_Weights->height == m_KernelMeanShiftSize.height); - /*calc shift vector */ - for(y=0;y0) HM = ((DefHistType*)m_HistModel->data.ptr)[index]/m_HistModelVolume; + if(m_HistCandidateVolume>0) HC = ((DefHistType*)m_HistCandidate->data.ptr)[index]/m_HistCandidateVolume; V = (HC>0)?sqrt(HM / HC):0; V += m_FGWeight*(pMaskData?((pMaskData[x]/255.0f)):0); pWData[x] = (float)MIN(V,100000); - }/* next column */ - }/* next row */ - }/* if m_Dim == 3 */ - }/* calcWeights */ + + } /* Next column. */ + } /* Next row. */ + } /* if m_Dim == 3. */ + } /* calcWeights */ public: CvBlobTrackerOneMSFGS() @@ -262,7 +279,7 @@ public: m_FGWeight = 0; m_Alpha = 0.0; - /* add several parameters for external use */ + /* Add several parameters for external use: */ AddParam("FGWeight", &m_FGWeight); CommentParam("FGWeight","Weight of FG mask using (0 - mask will not be used for tracking)"); AddParam("Alpha", &m_Alpha); @@ -276,13 +293,15 @@ public: m_KernelHistModel = NULL; m_KernelHistCandidate = NULL; m_Weights = NULL; - for(i=0;i 0) { dx /= sum; @@ -363,7 +391,7 @@ public: m_Blob.x += dx; m_Blob.y += dy; - { /* mean shift in scale space */ + { /* Mean shift in scale space: */ float news = 0; float sum = 0; float scale; @@ -372,6 +400,7 @@ public: calcHist(pImg, NULL, Center, m_KernelHistCandidate, m_HistCandidate, &m_HistCandidateVolume); calcWeights(pImg, pImgFG, Center); //cvSet(m_Weights,cvScalar(1)); + for(si=0; si0) { news /= sum; } + scale = (float)pow((double)SCALE_BASE,(double)news); m_Blob.w *= scale; m_Blob.h *= scale; - } /* mean shift in scale space */ + } /* Mean shift in scale space. */ - /* check fo finish */ + /* Check fo finish: */ if(fabs(dx)<0.1 && fabs(dy)<0.1) break; - }/* next iteration */ + + } /* Next iteration. */ if(m_Alpha>0) - {/* update hist */ + { /* Update histogram: */ double Vol, WM, WC; CvPoint Center = cvPoint(cvRound(m_Blob.x),cvRound(m_Blob.y)); calcHist(pImg, pImgFG, Center, m_KernelHistModel, m_HistCandidate, &m_HistCandidateVolume); @@ -402,10 +434,12 @@ public: WC = Vol*(m_Alpha)/m_HistCandidateVolume; cvAddWeighted(m_HistModel, WM, m_HistCandidate,WC,0,m_HistModel); m_HistModelVolume = (float)cvSum(m_HistModel).val[0]; - }/* update hist */ + } /* Update histogram. */ return &m_Blob; - }; /* Process */ + + }; /* Process */ + virtual void Release(){delete this;}; }; /*CvBlobTrackerOneMSFGS*/ @@ -413,6 +447,7 @@ CvBlobTrackerOne* cvCreateBlobTrackerOneMSFGS() { return (CvBlobTrackerOne*) new CvBlobTrackerOneMSFGS; } + CvBlobTracker* cvCreateBlobTrackerMSFGS() { return cvCreateBlobTrackerList(cvCreateBlobTrackerOneMSFGS); diff --git a/cvaux/src/vs/blobtrackpostprockalman.cpp b/cvaux/src/vs/blobtrackpostprockalman.cpp index 04b85cc..05e22ff 100644 --- a/cvaux/src/vs/blobtrackpostprockalman.cpp +++ b/cvaux/src/vs/blobtrackpostprockalman.cpp @@ -41,9 +41,10 @@ #include "_cvaux.h" /*======================= KALMAN FILTER =========================*/ -/* state vector is (x,y,w,h,dx,dy,dw,dh)*/ -/* mesurment is (x,y,w,h) */ - /* dinamic matrix A */ +/* State vector is (x,y,w,h,dx,dy,dw,dh). */ +/* Measurement is (x,y,w,h). */ + +/* Dynamic matrix A: */ const float A8[] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, @@ -52,21 +53,23 @@ const float A8[] = { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1}; -/* measurement matrix H */ + +/* Measurement matrix H: */ const float H8[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}; -/* matices for zero size velosity */ -/* dinamic matrix A */ +/* Matrices for zero size velocity: */ +/* Dinamic matrix A: */ const float A6[] = { 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}; -/* measurement matrix H */ + +/* Measurement matrix H: */ const float H6[] = { 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -78,6 +81,7 @@ const float H6[] = { 1, 0, 0, 0, 0, 0, class CvBlobTrackPostProcKalman:public CvBlobTrackPostProcOne { + private: CvBlob m_Blob; CvKalman* m_pKalman; @@ -85,9 +89,10 @@ private: float m_ModelNoise; float m_DataNoisePos; float m_DataNoiseSize; + public: CvBlobTrackPostProcKalman(); - ~CvBlobTrackPostProcKalman(); + ~CvBlobTrackPostProcKalman(); CvBlob* Process(CvBlob* pBlob); void Release(); virtual void ParamUpdate(); @@ -99,6 +104,7 @@ CvBlobTrackPostProcKalman::CvBlobTrackPostProcKalman() m_ModelNoise = 1e-6f; m_DataNoisePos = 1e-6f; m_DataNoiseSize = 1e-1f; + #if STATE_NUM>6 m_DataNoiseSize *= (float)pow(20.,2.); #else @@ -122,6 +128,7 @@ CvBlobTrackPostProcKalman::CvBlobTrackPostProcKalman() cvZero(m_pKalman->state_post); cvZero(m_pKalman->state_pre); } + CvBlobTrackPostProcKalman::~CvBlobTrackPostProcKalman() { cvReleaseKalman(&m_pKalman); @@ -134,14 +141,16 @@ void CvBlobTrackPostProcKalman::ParamUpdate() CV_MAT_ELEM(*m_pKalman->measurement_noise_cov, float, 2,2) = m_DataNoiseSize; CV_MAT_ELEM(*m_pKalman->measurement_noise_cov, float, 3,3) = m_DataNoiseSize; } + CvBlob* CvBlobTrackPostProcKalman::Process(CvBlob* pBlob) { CvBlob* pBlobRes = &m_Blob; float Z[4]; CvMat Zmat = cvMat(4,1,CV_32F,Z); m_Blob = pBlob[0]; + if(m_Frame < 2) - {/* first call */ + { /* First call: */ m_pKalman->state_post->data.fl[0+4] = CV_BLOB_X(pBlob)-m_pKalman->state_post->data.fl[0]; m_pKalman->state_post->data.fl[1+4] = CV_BLOB_Y(pBlob)-m_pKalman->state_post->data.fl[1]; if(m_pKalman->DP>6) @@ -155,7 +164,7 @@ CvBlob* CvBlobTrackPostProcKalman::Process(CvBlob* pBlob) m_pKalman->state_post->data.fl[3] = CV_BLOB_WY(pBlob); } else - {/* another call */ + { /* Nonfirst call: */ cvKalmanPredict(m_pKalman,0); Z[0] = CV_BLOB_X(pBlob); Z[1] = CV_BLOB_Y(pBlob); @@ -171,6 +180,7 @@ CvBlob* CvBlobTrackPostProcKalman::Process(CvBlob* pBlob) m_Frame++; return pBlobRes; } + void CvBlobTrackPostProcKalman::Release() { delete this; @@ -192,6 +202,7 @@ CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcKalman() /*======================= KALMAN PREDICTOR =========================*/ class CvBlobTrackPredictKalman:public CvBlobTrackPredictor { + private: CvBlob m_BlobPredict; CvKalman* m_pKalman; @@ -199,6 +210,7 @@ private: float m_ModelNoise; float m_DataNoisePos; float m_DataNoiseSize; + public: CvBlobTrackPredictKalman(); ~CvBlobTrackPredictKalman(); @@ -209,7 +221,7 @@ public: { delete this; } -}; /* class CvBlobTrackPredictKalman */ +}; /* class CvBlobTrackPredictKalman */ void CvBlobTrackPredictKalman::ParamUpdate() @@ -219,11 +231,13 @@ void CvBlobTrackPredictKalman::ParamUpdate() CV_MAT_ELEM(*m_pKalman->measurement_noise_cov, float, 2,2) = m_DataNoiseSize; CV_MAT_ELEM(*m_pKalman->measurement_noise_cov, float, 3,3) = m_DataNoiseSize; } + CvBlobTrackPredictKalman::CvBlobTrackPredictKalman() { m_ModelNoise = 1e-6f; m_DataNoisePos = 1e-6f; m_DataNoiseSize = 1e-1f; + #if STATE_NUM>6 m_DataNoiseSize *= (float)pow(20.,2.); #else @@ -247,10 +261,12 @@ CvBlobTrackPredictKalman::CvBlobTrackPredictKalman() cvZero(m_pKalman->state_post); cvZero(m_pKalman->state_pre); } + CvBlobTrackPredictKalman::~CvBlobTrackPredictKalman() { cvReleaseKalman(&m_pKalman); } + CvBlob* CvBlobTrackPredictKalman::Predict() { if(m_Frame >= 2) @@ -269,8 +285,9 @@ void CvBlobTrackPredictKalman::Update(CvBlob* pBlob) float Z[4]; CvMat Zmat = cvMat(4,1,CV_32F,Z); m_BlobPredict = pBlob[0]; + if(m_Frame < 2) - {/* first call */ + { /* First call: */ m_pKalman->state_post->data.fl[0+4] = CV_BLOB_X(pBlob)-m_pKalman->state_post->data.fl[0]; m_pKalman->state_post->data.fl[1+4] = CV_BLOB_Y(pBlob)-m_pKalman->state_post->data.fl[1]; if(m_pKalman->DP>6) @@ -284,16 +301,19 @@ void CvBlobTrackPredictKalman::Update(CvBlob* pBlob) m_pKalman->state_post->data.fl[3] = CV_BLOB_WY(pBlob); } else - {/* another call */ + { /* Nonfirst call: */ Z[0] = CV_BLOB_X(pBlob); Z[1] = CV_BLOB_Y(pBlob); Z[2] = CV_BLOB_WX(pBlob); Z[3] = CV_BLOB_WY(pBlob); cvKalmanCorrect(m_pKalman,&Zmat); } + cvKalmanPredict(m_pKalman,0); + m_Frame++; -}/* update */ + +} /* Update. */ CvBlobTrackPredictor* cvCreateModuleBlobTrackPredictKalman() { diff --git a/cvaux/src/vs/blobtrackpostproclinear.cpp b/cvaux/src/vs/blobtrackpostproclinear.cpp index 9b4e746..fa3f1a8 100644 --- a/cvaux/src/vs/blobtrackpostproclinear.cpp +++ b/cvaux/src/vs/blobtrackpostproclinear.cpp @@ -44,11 +44,13 @@ #define TIME_WND 5 class CvBlobTrackPostProcTimeAver:public CvBlobTrackPostProcOne { + protected: CvBlob m_Blob; CvBlob m_pBlobs[TIME_WND]; float m_Weights[TIME_WND]; int m_Frame; + public: CvBlobTrackPostProcTimeAver( int KernelType = 0) { @@ -63,7 +65,9 @@ public: } } }; - ~CvBlobTrackPostProcTimeAver(){}; + + ~CvBlobTrackPostProcTimeAver(){}; + CvBlob* Process(CvBlob* pBlob) { float WSum = 0; @@ -73,7 +77,7 @@ public: m_pBlobs[index] = pBlob[0]; m_Blob.x = m_Blob.y = m_Blob.w = m_Blob.h = 0; - for(i=0;iRelease(); } - ~CvBlobTrackPostProcList() + + ~CvBlobTrackPostProcList() { int i; for(i=m_BlobFilterList.GetBlobNum();i>0;--i) @@ -72,11 +74,12 @@ public: pF->pFilter->Release(); } }; + virtual void AddBlob(CvBlob* pBlob) { DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlobByID(CV_BLOB_ID(pBlob)); if(pF == NULL) - { /* create new filter */ + { /* Create new filter: */ DefBlobFilter F; F.blob = pBlob[0]; F.m_LastFrame = m_Frame; @@ -90,33 +93,37 @@ public: pF->blob = pBlob[0]; pF->m_LastFrame = m_Frame; }; + virtual void Process() { int i; - for(i=m_BlobFilterList.GetBlobNum();i>0;--i) + for(i=m_BlobFilterList.GetBlobNum(); i>0; --i) { DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlob(i-1); + if(pF->m_LastFrame == m_Frame) - {/* process */ + { /* Process: */ int ID = CV_BLOB_ID(pF); pF->blob = *(pF->pFilter->Process(&(pF->blob))); CV_BLOB_ID(pF) = ID; } else - {/* delete blob filter */ + { /* Delete blob filter: */ pF->pFilter->Release(); m_BlobFilterList.DelBlob(i-1); } - }/* next blob */ + } /* Next blob. */ m_Frame++; }; + int GetBlobNum(){return m_BlobFilterList.GetBlobNum();}; CvBlob* GetBlob(int index){return m_BlobFilterList.GetBlob(index);}; void Release(){delete this;}; - /* additional functionality */ + /* Additional functionality: */ CvBlob* GetBlobByID(int BlobID){return m_BlobFilterList.GetBlobByID(BlobID);} -}; /* CvBlobTrackPostProcList */ + +}; /* CvBlobTrackPostProcList */ CvBlobTrackPostProc* cvCreateBlobTrackPostProcList(CvBlobTrackPostProcOne* (*create)()) { diff --git a/cvaux/src/vs/enteringblobdetection.cpp b/cvaux/src/vs/enteringblobdetection.cpp index fd8bf56..5f3bb25 100644 --- a/cvaux/src/vs/enteringblobdetection.cpp +++ b/cvaux/src/vs/enteringblobdetection.cpp @@ -39,11 +39,18 @@ //M*/ /* -This file contain implementation of virtual interface of CvBlobDetector -this implementation based on simple algorithm -new blob is detected when several successive frames contains connected componets -which have uniform motion with not high speed. -Also separation from border and already tracked blobs are considered. +This file implements the virtual interface defined as "CvBlobDetector". +This implementation based on a simple algorithm: +A new blob is detected when several successive frames contains connected components +which have uniform motion not at an unreasonably high speed. +Separation from border and already tracked blobs are also considered. + +For an entrypoint into the literature see: + + Appearance Models for Occlusion Handling + Andrew Senior &t al, 8p 2001 + http://www.research.ibm.com/peoplevision/PETS2001.pdf + */ //#define USE_OBJECT_DETECTOR @@ -73,11 +80,11 @@ static int CompareContour(const void* a, const void* b, void* ) //wt = MAX(ra.width,rb.width)*0.1f; wt = 0; ht = MAX(ra.height,rb.height)*0.3f; - if(dx < wt && dy < ht) return 1; - return 0; + return (dx < wt && dy < ht); } + void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* storage) -{/* create contours */ +{ /* Create contours: */ IplImage* pIB = NULL; CvSeq* cnt = NULL; CvSeq* cnt_list = cvCreateSeq(0,sizeof(CvSeq),sizeof(CvSeq*), storage ); @@ -89,16 +96,16 @@ void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* sto cvFindContours(pIB,storage, &cnt, sizeof(CvContour), CV_RETR_EXTERNAL); cvReleaseImage(&pIB); - /* create cnt_list*/ - /* process each contours*/ - for(;cnt;cnt=cnt->h_next) + /* Create cnt_list. */ + /* Process each contour: */ + for(; cnt; cnt=cnt->h_next) { cvSeqPush( cnt_list, &cnt); } claster_num = cvSeqPartition( cnt_list, storage, &clasters, CompareContour, NULL ); - for(claster_cur=0;claster_curtotal;++cnt_cur) + for(cnt_cur=0; cnt_curtotal; ++cnt_cur) { CvRect rect; CvSeq* cnt; @@ -121,7 +128,7 @@ void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* sto rect_res = rect; } else - {/* unite rects */ + { /* Unite rects: */ int x0,x1,y0,y1; x0 = MIN(rect_res.x,rect.x); y0 = MIN(rect_res.y,rect.y); @@ -153,25 +160,27 @@ void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* sto } NewBlob = cvBlob(rect_res.x+(float)X,rect_res.y+(float)Y,(float)(4*sqrt(XX)),(float)(4*sqrt(YY))); pBlobs->AddBlob(&NewBlob); - }/* next cluster */ + + } /* Next cluster. */ #if 0 - {// debug info + { // Debug info: IplImage* pI = cvCreateImage(cvSize(pFG->width,pFG->height),IPL_DEPTH_8U,3); cvZero(pI); - for(claster_cur=0;claster_curtotal;++cnt_cur) + + for(cnt_cur=0; cnt_curtotal; ++cnt_cur) { CvSeq* cnt; int k = *(int*)cvGetSeqElem( clasters, cnt_cur ); if(k!=claster_cur) continue; cnt = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur ); cvDrawContours( pI, cnt, color, color, 0, 1, 8); - } + CvBlob* pB = pBlobs->GetBlob(claster_cur); int x = cvRound(CV_BLOB_RX(pB)), y = cvRound(CV_BLOB_RY(pB)); cvEllipse( pI, @@ -180,36 +189,39 @@ void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStorage* sto 0, 0, 360, color, 1 ); } + cvNamedWindow( "Clusters", 0); cvShowImage( "Clusters",pI ); cvReleaseImage(&pI); - }/* debug info */ + } /* Debug info. */ #endif -}/* cvFindBlobsByCCClasters */ -/* simple blob detector */ -/* numer of successive frame to analyse */ +} /* cvFindBlobsByCCClasters */ + +/* Simple blob detector. */ +/* Number of successive frame to analyse: */ #define EBD_FRAME_NUM 5 class CvBlobDetectorSimple:public CvBlobDetector { public: CvBlobDetectorSimple(); - ~CvBlobDetectorSimple(); + ~CvBlobDetectorSimple(); int DetectNewBlob(IplImage* pImg, IplImage* pFGMask, CvBlobSeq* pNewBlobList, CvBlobSeq* pOldBlobList); void Release(){delete this;}; + protected: IplImage* m_pMaskBlobNew; IplImage* m_pMaskBlobExist; - /* lists of connected components detected on previouse frames */ + /* Lists of connected components detected on previous frames: */ CvBlobSeq* m_pBlobLists[EBD_FRAME_NUM]; }; /* Blob detector creator (sole interface function for this file) */ CvBlobDetector* cvCreateBlobDetectorSimple(){return new CvBlobDetectorSimple;}; -/* Constructor of BlobDetector */ +/* Constructor of BlobDetector: */ CvBlobDetectorSimple::CvBlobDetectorSimple() { int i = 0; @@ -218,77 +230,92 @@ CvBlobDetectorSimple::CvBlobDetectorSimple() for(i=0;iwidth,pFGMask->height); if(m_pMaskBlobNew == NULL ) m_pMaskBlobNew = cvCreateImage(S,IPL_DEPTH_8U,1); if(m_pMaskBlobExist == NULL ) m_pMaskBlobExist = cvCreateImage(S,IPL_DEPTH_8U,1); - /* shift blob list */ + /* Shift blob list: */ { int i; if(m_pBlobLists[0]) delete m_pBlobLists[0]; for(i=1;ih_next) + + /* Process each contour: */ + for(cnt = cnts; cnt; cnt=cnt->h_next) { CvBlob NewBlob; - /* image moments */ + + /* Image moments: */ double M00,X,Y,XX,YY; CvMoments m; CvRect r = ((CvContour*)cnt)->rect; CvMat mat; + if(r.height < S.height*0.02 || r.width < S.width*0.02) continue; + cvMoments( cvGetSubRect(m_pMaskBlobNew,&mat,r), &m, 0 ); M00 = cvGetSpatialMoment( &m, 0, 0 ); + if(M00 <= 0 ) continue; - X = cvGetSpatialMoment( &m, 1, 0 )/M00; - Y = cvGetSpatialMoment( &m, 0, 1 )/M00; + + X = cvGetSpatialMoment( &m, 1, 0 )/M00; + Y = cvGetSpatialMoment( &m, 0, 1 )/M00; + XX = (cvGetSpatialMoment( &m, 2, 0 )/M00) - X*X; YY = (cvGetSpatialMoment( &m, 0, 2 )/M00) - Y*Y; + NewBlob = cvBlob(r.x+(float)X,r.y+(float)Y,(float)(4*sqrt(XX)),(float)(4*sqrt(YY))); + Blobs.AddBlob(&NewBlob); - }/* next contour */ + + } /* Next contour. */ + cvReleaseImage(&pIB); - }/* one contour - one blob */ + + } /* One contour - one blob. */ #endif - {/* Delete small and intersected blobs */ + { /* Delete small and intersected blobs: */ int i; - for(i=Blobs.GetBlobNum();i>0;i--) + for(i=Blobs.GetBlobNum(); i>0; i--) { CvBlob* pB = Blobs.GetBlob(i-1); @@ -300,26 +327,26 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C if(pOldBlobList) { int j; - for(j=pOldBlobList->GetBlobNum();j>0;j--) + for(j=pOldBlobList->GetBlobNum(); j>0; j--) { CvBlob* pBOld = pOldBlobList->GetBlob(j-1); if((fabs(pBOld->x-pB->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pB))) && (fabs(pBOld->y-pB->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pB)))) - {/* intersection is present, delete blob from list*/ + { /* Intersection is present, so delete blob from list: */ Blobs.DelBlob(i-1); break; } - }/* checl next old blob */ - }/*if pOldBlobList */ - }/* check next blob */ - }/* Delete small and intersected blobs */ + } /* Check next old blob. */ + } /* if pOldBlobList */ + } /* Check next blob. */ + } /* Delete small and intersected blobs. */ - {/* bubble sort blobs by size */ + { /* Bubble-sort blobs by size: */ int N = Blobs.GetBlobNum(); int i,j; - for(i=1;i0;--j) + for(j=i; j>0; --j) { CvBlob temp; float AreaP, AreaN; @@ -333,17 +360,21 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C pP[0] = temp; } } - /* copy only first 10 blobs */ - for(i=0;iAddBlob(Blobs.GetBlob(i)); } - }/* sort blobs by size */ + + } /* Sort blobs by size. */ + cvReleaseMemStorage(&storage); - }/* create Blobs */ - /* analize blob list to find best blob trajectory */ - {/* analize blob list to find best blob trajectory */ + } /* Create blobs. */ + + /* Analyze blob list to find best blob trajectory: */ + { int Count = 0; int pBLIndex[EBD_FRAME_NUM]; int pBL_BEST[EBD_FRAME_NUM]; @@ -351,60 +382,62 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C int finish = 0; double BestError = -1; int Good = 1; - for(i=0;iGetBlobNum() == 0) Good = 0; if(Good) - do{/* for each configuration */ + do{ /* For each configuration: */ CvBlob* pBL[EBD_FRAME_NUM]; int Good = 1; double Error = 0; CvBlob* pBNew = m_pBlobLists[EBD_FRAME_NUM-1]->GetBlob(pBLIndex[EBD_FRAME_NUM-1]); - for(i=0;iGetBlob(pBLIndex[i]); + + for(i=0; iGetBlob(pBLIndex[i]); Count++; - /* check intersection last blob with existed */ + /* Check intersection last blob with existed: */ if(Good && pOldBlobList) - { /* check intersection last blob with existed */ + { /* Check intersection last blob with existed: */ int k; - for(k=pOldBlobList->GetBlobNum();k>0;--k) + for(k=pOldBlobList->GetBlobNum(); k>0; --k) { CvBlob* pBOld = pOldBlobList->GetBlob(k-1); if((fabs(pBOld->x-pBNew->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pBNew))) && (fabs(pBOld->y-pBNew->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pBNew)))) Good = 0; } - }/* check intersection last blob with existed */ + } /* Check intersection last blob with existed. */ - /* check distance to image border */ + /* Check distance to image border: */ if(Good) - { /* check distance to image border */ + { /* Check distance to image border: */ CvBlob* pB = pBNew; float dx = MIN(pB->x,S.width-pB->x)/CV_BLOB_RX(pB); float dy = MIN(pB->y,S.height-pB->y)/CV_BLOB_RY(pB); if(dx < 1.1 || dy < 1.1) Good = 0; - }/* check distance to image border */ + } /* Check distance to image border. */ - /* check uniform moveing */ + /* Check uniform motion: */ if(Good) - {/* check uniform moveing */ + { int N = EBD_FRAME_NUM; float sum[2] = {0,0}; float jsum[2] = {0,0}; float a[2],b[2]; /* estimated parameters of moving x(t) = a*t+b*/ - int j; - - for(j=0;jx; float y = pBL[j]->y; @@ -413,49 +446,56 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C sum[1] += y; jsum[1] += j*y; } + a[0] = 6*((1-N)*sum[0]+2*jsum[0])/(N*(N*N-1)); b[0] = -2*((1-2*N)*sum[0]+3*jsum[0])/(N*(N+1)); a[1] = 6*((1-N)*sum[1]+2*jsum[1])/(N*(N*N-1)); b[1] = -2*((1-2*N)*sum[1]+3*jsum[1])/(N*(N+1)); - for(j=0;jx,2)+ pow(a[1]*j+b[1]-pBL[j]->y,2); } + Error = sqrt(Error/N); + if( Error > S.width*0.01 || fabs(a[0])>S.width*0.1 || fabs(a[1])>S.height*0.1) Good = 0; - }/* check configuration */ + + } /* Check configuration. */ - /* new best trajectory */ + /* New best trajectory: */ if(Good && (BestError == -1 || BestError > Error)) - {/* new best trajectory */ - for(i=0;iGetBlobNum()) break; pBLIndex[i]=0; - }/* next time shift */ + } /* Next time shift. */ + if(i==EBD_FRAME_NUM)finish=1; - }while(!finish); /* check next time configuration of connected components */ + + } while(!finish); /* Check next time configuration of connected components. */ #if 0 {/**/ printf("BlobDetector configurations = %d [",Count); int i; - for(i=0;iGetBlobNum():0); } @@ -465,25 +505,29 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C #endif if(BestError != -1) - {/* put new blob to output and delete from blob list */ + { /* Write new blob to output and delete from blob list: */ CvBlob* pNewBlob = m_pBlobLists[EBD_FRAME_NUM-1]->GetBlob(pBL_BEST[EBD_FRAME_NUM-1]); pNewBlobList->AddBlob(pNewBlob); - for(i=0;iDelBlob(pBL_BEST[i]); - }/* remove blob from each list */ - res = 1; - }/* put new blob to output and delete from blob list */ - }/* analize blod list to find best blob trajectory */ + } /* Remove blob from each list. */ - return res; -}/* cvDetectNewBlob */ + result = 1; + } /* Write new blob to output and delete from blob list. */ + } /* Analyze blob list to find best blob trajectory. */ + return result; +} /* cvDetectNewBlob */ -/* simple blob detector2 */ -/* numer of successive frame to analyse */ + + + +/* Simple blob detector2. */ +/* Number of successive frames to analyse: */ #define SEQ_SIZE_MAX 30 #define SEQ_NUM 1000 typedef struct @@ -491,13 +535,15 @@ typedef struct int size; CvBlob* pBlobs[SEQ_SIZE_MAX]; } DefSeq; + class CvBlobDetectorCC:public CvBlobDetector { public: CvBlobDetectorCC(); - ~CvBlobDetectorCC(); + ~CvBlobDetectorCC(); int DetectNewBlob(IplImage* pImg, IplImage* pFGMask, CvBlobSeq* pNewBlobList, CvBlobSeq* pOldBlobList); void Release(){delete this;}; + virtual void ParamUpdate() { if(SEQ_SIZE<1)SEQ_SIZE=1; @@ -520,8 +566,9 @@ public: } #endif } + private: - /* lists of connected components detected on previouse frames */ + /* Lists of connected components detected on previous frames: */ CvBlobSeq* m_pBlobLists[SEQ_SIZE_MAX]; DefSeq m_TrackSeq[SEQ_NUM]; int m_TrackNum; @@ -531,9 +578,10 @@ private: int m_Clastering; int SEQ_SIZE; - /* if not 0 then the detector is loaded from the specified file - and it is applied for splitting blobs which actually correspond - to groups of objects */ + /* If not 0 then the detector is loaded from the specified file + * and it is applied for splitting blobs which actually correspond + * to groups of objects: + */ char* m_param_split_detector_file_name; float m_param_roi_scale; int m_param_only_roi; @@ -548,10 +596,10 @@ private: CvBlobSeq m_debug_blob_seq; }; -/* Blob detector creator (sole interface function for this file) */ +/* Blob detector creator (sole interface function for this file): */ CvBlobDetector* cvCreateBlobDetectorCC(){return new CvBlobDetectorCC;} -/* Constructor of BlobDetector */ +/* Constructor for BlobDetector: */ CvBlobDetectorCC::CvBlobDetectorCC() : m_split_detector(0), m_detected_blob_seq(sizeof(CvDetectedBlob)), @@ -604,14 +652,13 @@ CvBlobDetectorCC::CvBlobDetectorCC() : m_roi_seq = cvCreateSeq( 0, sizeof(*m_roi_seq), sizeof(CvRect), cvCreateMemStorage() ); SetModuleName("BD_CC"); - } -/* destructor of BlobDetector*/ +/* Destructor for BlobDetector: */ CvBlobDetectorCC::~CvBlobDetectorCC() { int i; - for(i=0;iwidth,pFGMask->height); - /* shift blob list */ + /* Shift blob list: */ { int i; if(m_pBlobLists[SEQ_SIZE-1]) delete m_pBlobLists[SEQ_SIZE-1]; - for(i=SEQ_SIZE-1;i>0;--i)m_pBlobLists[i]=m_pBlobLists[i-1]; + + for(i=SEQ_SIZE-1; i>0; --i) m_pBlobLists[i] = m_pBlobLists[i-1]; + m_pBlobLists[0] = new CvBlobSeq; - }/* shift blob list */ + + } /* Shift blob list. */ - /* create contours and add new blobs to blob list */ - {/* create blobs */ + /* Create contours and add new blobs to blob list: */ + { /* Create blobs: */ CvBlobSeq Blobs; CvMemStorage* storage = cvCreateMemStorage(); if(m_Clastering) - {/* glue contours */ + { /* Glue contours: */ cvFindBlobsByCCClasters(pFGMask, &Blobs, storage ); - }/* glue contours */ + } /* Glue contours. */ else { /**/ IplImage* pIB = cvCloneImage(pFGMask); @@ -656,11 +709,12 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo CvSeq* cnt = NULL; cvThreshold(pIB,pIB,128,255,CV_THRESH_BINARY); cvFindContours(pIB,storage, &cnts, sizeof(CvContour), CV_RETR_EXTERNAL); - /* process each contours*/ - for(cnt = cnts;cnt;cnt=cnt->h_next) + + /* Process each contour: */ + for(cnt = cnts; cnt; cnt=cnt->h_next) { CvBlob NewBlob; - /* image moments */ + /* Image moments: */ double M00,X,Y,XX,YY; CvMoments m; CvRect r = ((CvContour*)cnt)->rect; @@ -675,13 +729,16 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo YY = (cvGetSpatialMoment( &m, 0, 2 )/M00) - Y*Y; NewBlob = cvBlob(r.x+(float)X,r.y+(float)Y,(float)(4*sqrt(XX)),(float)(4*sqrt(YY))); Blobs.AddBlob(&NewBlob); - }/* next contour */ + + } /* Next contour. */ + cvReleaseImage(&pIB); - }/* one contour - one blob */ - {/* Delete small and intersected blobs */ + } /* One contour - one blob. */ + + { /* Delete small and intersected blobs: */ int i; - for(i=Blobs.GetBlobNum();i>0;i--) + for(i=Blobs.GetBlobNum(); i>0; i--) { CvBlob* pB = Blobs.GetBlob(i-1); @@ -690,29 +747,30 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo Blobs.DelBlob(i-1); continue; } + if(pOldBlobList) { int j; - for(j=pOldBlobList->GetBlobNum();j>0;j--) + for(j=pOldBlobList->GetBlobNum(); j>0; j--) { CvBlob* pBOld = pOldBlobList->GetBlob(j-1); if((fabs(pBOld->x-pB->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pB))) && (fabs(pBOld->y-pB->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pB)))) - {/* intersection is present, delete blob from list*/ + { /* Intersection detected, delete blob from list: */ Blobs.DelBlob(i-1); break; } - }/* checl next old blob */ - }/*if pOldBlobList */ - }/* check next blob */ - }/* Delete small and intersected blobs */ + } /* Check next old blob. */ + } /* if pOldBlobList. */ + } /* Check next blob. */ + } /* Delete small and intersected blobs. */ - {/* bubble sort blobs by size */ + { /* Bubble-sort blobs by size: */ int N = Blobs.GetBlobNum(); int i,j; - for(i=1;i0;--j) + for(j=i; j>0; --j) { CvBlob temp; float AreaP, AreaN; @@ -726,40 +784,47 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo pP[0] = temp; } } - /* copy only first 10 blobs */ - for(i=0;iAddBlob(Blobs.GetBlob(i)); } - }/* sort blobs by size */ + + } /* Sort blobs by size. */ + cvReleaseMemStorage(&storage); - }/* create Blobs */ - {/* shift each track */ - int j; - for(j=0;j0;--i)pTrack->pBlobs[i]=pTrack->pBlobs[i-1]; + + for(i=SEQ_SIZE-1; i>0; --i) + pTrack->pBlobs[i] = pTrack->pBlobs[i-1]; + pTrack->pBlobs[0] = NULL; if(pTrack->size == SEQ_SIZE)pTrack->size--; } - }/* shift each track */ + } /* Shift each track. */ - /* analize blob list to find best blob trajectory */ - {/* analize blob list to find best blob trajectory */ + /* Analyze blob list to find best blob trajectory: */ + { double BestError = -1; int BestTrack = -1;; CvBlobSeq* pNewBlobs = m_pBlobLists[0]; int i; int NewTrackNum = 0; - for(i=pNewBlobs->GetBlobNum();i>0;--i) + for(i=pNewBlobs->GetBlobNum(); i>0; --i) { CvBlob* pBNew = pNewBlobs->GetBlob(i-1); int j; int AsignedTrack = 0; - for(j=0;j 2*CV_BLOB_WX(pLastBlob) || dy > 2*CV_BLOB_WY(pLastBlob)) continue; AsignedTrack++; + if(pTrack->pBlobs[0]==NULL) - {/*fill existed track */ + { /* Fill existed track: */ pTrack->pBlobs[0] = pBNew; pTrack->size++; } else if((m_TrackNum+NewTrackNum)size != SEQ_SIZE) continue; if(pBNew == NULL ) continue; - /* check intersection last blob with existed */ + /* Check intersection last blob with existed: */ if(Good && pOldBlobList) - { /* check intersection last blob with existed */ - int k; - for(k=pOldBlobList->GetBlobNum();k>0;--k) + { + int k; + for(k=pOldBlobList->GetBlobNum(); k>0; --k) { CvBlob* pBOld = pOldBlobList->GetBlob(k-1); if((fabs(pBOld->x-pBNew->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pBNew))) && (fabs(pBOld->y-pBNew->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pBNew)))) Good = 0; } - }/* check intersection last blob with existed */ + } /* Check intersection last blob with existed. */ - /* check distance to image border */ + /* Check distance to image border: */ if(Good) - { /* check distance to image border */ + { /* Check distance to image border: */ float dx = MIN(pBNew->x,S.width-pBNew->x)/CV_BLOB_RX(pBNew); float dy = MIN(pBNew->y,S.height-pBNew->y)/CV_BLOB_RY(pBNew); if(dx < m_MinDistToBorder || dy < m_MinDistToBorder) Good = 0; - }/* check distance to image border */ + } /* Check distance to image border. */ - /* check uniform moveing */ + /* Check uniform motion: */ if(Good) - {/* check uniform moveing */ + { /* Check uniform motion: */ double Error = 0; int N = pTrack->size; CvBlob** pBL = pTrack->pBlobs; @@ -833,7 +899,7 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo float a[2],b[2]; /* estimated parameters of moving x(t) = a*t+b*/ int j; - for(j=0;jx; float y = pBL[j]->y; @@ -842,63 +908,66 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo sum[1] += y; jsum[1] += j*y; } + a[0] = 6*((1-N)*sum[0]+2*jsum[0])/(N*(N*N-1)); b[0] = -2*((1-2*N)*sum[0]+3*jsum[0])/(N*(N+1)); a[1] = 6*((1-N)*sum[1]+2*jsum[1])/(N*(N*N-1)); b[1] = -2*((1-2*N)*sum[1]+3*jsum[1])/(N*(N+1)); - for(j=0;jx,2)+ pow(a[1]*j+b[1]-pBL[j]->y,2); } + Error = sqrt(Error/N); + if( Error > S.width*0.01 || fabs(a[0])>S.width*0.1 || fabs(a[1])>S.height*0.1) Good = 0; - /* new best trajectory */ + /* New best trajectory: */ if(Good && (BestError == -1 || BestError > Error)) - {/* new best trajectory */ + { /* New best trajectory: */ BestTrack = i; BestError = Error; - }/* new best trajectory */ - }/* check uniform moveing */ - }/* next track */ + } /* New best trajectory. */ + } /* Check uniform motion. */ + } /* Next track. */ #if 0 - {/**/ + { /**/ printf("BlobDetector configurations = %d [",m_TrackNum); int i; - for(i=0;iGetBlobNum():0); } printf("]\n"); - } #endif if(BestTrack >= 0) - {/* put new blob to output and delete from blob list */ + { /* Put new blob to output and delete from blob list: */ assert(m_TrackSeq[BestTrack].size == SEQ_SIZE); assert(m_TrackSeq[BestTrack].pBlobs[0]); pNewBlobList->AddBlob(m_TrackSeq[BestTrack].pBlobs[0]); m_TrackSeq[BestTrack].pBlobs[0] = NULL; m_TrackSeq[BestTrack].size--; - res = 1; - }/* put new blob to output and mark in blob list to delete*/ - }/* analize blod list to find best blob trajectory */ + result = 1; + } /* Put new blob to output and mark in blob list to delete. */ + } /* Analyze blod list to find best blob trajectory. */ - {/* delete bad tracks */ + { /* Delete bad tracks: */ int i; - for(i=m_TrackNum-1;i>=0;--i) - {/* delete bad tracks */ + for(i=m_TrackNum-1; i>=0; --i) + { /* Delete bad tracks: */ if(m_TrackSeq[i].pBlobs[0]) continue; if(m_TrackNum>0) m_TrackSeq[i] = m_TrackSeq[--m_TrackNum]; - }/* delete bad tracks */ + } /* Delete bad tracks: */ } #ifdef USE_OBJECT_DETECTOR @@ -961,9 +1030,9 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo if( m_detected_blob_seq.GetBlobNum() > 1 ) { /* - * Split blob + * Split blob. * The original blob is replaced by the first detected blob, - * remaining detected blobs are added to the end of the sequence + * remaining detected blobs are added to the end of the sequence: */ CvBlob* first_b = m_detected_blob_seq.GetBlob(0); CV_BLOB_X(b) = CV_BLOB_X(first_b); CV_BLOB_Y(b) = CV_BLOB_Y(first_b); @@ -975,17 +1044,19 @@ int CvBlobDetectorCC::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, CvBlo pNewBlobList->AddBlob(detected_b); } } - } /* for each new blob */ + } /* For each new blob. */ + for( i = 0; i < pNewBlobList->GetBlobNum(); ++i ) { CvBlob* b = pNewBlobList->GetBlob(i); CvDetectedBlob d_b = cvDetectedBlob( CV_BLOB_X(b), CV_BLOB_Y(b), CV_BLOB_WX(b), CV_BLOB_WY(b), 2 ); m_debug_blob_seq.AddBlob(&d_b); } - } // if( m_split_detector ) + } // if( m_split_detector ) #endif - return res; -}/* cvDetectNewBlob */ + return result; + +} /* cvDetectNewBlob */ diff --git a/cvaux/src/vs/enteringblobdetectionreal.cpp b/cvaux/src/vs/enteringblobdetectionreal.cpp index cc48cea..5a9c229 100644 --- a/cvaux/src/vs/enteringblobdetectionreal.cpp +++ b/cvaux/src/vs/enteringblobdetectionreal.cpp @@ -55,19 +55,24 @@ protected: CvTestSeq* m_pTestSeq; CvBlobSeq m_DetectedBlobs; CvMemStorage* m_pMem; + public: CvBlobDetectorReal(CvTestSeq* pTestSeq) { m_pTestSeq = pTestSeq; m_pMem = cvCreateMemStorage(0); } - /* destructor of BlobDetector*/ - ~CvBlobDetectorReal() + + /* Destructor of BlobDetector: */ + ~CvBlobDetectorReal() { if(m_pMem) cvReleaseMemStorage(&m_pMem); - }/* cvReleaseBlobDetector */ + } /* cvReleaseBlobDetector */ - /* cvDetectNewBlobs return 1 and fill blob pNewBlob by blob parameters if new blob is detected */ + /* cvDetectNewBlobs: + * Return 1 and fill blob pNewBlob with + * blob parameters if new blob is detected: + */ int DetectNewBlob(IplImage* /*pImg*/, IplImage* /*pFGMask*/, CvBlobSeq* pNewBlobList, CvBlobSeq* /*pOldBlobList*/) { int i; @@ -87,8 +92,8 @@ public: cvFindContours( pMaskCopy, m_pMem, &cnts, sizeof(CvContour), CV_RETR_EXTERNAL); cvReleaseImage(&pMaskCopy); - for(i=0;i W2 && RealPos.x < (pMask->width-W2) && RealPos.y > H2 && RealPos.y < (pMask->height-H2) ) - { /* yes !! we found new blob, Let's add it to list */ + { /* Yes!! We found new blob, let's add it to list: */ CvBlob NewBlob; NewBlob.x = RealPos.x; NewBlob.y = RealPos.y; @@ -113,12 +118,13 @@ public: m_DetectedBlobs.AddBlob(&NewBlob); pNewBlobList->AddBlob(&NewBlob); } - }/* real size is know */ + } /* Real size is known. */ else { CvSeq* cnt; if(m_DetectedBlobs.GetBlobByID(i)) continue; - for(cnt=cnts;cnt;cnt=cnt->h_next) + + for(cnt=cnts; cnt; cnt=cnt->h_next) { //CvBlob* pNewBlob = NULL; CvBlob NewBlob; @@ -127,12 +133,13 @@ public: float y = RealPos.y - r.y; if(x<0 || x > r.width || y < 0 || y > r.height ) continue; + if( r.x <= 1 || r.y <= 1 || r.x + r.width >= pMask->width - 2 || r.y + r.height >= pMask->height - 2 ) continue; - /* yes !! we found new blob, Let's add it to list */ + /* Yes!! We found new blob, let's add it to list: */ NewBlob.x = RealPos.x; NewBlob.y = RealPos.y; NewBlob.w = (float)r.width; @@ -141,15 +148,17 @@ public: m_DetectedBlobs.AddBlob(&NewBlob); pNewBlobList->AddBlob(&NewBlob); } - }/* check new blob entrance */ - }/* check next object */ + } /* Check new blob entrance. */ + } /* Check next object. */ return pNewBlobList->GetBlobNum(); - }/* cvDetectNewBlob */ + + } /* cvDetectNewBlob */ + void Release(){delete this;}; }; -/* Blob detector creator */ +/* Blob detector constructor: */ CvBlobDetector* cvCreateBlobDetectorReal(CvTestSeq* pTestSeq){return new CvBlobDetectorReal(pTestSeq);} diff --git a/cvaux/src/vs/testseq.cpp b/cvaux/src/vs/testseq.cpp index 93b8958..c420763 100644 --- a/cvaux/src/vs/testseq.cpp +++ b/cvaux/src/vs/testseq.cpp @@ -49,7 +49,7 @@ This file contain implementation of virtual interface of CvTestSeq #define SRC_TYPE_AVI 1 #define SRC_TYPE_IMAGE 0 -/* Transformation structure */ +/* Transformation structure: */ typedef struct CvTSTrans { float T[6]; /* geometry transformation */ @@ -60,7 +60,8 @@ typedef struct CvTSTrans float GN; /* standart deviation of added gaussian noise */ float NoiseAmp; /* amplifier of noise power */ float angle; -}CvTSTrans; +} CvTSTrans; + void SET_TRANS_0(CvTSTrans *pT) { memset(pT,0,sizeof(CvTSTrans)); @@ -71,7 +72,7 @@ void SET_TRANS_0(CvTSTrans *pT) pT->NoiseAmp = 1; } -/* ===some defenitions and function for transformation update ===*/ +/* === Some definitions and functions for transformation update: ===*/ #define P_ANGLE 0 #define P_S 1 #define P_SX 2 @@ -104,6 +105,7 @@ static void icvUpdateTrans(CvTSTrans* pTrans, int param, double val, float MaxX, TR[5] = S*T[2]+C*T[5]; for(i=0;i<6;++i)T[i]=(float)TR[i]; } + if(param==P_S) { int i; @@ -113,6 +115,7 @@ static void icvUpdateTrans(CvTSTrans* pTrans, int param, double val, float MaxX, pTrans->Shift.x = (float)(pTrans->Shift.x *val); pTrans->Shift.y = (float)(pTrans->Shift.y *val); } + if(param==P_SX) { int i; @@ -120,6 +123,7 @@ static void icvUpdateTrans(CvTSTrans* pTrans, int param, double val, float MaxX, pTrans->Scale.x = (float)(pTrans->Scale.x*val); pTrans->Shift.x = (float)(pTrans->Shift.x*val); } + if(param==P_SY) { int i; @@ -127,28 +131,35 @@ static void icvUpdateTrans(CvTSTrans* pTrans, int param, double val, float MaxX, pTrans->Scale.y = (float)(pTrans->Scale.y *val); pTrans->Shift.y = (float)(pTrans->Shift.y *val); } + if(param==P_DX) { pTrans->Shift.x = (float)(pTrans->Shift.x +val); pTrans->T[2] = (float)(pTrans->T[2] +val*MaxX); } + if(param==P_DY) { pTrans->Shift.y = (float)(pTrans->Shift.y +val); pTrans->T[5] = (float)(pTrans->T[5] +val*MaxY); } + if(param==P_C) { pTrans->C = (float)(pTrans->C *val); pTrans->I = (float)(pTrans->I *val); } + if(param==P_I) pTrans->I = (float)(pTrans->I +val); + if(param==P_GN) { pTrans->GN = (float)sqrt(val*val+pTrans->GN*pTrans->GN); } + if(param==P_NAmp) pTrans->NoiseAmp = (float)(pTrans->NoiseAmp *val); -}/* icvUpdateTrans */ +} /* icvUpdateTrans */ + /* === END some defenitions and function for transformation update ===*/ typedef struct CvTestSeqElem @@ -178,8 +189,9 @@ typedef struct CvTestSeqElem int noise_type; CvRandState rnd_state; int ObjID; - }CvTestSeqElem; -/* test seq main structure */ +} CvTestSeqElem; + +/* Test seq main structure: */ typedef struct CvTestSeq_ { int ID; @@ -199,11 +211,12 @@ typedef struct CvTestSeq_ float IVar_CurI; int ObjNum; -}CvTestSeq_; +} CvTestSeq_; CvSize cvTestSeqGetImageSize(CvTestSeq* pTestSeq){return cvSize(((CvTestSeq_*)(pTestSeq))->pImg->width,((CvTestSeq_*)(pTestSeq))->pImg->height);} int cvTestSeqFrameNum(CvTestSeq* pTestSeq){return ((CvTestSeq_*)(pTestSeq))->FrameNum;} + static void icvTestSeqCreateMask(IplImage* pImg,IplImage* pImgMask, int threshold) { if(pImg->nChannels > 1) @@ -215,29 +228,29 @@ static void icvTestSeqCreateMask(IplImage* pImg,IplImage* pImgMask, int threshol { cvThreshold(pImg,pImgMask,threshold,255,CV_THRESH_BINARY); } -}/* icvTestSeqCreateMask */ +} /* icvTestSeqCreateMask */ static void icvTestSeqQureyFrameElem(CvTestSeqElem* p, int /*frame*/) -{/* read next frame from avi for one record */ +{ /* Read next frame from avi for one record: */ if(p->type == SRC_TYPE_AVI) { IplImage* pI = NULL; //int frameNum = p->AVILen; if(p->pAVI == NULL && p->pFileName) - {/* open avi file if it is necessary */ + { /* Open avi file if necessary: */ p->pAVI = 0;//cvCaptureFromFile(p->pFileName); if(p->pAVI == NULL) { printf("WARNING!!! Can not open avi file %s\n",p->pFileName); return; } - }/* open avi file if it is necessary */ + } /* Open avi file if necessary. */ assert(p->pAVI); //if(frame >= frameNum) - {/* set new position */ + { /* Set new position: */ //int N = frame%frameNum; /*if( N==0 || @@ -245,7 +258,7 @@ static void icvTestSeqQureyFrameElem(CvTestSeqElem* p, int /*frame*/) { cvSetCaptureProperty(p->pAVI,CV_CAP_PROP_POS_FRAMES,N); }*/ - }/* set new position */ + } /* Set new position. */ //pI = cvQueryFrame(p->pAVI); if(pI) @@ -268,16 +281,18 @@ static void icvTestSeqQureyFrameElem(CvTestSeqElem* p, int /*frame*/) } } -}/* icvTestSeqQureyFrameElem */ +} /* icvTestSeqQureyFrameElem */ + +/*------------- Recursive function to read all images, ------------------------*/ +/*------------- videos and objects from config file. ------------------------*/ -/*------------- recursive function to read all images,------------------------*/ -/*-------------------videos and objects from config file ---------------------*/ static CvTestSeqElem* icvTestSeqReadElemAll(CvTestSeq_* pTS, CvFileStorage* fs, const char* name); + static void icvTestSeqAllocTrans(CvTestSeqElem* p) -{/*allocate transformation array if necessary */ +{ /* Allocate transformation array if necessary */ /* work with transformation */ if(p->pTrans == NULL/* && p->FrameNum>0*/) - {/* allocate transforamtion array */ + { /* Allocate transformation array: */ int num = MAX(1,p->FrameNum); p->pTrans = (CvTSTrans*)cvAlloc(sizeof(CvTSTrans)*num); p->TransNum = num; @@ -285,11 +300,12 @@ static void icvTestSeqAllocTrans(CvTestSeqElem* p) } if(p->FrameNum > p->TransNum) - {/* allocate new transforamtion array */ + { /* Allocate new transformation array: */ int i; int num = p->FrameNum; CvTSTrans* pNewTrans = (CvTSTrans*)cvAlloc(sizeof(CvTSTrans)*num); - for(i=0;ipTrans) pNewTrans[i] = p->pTrans[i%p->TransNum]; @@ -299,8 +315,8 @@ static void icvTestSeqAllocTrans(CvTestSeqElem* p) if(p->pTrans)cvFree(&p->pTrans); p->pTrans = pNewTrans; p->TransNum = num; - }/* allocate new transforamtion array */ -}/*allocate transformation array if necessary */ + } /* Allocate new transformation array. */ +} /* Allocate transformation array if necessary. */ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, CvFileNode* node) { @@ -310,7 +326,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, const char* pVideoObjName = cvReadStringByName( fs, node,"VideoObj", NULL); if(pVideoName) - {/* check to noise flag */ + { /* Check to noise flag: */ if( cv_stricmp(pVideoName,"noise_gaussian") == 0 || cv_stricmp(pVideoName,"noise_normal") == 0) noise_type = CV_NOISE_GAUSSIAN; if( cv_stricmp(pVideoName,"noise_uniform") == 0) noise_type = CV_NOISE_UNIFORM; @@ -319,7 +335,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } if((pVideoName || pVideoObjName ) && noise_type == CV_NOISE_NONE) - {/* read other elements */ + { /* Read other elements: */ if(pVideoName) pElem = icvTestSeqReadElemAll(pTS, fs, pVideoName); if(pVideoObjName) { @@ -332,9 +348,9 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } pTS->ObjNum++; } - }/* read other elements */ + } /* Read other elements. */ else - {/* create new elem */ + { /* Create new element: */ CvFileNode* pPosNode = cvGetFileNodeByName( fs, node,"Pos"); CvFileNode* pSizeNode = cvGetFileNodeByName( fs, node,"Size"); int AutoSize = (pSizeNode && CV_NODE_IS_STRING(pSizeNode->tag) && cv_stricmp("auto",cvReadString(pSizeNode,""))==0); @@ -348,7 +364,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, cvRandInit( &pElem->rnd_state, 1, 0, 0,CV_RAND_NORMAL); if(pFileName && pElem->noise_type == CV_NOISE_NONE) - {/* if AVI or BMP */ + { /* If AVI or BMP: */ size_t l = strlen(pFileName); pElem->pFileName = pFileName; @@ -387,14 +403,14 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } else { - printf("WARNING!!! Can not open avi file %s\n",pFileName); + printf("WARNING!!! Cannot open avi file %s\n",pFileName); } } - }/* if AVI or BMP */ + } /* If AVI or BMP. */ if(pPosNode) - {/* read positions */ + { /* Read positions: */ if(CV_NODE_IS_SEQ(pPosNode->tag)) { int num = pPosNode->data.seq->total; @@ -406,7 +422,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } if(pSizeNode) - {/* read sizes */ + { /* Read sizes: */ if(CV_NODE_IS_SEQ(pSizeNode->tag)) { int num = pSizeNode->data.seq->total; @@ -417,7 +433,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } if(AutoPos || AutoSize) - {/* auto size and pos */ + { /* Auto size and pos: */ int i; int num = (pElem->type == SRC_TYPE_AVI)?pElem->AVILen:1; if(AutoSize) @@ -431,7 +447,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, pElem->PosNum = num; } - for(i=0;ipPos + i):NULL; @@ -457,6 +473,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, CvMoments m; cvMoments( pElem->pImgMask, &m, 0 ); M00 = cvGetSpatialMoment( &m, 0, 0 ); + if(M00 > 0 && pSize ) { double X = cvGetSpatialMoment( &m, 1, 0 )/M00; @@ -466,6 +483,7 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, pSize->x = (float)(4*sqrt(XX))/(pElem->pImgMask->width-1); pSize->y = (float)(4*sqrt(YY))/(pElem->pImgMask->height-1); } + if(M00 > 0 && pPos) { pPos->x = (float)(cvGetSpatialMoment( &m, 1, 0 )/(M00*(pElem->pImgMask->width-1))); @@ -473,31 +491,38 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, } if(pPos) - { /* another way to calculate y pos using object median */ - int y0=0,y1=pFG->height-1; - for(y0=0;y0height;++y0) + { /* Another way to calculate y pos + * using object median: + */ + int y0=0, y1=pFG->height-1; + for(y0=0; y0height; ++y0) { CvMat m; CvScalar s = cvSum(cvGetRow(pFG, &m, y0)); if(s.val[0] > 255*7) break; } - for(y1=pFG->height-1;y1>0;--y1) + + for(y1=pFG->height-1; y1>0; --y1) { CvMat m; CvScalar s = cvSum(cvGetRow(pFG, &m, y1)); if(s.val[0] > 255*7) break; } + pPos->y = (y0+y1)*0.5f/(pFG->height-1); } - }/* pFG */ - }/* next frame */ + } /* pFG */ + } /* Next frame. */ + //if(pElem->pAVI) cvReleaseCapture(&pElem->pAVI); + pElem->pAVI = NULL; - }/* end auto pos creation */ - }/* create new elem */ + + } /* End auto position creation. */ + } /* Create new element. */ if(pElem) - {/* read transfroms and */ + { /* Read transforms and: */ int FirstFrame, LastFrame; CvTestSeqElem* p=pElem; CvFileNode* pTransNode = NULL; @@ -512,9 +537,10 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, while( pTransNode && CV_NODE_IS_STRING(pTransNode->tag) && cv_stricmp("auto",cvReadString(pTransNode,""))!=0) - {/* Trans is reference */ + { /* Trans is reference: */ pTransNode = cvGetFileNodeByName( fs, NULL,cvReadString(pTransNode,"")); } + pS = cvGetFileNodeByName( fs, node,"Shift"); ShiftByPos = 0; pTransSeq = pTransNode?(CV_NODE_IS_SEQ(pTransNode->tag)?pTransNode->data.seq:NULL):NULL; @@ -528,8 +554,11 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, FirstFrame = pElem->FrameBegin; LastFrame = pElem->FrameBegin+pElem->FrameNum-1; - /* calc length of video and reallocate transformation array */ - for(p=pElem;p;p=p->next) + + /* Calculate length of video and reallocate + * transformation array: + */ + for(p=pElem; p; p=p->next) { int v; v = cvReadIntByName( fs, node, "BG", -1 ); @@ -547,22 +576,23 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, icvTestSeqAllocTrans(p); - {/* new range estimation */ + { /* New range estimation: */ int LF = p->FrameBegin+p->FrameNum-1; if(p==pElem || FirstFrame > p->FrameBegin)FirstFrame = p->FrameBegin; if(p==pElem || LastFrame < LF)LastFrame = LF; - }/* new range estimation */ - }/* end allocate new transfrom array */ + } /* New range estimation. */ + } /* End allocate new transfrom array. */ if(ShiftByPos) { for(p=pElem;p;p=p->next) - {/* modify transformation to make autoshift */ + { /* Modify transformation to make autoshift: */ int i; int num = p->FrameNum; assert(num <= p->TransNum); p->TransNum = MAX(1,num); - for(i=0;ipTrans+i; //float t = (num>1)?((float)i/(num-1)):0.0f; @@ -570,73 +600,82 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, float newy = p->pPos[i%p->PosNum].y; pT->Shift.x = -newx*pT->Scale.x; pT->Shift.y = -newy*pT->Scale.y; + if(p->pImg) { newx *= p->pImg->width-1; newy *= p->pImg->height-1; } + pT->T[2] = -(pT->T[0]*newx+pT->T[1]*newy); pT->T[5] = -(pT->T[3]*newx+pT->T[4]*newy); } - }/* modify transformation old*/ - }/* next record */ + } /* Modify transformation old. */ + } /* Next record. */ - /* init frame num array */ + /* Initialize frame number array: */ KeyFrames[0] = FirstFrame; + if(pTransSeq&&KeyFrameNum>1) - {/* init frame num array */ + { int i0,i1,i; - for(i=0;ii0); - for(i=i0+1;inext) + for(p=pElem; p; p=p->next) { //int trans_num = p->TransNum; - for(param=0;param_name[param];++param) + for(param=0; param_name[param]; ++param) { char* name = param_name[param]; float defv = param_defval[param]; if(KeyFrameNum==1) - {/* only one transform record */ + { /* Only one transform record: */ int i; double val; CvFileNode* node = cvGetFileNodeByName( fs, pTN,name); if(node == NULL) continue; val = cvReadReal(node,defv); - for(i=0;iTransNum;++i) + + for(i=0; iTransNum; ++i) { icvUpdateTrans( p->pTrans+i, param, val, p->pImg?(float)(p->pImg->width-1):1.0f, p->pImg?(float)(p->pImg->height-1):1.0f); } - }/* next record */ + } /* Next record. */ else - { /* several transforms */ + { /* Several transforms: */ int i0,i1; double v0; double v1; @@ -644,19 +683,23 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs, CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,0); v0 = cvReadRealByName(fs, pTN,name,defv); - for(i1=1,i0=0;i1= p->TransNum) break; if(KeyFrames[i1]>KeyFrames[i0]) t /=(float)(KeyFrames[i1]-KeyFrames[i0]); val = t*(v1-v0)+v0; + icvUpdateTrans( p->pTrans+li, param, val, p->pImg?(float)(p->pImg->width-1):1.0f, p->pImg?(float)(p->pImg->height-1):1.0f); - }/* next transform */ + + } /* Next transform. */ i0 = i1; v0 = v1; - }/* next value run */ - } /* several transforms */ - }/* next parameters */ - }/* next record */ - }/* more complex transform */ - }/* read transfroms */ + + } /* Next value run. */ + } /* Several transforms. */ + } /* Next parameter. */ + } /* Next record. */ + } /* More complex transform. */ + } /* Read transfroms. */ + return pElem; -}/* icvTestSeqReadElemOne */ + +} /* icvTestSeqReadElemOne */ static CvTestSeqElem* icvTestSeqReadElemAll(CvTestSeq_* pTS, CvFileStorage* fs, const char* name) { CvTestSeqElem* pElem = NULL; CvFileNode* node; + if(name == NULL) return NULL; + node = cvGetFileNodeByName( fs, NULL, name ); + if(node == NULL) { printf("WARNING!!! - Video %s does not exist!\n", name); @@ -696,20 +747,23 @@ static CvTestSeqElem* icvTestSeqReadElemAll(CvTestSeq_* pTS, CvFileStorage* fs, printf("Read node %s\n",name); if(CV_NODE_IS_SEQ(node->tag)) - {/* read all element in sequence */ + { /* Read all element in sequence: */ int i; CvSeq* seq = node->data.seq; CvTestSeqElem* pElemLast = NULL; - for(i=0;itotal;++i) + + for(i=0; itotal; ++i) { CvFileNode* next_node = (CvFileNode*)cvGetSeqElem( seq, i ); CvTestSeqElem* pElemNew = icvTestSeqReadElemOne(pTS, fs, next_node ); CvFileNode* pDurNode = cvGetFileNodeByName( fs, next_node,"Dur"); + if(pElemNew == NULL ) { - printf("WARNING in parsing %s record!!! Can not read array element\n", name); + printf("WARNING in parsing %s record!!! Cannot read array element\n", name); continue; } + if(pElem && pElemLast) { pElemLast->next = pElemNew; @@ -723,20 +777,24 @@ static CvTestSeqElem* icvTestSeqReadElemAll(CvTestSeq_* pTS, CvFileStorage* fs, pElem = pElemNew; } - /* find last elem */ + /* Find last element: */ for(pElemLast=pElemNew;pElemLast && pElemLast->next;pElemLast= pElemLast->next); - }/* next elemnt */ - }/* read all element in sequence */ + + } /* Next element. */ + } /* Read all element in sequence. */ else - {/* read one element */ + { /* Read one element: */ pElem = icvTestSeqReadElemOne(pTS, fs, node ); } + return pElem; -}/* icvTestSeqReadElemAll */ + +} /* icvTestSeqReadElemAll */ static void icvTestSeqReleaseAll(CvTestSeqElem** ppElemList) { CvTestSeqElem* p = ppElemList[0]; + while(p) { CvTestSeqElem* pd = p; @@ -751,9 +809,12 @@ static void icvTestSeqReleaseAll(CvTestSeqElem** ppElemList) if(p->pSize)cvFree(&p->pSize); p=p->next; cvFree(&pd); - }/* next element */ + + } /* Next element. */ + ppElemList[0] = NULL; -}/* icvTestSeqReleaseAll */ + +} /* icvTestSeqReleaseAll */ CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float Scale, int noise_type, double noise_ampl) { @@ -771,10 +832,11 @@ CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float pTS->IVar_DI = 0; pTS->ObjNum = 0; - /* read all videos */ - for(i=0;ipElemList==NULL)pTS->pElemList = pElemNew; else { @@ -782,17 +844,19 @@ CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float for(p=pTS->pElemList;p->next;p=p->next); p->next = pElemNew; } - }/* read all videos */ + } /* Read all videos. */ - {/* Calculate elements and image size and video length */ + { /* Calculate elements and image size and video length: */ CvTestSeqElem* p = pTS->pElemList; int num = 0; CvSize MaxSize = {0,0}; int MaxFN = 0; - for(p = pTS->pElemList;p;p=p->next,num++) + + for(p = pTS->pElemList; p; p=p->next, num++) { int FN = p->FrameBegin+p->FrameNum; CvSize S = {0,0}; + if(p->pImg && p->BG) { S.width = p->pImg->width; @@ -803,22 +867,28 @@ CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float if(MaxSize.height < S.height) MaxSize.height = S.height; if(MaxFN < FN)MaxFN = FN; } + pTS->ListNum = num; + if(MaxSize.width == 0)MaxSize.width = 320; if(MaxSize.height == 0)MaxSize.height = 240; + MaxSize.width = cvRound(Scale*MaxSize.width); MaxSize.height = cvRound(Scale*MaxSize.height); + pTS->pImg = cvCreateImage(MaxSize,IPL_DEPTH_8U,3); pTS->pImgMask = cvCreateImage(MaxSize,IPL_DEPTH_8U,1); pTS->FrameNum = MaxFN; - for(p = pTS->pElemList;p;p=p->next) + + for(p = pTS->pElemList; p; p=p->next) { if(p->FrameNum<=0)p->FrameNum=MaxFN; } - }/* Calculate elements and image size */ + } /* Calculate elements and image size. */ return (CvTestSeq*)pTS; -}/* cvCreateTestSeq */ + +} /* cvCreateTestSeq */ void cvReleaseTestSeq(CvTestSeq** ppTestSeq) { @@ -830,7 +900,8 @@ void cvReleaseTestSeq(CvTestSeq** ppTestSeq) if(pTS->pFileStorage)cvReleaseFileStorage(&pTS->pFileStorage); cvFree(ppTestSeq); -}/* cvReleaseTestSeq */ + +} /* cvReleaseTestSeq */ void cvTestSeqSetFrame(CvTestSeq* pTestSeq, int n) { @@ -852,7 +923,8 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) if(pTS->CurFrame >= pTS->FrameNum) return NULL; cvZero(pImg); cvZero(pImgMask); - for(p=pTS->pElemList;p;p=p->next) + + for(p=pTS->pElemList; p; p=p->next) { int DirectCopy = FALSE; int frame = pTS->CurFrame - p->FrameBegin; @@ -862,7 +934,7 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) assert(pTrans); if( p->FrameNum > 0 && (frame < 0 || frame >= p->FrameNum) ) - { /* current frame is out of range */ + { /* Current frame is out of range: */ //if(p->pAVI)cvReleaseCapture(&p->pAVI); p->pAVI = NULL; continue; @@ -873,19 +945,19 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) cvZero(pImgMaskAdd); if(p->noise_type == CV_NOISE_NONE) - {/* for not noise */ - /* get next frame */ + { /* For not noise: */ + /* Get next frame: */ icvTestSeqQureyFrameElem(p, frame); if(p->pImg == NULL) continue; #if 1 /* transform using T filed in Trans */ - {/* calc transform matrix */ + { /* Calculate transform matrix: */ float W = (float)(pImgAdd->width-1); float H = (float)(pImgAdd->height-1); float W0 = (float)(p->pImg->width-1); float H0 = (float)(p->pImg->height-1); cvZero(pT); - {/* calc invert matrxi */ + { /* Calcualte inverse matrix: */ CvMat mat = cvMat(2,3,CV_32F, pTrans->T); mat.width--; pT->width--; @@ -896,6 +968,7 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) CV_MAT_ELEM(pT[0], float, 0, 2) = CV_MAT_ELEM(pT[0], float, 0, 0)*(W0/2-pTrans->T[2])+ CV_MAT_ELEM(pT[0], float, 0, 1)*(H0/2-pTrans->T[5]); + CV_MAT_ELEM(pT[0], float, 1, 2) = CV_MAT_ELEM(pT[0], float, 1, 0)*(W0/2-pTrans->T[2])+ CV_MAT_ELEM(pT[0], float, 1, 1)*(H0/2-pTrans->T[5]); @@ -904,9 +977,10 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) CV_MAT_ELEM(pT[0], float, 0, 1) *= H0/H; CV_MAT_ELEM(pT[0], float, 1, 0) *= W0/W; CV_MAT_ELEM(pT[0], float, 1, 1) *= H0/H; - }/* calc transform matrix */ + + } /* Calculate transform matrix. */ #else - {/* calc transform matrix */ + { /* Calculate transform matrix: */ float SX = (float)(p->pImg->width-1)/((pImgAdd->width-1)*pTrans->Scale.x); float SY = (float)(p->pImg->height-1)/((pImgAdd->height-1)*pTrans->Scale.y); float DX = pTrans->Shift.x; @@ -916,11 +990,11 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) ((float*)(pT->data.ptr+pT->step*1))[1]=SY; ((float*)(pT->data.ptr+pT->step*0))[2]=SX*(pImgAdd->width-1)*(0.5f-DX); ((float*)(pT->data.ptr+pT->step*1))[2]=SY*(pImgAdd->height-1)*(0.5f-DY); - }/* calc transform matrix */ + } /* Calculate transform matrix. */ #endif - {/* check for direct copy */ + { /* Check for direct copy: */ DirectCopy = TRUE; if( fabs(CV_MAT_ELEM(pT[0],float,0,0)-1) > 0.00001) DirectCopy = FALSE; if( fabs(CV_MAT_ELEM(pT[0],float,1,0)) > 0.00001) DirectCopy = FALSE; @@ -930,7 +1004,7 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) if( fabs(CV_MAT_ELEM(pT[0],float,1,2)-(pImg->height-1)*0.5) > 0.5) DirectCopy = FALSE; } - /* extract image and mask */ + /* Extract image and mask: */ if(p->pImg->nChannels == 1) { if(DirectCopy) @@ -943,6 +1017,7 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) cvCvtColor( pImgAddG,pImgAdd,CV_GRAY2BGR); } } + if(p->pImg->nChannels == 3) { if(DirectCopy) @@ -957,78 +1032,85 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) cvCopyImage(p->pImgMask, pImgMaskAdd); else cvGetQuadrangleSubPix( p->pImgMask, pImgMaskAdd, pT); + cvThreshold(pImgMaskAdd,pImgMaskAdd,128,255,CV_THRESH_BINARY); } if(pTrans->C != 1 || pTrans->I != 0) - {/* intencity transformation */ + { /* Intensity transformation: */ cvScale(pImgAdd, pImgAdd, pTrans->C,pTrans->I); - }/* intencity transformation */ + } /* Intensity transformation: */ if(pTrans->GN > 0) - {/* add noise */ + { /* Add noise: */ IplImage* pImgN = cvCloneImage(pImgAdd); cvRandSetRange( &p->rnd_state, pTrans->GN, 0, -1 ); cvRand(&p->rnd_state, pImgN); cvAdd(pImgN,pImgAdd,pImgAdd); cvReleaseImage(&pImgN); - }/* add noise */ + } /* Add noise. */ if(p->Mask) - {/* update only mask */ + { /* Update only mask: */ cvOr(pImgMaskAdd, pImgMask, pImgMask); } else - { /* add image and mask to exist main image and mask */ + { /* Add image and mask to exist main image and mask: */ if(p->BG) - {/* if image is background */ + { /* If image is background: */ cvCopy( pImgAdd, pImg, NULL); } else - {/* if image is foreground */ + { /* If image is foreground: */ cvCopy( pImgAdd, pImg, pImgMaskAdd); if(p->ObjID>=0) cvOr(pImgMaskAdd, pImgMask, pImgMask); } - }/* not mask */ - }/* for not noise */ + } /* Not mask. */ + } /* For not noise. */ else - {/* process noise video */ + { /* Process noise video: */ if( p->noise_type == CV_NOISE_GAUSSIAN || p->noise_type == CV_NOISE_UNIFORM) - {/* gaussan and uniform additive noise */ + + { /* Gaussan and uniform additive noise: */ cvAddNoise(pImg,p->noise_type,pTrans->NoiseAmp * pTrans->C, &p->rnd_state); - }/* gaussan and uniform additive noise */ + } /* Gaussan and uniform additive noise. */ + if( p->noise_type == CV_NOISE_SPECKLE) - { /* speckle - multiplicative noise */ + { /* Speckle -- multiplicative noise: */ if(pTrans->I != 0)cvSubS(pImg,cvScalar(pTrans->I,pTrans->I,pTrans->I),pImg); cvAddNoise(pImg,p->noise_type,pTrans->NoiseAmp, &p->rnd_state); if(pTrans->I != 0)cvAddS(pImg,cvScalar(pTrans->I,pTrans->I,pTrans->I),pImg); - }/* speckle - multiplicative noise */ + } /* Speckle -- multiplicative noise. */ + if( p->noise_type == CV_NOISE_SALT_AND_PEPPER) - { /* salt and pepper */ + { /* Salt and pepper: */ cvAddNoise(pImg,p->noise_type,pTrans->NoiseAmp, &p->rnd_state); - }/* speckle - multiplicative noise */ - }/* process noise video */ - }/* next item */ + } /* Salt and pepper. */ + } /* Process noise video.*/ + } /* Next item. */ if(pImg) { if(pTS->noise_type != CV_NOISE_NONE) - {/* add noise */ + { /* Add noise: */ cvAddNoise(pImg,pTS->noise_type,pTS->noise_ampl); } + if(pTS->IVar_DI != 0) - {/* change intensity */ + { /* Change intensity: */ float I = MIN(pTS->IVar_CurI,pTS->IVar_MaxI); I = MAX(I,pTS->IVar_MinI); cvScale(pImg,pImg,1,I); if(pTS->IVar_CurI >= pTS->IVar_MaxI) pTS->IVar_CurDI = (float)-fabs(pTS->IVar_DI); + if(pTS->IVar_CurI <= pTS->IVar_MinI) pTS->IVar_CurDI = (float)+fabs(pTS->IVar_DI); + pTS->IVar_CurI += pTS->IVar_CurDI; } } @@ -1040,12 +1122,14 @@ IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq) cvReleaseImage(&pImgMaskAdd); cvReleaseMat(&pT); return pImg; -}/*cvTestSeqQueryFrame*/ + +} /*cvTestSeqQueryFrame*/ IplImage* cvTestSeqGetFGMask(CvTestSeq* pTestSeq) { return ((CvTestSeq_*)pTestSeq)->pImgMask; } + IplImage* cvTestSeqGetImage(CvTestSeq* pTestSeq) { return ((CvTestSeq_*)pTestSeq)->pImg; @@ -1062,11 +1146,13 @@ int cvTestSeqGetObjectPos(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pPos) CvTestSeq_* pTS = (CvTestSeq_*)pTestSeq; CvTestSeqElem* p = pTS->pElemList; if(pTS->CurFrame > pTS->FrameNum) return 0; - for(p=pTS->pElemList;p;p=p->next) + + for(p=pTS->pElemList; p; p=p->next) { int frame = pTS->CurFrame - p->FrameBegin - 1; if(ObjIndex==p->ObjID && frame >= 0 && frame < p->FrameNum) break; } + if(p && p->pPos && p->PosNum>0) { CvTSTrans* pTrans; @@ -1076,7 +1162,8 @@ int cvTestSeqGetObjectPos(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pPos) t = (p->FrameNum>1)?((float)frame / (p->FrameNum-1)):0; pTrans = p->pTrans + frame%p->TransNum; pPos[0] = p->pPos[frame%p->PosNum]; -#if 1 /* transform using T filed in Trans */ + +#if 1 /* Transform using T filed in Trans: */ { float x = pPos->x * (p->pImg?(p->pImg->width-1):1); float y = pPos->y * (p->pImg?(p->pImg->height-1):1); @@ -1102,28 +1189,34 @@ int cvTestSeqGetObjectPos(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pPos) return 1; } return 0; -}/* cvTestSeqGetObjectPos */ + +} /* cvTestSeqGetObjectPos */ int cvTestSeqGetObjectSize(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pSize) { CvTestSeq_* pTS = (CvTestSeq_*)pTestSeq; CvTestSeqElem* p = pTS->pElemList; if(pTS->CurFrame > pTS->FrameNum) return 0; - for(p=pTS->pElemList;p;p=p->next) + + for(p=pTS->pElemList; p; p=p->next) { int frame = pTS->CurFrame - p->FrameBegin - 1; if(ObjIndex==p->ObjID && frame >= 0 && frame < p->FrameNum) break; } + if(p && p->pSize && p->SizeNum>0) { CvTSTrans* pTrans; float t; int frame = pTS->CurFrame - p->FrameBegin - 1; + if(frame < 0 || frame >= p->FrameNum) return 0; + t = (p->FrameNum>1)?((float)frame / (p->FrameNum-1)):0; pTrans = p->pTrans + frame%p->TransNum; pSize[0] = p->pSize[frame%p->SizeNum]; -#if 1 /* transform using T filed in Trans */ + +#if 1 /* Transform using T filed in Trans: */ { float x = pSize->x * (p->pImg?(p->pImg->width-1):1); float y = pSize->y * (p->pImg?(p->pImg->height-1):1); @@ -1156,17 +1249,20 @@ int cvTestSeqGetObjectSize(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pSiz pSize->y *= pTS->pImg->height-1; return 1; } + return 0; -}/* cvTestSeqGetObjectSize */ -/* add noise to finile image */ +} /* cvTestSeqGetObjectSize */ + +/* Add noise to finile image: */ void cvTestSeqAddNoise(CvTestSeq* pTestSeq, int noise_type, double noise_ampl) { CvTestSeq_* pTS = (CvTestSeq_*)pTestSeq; pTS->noise_type = noise_type; pTS->noise_ampl = noise_ampl; } -/* add Intensity variation */ + +/* Add Intensity variation: */ void cvTestSeqAddIntensityVariation(CvTestSeq* pTestSeq, float DI_per_frame, float MinI, float MaxI) { CvTestSeq_* pTS = (CvTestSeq_*)pTestSeq; @@ -1176,7 +1272,7 @@ void cvTestSeqAddIntensityVariation(CvTestSeq* pTestSeq, float DI_per_frame, flo } void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_state) -{/* add noise to image */ +{ /* Add noise to image: */ CvSize S = cvSize(pImg->width,pImg->height); IplImage* pImgAdd = cvCreateImage(S,pImg->depth,pImg->nChannels); static CvRandState local_rnd_state; @@ -1187,18 +1283,21 @@ void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_st first = 0; cvRandInit( &local_rnd_state, 1, 0, 0,CV_RAND_NORMAL); } + if(rnd_state == NULL)rnd_state = &local_rnd_state; if( noise_type == CV_NOISE_GAUSSIAN || noise_type == CV_NOISE_UNIFORM) - {/* gaussan and uniform additive noise */ + { /* Gaussan and uniform additive noise: */ int set_zero = 0; + if( noise_type == CV_NOISE_GAUSSIAN) { rnd_state->disttype = CV_RAND_NORMAL; cvRandSetRange( rnd_state, Ampl, 0, -1 ); if(Ampl <= 0) set_zero = 1; } + if( noise_type == CV_NOISE_UNIFORM) { double max_val = @@ -1207,6 +1306,7 @@ void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_st cvRandSetRange( rnd_state, -max_val, max_val, -1 ); if(max_val < 1) set_zero = 1; } + if(!set_zero) { IplImage* pImgNoise = cvCreateImage(S,IPL_DEPTH_32F,pImg->nChannels); @@ -1218,10 +1318,10 @@ void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_st cvReleaseImage(&pImgNoise); cvReleaseImage(&pImgOrg); } - }/* gaussan and uniform additive noise */ + } /* Gaussan and uniform additive noise. */ if( noise_type == CV_NOISE_SPECKLE) - { /* speckle - multiplicative noise */ + { /* Speckle -- multiplicative noise: */ IplImage* pImgSP = cvCreateImage( S,IPL_DEPTH_32F, pImg->nChannels ); IplImage* pImgTemp = cvCreateImage(S,IPL_DEPTH_32F, pImg->nChannels ); rnd_state->disttype = CV_RAND_NORMAL; @@ -1233,20 +1333,22 @@ void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_st cvConvert(pImgTemp,pImg); cvReleaseImage(&pImgSP); cvReleaseImage(&pImgTemp); - }/* speckle - multiplicative noise */ + } /* Speckle -- multiplicative noise. */ if( noise_type == CV_NOISE_SALT_AND_PEPPER && Ampl > 0) - { /* salt and pepper */ + { /* Salt and pepper: */ IplImage* pImgMask = cvCreateImage( S,IPL_DEPTH_32F, 1 ); IplImage* pImgMaskBin = cvCreateImage( S,IPL_DEPTH_8U, 1 ); IplImage* pImgVal = cvCreateImage( S,IPL_DEPTH_8U, 1 ); rnd_state->disttype = CV_RAND_UNI; - /* create mask */ + + /* Create mask: */ cvRandSetRange( rnd_state, 0, 1, -1 ); cvRand(rnd_state, pImgMask); cvThreshold(pImgMask,pImgMask, Ampl, 255, CV_THRESH_BINARY_INV ); cvConvert(pImgMask,pImgMaskBin); - /* create vals */ + + /* Create vals: */ cvRandSetRange( rnd_state, 0, 255, -1 ); cvRand(rnd_state, pImgVal); cvThreshold(pImgVal,pImgVal,128, 255, CV_THRESH_BINARY ); @@ -1260,7 +1362,10 @@ void cvAddNoise(IplImage* pImg, int noise_type, double Ampl, CvRandState* rnd_st cvReleaseImage(&pImgMask); cvReleaseImage(&pImgMaskBin); cvReleaseImage(&pImgVal); - }/* speckle - multiplicative noise */ + + } /* Salt and pepper. */ + cvReleaseImage(&pImgAdd); -}/* cvAddNoise */ + +} /* cvAddNoise */ diff --git a/cvconfig.h.in b/cvconfig.h.in index 6f27546..f27f12d 100644 --- a/cvconfig.h.in +++ b/cvconfig.h.in @@ -39,6 +39,9 @@ /* FFMpeg video library */ #undef HAVE_FFMPEG +/* GStreamer multimedia framework */ +#undef HAVE_GSTREAMER + /* GTK+ 2.0 Thread support */ #undef HAVE_GTHREAD diff --git a/cxcore/Makefile.in b/cxcore/Makefile.in index 2a8b94b..dbb27d1 100644 --- a/cxcore/Makefile.in +++ b/cxcore/Makefile.in @@ -80,10 +80,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -106,8 +110,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -118,6 +124,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -136,11 +144,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -160,10 +173,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/cxcore/include/Makefile.in b/cxcore/include/Makefile.in index 228a2ca..426c477 100644 --- a/cxcore/include/Makefile.in +++ b/cxcore/include/Makefile.in @@ -84,10 +84,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -110,8 +114,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -122,6 +128,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -140,11 +148,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -164,10 +177,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/cxcore/include/cxcore.h b/cxcore/include/cxcore.h index c605147..62e903d 100644 --- a/cxcore/include/cxcore.h +++ b/cxcore/include/cxcore.h @@ -113,7 +113,7 @@ CVAPI(void) cvReleaseImage( IplImage** image ); /* Creates a copy of IPL image (widthStep may differ) */ CVAPI(IplImage*) cvCloneImage( const IplImage* image ); -/* Sets a Channel Of Interest (only a few functions support COI) - +/* Sets a Channel Of Interest (only a few functions support COI) - use cvCopy to extract the selected channel and/or put it back */ CVAPI(void) cvSetImageCOI( IplImage* image, int coi ); @@ -532,7 +532,7 @@ CVAPI(void) cvSubRS( const CvArr* src, CvScalar value, CvArr* dst, CVAPI(void) cvMul( const CvArr* src1, const CvArr* src2, CvArr* dst, double scale CV_DEFAULT(1) ); -/* element-wise division/inversion with scaling: +/* element-wise division/inversion with scaling: dst(idx) = src1(idx) * scale / src2(idx) or dst(idx) = scale / src2(idx) if src1 == 0 */ CVAPI(void) cvDiv( const CvArr* src1, const CvArr* src2, @@ -661,7 +661,7 @@ CVAPI(float) cvCbrt( float value ); /* Checks array values for NaNs, Infs or simply for too large numbers (if CV_CHECK_RANGE is set). If CV_CHECK_QUIET is set, no runtime errors is raised (function returns zero value in case of "bad" values). - Otherwise cvError is called */ + Otherwise cvError is called */ #define CV_CHECK_RANGE 1 #define CV_CHECK_QUIET 2 CVAPI(int) cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0), @@ -679,6 +679,10 @@ CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng, /* Finds real roots of a cubic equation */ CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots ); +/* Finds all real and complex roots of a polynomial equation */ +CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots, + int maxiter = 10, int fig = 10); + /****************************************************************************************\ * Matrix operations * \****************************************************************************************/ @@ -795,7 +799,7 @@ CVAPI(CvArr*) cvRange( CvArr* mat, double start, double end ); CVAPI(void) cvCalcCovarMatrix( const CvArr** vects, int count, CvArr* cov_mat, CvArr* avg, int flags ); -#define CV_PCA_DATA_AS_ROW 0 +#define CV_PCA_DATA_AS_ROW 0 #define CV_PCA_DATA_AS_COL 1 #define CV_PCA_USE_AVG 2 CVAPI(void) cvCalcPCA( const CvArr* data, CvArr* mean, @@ -951,11 +955,11 @@ CVAPI(void) cvSetSeqBlockSize( CvSeq* seq, int delta_elems ); /* Adds new element to the end of sequence. Returns pointer to the element */ -CVAPI(char*) cvSeqPush( CvSeq* seq, void* element CV_DEFAULT(NULL)); +CVAPI(schar*) cvSeqPush( CvSeq* seq, void* element CV_DEFAULT(NULL)); /* Adds new element to the beginning of sequence. Returns pointer to it */ -CVAPI(char*) cvSeqPushFront( CvSeq* seq, void* element CV_DEFAULT(NULL)); +CVAPI(schar*) cvSeqPushFront( CvSeq* seq, void* element CV_DEFAULT(NULL)); /* Removes the last element from sequence and optionally saves it */ @@ -978,8 +982,8 @@ CVAPI(void) cvSeqPopMulti( CvSeq* seq, void* elements, /* Inserts a new element in the middle of sequence. cvSeqInsert(seq,0,elem) == cvSeqPushFront(seq,elem) */ -CVAPI(char*) cvSeqInsert( CvSeq* seq, int before_index, - void* element CV_DEFAULT(NULL)); +CVAPI(schar*) cvSeqInsert( CvSeq* seq, int before_index, + void* element CV_DEFAULT(NULL)); /* Removes specified sequence element */ CVAPI(void) cvSeqRemove( CvSeq* seq, int index ); @@ -991,10 +995,10 @@ CVAPI(void) cvSeqRemove( CvSeq* seq, int index ); CVAPI(void) cvClearSeq( CvSeq* seq ); -/* Retrives pointer to specified sequence element. +/* Retrieves pointer to specified sequence element. Negative indices are supported and mean counting from the end (e.g -1 means the last sequence element) */ -CVAPI(char*) cvGetSeqElem( const CvSeq* seq, int index ); +CVAPI(schar*) cvGetSeqElem( const CvSeq* seq, int index ); /* Calculates index of the specified sequence element. Returns -1 if element does not belong to the sequence */ @@ -1071,9 +1075,9 @@ typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata ) CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) ); /* Finds element in a [sorted] sequence */ -CVAPI(char*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func, - int is_sorted, int* elem_idx, - void* userdata CV_DEFAULT(NULL) ); +CVAPI(schar*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func, + int is_sorted, int* elem_idx, + void* userdata CV_DEFAULT(NULL) ); /* Reverses order of sequence elements in-place */ CVAPI(void) cvSeqInvert( CvSeq* seq ); @@ -1298,7 +1302,7 @@ CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, CvSize axes; axes.width = cvRound(box.size.height*0.5); axes.height = cvRound(box.size.width*0.5); - + cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle, 0, 360, color, thickness, line_type, shift ); } @@ -1350,14 +1354,14 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, #define CV_FONT_HERSHEY_SIMPLEX 0 #define CV_FONT_HERSHEY_PLAIN 1 #define CV_FONT_HERSHEY_DUPLEX 2 -#define CV_FONT_HERSHEY_COMPLEX 3 +#define CV_FONT_HERSHEY_COMPLEX 3 #define CV_FONT_HERSHEY_TRIPLEX 4 #define CV_FONT_HERSHEY_COMPLEX_SMALL 5 #define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6 #define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7 /* font flags */ -#define CV_FONT_ITALIC 16 +#define CV_FONT_ITALIC 16 #define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX diff --git a/cxcore/include/cxcore.hpp b/cxcore/include/cxcore.hpp index e9d9021..03ce128 100644 --- a/cxcore/include/cxcore.hpp +++ b/cxcore/include/cxcore.hpp @@ -85,7 +85,10 @@ public: void create( CvSize size, int depth, int channels ) { - attach( cvCreateImage( size, depth, channels )); + if( !image || !refcount || + image->width != size.width || image->height != size.height || + image->depth != depth || image->nChannels != channels ) + attach( cvCreateImage( size, depth, channels )); } void release() { detach(); } @@ -258,7 +261,10 @@ public: void create( int rows, int cols, int type ) { - set( cvCreateMat( rows, cols, type ), false ); + if( !matrix || !matrix->refcount || + matrix->rows != rows || matrix->cols != cols || + CV_MAT_TYPE(matrix->type) != type ) + set( cvCreateMat( rows, cols, type ), false ); } void addref() const diff --git a/cxcore/include/cxmisc.h b/cxcore/include/cxmisc.h index 75e2b2c..9a04cdf 100644 --- a/cxcore/include/cxmisc.h +++ b/cxcore/include/cxmisc.h @@ -109,7 +109,7 @@ #endif #if 0 /*def CV_CHECK_FOR_NANS*/ - #define CV_CHECK_NANS( arr ) cvCheckArray((arr)) + #define CV_CHECK_NANS( arr ) cvCheckArray((arr)) #else #define CV_CHECK_NANS( arr ) #endif @@ -192,9 +192,9 @@ #define CV_NONZERO(a) ((a) != 0) #define CV_NONZERO_FLT(a) (((a)+(a)) != 0) -/* general-purpose saturation macros */ +/* general-purpose saturation macros */ #define CV_CAST_8U(t) (uchar)(!((t) & ~255) ? (t) : (t) > 0 ? 255 : 0) -#define CV_CAST_8S(t) (char)(!(((t)+128) & ~255) ? (t) : (t) > 0 ? 127 : -128) +#define CV_CAST_8S(t) (schar)(!(((t)+128) & ~255) ? (t) : (t) > 0 ? 127 : -128) #define CV_CAST_16U(t) (ushort)(!((t) & ~65535) ? (t) : (t) > 0 ? 65535 : 0) #define CV_CAST_16S(t) (short)(!(((t)+32768) & ~65535) ? (t) : (t) > 0 ? 32767 : -32768) #define CV_CAST_32S(t) (int)(t) @@ -224,7 +224,7 @@ #define CV_UN_ENTRY_C1(worktype) \ worktype s0 = scalar[0] - + #define CV_UN_ENTRY_C2(worktype) \ worktype s0 = scalar[0], s1 = scalar[1] @@ -273,14 +273,14 @@ CvFastDiv; CV_INLINE CvFastDiv cvFastDiv( int divisor ) { CvFastDiv fastdiv; - + assert( divisor >= 1 ); uint64 temp = ((uint64)1 << CV_FAST_DIV_SHIFT)/divisor; fastdiv.divisor = divisor; fastdiv.delta = (unsigned)(((temp & 1) ^ 1) + divisor - 1); fastdiv.scale = (unsigned)((temp + 1) >> 1); - + return fastdiv; } @@ -361,7 +361,7 @@ CV_INLINE CvFastDiv cvFastDiv( int divisor ) /****************************************************************************************\ - + Generic implementation of QuickSort algorithm. ---------------------------------------------- Using this macro user can declare customized sort function that can be much faster @@ -595,7 +595,7 @@ void func_name( T *array, size_t total, user_data_type aux ) /* IPP-compatible return codes */ typedef enum CvStatus -{ +{ CV_BADMEMBLOCK_ERR = -113, CV_INPLACE_NOT_SUPPORTED_ERR= -112, CV_UNMATCHED_ROI_ERR = -111, @@ -671,10 +671,10 @@ CvStatus; #endif #define IPCVAPI_EX(type,name,ipp_name,ipp_search_modules,args) \ - IPCVAPI(type,CV_STDCALL,name,args) + IPCVAPI(type,CV_STDCALL,name,args) #define IPCVAPI_C_EX(type,name,ipp_name,ipp_search_modules,args)\ - IPCVAPI(type,CV_CDECL,name,args) + IPCVAPI(type,CV_CDECL,name,args) #ifndef IPCVAPI_IMPL #define IPCVAPI_IMPL(type,name,args,arg_names) \ diff --git a/cxcore/include/cxtypes.h b/cxcore/include/cxtypes.h index 8249f02..a493d3a 100644 --- a/cxcore/include/cxtypes.h +++ b/cxcore/include/cxtypes.h @@ -150,9 +150,13 @@ typedef unsigned char uchar; typedef unsigned short ushort; #endif -/* CvArr* is used to pass arbitrary array-like data structures - into the functions where the particular - array type is recognized at runtime */ +typedef signed char schar; + +/* CvArr* is used to pass arbitrary + * array-like data structures + * into functions where the particular + * array type is recognized at runtime: + */ typedef void CvArr; typedef union Cv32suf @@ -301,7 +305,7 @@ CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1)) return rng; } -/* returns random 32-bit unsigned integer */ +/* Return random 32-bit unsigned integer: */ CV_INLINE unsigned cvRandInt( CvRNG* rng ) { uint64 temp = *rng; @@ -310,7 +314,7 @@ CV_INLINE unsigned cvRandInt( CvRNG* rng ) return (unsigned)temp; } -/* returns random floating-point number between 0 and 1 */ +/* Returns random floating-point number between 0 and 1: */ CV_INLINE double cvRandReal( CvRNG* rng ) { return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */; @@ -359,36 +363,36 @@ CV_INLINE double cvRandReal( CvRNG* rng ) typedef struct _IplImage { - int nSize; /* sizeof(IplImage) */ - int ID; /* version (=0)*/ - int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */ - int alphaChannel; /* ignored by OpenCV */ - int depth; /* pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, - IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported */ - char colorModel[4]; /* ignored by OpenCV */ - char channelSeq[4]; /* ditto */ - int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. - cvCreateImage can only create interleaved images */ - int origin; /* 0 - top-left origin, - 1 - bottom-left origin (Windows bitmaps style) */ - int align; /* Alignment of image rows (4 or 8). - OpenCV ignores it and uses widthStep instead */ - int width; /* image width in pixels */ - int height; /* image height in pixels */ - struct _IplROI *roi;/* image ROI. if NULL, the whole image is selected */ - struct _IplImage *maskROI; /* must be NULL */ - void *imageId; /* ditto */ - struct _IplTileInfo *tileInfo; /* ditto */ - int imageSize; /* image data size in bytes - (==image->height*image->widthStep - in case of interleaved data)*/ - char *imageData; /* pointer to aligned image data */ - int widthStep; /* size of aligned image row in bytes */ - int BorderMode[4]; /* ignored by OpenCV */ - int BorderConst[4]; /* ditto */ - char *imageDataOrigin; /* pointer to very origin of image data - (not necessarily aligned) - - needed for correct deallocation */ + int nSize; /* sizeof(IplImage) */ + int ID; /* version (=0)*/ + int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */ + int alphaChannel; /* Ignored by OpenCV */ + int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, + IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */ + char colorModel[4]; /* Ignored by OpenCV */ + char channelSeq[4]; /* ditto */ + int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. + cvCreateImage can only create interleaved images */ + int origin; /* 0 - top-left origin, + 1 - bottom-left origin (Windows bitmaps style). */ + int align; /* Alignment of image rows (4 or 8). + OpenCV ignores it and uses widthStep instead. */ + int width; /* Image width in pixels. */ + int height; /* Image height in pixels. */ + struct _IplROI *roi; /* Image ROI. If NULL, the whole image is selected. */ + struct _IplImage *maskROI; /* Must be NULL. */ + void *imageId; /* " " */ + struct _IplTileInfo *tileInfo; /* " " */ + int imageSize; /* Image data size in bytes + (==image->height*image->widthStep + in case of interleaved data)*/ + char *imageData; /* Pointer to aligned image data. */ + int widthStep; /* Size of aligned image row in bytes. */ + int BorderMode[4]; /* Ignored by OpenCV. */ + int BorderConst[4]; /* Ditto. */ + char *imageDataOrigin; /* Pointer to very origin of image data + (not necessarily aligned) - + needed for correct deallocation */ } IplImage; @@ -595,12 +599,12 @@ CvMat; ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0) #define CV_ARE_SIZES_EQ(mat1, mat2) \ - ((mat1)->height == (mat2)->height && (mat1)->width == (mat2)->width) + ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols) #define CV_IS_MAT_CONST(mat) \ - (((mat)->height|(mat)->width) == 1) + (((mat)->rows|(mat)->cols) == 1) -/* size of each channel item, +/* Size of each channel item, 0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */ #define CV_ELEM_SIZE1(type) \ ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15) @@ -609,9 +613,10 @@ CvMat; #define CV_ELEM_SIZE(type) \ (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3)) -/* inline constructor. No data is allocated internally!!! - (use together with cvCreateData, or use cvCreateMat instead to - get a matrix with allocated data) */ +/* Inline constructor. No data is allocated internally!!! + * (Use together with cvCreateData, or use cvCreateMat instead to + * get a matrix with allocated data): + */ CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)) { CvMat m; @@ -804,9 +809,9 @@ typedef struct CvHistogram { int type; CvArr* bins; - float thresh[CV_MAX_DIM][2]; /* for uniform histograms */ - float** thresh2; /* for non-uniform histograms */ - CvMatND mat; /* embedded matrix header for array histograms */ + float thresh[CV_MAX_DIM][2]; /* For uniform histograms. */ + float** thresh2; /* For non-uniform histograms. */ + CvMatND mat; /* Embedded matrix header for array histograms. */ } CvHistogram; @@ -1054,21 +1059,21 @@ CV_INLINE CvSize2D32f cvSize2D32f( double width, double height ) typedef struct CvBox2D { - CvPoint2D32f center; /* center of the box */ - CvSize2D32f size; /* box width and length */ - float angle; /* angle between the horizontal axis - and the first side (i.e. length) in degrees */ + CvPoint2D32f center; /* Center of the box. */ + CvSize2D32f size; /* Box width and length. */ + float angle; /* Angle between the horizontal axis */ + /* and the first side (i.e. length) in degrees */ } CvBox2D; -/* Line iterator state */ +/* Line iterator state: */ typedef struct CvLineIterator { - /* pointer to the current point */ + /* Pointer to the current point: */ uchar* ptr; - /* Bresenham algorithm state */ + /* Bresenham algorithm state: */ int err; int plus_delta; int minus_delta; @@ -1154,11 +1159,11 @@ CvMemBlock; typedef struct CvMemStorage { int signature; - CvMemBlock* bottom;/* first allocated block */ - CvMemBlock* top; /* current memory block - top of the stack */ - struct CvMemStorage* parent; /* borrows new blocks from */ - int block_size; /* block size */ - int free_space; /* free space in the current block */ + CvMemBlock* bottom; /* First allocated block. */ + CvMemBlock* top; /* Current memory block - top of the stack. */ + struct CvMemStorage* parent; /* We get new blocks from parent as needed. */ + int block_size; /* Block size. */ + int free_space; /* Remaining free space in current block. */ } CvMemStorage; @@ -1179,38 +1184,38 @@ CvMemStoragePos; typedef struct CvSeqBlock { - struct CvSeqBlock* prev; /* previous sequence block */ - struct CvSeqBlock* next; /* next sequence block */ - int start_index; /* index of the first element in the block + - sequence->first->start_index */ - int count; /* number of elements in the block */ - char* data; /* pointer to the first element of the block */ + struct CvSeqBlock* prev; /* Previous sequence block. */ + struct CvSeqBlock* next; /* Next sequence block. */ + int start_index; /* Index of the first element in the block + */ + /* sequence->first->start_index. */ + int count; /* Number of elements in the block. */ + schar* data; /* Pointer to the first element of the block. */ } CvSeqBlock; -#define CV_TREE_NODE_FIELDS(node_type) \ - int flags; /* micsellaneous flags */ \ - int header_size; /* size of sequence header */ \ - struct node_type* h_prev; /* previous sequence */ \ - struct node_type* h_next; /* next sequence */ \ - struct node_type* v_prev; /* 2nd previous sequence */ \ - struct node_type* v_next /* 2nd next sequence */ +#define CV_TREE_NODE_FIELDS(node_type) \ + int flags; /* Miscellaneous flags. */ \ + int header_size; /* Size of sequence header. */ \ + struct node_type* h_prev; /* Previous sequence. */ \ + struct node_type* h_next; /* Next sequence. */ \ + struct node_type* v_prev; /* 2nd previous sequence. */ \ + struct node_type* v_next /* 2nd next sequence. */ /* Read/Write sequence. Elements can be dynamically inserted to or deleted from the sequence. */ -#define CV_SEQUENCE_FIELDS() \ - CV_TREE_NODE_FIELDS(CvSeq); \ - int total; /* total number of elements */ \ - int elem_size; /* size of sequence element in bytes */ \ - char* block_max; /* maximal bound of the last block */ \ - char* ptr; /* current write pointer */ \ - int delta_elems; /* how many elements allocated when the seq grows */ \ - CvMemStorage* storage; /* where the seq is stored */ \ - CvSeqBlock* free_blocks; /* free blocks list */ \ - CvSeqBlock* first; /* pointer to the first sequence block */ +#define CV_SEQUENCE_FIELDS() \ + CV_TREE_NODE_FIELDS(CvSeq); \ + int total; /* Total number of elements. */ \ + int elem_size; /* Size of sequence element in bytes. */ \ + schar* block_max; /* Maximal bound of the last block. */ \ + schar* ptr; /* Current write pointer. */ \ + int delta_elems; /* Grow seq this many at a time. */ \ + CvMemStorage* storage; /* Where the seq is stored. */ \ + CvSeqBlock* free_blocks; /* Free blocks list. */ \ + CvSeqBlock* first; /* Pointer to the first sequence block. */ typedef struct CvSeq { @@ -1259,19 +1264,22 @@ CvSet; /************************************* Graph ********************************************/ /* - Graph is represented as a set of vertices. + We represent a graph as a set of vertices. Vertices contain their adjacency lists (more exactly, pointers to first incoming or outcoming edge (or 0 if isolated vertex)). Edges are stored in another set. - There is a single-linked list of incoming/outcoming edges for each vertex. + There is a singly-linked list of incoming/outcoming edges for each vertex. + + Each edge consists of + + o Two pointers to the starting and ending vertices + (vtx[0] and vtx[1] respectively). - Each edge consists of: - two pointers to the starting and the ending vertices (vtx[0] and vtx[1], - respectively). Graph may be oriented or not. In the second case, edges between - vertex i to vertex j are not distingueshed (during the search operations). + A graph may be oriented or not. In the latter case, edges between + vertex i to vertex j are not distinguished during search operations. - two pointers to next edges for the starting and the ending vertices. - next[0] points to the next edge in the vtx[0] adjacency list and - next[1] points to the next edge in the vtx[1] adjacency list. + o Two pointers to next edges for the starting and ending vertices, where + next[0] points to the next edge in the vtx[0] adjacency list and + next[1] points to the next edge in the vtx[1] adjacency list. */ #define CV_GRAPH_EDGE_FIELDS() \ int flags; \ @@ -1475,9 +1483,9 @@ typedef CvContour CvPoint2DSeq; int header_size; \ CvSeq* seq; /* the sequence written */ \ CvSeqBlock* block; /* current block */ \ - char* ptr; /* pointer to free space */ \ - char* block_min; /* pointer to the beginning of block*/\ - char* block_max; /* pointer to the end of block */ + schar* ptr; /* pointer to free space */ \ + schar* block_min; /* pointer to the beginning of block*/\ + schar* block_max; /* pointer to the end of block */ typedef struct CvSeqWriter { @@ -1490,11 +1498,11 @@ CvSeqWriter; int header_size; \ CvSeq* seq; /* sequence, beign read */ \ CvSeqBlock* block; /* current block */ \ - char* ptr; /* pointer to element be read next */ \ - char* block_min; /* pointer to the beginning of block */\ - char* block_max; /* pointer to the end of block */ \ + schar* ptr; /* pointer to element be read next */ \ + schar* block_min; /* pointer to the beginning of block */\ + schar* block_max; /* pointer to the end of block */ \ int delta_index;/* = seq->first->start_index */ \ - char* prev_elem; /* pointer to previous element */ + schar* prev_elem; /* pointer to previous element */ typedef struct CvSeqReader @@ -1517,7 +1525,7 @@ CvSeqReader; cvGetSeqElem( (CvSeq*)(seq), (index) ))) #define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) ) -/* macro that adds element to sequence */ +/* Add element to sequence: */ #define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer ) \ { \ if( (writer).ptr >= (writer).block_max ) \ @@ -1541,7 +1549,7 @@ CvSeqReader; } -/* move reader position forward */ +/* Move reader position forward: */ #define CV_NEXT_SEQ_ELEM( elem_size, reader ) \ { \ if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \ @@ -1551,7 +1559,7 @@ CvSeqReader; } -/* move reader position backward */ +/* Move reader position backward: */ #define CV_PREV_SEQ_ELEM( elem_size, reader ) \ { \ if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \ @@ -1560,7 +1568,7 @@ CvSeqReader; } \ } -/* read element and move read position forward */ +/* Read element and move read position forward: */ #define CV_READ_SEQ_ELEM( elem, reader ) \ { \ assert( (reader).seq->elem_size == sizeof(elem)); \ @@ -1568,7 +1576,7 @@ CvSeqReader; CV_NEXT_SEQ_ELEM( sizeof(elem), reader ) \ } -/* read element and move read position backward */ +/* Read element and move read position backward: */ #define CV_REV_READ_SEQ_ELEM( elem, reader ) \ { \ assert( (reader).seq->elem_size == sizeof(elem)); \ @@ -1605,7 +1613,7 @@ CvSeqReader; /************ Graph macros ************/ -/* returns next graph edge for given vertex */ +/* Return next graph edge for given vertex: */ #define CV_NEXT_GRAPH_EDGE( edge, vertex ) \ (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)), \ (edge)->next[(edge)->vtx[1] == (vertex)]) @@ -1619,18 +1627,18 @@ CvSeqReader; /* "black box" file storage */ typedef struct CvFileStorage CvFileStorage; -/* storage flags */ +/* Storage flags: */ #define CV_STORAGE_READ 0 #define CV_STORAGE_WRITE 1 #define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE #define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE #define CV_STORAGE_APPEND 2 -/* list of attributes */ +/* List of attributes: */ typedef struct CvAttrList { - const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs */ - struct CvAttrList* next; /* pointer to next chunk of the attributes list */ + const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs. */ + struct CvAttrList* next; /* Pointer to next chunk of the attributes list. */ } CvAttrList; @@ -1661,7 +1669,7 @@ struct CvTypeInfo; #define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK) /* file node flags */ -#define CV_NODE_FLOW 8 /* used only for writing structures to YAML format */ +#define CV_NODE_FLOW 8 /* Used only for writing structures in YAML format. */ #define CV_NODE_USER 16 #define CV_NODE_EMPTY 32 #define CV_NODE_NAMED 64 @@ -1687,8 +1695,8 @@ typedef struct CvString } CvString; -/* all the keys (names) of elements in the readed file storage - are stored in the hash to speed up the lookup operations */ +/* All the keys (names) of elements in the readed file storage + are stored in the hash to speed up the lookup operations: */ typedef struct CvStringHashNode { unsigned hashval; @@ -1699,7 +1707,7 @@ CvStringHashNode; typedef struct CvGenericHash CvFileNodeHash; -/* basic element of the file storage - scalar or collection */ +/* Basic element of the file storage - scalar or collection: */ typedef struct CvFileNode { int tag; diff --git a/cxcore/src/Makefile.am b/cxcore/src/Makefile.am index d558d8f..7f62a56 100644 --- a/cxcore/src/Makefile.am +++ b/cxcore/src/Makefile.am @@ -1,3 +1,6 @@ +# use the default c++ flags +AM_CXXFLAGS=@DEF_CXXFLAGS@ + EXTRA_DIST = cxcore.dsp cxcore.vcproj cxcore.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cxcore/include -I$(top_srcdir) diff --git a/cxcore/src/Makefile.in b/cxcore/src/Makefile.in index 99bf706..6a9b1dd 100644 --- a/cxcore/src/Makefile.in +++ b/cxcore/src/Makefile.in @@ -117,10 +117,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -143,8 +147,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -155,6 +161,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -173,11 +181,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -197,10 +210,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ @@ -264,6 +279,9 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ + +# use the default c++ flags +AM_CXXFLAGS = @DEF_CXXFLAGS@ EXTRA_DIST = cxcore.dsp cxcore.vcproj cxcore.rc resource.h INCLUDES = -I. -I$(top_srcdir)/cxcore/include -I$(top_srcdir) noinst_HEADERS = _cxcore.h _cxipp.h diff --git a/cxcore/src/_cxcore.h b/cxcore/src/_cxcore.h index 6b28e93..082d052 100644 --- a/cxcore/src/_cxcore.h +++ b/cxcore/src/_cxcore.h @@ -320,8 +320,8 @@ typedef CvStatus (CV_STDCALL * CvLUT_TransformFunc)( const void* src, int srcste int dststep, CvSize size, const void* lut ); CV_INLINE CvStatus -icvLUT_Transform8u_8s_C1R( const uchar* src, int srcstep, char* dst, - int dststep, CvSize size, const char* lut ) +icvLUT_Transform8u_8s_C1R( const uchar* src, int srcstep, schar* dst, + int dststep, CvSize size, const schar* lut ) { return icvLUT_Transform8u_8u_C1R( src, srcstep, (uchar*)dst, dststep, size, (const uchar*)lut ); diff --git a/cxcore/src/cxconvert.cpp b/cxcore/src/cxconvert.cpp index fce3c7f..1c29f0e 100644 --- a/cxcore/src/cxconvert.cpp +++ b/cxcore/src/cxconvert.cpp @@ -727,11 +727,11 @@ cvMixChannels( const CvArr** src, int src_count, static int inittab = 0; uchar* buffer = 0; int heap_alloc = 0; - + CV_FUNCNAME( "cvMixChannels" ); __BEGIN__; - + CvSize size = {0,0}; int depth = -1, elem_size = 1; int *sdelta0 = 0, *sdelta1 = 0, *ddelta0 = 0, *ddelta1 = 0; @@ -765,7 +765,7 @@ cvMixChannels( const CvArr** src, int src_count, CV_ERROR( CV_StsNullPtr, "The array of copied channel indices is NULL" ); buf_size = (src_count + dst_count + 2)* - (sizeof(src0[0]) + sizeof(src_cn[0]) + sizeof(src_step[0])) + + (sizeof(src0[0]) + sizeof(src_cn[0]) + sizeof(src_step[0])) + pair_count*2*(sizeof(sptr[0]) + sizeof(sdelta0[0]) + sizeof(sdelta1[0])); if( buf_size > CV_MAX_LOCAL_SIZE ) @@ -798,10 +798,10 @@ cvMixChannels( const CvArr** src, int src_count, { CvMat stub, *mat = (CvMat*)(k == 0 ? src[i] : dst[i]); int cn; - + if( !CV_IS_MAT(mat) ) CV_CALL( mat = cvGetMat( mat, &stub )); - + if( depth < 0 ) { depth = CV_MAT_DEPTH(mat->type); @@ -868,7 +868,7 @@ cvMixChannels( const CvArr** src, int src_count, for( ; cn >= cn_arr[a+1]; a++ ) ; - + if( k == 0 ) { sptr[i] = src0[a] + (cn - cn_arr[a])*elem_size; @@ -889,7 +889,7 @@ cvMixChannels( const CvArr** src, int src_count, CV_ERROR( CV_StsUnsupportedFormat, "The data type is not supported by the function" ); IPPI_CALL( func( (const void**)sptr, sdelta0, sdelta1, (void**)dptr, - ddelta0, ddelta1, pair_count, size )); + ddelta0, ddelta1, pair_count, size )); __END__; @@ -966,16 +966,16 @@ icvCvtScaleAbsTo_8u_C1R( const uchar* src, int srcstep, uchar lut[256]; int i; double val = shift; - + for( i = 0; i < 128; i++, val += scale ) { int t = cvRound(fabs(val)); lut[i] = CV_CAST_8U(t); } - + if( srcdepth == CV_8S ) val = -val; - + for( ; i < 256; i++, val += scale ) { int t = cvRound(fabs(val)); @@ -1181,7 +1181,7 @@ icvCvtScaleTo_##flavor##_C1R( const uchar* src, int srcstep, \ { \ for( i = 0; i < 256; i++ ) \ { \ - int t = cvRound( (char)i*scale + shift ); \ + int t = cvRound( (schar)i*scale + shift ); \ lut[i] = cast_macro(t); \ } \ \ @@ -1194,12 +1194,12 @@ icvCvtScaleTo_##flavor##_C1R( const uchar* src, int srcstep, \ int iscale = cvRound(scale*(1 << ICV_FIX_SHIFT)); \ int ishift = cvRound(shift*(1 << ICV_FIX_SHIFT)); \ \ - ICV_DEF_CVT_SCALE_CASE( char, int, ICV_SCALE, \ + ICV_DEF_CVT_SCALE_CASE( schar, int, ICV_SCALE, \ cast_macro, iscale, ishift ); \ } \ else \ { \ - ICV_DEF_CVT_SCALE_CASE( char, int, cvRound, \ + ICV_DEF_CVT_SCALE_CASE( schar, int, cvRound, \ cast_macro, scale, shift ); \ } \ break; \ @@ -1286,14 +1286,14 @@ icvCvtScaleTo_##flavor##_C1R( const uchar* src, int srcstep, \ if( size.width*size.height >= 256 ) \ { \ for( i = 0; i < 256; i++ ) \ - lut[i] = (dsttype)((char)i*scale + shift); \ + lut[i] = (dsttype)((schar)i*scale + shift); \ \ icvLUT_Transform8u_##flavor##_C1R( src, srcstep, dst, \ dststep*sizeof(dst[0]), size, lut ); \ } \ else \ { \ - ICV_DEF_CVT_SCALE_CASE( char, double, CV_NOP, \ + ICV_DEF_CVT_SCALE_CASE( schar, double, CV_NOP, \ cast_macro, scale, shift ); \ } \ break; \ @@ -1327,7 +1327,7 @@ icvCvtScaleTo_##flavor##_C1R( const uchar* src, int srcstep, \ ICV_DEF_CVT_SCALE_FUNC_INT( 8u, uchar, CV_CAST_8U ) -ICV_DEF_CVT_SCALE_FUNC_INT( 8s, char, CV_CAST_8S ) +ICV_DEF_CVT_SCALE_FUNC_INT( 8s, schar, CV_CAST_8S ) ICV_DEF_CVT_SCALE_FUNC_INT( 16s, short, CV_CAST_16S ) ICV_DEF_CVT_SCALE_FUNC_INT( 16u, ushort, CV_CAST_16U ) ICV_DEF_CVT_SCALE_FUNC_INT( 32s, int, CV_CAST_32S ) @@ -1424,14 +1424,14 @@ icvCvtTo_##flavor##_C1R( const uchar* src, int srcstep, \ ICV_DEF_CVT_FUNC_2D( 8u, uchar, int, CV_CAST_8U, - CV_8S, char, CV_NOP, + CV_8S, schar, CV_NOP, CV_16U, ushort, CV_NOP, CV_16S, short, CV_NOP, CV_32S, int, CV_NOP, CV_32F, float, cvRound, CV_64F, double, cvRound ) -ICV_DEF_CVT_FUNC_2D( 8s, char, int, CV_CAST_8S, +ICV_DEF_CVT_FUNC_2D( 8s, schar, int, CV_CAST_8S, CV_8U, uchar, CV_NOP, CV_16U, ushort, CV_NOP, CV_16S, short, CV_NOP, @@ -1441,7 +1441,7 @@ ICV_DEF_CVT_FUNC_2D( 8s, char, int, CV_CAST_8S, ICV_DEF_CVT_FUNC_2D( 16u, ushort, int, CV_CAST_16U, CV_8U, uchar, CV_NOP, - CV_8S, char, CV_NOP, + CV_8S, schar, CV_NOP, CV_16S, short, CV_NOP, CV_32S, int, CV_NOP, CV_32F, float, cvRound, @@ -1449,7 +1449,7 @@ ICV_DEF_CVT_FUNC_2D( 16u, ushort, int, CV_CAST_16U, ICV_DEF_CVT_FUNC_2D( 16s, short, int, CV_CAST_16S, CV_8U, uchar, CV_NOP, - CV_8S, char, CV_NOP, + CV_8S, schar, CV_NOP, CV_16U, ushort, CV_NOP, CV_32S, int, CV_NOP, CV_32F, float, cvRound, @@ -1457,7 +1457,7 @@ ICV_DEF_CVT_FUNC_2D( 16s, short, int, CV_CAST_16S, ICV_DEF_CVT_FUNC_2D( 32s, int, int, CV_NOP, CV_8U, uchar, CV_NOP, - CV_8S, char, CV_NOP, + CV_8S, schar, CV_NOP, CV_16U, ushort, CV_NOP, CV_16S, short, CV_NOP, CV_32F, float, cvRound, @@ -1465,7 +1465,7 @@ ICV_DEF_CVT_FUNC_2D( 32s, int, int, CV_NOP, ICV_DEF_CVT_FUNC_2D( 32f, float, float, CV_NOP, CV_8U, uchar, CV_8TO32F, - CV_8S, char, CV_8TO32F, + CV_8S, schar, CV_8TO32F, CV_16U, ushort, CV_NOP, CV_16S, short, CV_NOP, CV_32S, int, CV_CAST_32F, @@ -1473,7 +1473,7 @@ ICV_DEF_CVT_FUNC_2D( 32f, float, float, CV_NOP, ICV_DEF_CVT_FUNC_2D( 64f, double, double, CV_NOP, CV_8U, uchar, CV_8TO32F, - CV_8S, char, CV_8TO32F, + CV_8S, schar, CV_8TO32F, CV_16U, ushort, CV_NOP, CV_16S, short, CV_NOP, CV_32S, int, CV_NOP, diff --git a/cxcore/src/cxcore.dsp b/cxcore/src/cxcore.dsp index a6f5b52..90d4337 100644 --- a/cxcore/src/cxcore.dsp +++ b/cxcore/src/cxcore.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=cxcore - Win32 Debug64 Itanium +CFG=cxcore - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,23 +13,19 @@ CFG=cxcore - Win32 Debug64 Itanium !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "cxcore.mak" CFG="cxcore - Win32 Debug64 Itanium" +!MESSAGE NMAKE /f "cxcore.mak" CFG="cxcore - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "cxcore - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "cxcore - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cxcore - Win32 Debug64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cxcore - Win32 Release64" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cxcore - Win32 Release64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cxcore - Win32 Debug64 Itanium" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=xicl6.exe +CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -42,8 +38,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cxcore_Rls" -# PROP Intermediate_Dir "..\..\_temp\cxcore_Rls" +# PROP Output_Dir "..\..\_temp\cxcore_Release" +# PROP Intermediate_Dir "..\..\_temp\cxcore_Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" LIB32=link.exe -lib @@ -56,7 +52,7 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cxcore100.pdb" /debug /machine:I386 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cxcore100.dll" /implib:"../../lib/cxcore.lib" # SUBTRACT LINK32 /profile /pdb:none /map @@ -70,8 +66,8 @@ LINK32=xilink6.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cxcore_Dbg" -# PROP Intermediate_Dir "..\..\_temp\cxcore_Dbg" +# PROP Output_Dir "..\..\_temp\cxcore_Debug" +# PROP Intermediate_Dir "..\..\_temp\cxcore_Debug" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" LIB32=link.exe -lib @@ -84,141 +80,17 @@ LIB32=link.exe -lib BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=xilink6.exe +LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cxcore100d.pdb" /debug /machine:I386 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cxcore100d.dll" /implib:"../../lib/cxcored.lib" # SUBTRACT LINK32 /pdb:none -!ELSEIF "$(CFG)" == "cxcore - Win32 Debug64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cxcore___Win32_Debug64" -# PROP BASE Intermediate_Dir "cxcore___Win32_Debug64" -# PROP BASE Ignore_Export_Lib 1 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cxcore_Dbg64" -# PROP Intermediate_Dir "..\..\_temp\cxcore_Dbg64" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /G6 /MDd /W4 /Gm /Zi /Od /I "." /I "..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "CVAPI_EXPORTS" /FR /Yu"_cxcore.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Zi /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cxcore.h" /FD /Wp64 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cxcore100d.dll" /implib:"../../lib/cxcored.lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cxcore100d_64.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cxcore100d_64.dll" /implib:"../../lib/cxcored_64.lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cxcore - Win32 Release64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cxcore___Win32_Release64" -# PROP BASE Intermediate_Dir "cxcore___Win32_Release64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cxcore_Rls64" -# PROP Intermediate_Dir "..\..\_temp\cxcore_Rls64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /G6 /MD /W4 /Zi /O2 /Ob2 /I "." /I "..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "CVAPI_EXPORTS" /FR /Yu"_cxcore.h" /FD /c -# ADD CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "." /I "..\include" /D "NDEBUG" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cxcore.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cxcore100.dll" /implib:"../../lib/cxcore.lib" /machine:AMD64 -# SUBTRACT BASE LINK32 /profile /map -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cxcore100_64.dll" /implib:"../../lib/cxcore_64.lib" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cxcore - Win32 Release64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cxcore___Win32_Release64_Itanium" -# PROP BASE Intermediate_Dir "cxcore___Win32_Release64_Itanium" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\_temp\cxcore_RlsI7" -# PROP Intermediate_Dir "..\..\_temp\cxcore_RlsI7" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MD /W4 /Zi /O2 /Ob2 /I "." /I "..\include" /D "NDEBUG" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cxcore.h" /FD /c -# ADD CPP /nologo /MD /w /W0 /Zi /Ob2 /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "NDEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cxcore.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /nodefaultlib:"libmmd.lib" /out:"..\..\bin\cxcore100_i7.dll" /implib:"../../lib/cxcore_i7.lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /debug /machine:IX86 /out:"..\..\bin\cxcore100_i7.dll" /implib:"../../lib/cxcore_i7.lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cxcore - Win32 Debug64 Itanium" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cxcore___Win32_Debug64_Itanium" -# PROP BASE Intermediate_Dir "cxcore___Win32_Debug64_Itanium" -# PROP BASE Ignore_Export_Lib 1 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\_temp\cxcore_DbgI7" -# PROP Intermediate_Dir "..\..\_temp\cxcore_DbgI7" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -LIB32=link.exe -lib -# ADD BASE CPP /nologo /MDd /W4 /Gm /Zi /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "WIN32" /D "WIN64" /D "EM64T" /FR /Yu"_cxcore.h" /FD /Wp64 /c -# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "." /I "..\include" /D "_WINDOWS" /D "CVAPI_EXPORTS" /D "_DEBUG" /D "WIN32" /D "WIN64" /FR /Yu"_cxcore.h" /FD /Qwd167 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cxcore100d_i7.pdb" /debug /machine:IX86 /nodefaultlib:"libmmdd.lib" /out:"..\..\bin\cxcore100d_i7.dll" /implib:"../../lib/cxcored_i7.lib" /machine:IA64 -# SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:"..\..\bin/cxcore100d_i7.pdb" /debug /machine:IX86 /out:"..\..\bin\cxcore100d_i7.dll" /implib:"../../lib/cxcored_i7.lib" /machine:IA64 -# SUBTRACT LINK32 /pdb:none - !ENDIF # Begin Target # Name "cxcore - Win32 Release" # Name "cxcore - Win32 Debug" -# Name "cxcore - Win32 Debug64" -# Name "cxcore - Win32 Release64" -# Name "cxcore - Win32 Release64 Itanium" -# Name "cxcore - Win32 Debug64 Itanium" # Begin Group "Src" # PROP Default_Filter "" diff --git a/cxcore/src/cxcore.vcproj b/cxcore/src/cxcore.vcproj index 5b11538..e69de29 100644 --- a/cxcore/src/cxcore.vcproj +++ b/cxcore/src/cxcore.vcproj @@ -1,3245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cxcore/src/cxdatastructs.cpp b/cxcore/src/cxdatastructs.cpp index f2512c2..b31b06f 100644 --- a/cxcore/src/cxdatastructs.cpp +++ b/cxcore/src/cxdatastructs.cpp @@ -41,7 +41,7 @@ #include "_cxcore.h" #define ICV_FREE_PTR(storage) \ - ((char*)(storage)->top + (storage)->block_size - (storage)->free_space) + ((schar*)(storage)->top + (storage)->block_size - (storage)->free_space) #define ICV_ALIGNED_SEQ_BLOCK_SIZE \ (int)cvAlign(sizeof(CvSeqBlock), CV_STRUCT_ALIGN) @@ -68,7 +68,7 @@ cvAlignLeft( int size, int align ) } #define ICV_SHIFT_TAB_MAX 32 -static const char icvPower2ShiftTab[] = +static const schar icvPower2ShiftTab[] = { 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5 @@ -78,12 +78,12 @@ static const char icvPower2ShiftTab[] = * Functions for manipulating memory storage - list of memory blocks * \****************************************************************************************/ -/* initializes allocated storage */ +/* Initialize allocated storage: */ static void icvInitMemStorage( CvMemStorage* storage, int block_size ) { CV_FUNCNAME( "icvInitMemStorage " ); - + __BEGIN__; if( !storage ) @@ -103,7 +103,7 @@ icvInitMemStorage( CvMemStorage* storage, int block_size ) } -/* creates root memory storage */ +/* Create root memory storage: */ CV_IMPL CvMemStorage* cvCreateMemStorage( int block_size ) { @@ -125,7 +125,7 @@ cvCreateMemStorage( int block_size ) } -/* creates child memory storage */ +/* Create child memory storage: */ CV_IMPL CvMemStorage * cvCreateChildMemStorage( CvMemStorage * parent ) { @@ -149,7 +149,7 @@ cvCreateChildMemStorage( CvMemStorage * parent ) } -/* releases all blocks of the storage (or returns them to parent if any) */ +/* Release all blocks of the storage (or return them to parent, if any): */ static void icvDestroyMemStorage( CvMemStorage* storage ) { @@ -203,7 +203,7 @@ icvDestroyMemStorage( CvMemStorage* storage ) } -/* releases memory storage */ +/* Release memory storage: */ CV_IMPL void cvReleaseMemStorage( CvMemStorage** storage ) { @@ -228,7 +228,7 @@ cvReleaseMemStorage( CvMemStorage** storage ) } -/* clears memory storage (returns blocks to the parent if any) */ +/* Clears memory storage (return blocks to the parent, if any): */ CV_IMPL void cvClearMemStorage( CvMemStorage * storage ) { @@ -253,15 +253,15 @@ cvClearMemStorage( CvMemStorage * storage ) } -/* moves stack pointer to next block. - If no blocks, allocate new one and link it to the storage */ +/* Moves stack pointer to next block. + If no blocks, allocate new one and link it to the storage: */ static void icvGoNextMemBlock( CvMemStorage * storage ) { CV_FUNCNAME( "icvGoNextMemBlock" ); - + __BEGIN__; - + if( !storage ) CV_ERROR( CV_StsNullPtr, "" ); @@ -318,7 +318,7 @@ icvGoNextMemBlock( CvMemStorage * storage ) } -/* remembers memory storage position */ +/* Remember memory storage position: */ CV_IMPL void cvSaveMemStoragePos( const CvMemStorage * storage, CvMemStoragePos * pos ) { @@ -336,7 +336,7 @@ cvSaveMemStoragePos( const CvMemStorage * storage, CvMemStoragePos * pos ) } -/* restores memory storage position */ +/* Restore memory storage position: */ CV_IMPL void cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos ) { @@ -380,12 +380,12 @@ cvRestoreMemStoragePos( CvMemStorage * storage, CvMemStoragePos * pos ) } -/* Allocates continuous buffer of the specified size in the storage */ +/* Allocate continuous buffer of the specified size in the storage: */ CV_IMPL void* cvMemStorageAlloc( CvMemStorage* storage, size_t size ) { - char *ptr = 0; - + schar *ptr = 0; + CV_FUNCNAME( "cvMemStorageAlloc" ); __BEGIN__; @@ -440,7 +440,7 @@ cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len ) * Sequence implementation * \****************************************************************************************/ -/* creates empty sequence */ +/* Create empty sequence: */ CV_IMPL CvSeq * cvCreateSeq( int seq_flags, int header_size, int elem_size, CvMemStorage * storage ) { @@ -522,8 +522,8 @@ cvSetSeqBlockSize( CvSeq *seq, int delta_elements ) } -/* finds sequence element by its index */ -CV_IMPL char* +/* Find a sequence element by its index: */ +CV_IMPL schar* cvGetSeqElem( const CvSeq *seq, int index ) { CvSeqBlock *block; @@ -561,11 +561,11 @@ cvGetSeqElem( const CvSeq *seq, int index ) } -/* calculates index of sequence element */ +/* Calculate index of a sequence element: */ CV_IMPL int cvSeqElemIdx( const CvSeq* seq, const void* _element, CvSeqBlock** _block ) { - const char *element = (const char *)_element; + const schar *element = (const schar *)_element; int elem_size; int id = -1; CvSeqBlock *first_block; @@ -610,7 +610,7 @@ cvSliceLength( CvSlice slice, const CvSeq* seq ) { int total = seq->total; int length = slice.end_index - slice.start_index; - + if( length != 0 ) { if( slice.start_index < 0 ) @@ -634,7 +634,7 @@ cvSliceLength( CvSlice slice, const CvSeq* seq ) } -/* copies all the sequence elements into single continuous array */ +/* Copy all sequence elements into single continuous array: */ CV_IMPL void* cvCvtSeqToArray( const CvSeq *seq, void *array, CvSlice slice ) { @@ -651,10 +651,10 @@ cvCvtSeqToArray( const CvSeq *seq, void *array, CvSlice slice ) elem_size = seq->elem_size; total = cvSliceLength( slice, seq )*elem_size; - + if( total == 0 ) EXIT; - + cvStartReadSeq( seq, &reader, 0 ); CV_CALL( cvSetSeqReaderPos( &reader, slice.start_index, 0 )); @@ -679,14 +679,14 @@ cvCvtSeqToArray( const CvSeq *seq, void *array, CvSlice slice ) } -/* constructs sequence from array without copying any data. - the resultant sequence can't grow above its initial size */ +/* Construct a sequence from an array without copying any data. + NB: The resultant sequence cannot grow beyond its initial size: */ CV_IMPL CvSeq* cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, void *array, int total, CvSeq *seq, CvSeqBlock * block ) { CvSeq* result = 0; - + CV_FUNCNAME( "cvMakeSeqHeaderForArray" ); __BEGIN__; @@ -713,7 +713,7 @@ cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, } seq->elem_size = elem_size; seq->total = total; - seq->block_max = seq->ptr = (char *) array + total * elem_size; + seq->block_max = seq->ptr = (schar *) array + total * elem_size; if( total > 0 ) { @@ -721,7 +721,7 @@ cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, block->prev = block->next = block; block->start_index = 0; block->count = total; - block->data = (char *) array; + block->data = (schar *) array; } result = seq; @@ -732,9 +732,9 @@ cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size, } -/* the function allocates space for at least one more sequence element. - if there are free sequence blocks (seq->free_blocks != 0), - they are reused, otherwise the space is allocated in the storage */ +/* The function allocates space for at least one more sequence element. + If there are free sequence blocks (seq->free_blocks != 0) + they are reused, otherwise the space is allocated in the storage: */ static void icvGrowSeq( CvSeq *seq, int in_front_of ) { @@ -760,9 +760,9 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) if( !storage ) CV_ERROR( CV_StsNullPtr, "The sequence has NULL storage pointer" ); - /* if there is a free space just after last allocated block - and it's big enough then enlarge the last block - (this can happen only if the new block is added to the end of sequence */ + /* If there is a free space just after last allocated block + and it is big enough then enlarge the last block. + This can happen only if the new block is added to the end of sequence: */ if( (unsigned)(ICV_FREE_PTR(storage) - seq->block_max) < CV_STRUCT_ALIGN && storage->free_space >= seq->elem_size && !in_front_of ) { @@ -770,7 +770,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) delta = MIN( delta, delta_elems ) * elem_size; seq->block_max += delta; - storage->free_space = cvAlignLeft((int)(((char*)storage->top + storage->block_size) - + storage->free_space = cvAlignLeft((int)(((schar*)storage->top + storage->block_size) - seq->block_max), CV_STRUCT_ALIGN ); EXIT; } @@ -778,7 +778,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) { int delta = elem_size * delta_elems + ICV_ALIGNED_SEQ_BLOCK_SIZE; - /* try to allocate elements */ + /* Try to allocate elements: */ if( storage->free_space < delta ) { int small_block_size = MAX(1, delta_elems/3)*elem_size + @@ -797,7 +797,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) } CV_CALL( block = (CvSeqBlock*)cvMemStorageAlloc( storage, delta )); - block->data = (char*)cvAlignPtr( block + 1, CV_STRUCT_ALIGN ); + block->data = (schar*)cvAlignPtr( block + 1, CV_STRUCT_ALIGN ); block->count = delta - ICV_ALIGNED_SEQ_BLOCK_SIZE; block->prev = block->next = 0; } @@ -819,9 +819,12 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) block->prev->next = block->next->prev = block; } - /* for free blocks the field means total number of bytes in the block. - And for used blocks it means a current number of sequence - elements in the block */ + /* For free blocks the field means + * total number of bytes in the block. + * + * For used blocks it means current number + * of sequence elements in the block: + */ assert( block->count % seq->elem_size == 0 && block->count > 0 ); if( !in_front_of ) @@ -862,7 +865,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of ) __END__; } -/* recycles a sequence block for the further use */ +/* Recycle a sequence block: */ static void icvFreeSeqBlock( CvSeq *seq, int in_front_of ) { @@ -900,7 +903,7 @@ icvFreeSeqBlock( CvSeq *seq, int in_front_of ) block->count = delta * seq->elem_size; block->data -= block->count; - /* update start indices of sequence blocks */ + /* Update start indices of sequence blocks: */ for( ;; ) { block->start_index -= delta; @@ -928,7 +931,7 @@ icvFreeSeqBlock( CvSeq *seq, int in_front_of ) * Sequence Writer implementation * \****************************************************************************************/ -/* initializes sequence writer */ +/* Initialize sequence writer: */ CV_IMPL void cvStartAppendToSeq( CvSeq *seq, CvSeqWriter * writer ) { @@ -951,7 +954,7 @@ cvStartAppendToSeq( CvSeq *seq, CvSeqWriter * writer ) } -/* initializes sequence writer */ +/* Initialize sequence writer: */ CV_IMPL void cvStartWriteSeq( int seq_flags, int header_size, int elem_size, CvMemStorage * storage, CvSeqWriter * writer ) @@ -972,7 +975,7 @@ cvStartWriteSeq( int seq_flags, int header_size, } -/* updates sequence header */ +/* Update sequence header: */ CV_IMPL void cvFlushSeqWriter( CvSeqWriter * writer ) { @@ -1011,7 +1014,7 @@ cvFlushSeqWriter( CvSeqWriter * writer ) } -/* calls icvFlushSeqWriter and finishes writing process */ +/* Calls icvFlushSeqWriter and finishes writing process: */ CV_IMPL CvSeq * cvEndWriteSeq( CvSeqWriter * writer ) { @@ -1027,11 +1030,11 @@ cvEndWriteSeq( CvSeqWriter * writer ) CV_CALL( cvFlushSeqWriter( writer )); seq = writer->seq; - /* truncate the last block */ + /* Truncate the last block: */ if( writer->block && writer->seq->storage ) { CvMemStorage *storage = seq->storage; - char *storage_block_max = (char *) storage->top + storage->block_size; + schar *storage_block_max = (schar *) storage->top + storage->block_size; assert( writer->block->count > 0 ); @@ -1051,7 +1054,7 @@ cvEndWriteSeq( CvSeqWriter * writer ) } -/* creates new sequence block */ +/* Create new sequence block: */ CV_IMPL void cvCreateSeqBlock( CvSeqWriter * writer ) { @@ -1082,7 +1085,7 @@ cvCreateSeqBlock( CvSeqWriter * writer ) * Sequence Reader implementation * \****************************************************************************************/ -/* initializes sequence reader */ +/* Initialize sequence reader: */ CV_IMPL void cvStartReadSeq( const CvSeq *seq, CvSeqReader * reader, int reverse ) { @@ -1117,7 +1120,7 @@ cvStartReadSeq( const CvSeq *seq, CvSeqReader * reader, int reverse ) if( reverse ) { - char *temp = reader->ptr; + schar *temp = reader->ptr; reader->ptr = reader->prev_elem; reader->prev_elem = temp; @@ -1144,7 +1147,9 @@ cvStartReadSeq( const CvSeq *seq, CvSeqReader * reader, int reverse ) } -/* changes the current reading block to the previous or to the next */ +/* Change the current reading block + * to the previous or to the next: + */ CV_IMPL void cvChangeSeqBlock( void* _reader, int direction ) { @@ -1153,7 +1158,7 @@ cvChangeSeqBlock( void* _reader, int direction ) __BEGIN__; CvSeqReader* reader = (CvSeqReader*)_reader; - + if( !reader ) CV_ERROR( CV_StsNullPtr, "" ); @@ -1174,7 +1179,7 @@ cvChangeSeqBlock( void* _reader, int direction ) } -/* returns the current reader position */ +/* Return the current reader position: */ CV_IMPL int cvGetSeqReaderPos( CvSeqReader* reader ) { @@ -1202,8 +1207,10 @@ cvGetSeqReaderPos( CvSeqReader* reader ) } -/* sets reader position to given absolute or relative - (relatively to the current one) position */ +/* Set reader position to given position, + * either absolute or relative to the + * current one: + */ CV_IMPL void cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative ) { @@ -1268,7 +1275,7 @@ cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative ) } else { - char* ptr = reader->ptr; + schar* ptr = reader->ptr; index *= elem_size; block = reader->block; @@ -1302,11 +1309,11 @@ cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative ) } -/* pushes element to the sequence */ -CV_IMPL char* +/* Push element onto the sequence: */ +CV_IMPL schar* cvSeqPush( CvSeq *seq, void *element ) { - char *ptr = 0; + schar *ptr = 0; size_t elem_size; CV_FUNCNAME( "cvSeqPush" ); @@ -1339,11 +1346,11 @@ cvSeqPush( CvSeq *seq, void *element ) } -/* pops the last element out of the sequence */ +/* Pop last element off of the sequence: */ CV_IMPL void cvSeqPop( CvSeq *seq, void *element ) { - char *ptr; + schar *ptr; int elem_size; CV_FUNCNAME( "cvSeqPop" ); @@ -1373,11 +1380,11 @@ cvSeqPop( CvSeq *seq, void *element ) } -/* pushes element to the front of the sequence */ -CV_IMPL char* +/* Push element onto the front of the sequence: */ +CV_IMPL schar* cvSeqPushFront( CvSeq *seq, void *element ) { - char* ptr = 0; + schar* ptr = 0; int elem_size; CvSeqBlock *block; @@ -1413,7 +1420,7 @@ cvSeqPushFront( CvSeq *seq, void *element ) } -/* pulls out the first element of the sequence */ +/* Shift out first element of the sequence: */ CV_IMPL void cvSeqPopFront( CvSeq *seq, void *element ) { @@ -1446,8 +1453,8 @@ cvSeqPopFront( CvSeq *seq, void *element ) __END__; } -/* inserts new element in the middle of the sequence */ -CV_IMPL char* +/* Insert new element in middle of sequence: */ +CV_IMPL schar* cvSeqInsert( CvSeq *seq, int before_index, void *element ) { int elem_size; @@ -1455,7 +1462,7 @@ cvSeqInsert( CvSeq *seq, int before_index, void *element ) CvSeqBlock *block; int delta_index; int total; - char* ret_ptr = 0; + schar* ret_ptr = 0; CV_FUNCNAME( "cvSeqInsert" ); @@ -1485,7 +1492,7 @@ cvSeqInsert( CvSeq *seq, int before_index, void *element ) if( before_index >= total >> 1 ) { - char *ptr = seq->ptr + elem_size; + schar *ptr = seq->ptr + elem_size; if( ptr > seq->block_max ) { @@ -1509,7 +1516,7 @@ cvSeqInsert( CvSeq *seq, int before_index, void *element ) memcpy( block->data, prev_block->data + block_size - elem_size, elem_size ); block = prev_block; - /* check that we don't fall in the infinite loop */ + /* Check that we don't fall into an infinite loop: */ assert( block != seq->first->prev ); } @@ -1547,7 +1554,8 @@ cvSeqInsert( CvSeq *seq, int before_index, void *element ) memmove( block->data, block->data + elem_size, block_size - elem_size ); memcpy( block->data + block_size - elem_size, next_block->data, elem_size ); block = next_block; - /* check that we don't fall in the infinite loop */ + + /* Check that we don't fall into an infinite loop: */ assert( block != seq->first ); } @@ -1569,11 +1577,11 @@ cvSeqInsert( CvSeq *seq, int before_index, void *element ) } -/* removes element from the sequence */ +/* Removes element from sequence: */ CV_IMPL void cvSeqRemove( CvSeq *seq, int index ) { - char *ptr; + schar *ptr; int elem_size; int block_size; CvSeqBlock *block; @@ -1661,7 +1669,7 @@ cvSeqRemove( CvSeq *seq, int index ) } -/* adds several elements to the end or in the beginning of sequence */ +/* Add several elements to the beginning or end of a sequence: */ CV_IMPL void cvSeqPushMulti( CvSeq *seq, void *_elements, int count, int front ) { @@ -1707,11 +1715,11 @@ cvSeqPushMulti( CvSeq *seq, void *_elements, int count, int front ) else { CvSeqBlock* block = seq->first; - + while( count > 0 ) { int delta; - + if( !block || block->start_index == 0 ) { CV_CALL( icvGrowSeq( seq, 1 )); @@ -1737,7 +1745,7 @@ cvSeqPushMulti( CvSeq *seq, void *_elements, int count, int front ) } -/* removes several elements from the end of sequence */ +/* Remove several elements from the end of sequence: */ CV_IMPL void cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front ) { @@ -1813,7 +1821,7 @@ cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front ) } -/* removes all elements from the sequence */ +/* Remove all elements from a sequence: */ CV_IMPL void cvClearSeq( CvSeq *seq ) { @@ -1833,15 +1841,15 @@ CV_IMPL CvSeq* cvSeqSlice( const CvSeq* seq, CvSlice slice, CvMemStorage* storage, int copy_data ) { CvSeq* subseq = 0; - + CV_FUNCNAME("cvSeqSlice"); __BEGIN__; - + int elem_size, count, length; CvSeqReader reader; CvSeqBlock *block, *first_block = 0, *last_block = 0; - + if( !CV_IS_SEQ(seq) ) CV_ERROR( CV_StsBadArg, "Invalid sequence header" ); @@ -1873,7 +1881,7 @@ cvSeqSlice( const CvSeq* seq, CvSlice slice, CvMemStorage* storage, int copy_dat do { int bl = MIN( count, length ); - + if( !copy_data ) { block = (CvSeqBlock*)cvMemStorageAlloc( storage, sizeof(*block) ); @@ -1903,14 +1911,14 @@ cvSeqSlice( const CvSeq* seq, CvSlice slice, CvMemStorage* storage, int copy_dat } while( length > 0 ); } - + __END__; return subseq; } -// Remove slice from the middle of the sequence +// Remove slice from the middle of the sequence. // !!! TODO !!! Implement more efficient algorithm CV_IMPL void cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ) @@ -1987,14 +1995,14 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ) } -// Inserts a new sequence into the middle of another sequence +// Insert a sequence into the middle of another sequence: // !!! TODO !!! Implement more efficient algorithm CV_IMPL void cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) { CvSeqReader reader_to, reader_from; int i, elem_size, total, from_total; - + CV_FUNCNAME("cvSeqInsertSlice"); __BEGIN__; @@ -2022,7 +2030,7 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) if( seq->elem_size != from->elem_size ) CV_ERROR( CV_StsUnmatchedSizes, - "Sizes of source and destination sequences' elements are different" ); + "Source and destination sequence element sizes are different." ); from_total = from->total; @@ -2084,8 +2092,8 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) } // Sort the sequence using user-specified comparison function. -// The semantics is similar to qsort() function. The code is based -// on BSD system qsort(): +// The semantics is similar to qsort() function. +// The code is based on BSD system qsort(): // * Copyright (c) 1992, 1993 // * The Regents of the University of California. All rights reserved. // * @@ -2120,9 +2128,9 @@ cvSeqInsertSlice( CvSeq* seq, int index, const CvArr* from_arr ) typedef struct CvSeqReaderPos { CvSeqBlock* block; - char* ptr; - char* block_min; - char* block_max; + schar* ptr; + schar* block_min; + schar* block_max; } CvSeqReaderPos; @@ -2142,8 +2150,8 @@ CvSeqReaderPos; (reader).block_max = (pos).block_max; \ } -inline char* -icvMed3( char* a, char* b, char* c, CvCmpFunc cmp_func, void* aux ) +inline schar* +icvMed3( schar* a, schar* b, schar* c, CvCmpFunc cmp_func, void* aux ) { return cmp_func(a, b, aux) < 0 ? (cmp_func(b, c, aux) < 0 ? b : cmp_func(a, c, aux) < 0 ? c : a) @@ -2152,7 +2160,7 @@ icvMed3( char* a, char* b, char* c, CvCmpFunc cmp_func, void* aux ) CV_IMPL void cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) -{ +{ int elem_size; int isort_thresh = 7; CvSeqReader left, right; @@ -2168,7 +2176,7 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) CV_FUNCNAME( "cvSeqSort" ); __BEGIN__; - + if( !CV_IS_SEQ(seq) ) CV_ERROR( !seq ? CV_StsNullPtr : CV_StsBadArg, "Bad input sequence" ); @@ -2223,7 +2231,7 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) } while( ptr2.ptr != left.ptr ) { - char* cur = ptr2.ptr; + schar* cur = ptr2.ptr; CV_PREV_SEQ_ELEM( elem_size, ptr2 ); if( cmp_func( ptr2.ptr, cur, aux ) <= 0 ) break; @@ -2237,18 +2245,18 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) { CvSeqReader left0, left1, right0, right1; CvSeqReader tmp0, tmp1; - char *m1, *m2, *m3, *pivot; + schar *m1, *m2, *m3, *pivot; int swap_cnt = 0; int l, l0, l1, r, r0, r1; left0 = tmp0 = left; right0 = right1 = right; n /= elem_size; - + if( n > 40 ) { int d = n / 8; - char *p1, *p2, *p3; + schar *p1, *p2, *p3; p1 = tmp0.ptr; cvSetSeqReaderPos( &tmp0, d, 1 ); p2 = tmp0.ptr; @@ -2358,7 +2366,7 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) l1 = cvGetSeqReaderPos( &left1 ); if( l1 == 0 ) l1 = seq->total; - + n = MIN( l - l1, l1 - l0 ); if( n > 0 ) { @@ -2436,15 +2444,15 @@ cvSeqSort( CvSeq* seq, CvCmpFunc cmp_func, void* aux ) } -CV_IMPL char* +CV_IMPL schar* cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func, int is_sorted, int* _idx, void* userdata ) { - char* result = 0; - const char* elem = (const char*)_elem; + schar* result = 0; + const schar* elem = (const schar*)_elem; int idx = -1; - - CV_FUNCNAME("cvSeqSort"); + + CV_FUNCNAME("cvSeqSearch"); __BEGIN__; @@ -2515,11 +2523,11 @@ cvSeqSearch( CvSeq* seq, const void* _elem, CvCmpFunc cmp_func, CV_ERROR( CV_StsNullPtr, "Null compare function" ); i = 0, j = total; - + while( j > i ) { int k = (i+j)>>1, code; - char* ptr = cvGetSeqElem( seq, k ); + schar* ptr = cvGetSeqElem( seq, k ); code = cmp_func( elem, ptr, userdata ); if( !code ) { @@ -2574,15 +2582,15 @@ cvSeqInvert( CvSeq* seq ) typedef struct CvPTreeNode { struct CvPTreeNode* parent; - char* element; + schar* element; int rank; } CvPTreeNode; -// the function splits the input sequence or set into one or more equivalence classes. +// This function splits the input sequence or set into one or more equivalence classes. // is_equal(a,b,...) returns non-zero if the two sequence elements -// belong to the same class. the function returns sequence of integers - +// belong to the same class. The function returns sequence of integers - // 0-based class indexes for each element. // // The algorithm is described in "Introduction to Algorithms" @@ -2594,7 +2602,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, CvSeq* result = 0; CvMemStorage* temp_storage = 0; int class_idx = 0; - + CV_FUNCNAME( "cvSeqPartition" ); __BEGIN__; @@ -2603,7 +2611,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, CvSeqReader reader, reader0; CvSeq* nodes; int i, j; - int is_set; + int is_set; if( !labels ) CV_ERROR( CV_StsNullPtr, "" ); @@ -2625,7 +2633,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, cvStartReadSeq( seq, &reader ); memset( &writer, 0, sizeof(writer)); - cvStartAppendToSeq( nodes, &writer ); + cvStartAppendToSeq( nodes, &writer ); // Initial O(N) pass. Make a forest of single-vertex trees. for( i = 0; i < seq->total; i++ ) @@ -2639,9 +2647,9 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, cvEndWriteSeq( &writer ); - // because in the next loop we will iterate + // Because in the next loop we will iterate // through all the sequence nodes each time, - // we do not need to initialize reader every time + // we do not need to initialize reader every time: cvStartReadSeq( nodes, &reader ); cvStartReadSeq( nodes, &reader0 ); @@ -2662,12 +2670,12 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, for( j = 0; j < nodes->total; j++ ) { CvPTreeNode* node2 = (CvPTreeNode*)reader.ptr; - + if( node2->element && node2 != node && is_equal( node->element, node2->element, userdata )) { CvPTreeNode* root2 = node2; - + // unite both trees while( root2->parent ) root2 = root2->parent; @@ -2684,7 +2692,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, } assert( root->parent == 0 ); - // compress path from node2 to the root + // Compress path from node2 to the root: while( node2->parent ) { CvPTreeNode* temp = node2; @@ -2692,7 +2700,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, temp->parent = root; } - // compress path from node to the root + // Compress path from node to the root: node2 = node; while( node2->parent ) { @@ -2716,7 +2724,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, { CvPTreeNode* node = (CvPTreeNode*)reader.ptr; int idx = -1; - + if( node->element ) { while( node->parent ) @@ -2746,7 +2754,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels, * Set implementation * \****************************************************************************************/ -/* creates empty set */ +/* Creates empty set: */ CV_IMPL CvSet* cvCreateSet( int set_flags, int header_size, int elem_size, CvMemStorage * storage ) { @@ -2772,7 +2780,7 @@ cvCreateSet( int set_flags, int header_size, int elem_size, CvMemStorage * stora } -/* adds new element to the set */ +/* Add new element to the set: */ CV_IMPL int cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element ) { @@ -2791,7 +2799,7 @@ cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element ) { int count = set->total; int elem_size = set->elem_size; - char *ptr; + schar *ptr; CV_CALL( icvGrowSeq( (CvSeq *) set, 0 )); set->free_elems = (CvSetElem*) (ptr = set->ptr); @@ -2826,7 +2834,7 @@ cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element ) } -/* removes element from the set given its index */ +/* Remove element from a set given element index: */ CV_IMPL void cvSetRemove( CvSet* set, int index ) { @@ -2844,7 +2852,7 @@ cvSetRemove( CvSet* set, int index ) } -/* removes all elements from the set */ +/* Remove all elements from a set: */ CV_IMPL void cvClearSet( CvSet* set ) { @@ -2864,7 +2872,7 @@ cvClearSet( CvSet* set ) * Graph implementation * \****************************************************************************************/ -/* creates new graph */ +/* Create a new graph: */ CV_IMPL CvGraph * cvCreateGraph( int graph_type, int header_size, int vtx_size, int edge_size, CvMemStorage * storage ) @@ -2878,10 +2886,12 @@ cvCreateGraph( int graph_type, int header_size, CvSet *vertices = 0; - if( header_size < (int)sizeof( CvGraph ) || - edge_size < (int)sizeof( CvGraphEdge ) || - vtx_size < (int)sizeof( CvGraphVtx )) + if( header_size < (int) sizeof( CvGraph ) + || edge_size < (int) sizeof( CvGraphEdge ) + || vtx_size < (int) sizeof( CvGraphVtx ) + ){ CV_ERROR( CV_StsBadSize, "" ); + } CV_CALL( vertices = cvCreateSet( graph_type, header_size, vtx_size, storage )); CV_CALL( edges = cvCreateSet( CV_SEQ_KIND_GENERIC | CV_SEQ_ELTYPE_GRAPH_EDGE, @@ -2896,7 +2906,7 @@ cvCreateGraph( int graph_type, int header_size, } -/* Removes all the vertices and edges from the graph */ +/* Remove all vertices and edges from a graph: */ CV_IMPL void cvClearGraph( CvGraph * graph ) { @@ -2914,7 +2924,7 @@ cvClearGraph( CvGraph * graph ) } -/* Adds vertex to the graph */ +/* Add a vertex to a graph: */ CV_IMPL int cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* _vertex, CvGraphVtx** _inserted_vertex ) { @@ -2947,7 +2957,7 @@ cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* _vertex, CvGraphVtx** _inserted } -/* Removes vertex from the graph together with incident edges */ +/* Remove a vertex from the graph together with its incident edges: */ CV_IMPL int cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx ) { @@ -2980,7 +2990,7 @@ cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx ) } -/* Removes vertex from the graph together with incident edges */ +/* Remove a vertex from the graph together with its incident edges: */ CV_IMPL int cvGraphRemoveVtx( CvGraph* graph, int index ) { @@ -3017,7 +3027,7 @@ cvGraphRemoveVtx( CvGraph* graph, int index ) } -/* Finds graph edge given pointers to the ending vertices */ +/* Find a graph edge given pointers to the ending vertices: */ CV_IMPL CvGraphEdge* cvFindGraphEdgeByPtr( const CvGraph* graph, const CvGraphVtx* start_vtx, @@ -3058,7 +3068,7 @@ cvFindGraphEdgeByPtr( const CvGraph* graph, } -/* Finds edge in the graph given indices of the ending vertices */ +/* Find an edge in the graph given indices of the ending vertices: */ CV_IMPL CvGraphEdge * cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx ) { @@ -3084,8 +3094,10 @@ cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx ) } -/* Connects the two given vertices if they were not connected before, - otherwise it returns the existing edge */ +/* Given two vertices, return the edge + * connecting them, creating it if it + * did not already exist: + */ CV_IMPL int cvGraphAddEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_vtx, @@ -3155,8 +3167,10 @@ cvGraphAddEdgeByPtr( CvGraph* graph, return result; } -/* Connects the two given vertices if they were not connected before, - otherwise it returns the existing edge */ +/* Given two vertices, return the edge + * connecting them, creating it if it + * did not already exist: + */ CV_IMPL int cvGraphAddEdge( CvGraph* graph, int start_idx, int end_idx, @@ -3185,7 +3199,7 @@ cvGraphAddEdge( CvGraph* graph, } -/* Removes the graph edge connecting two given vertices */ +/* Remove the graph edge connecting two given vertices: */ CV_IMPL void cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_vtx ) { @@ -3250,7 +3264,7 @@ cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_v } -/* Removes the graph edge connecting two given vertices */ +/* Remove the graph edge connecting two given vertices: */ CV_IMPL void cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx ) { @@ -3273,7 +3287,7 @@ cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx ) } -/* Counts number of edges incident to the vertex */ +/* Count number of edges incident to a given vertex: */ CV_IMPL int cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vertex ) { @@ -3299,7 +3313,7 @@ cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vertex ) } -/* Counts number of edges incident to the vertex */ +/* Count number of edges incident to a given vertex: */ CV_IMPL int cvGraphVtxDegree( const CvGraph* graph, int vtx_idx ) { @@ -3344,7 +3358,7 @@ icvSeqElemsClearFlags( CvSeq* seq, int offset, int clear_mask ) CV_FUNCNAME("icvStartScanGraph"); __BEGIN__; - + CvSeqReader reader; int i, total, elem_size; @@ -3371,16 +3385,16 @@ icvSeqElemsClearFlags( CvSeq* seq, int offset, int clear_mask ) } -static char* +static schar* icvSeqFindNextElem( CvSeq* seq, int offset, int mask, int value, int* start_index ) { - char* elem_ptr = 0; - + schar* elem_ptr = 0; + CV_FUNCNAME("icvStartScanGraph"); __BEGIN__; - + CvSeqReader reader; int total, elem_size, index; @@ -3504,7 +3518,7 @@ CV_IMPL int cvNextGraphItem( CvGraphScanner* scanner ) { int code = -1; - + CV_FUNCNAME("cvNextGraphItem"); __BEGIN__; @@ -3544,10 +3558,10 @@ cvNextGraphItem( CvGraphScanner* scanner ) while( edge ) { dst = edge->vtx[vtx == edge->vtx[0]]; - + if( !CV_IS_GRAPH_EDGE_VISITED(edge) ) { - // check that the edge is outcoming + // Check that the edge is outgoing: if( !CV_IS_GRAPH_ORIENTED( scanner->graph ) || dst != edge->vtx[0] ) { edge->flags |= CV_GRAPH_ITEM_VISITED_FLAG; @@ -3560,7 +3574,7 @@ cvNextGraphItem( CvGraphScanner* scanner ) vtx->flags |= CV_GRAPH_SEARCH_TREE_NODE_FLAG; cvSeqPush( scanner->stack, &item ); - + if( scanner->mask & CV_GRAPH_TREE_EDGE ) { code = CV_GRAPH_TREE_EDGE; @@ -3667,7 +3681,7 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) int* flag_buffer = 0; CvGraphVtx** ptr_buffer = 0; CvGraph* result = 0; - + CV_FUNCNAME( "cvCloneGraph" ); __BEGIN__; @@ -3695,7 +3709,7 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) memcpy( result + sizeof(CvGraph), graph + sizeof(CvGraph), graph->header_size - sizeof(CvGraph)); - // pass 1. save flags, copy vertices + // Pass 1. Save flags, copy vertices: cvStartReadSeq( (CvSeq*)graph, &reader ); for( i = 0, k = 0; i < graph->total; i++ ) { @@ -3711,7 +3725,7 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) CV_NEXT_SEQ_ELEM( vtx_size, reader ); } - // pass 2. copy edges + // Pass 2. Copy edges: cvStartReadSeq( (CvSeq*)graph->edges, &reader ); for( i = 0; i < graph->edges->total; i++ ) { @@ -3727,7 +3741,7 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) CV_NEXT_SEQ_ELEM( edge_size, reader ); } - // pass 3. restore flags + // Pass 3. Restore flags: cvStartReadSeq( (CvSeq*)graph, &reader ); for( i = 0, k = 0; i < graph->edges->total; i++ ) { @@ -3755,7 +3769,7 @@ cvCloneGraph( const CvGraph* graph, CvMemStorage* storage ) * Working with sequence tree * \****************************************************************************************/ -// Gathers pointers to all the sequences, accessible from the , to the single sequence. +// Gather pointers to all the sequences, accessible from the , to the single sequence. CV_IMPL CvSeq* cvTreeToNodeSeq( const void* first, int header_size, CvMemStorage* storage ) { @@ -3793,11 +3807,11 @@ cvTreeToNodeSeq( const void* first, int header_size, CvMemStorage* storage ) typedef struct CvTreeNode { - int flags; /* micsellaneous flags */ - int header_size; /* size of sequence header */ - struct CvTreeNode* h_prev; /* previous sequence */ - struct CvTreeNode* h_next; /* next sequence */ - struct CvTreeNode* v_prev; /* 2nd previous sequence */ + int flags; /* micsellaneous flags */ + int header_size; /* size of sequence header */ + struct CvTreeNode* h_prev; /* previous sequence */ + struct CvTreeNode* h_next; /* next sequence */ + struct CvTreeNode* v_prev; /* 2nd previous sequence */ struct CvTreeNode* v_next; /* 2nd next sequence */ } CvTreeNode; @@ -3806,7 +3820,7 @@ CvTreeNode; // Insert contour into tree given certain parent sequence. // If parent is equal to frame (the most external contour), -// then added contour will have null pointer to parent. +// then added contour will have null pointer to parent: CV_IMPL void cvInsertNodeIntoTree( void* _node, void* _parent, void* _frame ) { @@ -3833,7 +3847,7 @@ cvInsertNodeIntoTree( void* _node, void* _parent, void* _frame ) } -// Removes contour from tree (together with the contour children). +// Remove contour from tree, together with the contour's children: CV_IMPL void cvRemoveNodeFromTree( void* _node, void* _frame ) { @@ -3879,7 +3893,7 @@ cvInitTreeNodeIterator( CvTreeNodeIterator* treeIterator, CV_FUNCNAME("icvInitTreeNodeIterator"); __BEGIN__; - + if( !treeIterator || !first ) CV_ERROR( CV_StsNullPtr, "" ); @@ -3898,11 +3912,11 @@ CV_IMPL void* cvNextTreeNode( CvTreeNodeIterator* treeIterator ) { CvTreeNode* prevNode = 0; - + CV_FUNCNAME("cvNextTreeNode"); __BEGIN__; - + CvTreeNode* node; int level; @@ -3947,7 +3961,7 @@ CV_IMPL void* cvPrevTreeNode( CvTreeNodeIterator* treeIterator ) { CvTreeNode* prevNode = 0; - + CV_FUNCNAME("cvPrevTreeNode"); __BEGIN__; @@ -3956,11 +3970,11 @@ cvPrevTreeNode( CvTreeNodeIterator* treeIterator ) int level; if( !treeIterator ) - CV_ERROR( CV_StsNullPtr, "" ); + CV_ERROR( CV_StsNullPtr, "" ); prevNode = node = (CvTreeNode*)treeIterator->node; level = treeIterator->level; - + if( node ) { if( !node->h_prev ) diff --git a/cxcore/src/cxdxt.cpp b/cxcore/src/cxdxt.cpp index b13de92..5791b83 100644 --- a/cxcore/src/cxdxt.cpp +++ b/cxcore/src/cxdxt.cpp @@ -306,18 +306,20 @@ icvDFTInit( int n0, int nf, int* factors, int* itab, int elem_size, void* _wave, digits[1]++; - assert (nf >= 2); // because we read radix[2] which is uninitialized otherwise - for( i = n, j = radix[2]; i < n0; ) + if( nf >= 2 ) { - for( k = 0; k < n; k++ ) - itab[i+k] = itab[k] + j; - if( (i += n) >= n0 ) - break; - j += radix[2]; - for( k = 1; ++digits[k] >= factors[k]; k++ ) + for( i = n, j = radix[2]; i < n0; ) { - digits[k] = 0; - j += radix[k+2] - radix[k]; + for( k = 0; k < n; k++ ) + itab[i+k] = itab[k] + j; + if( (i += n) >= n0 ) + break; + j += radix[2]; + for( k = 1; ++digits[k] >= factors[k]; k++ ) + { + digits[k] = 0; + j += radix[k+2] - radix[k]; + } } } } diff --git a/cxcore/src/cxpersistence.cpp b/cxcore/src/cxpersistence.cpp index 5a6eae9..ac2c7b5 100644 --- a/cxcore/src/cxpersistence.cpp +++ b/cxcore/src/cxpersistence.cpp @@ -249,7 +249,7 @@ icvFSCreateCollection( CvFileStorage* fs, int tag, CvFileNode* collection ) CV_FUNCNAME( "icvFSCreateCollection" ); __BEGIN__; - + if( CV_NODE_IS_MAP(tag) ) { if( collection->tag != CV_NODE_NONE ) @@ -265,7 +265,7 @@ icvFSCreateCollection( CvFileStorage* fs, int tag, CvFileNode* collection ) { CvSeq* seq; CV_CALL( seq = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvFileNode), fs->memstorage )); - + // if contains some scalar element, add it to the newly created collection if( CV_NODE_TYPE(collection->tag) != CV_NODE_NONE ) cvSeqPush( seq, collection ); @@ -293,7 +293,7 @@ icvFSReleaseCollection( CvSeq* seq ) for( i = 0; i < total; i++ ) { CvFileNode* node = (CvFileNode*)reader.ptr; - + if( (!is_map || CV_IS_SET_ELEM( node )) && CV_NODE_IS_COLLECTION(node->tag) ) { if( CV_NODE_IS_USER(node->tag) && node->info && node->data.obj.decoded ) @@ -314,7 +314,7 @@ icvFSDoResize( CvFileStorage* fs, char* ptr, int len ) CV_FUNCNAME( "icvFSDoResize" ); __BEGIN__; - + int written_len = (int)(ptr - fs->buffer_start); int new_size = (int)((fs->buffer_end - fs->buffer_start)*3/2); new_size = MAX( written_len + len, new_size ); @@ -425,7 +425,7 @@ cvGetHashedKey( CvFileStorage* fs, const char* str, int len, int create_missing CV_FUNCNAME( "cvGetHashedKey" ); __BEGIN__; - + unsigned hashval = 0; int i, tab_size; CvStringHash* map = fs->str_hash; @@ -478,7 +478,7 @@ cvGetFileNode( CvFileStorage* fs, CvFileNode* _map_node, int create_missing ) { CvFileNode* value = 0; - + CV_FUNCNAME( "cvGetFileNode" ); __BEGIN__; @@ -498,7 +498,7 @@ cvGetFileNode( CvFileStorage* fs, CvFileNode* _map_node, if( !fs->roots ) EXIT; attempts = fs->roots->total; - } + } for( k = 0; k < attempts; k++ ) { @@ -584,7 +584,7 @@ cvGetFileNodeByName( const CvFileStorage* fs, const CvFileNode* _map_node, const if( !fs->roots ) EXIT; attempts = fs->roots->total; - } + } for( k = 0; k < attempts; k++ ) { @@ -658,7 +658,7 @@ cvGetFileNodeFromSeq( CvFileStorage* fs, CvFileNode* seq_node, int index ) { CvFileNode* value = 0; - + CV_FUNCNAME( "cvGetFileNodeFromSeq" ); __BEGIN__; @@ -680,7 +680,7 @@ cvGetFileNodeFromSeq( CvFileStorage* fs, } else seq = seq_node->data.seq; - + if( !seq ) CV_ERROR( CV_StsNullPtr, "The file storage is empty" ); @@ -778,16 +778,16 @@ icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** end CV_FUNCNAME( "icvProcessSpecialDouble" ); __BEGIN__; - + char c = buf[0]; int inf_hi = 0x7ff00000; - + if( c == '-' || c == '+' ) { inf_hi = c == '-' ? 0xfff00000 : 0x7ff00000; c = *++buf; } - + if( c != '.' ) CV_PARSE_ERROR( "Bad format of floating-point constant" ); @@ -836,7 +836,7 @@ icvYMLSkipSpaces( CvFileStorage* fs, char* ptr, int min_indent, int max_comment_ CV_FUNCNAME( "icvYMLSkipSpaces" ); __BEGIN__; - + for(;;) { while( *ptr == ' ' ) @@ -876,7 +876,7 @@ icvYMLSkipSpaces( CvFileStorage* fs, char* ptr, int min_indent, int max_comment_ fs->lineno++; } else - CV_PARSE_ERROR( *ptr == '\t' ? "Tabs are prohibited in YAML!" : "Invalid character" ); + CV_PARSE_ERROR( *ptr == '\t' ? "Tabs are prohibited in YAML!" : "Invalid character" ); } __END__; @@ -890,7 +890,7 @@ icvYMLParseKey( CvFileStorage* fs, char* ptr, CvFileNode* map_node, CvFileNode** value_placeholder ) { CV_FUNCNAME( "icvYMLParseKey" ); - + __BEGIN__; char c; @@ -913,7 +913,7 @@ icvYMLParseKey( CvFileStorage* fs, char* ptr, ++endptr; if( endptr == ptr ) CV_PARSE_ERROR( "An empty key" ); - + CV_CALL( str_hash_node = cvGetHashedKey( fs, ptr, (int)(endptr - ptr), 1 )); CV_CALL( *value_placeholder = cvGetFileNode( fs, map_node, str_hash_node, 1 )); ptr = saveptr; @@ -929,7 +929,7 @@ icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, int parent_flags, int min_indent ) { CV_FUNCNAME( "icvYMLParseValue" ); - + __BEGIN__; char buf[CV_FS_MAX_LEN + 1024]; @@ -957,7 +957,7 @@ icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, CV_PARSE_ERROR( "Empty type name" ); d = *endptr; *endptr = '\0'; - + if( len == 3 && !CV_NODE_IS_USER(value_type) ) { if( memcmp( ptr, "str", 3 ) == 0 ) @@ -983,7 +983,7 @@ icvYMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, *endptr = d; CV_CALL( ptr = icvYMLSkipSpaces( fs, endptr, min_indent, INT_MAX )); - + c = *ptr; if( !CV_NODE_IS_USER(value_type) ) @@ -1102,7 +1102,7 @@ force_int: int new_min_indent = min_indent + !is_parent_flow; int struct_flags = CV_NODE_FLOW + (c == '{' ? CV_NODE_MAP : CV_NODE_SEQ); int is_simple = 1; - + CV_CALL( icvFSCreateCollection( fs, CV_NODE_TYPE(struct_flags) + (node->info ? CV_NODE_USER : 0), node )); @@ -1149,7 +1149,7 @@ force_int: else { int indent, struct_flags, is_simple; - + if( is_parent_flow || c != '-' ) { // implicit (one-line) string or nested block-style collection @@ -1191,14 +1191,14 @@ force_string: CV_CALL( icvFSCreateCollection( fs, struct_flags + (node->info ? CV_NODE_USER : 0), node )); - + indent = (int)(ptr - fs->buffer_start); is_simple = 1; for(;;) { CvFileNode* elem = 0; - + if( CV_NODE_IS_MAP(struct_flags) ) { CV_CALL( ptr = icvYMLParseKey( fs, ptr, node, &elem )); @@ -1295,7 +1295,7 @@ icvYMLParse( CvFileStorage* fs ) CV_CALL( ptr = icvYMLParseValue( fs, ptr, root_node, CV_NODE_NONE, 0 )); if( !CV_NODE_IS_COLLECTION(root_node->tag) ) CV_PARSE_ERROR( "Only collections as YAML streams are supported by this parser" ); - + // 3. parse until the end of file or next collection CV_CALL( ptr = icvYMLSkipSpaces( fs, ptr, 0, INT_MAX )); if( !ptr ) @@ -1322,7 +1322,7 @@ icvYMLWrite( CvFileStorage* fs, const char* key, const char* data, const char* c //CV_FUNCNAME( "icvYMLWrite" ); __BEGIN__; - + int i, keylen = 0; int datalen = 0; int struct_flags; @@ -1388,13 +1388,13 @@ icvYMLWrite( CvFileStorage* fs, const char* key, const char* data, const char* c { if( !isalpha(key[0]) && key[0] != '_' ) CV_ERROR( CV_StsBadArg, "Key must start with a letter or _" ); - + ptr = icvFSResizeWriteBuffer( fs, ptr, keylen ); for( i = 0; i < keylen; i++ ) { int c = key[i]; - + ptr[i] = (char)c; if( !isalnum(c) && c != '-' && c != '_' && c != ' ' ) CV_ERROR( CV_StsBadArg, "Invalid character occurs in the key" ); @@ -1466,7 +1466,7 @@ icvYMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags, if( !CV_NODE_IS_FLOW(parent_flags) ) fs->struct_indent += CV_YML_INDENT + CV_NODE_IS_FLOW(struct_flags); - __END__; + __END__; } @@ -1540,11 +1540,11 @@ icvYMLWriteInt( CvFileStorage* fs, const char* key, int value ) CV_FUNCNAME( "icvYMLWriteInt" ); __BEGIN__; - + char buf[128]; CV_CALL( icvYMLWrite( fs, key, icv_itoa( value, buf, 10 ), cvFuncName )); - - __END__; + + __END__; } @@ -1554,11 +1554,11 @@ icvYMLWriteReal( CvFileStorage* fs, const char* key, double value ) CV_FUNCNAME( "icvYMLWriteReal" ); __BEGIN__; - + char buf[128]; CV_CALL( icvYMLWrite( fs, key, icvDoubleToString( buf, value ), cvFuncName )); - - __END__; + + __END__; } @@ -1589,7 +1589,7 @@ icvYMLWriteString( CvFileStorage* fs, const char* key, for( i = 0; i < len; i++ ) { char c = str[i]; - + if( !need_quote && !isalnum(c) && c != '_' && c != ' ' && c != '-' && c != '(' && c != ')' && c != '/' && c != '+' && c != ';' ) need_quote = 1; @@ -1678,7 +1678,7 @@ icvYMLWriteComment( CvFileStorage* fs, const char* comment, int eol_comment ) } ptr = icvFSFlush( fs ); } - + __END__; } @@ -1704,12 +1704,12 @@ icvXMLSkipSpaces( CvFileStorage* fs, char* ptr, int mode ) { char c; ptr--; - + if( mode == CV_XML_INSIDE_COMMENT ) { do c = *++ptr; while( cv_isprint_or_tab(c) && (c != '-' || ptr[1] != '-' || ptr[2] != '>') ); - + if( c == '-' ) { assert( ptr[1] == '-' && ptr[2] == '>' ); @@ -1744,7 +1744,7 @@ icvXMLSkipSpaces( CvFileStorage* fs, char* ptr, int mode ) else if( cv_isprint(c) ) break; } - + if( !cv_isprint(*ptr) ) { int max_size = (int)(fs->buffer_end - fs->buffer_start); @@ -1783,7 +1783,7 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, int value_type CV_DEFAULT(CV_NODE_NONE)) { CV_FUNCNAME( "icvXMLParseValue" ); - + __BEGIN__; CvFileNode *elem = node; @@ -1792,7 +1792,7 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, memset( node, 0, sizeof(*node) ); value_type = CV_NODE_TYPE(value_type); - + for(;;) { char c = *ptr, d; @@ -1853,13 +1853,13 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, } else if( is_noname ^ CV_NODE_IS_SEQ(node->tag) ) CV_PARSE_ERROR( is_noname ? "Map element should have a name" : - "Sequence element should not have name (use <_>)" ); + "Sequence element should not have name (use <_>)" ); if( is_noname ) elem = (CvFileNode*)cvSeqPush( node->data.seq, 0 ); else CV_CALL( elem = cvGetFileNode( fs, node, key, 1 )); - + CV_CALL( ptr = icvXMLParseValue( fs, ptr, elem, elem_type)); if( !is_noname ) elem->tag |= CV_NODE_NAMED; @@ -1874,7 +1874,7 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node, { if( !have_space ) CV_PARSE_ERROR( "There should be space between literals" ); - + elem = node; if( node->tag != CV_NODE_NONE ) { @@ -2032,7 +2032,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, CvAttrList *first = 0, *last = 0; int count = 0, max_count = 4; int attr_buf_size = (max_count*2 + 1)*sizeof(char*) + sizeof(CvAttrList); - + CV_FUNCNAME( "icvXMLParseTag" ); __BEGIN__; @@ -2069,7 +2069,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, for(;;) { CvStringHashNode* attrname; - + if( !isalpha(*ptr) && *ptr != '_' ) CV_PARSE_ERROR( "Name should start with a letter or underscore" ); @@ -2090,7 +2090,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, if( !last || count >= max_count ) { CvAttrList* chunk; - + CV_CALL( chunk = (CvAttrList*)cvMemStorageAlloc( fs->memstorage, attr_buf_size )); memset( chunk, 0, attr_buf_size ); chunk->attr = (const char**)(chunk + 1); @@ -2106,7 +2106,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, if( last ) { CvFileNode stub; - + if( *ptr != '=' ) { CV_CALL( ptr = icvXMLSkipSpaces( fs, ptr, CV_XML_INSIDE_TAG )); @@ -2127,7 +2127,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag, last->attr[count*2+1] = stub.data.str.ptr; count++; } - + c = *ptr; have_space = isspace(c) || c == '\0'; @@ -2268,7 +2268,7 @@ icvXMLWriteTag( CvFileStorage* fs, const char* key, int tag_type, CvAttrList lis ptr = icvXMLFlush(fs); } - if( !key ) + if( !key ) key = "_"; else if( key[0] == '_' && key[1] == '\0' ) CV_ERROR( CV_StsBadArg, "A single _ is a reserved tag name" ); @@ -2281,10 +2281,10 @@ icvXMLWriteTag( CvFileStorage* fs, const char* key, int tag_type, CvAttrList lis CV_ERROR( CV_StsBadArg, "Closing tag should not include any attributes" ); *ptr++ = '/'; } - + if( !isalpha(key[0]) && key[0] != '_' ) CV_ERROR( CV_StsBadArg, "Key should start with a letter or _" ); - + ptr = icvFSResizeWriteBuffer( fs, ptr, len ); for( i = 0; i < len; i++ ) { @@ -2298,7 +2298,7 @@ icvXMLWriteTag( CvFileStorage* fs, const char* key, int tag_type, CvAttrList lis for(;;) { const char** attr = list.attr; - + for( ; attr && attr[0] != 0; attr += 2 ) { int len0 = (int)strlen(attr[0]); @@ -2376,7 +2376,7 @@ icvXMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags, fs->struct_tag.len = 0; } - __END__; + __END__; } @@ -2464,7 +2464,7 @@ icvXMLWriteScalar( CvFileStorage* fs, const char* key, const char* data, int len } else if( ptr > fs->buffer_start + fs->struct_indent && ptr[-1] != '>' ) *ptr++ = ' '; - + memcpy( ptr, data, len ); fs->buffer = ptr + len; } @@ -2479,12 +2479,12 @@ icvXMLWriteInt( CvFileStorage* fs, const char* key, int value ) //CV_FUNCNAME( "cvXMLWriteInt" ); __BEGIN__; - + char buf[128], *ptr = icv_itoa( value, buf, 10 ); int len = (int)strlen(ptr); icvXMLWriteScalar( fs, key, ptr, len ); - - __END__; + + __END__; } @@ -2494,12 +2494,12 @@ icvXMLWriteReal( CvFileStorage* fs, const char* key, double value ) //CV_FUNCNAME( "cvXMLWriteReal" ); __BEGIN__; - + char buf[128]; int len = (int)strlen( icvDoubleToString( buf, value )); icvXMLWriteScalar( fs, key, buf, len ); - - __END__; + + __END__; } @@ -2529,7 +2529,7 @@ icvXMLWriteString( CvFileStorage* fs, const char* key, const char* str, int quot for( i = 0; i < len; i++ ) { char c = str[i]; - + if( !isalnum(c) && (!cv_isprint(c) || c == '<' || c == '>' || c == '&' || c == '\'' || c == '\"') ) { @@ -2660,7 +2660,7 @@ icvXMLWriteComment( CvFileStorage* fs, const char* comment, int eol_comment ) fs->buffer = ptr + 3; icvXMLFlush( fs ); } - + __END__; } @@ -2799,17 +2799,17 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags ) char buf[16]; fgets( buf, sizeof(buf)-2, fs->file ); fs->is_xml = strncmp( buf, yaml_signature, strlen(yaml_signature) ) != 0; - + fseek( fs->file, 0, SEEK_END ); buf_size = ftell( fs->file ); fseek( fs->file, 0, SEEK_SET ); buf_size = MIN( buf_size, (1 << 20) ); buf_size = MAX( buf_size, CV_FS_MAX_LEN*2 + 1024 ); - + CV_CALL( fs->str_hash = cvCreateMap( 0, sizeof(CvStringHash), sizeof(CvStringHashNode), fs->memstorage, 256 )); - + CV_CALL( fs->roots = cvCreateSeq( 0, sizeof(CvSeq), sizeof(CvFileNode), fs->memstorage )); @@ -2952,7 +2952,7 @@ cvStartNextStream( CvFileStorage* fs ) static const char icvTypeSymbol[] = "ucwsifdr"; -#define CV_FS_MAX_FMT_PAIRS 128 +#define CV_FS_MAX_FMT_PAIRS 128 static char* icvEncodeFormat( int elem_type, char* dt ) @@ -2970,7 +2970,7 @@ icvDecodeFormat( const char* dt, int* fmt_pairs, int max_len ) __BEGIN__; int i = 0, k = 0, len = dt ? (int)strlen(dt) : 0; - + if( !dt || !len ) EXIT; @@ -2981,7 +2981,7 @@ icvDecodeFormat( const char* dt, int* fmt_pairs, int max_len ) for( ; k < len; k++ ) { char c = dt[k]; - + if( isdigit(c) ) { int count = c - '0'; @@ -3119,7 +3119,7 @@ cvWriteRawData( CvFileStorage* fs, const void* _data, int len, const char* dt ) int elem_type = fmt_pairs[k*2+1]; int elem_size = CV_ELEM_SIZE(elem_type); const char* data, *ptr; - + offset = cvAlign( offset, elem_size ); data = data0 + offset; @@ -3193,12 +3193,12 @@ cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src, CvSeqReader* if( !src || !reader ) CV_ERROR( CV_StsNullPtr, "Null pointer to source file node or reader" ); - + node_type = CV_NODE_TYPE(src->tag); if( node_type == CV_NODE_INT || node_type == CV_NODE_REAL ) { // emulate reading from 1-element sequence - reader->ptr = (char*)src; + reader->ptr = (schar*)src; reader->block_max = reader->ptr + sizeof(*src)*2; reader->block_min = reader->ptr; reader->seq = 0; @@ -3297,7 +3297,7 @@ cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader, EXIT; } } - else if( CV_NODE_IS_REAL(node->tag) ) + else if( CV_NODE_IS_REAL(node->tag) ) { double fval = node->data.f; int ival; @@ -3349,7 +3349,7 @@ cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader, else CV_ERROR( CV_StsError, "The sequence element is not a numerical scalar" ); - + CV_NEXT_SEQ_ELEM( sizeof(CvFileNode), *reader ); if( !--len ) goto end_loop; @@ -3387,7 +3387,7 @@ cvReadRawData( const CvFileStorage* fs, const CvFileNode* src, CV_CALL( cvStartReadRawData( fs, src, &reader )); cvReadRawDataSlice( fs, &reader, CV_NODE_IS_SEQ(src->tag) ? src->data.seq->total : 1, data, dt ); - + __END__; } @@ -3423,7 +3423,7 @@ icvWriteFileNode( CvFileStorage* fs, const char* name, const CvFileNode* node ) CV_FUNCNAME( "icvWriteFileNode" ); __BEGIN__; - + switch( CV_NODE_TYPE(node->tag) ) { case CV_NODE_INT: @@ -3460,9 +3460,9 @@ cvWriteFileNode( CvFileStorage* fs, const char* new_node_name, const CvFileNode* node, int embed ) { CvFileStorage* dst = 0; - + CV_FUNCNAME( "cvWriteFileNode" ); - + __BEGIN__; CV_CHECK_OUTPUT_FILE_STORAGE(fs); @@ -3542,7 +3542,7 @@ icvWriteMat( CvFileStorage* fs, const char* name, cvWriteInt( fs, "cols", mat->cols ); cvWriteString( fs, "dt", icvEncodeFormat( CV_MAT_TYPE(mat->type), dt ), 0 ); cvStartWriteStruct( fs, "data", CV_NODE_SEQ + CV_NODE_FLOW ); - + size = cvGetSize(mat); if( CV_IS_MAT_CONT(mat->type) ) { @@ -3640,7 +3640,7 @@ icvWriteMatND( CvFileStorage* fs, const char* name, cvEndWriteStruct( fs ); cvWriteString( fs, "dt", icvEncodeFormat( cvGetElemType(mat), dt ), 0 ); cvStartWriteStruct( fs, "data", CV_NODE_SEQ + CV_NODE_FLOW ); - + CV_CALL( cvInitNArrayIterator( 1, &mat, 0, &stub, &iterator )); do @@ -3737,7 +3737,7 @@ icvWriteSparseMat( CvFileStorage* fs, const char* name, const void* struct_ptr, CvAttrList /*attr*/ ) { CvMemStorage* memstorage = 0; - + CV_FUNCNAME( "icvWriteSparseMat" ); __BEGIN__; @@ -3774,7 +3774,7 @@ icvWriteSparseMat( CvFileStorage* fs, const char* name, node = cvGetNextSparseNode( &iterator ); } - cvSeqSort( elements, icvSortIdxCmpFunc, &dims ); + cvSeqSort( elements, icvSortIdxCmpFunc, &dims ); cvStartReadSeq( elements, &reader, 0 ); for( i = 0; i < elements->total; i++ ) @@ -3789,7 +3789,7 @@ icvWriteSparseMat( CvFileStorage* fs, const char* name, for( ; idx[k] == prev_idx[k]; k++ ) assert( k < dims ); if( k < dims - 1 ) - fs->write_int( fs, 0, k - dims + 1 ); + fs->write_int( fs, 0, k - dims + 1 ); } for( ; k < dims; k++ ) fs->write_int( fs, 0, idx[k] ); @@ -3859,7 +3859,7 @@ icvReadSparseMat( CvFileStorage* fs, CvFileNode* node ) { CvFileNode* elem = (CvFileNode*)reader.ptr; uchar* val; - int k; + int k; if( !CV_NODE_IS_INT(elem->tag )) CV_ERROR( CV_StsParseError, "Sparse matrix data is corrupted" ); k = elem->data.i; @@ -4082,7 +4082,7 @@ icvWriteHeaderData( CvFileStorage* fs, const CvSeq* seq, char header_dt_buf[128]; const char* header_dt = cvAttrValue( attr, "header_dt" ); - + if( header_dt ) { int dt_header_size; @@ -4098,7 +4098,7 @@ icvWriteHeaderData( CvFileStorage* fs, const CvSeq* seq, seq->elem_size == sizeof(int)*2 ) { CvPoint2DSeq* point_seq = (CvPoint2DSeq*)seq; - + cvStartWriteStruct( fs, "rect", CV_NODE_MAP + CV_NODE_FLOW ); cvWriteInt( fs, "x", point_seq->rect.x ); cvWriteInt( fs, "y", point_seq->rect.y ); @@ -4111,7 +4111,7 @@ icvWriteHeaderData( CvFileStorage* fs, const CvSeq* seq, CV_MAT_TYPE(seq->flags) == CV_8UC1 ) { CvChain* chain = (CvChain*)seq; - + cvStartWriteStruct( fs, "origin", CV_NODE_MAP + CV_NODE_FLOW ); cvWriteInt( fs, "x", chain->origin.x ); cvWriteInt( fs, "y", chain->origin.y ); @@ -4136,7 +4136,7 @@ icvWriteHeaderData( CvFileStorage* fs, const CvSeq* seq, cvWriteRawData( fs, (uchar*)seq + sizeof(CvSeq), 1, header_dt ); cvEndWriteStruct( fs ); } - + __END__; } @@ -4146,7 +4146,7 @@ icvGetFormat( const CvSeq* seq, const char* dt_key, CvAttrList* attr, int initial_elem_size, char* dt_buf ) { char* dt = 0; - + CV_FUNCNAME( "icvWriteFormat" ); __BEGIN__; @@ -4207,7 +4207,7 @@ icvWriteSeq( CvFileStorage* fs, const char* name, if( level >= 0 ) cvWriteInt( fs, "level", level ); - + sprintf( buf, "%08x", seq->flags ); cvWriteString( fs, "flags", buf, 1 ); cvWriteInt( fs, "count", seq->total ); @@ -4216,7 +4216,7 @@ icvWriteSeq( CvFileStorage* fs, const char* name, CV_CALL( icvWriteHeaderData( fs, seq, &attr, sizeof(CvSeq) )); cvStartWriteStruct( fs, "data", CV_NODE_SEQ + CV_NODE_FLOW ); - + for( block = seq->first; block; block = block->next ) { cvWriteRawData( fs, block->data, block->count, dt ); @@ -4259,7 +4259,7 @@ icvWriteSeqTree( CvFileStorage* fs, const char* name, CV_CALL( cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_SEQ_TREE )); CV_CALL( cvStartWriteStruct( fs, "sequences", CV_NODE_SEQ )); cvInitTreeNodeIterator( &tree_iterator, seq, INT_MAX ); - + for(;;) { if( !tree_iterator.node ) @@ -4516,10 +4516,10 @@ icvWriteGraph( CvFileStorage* fs, const char* name, } CV_NEXT_SEQ_ELEM( graph->elem_size, reader ); } - + // write header CV_CALL( cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_GRAPH )); - + sprintf( buf, "%08x", graph->flags ); cvWriteString( fs, "flags", buf, 1 ); @@ -4535,7 +4535,7 @@ icvWriteGraph( CvFileStorage* fs, const char* name, sprintf( edge_dt_buf, "2if%s", edge_dt ? edge_dt : "" ); edge_dt = edge_dt_buf; cvWriteString( fs, "edge_dt", edge_dt, 0 ); - + CV_CALL( icvWriteHeaderData( fs, (CvSeq*)graph, &attr, sizeof(CvGraph) )); write_buf_size = MAX( 3*graph->elem_size, 1 << 16 ); @@ -4554,10 +4554,10 @@ icvWriteGraph( CvFileStorage* fs, const char* name, int write_elem_size = icvCalcElemSize( dt, 0 ); char* src_ptr = write_buf; int write_max = write_buf_size / write_elem_size, write_count = 0; - + // alignment of user part of the edge data following 2if int edge_user_align = sizeof(float); - + if( k == 1 ) { int fmt_pairs[CV_FS_MAX_FMT_PAIRS], fmt_pair_count; @@ -4718,7 +4718,7 @@ icvReadGraph( CvFileStorage* fs, CvFileNode* node ) CV_CALL( edge_size = icvCalcElemSize( dst_edge_dt, sizeof(CvGraphEdge) )); CV_CALL( src_edge_size = icvCalcElemSize( edge_dt, 0 )); } - + CV_CALL( graph = cvCreateGraph( flags, header_size, vtx_size, edge_size, fs->dststorage )); if( header_node ) @@ -4728,14 +4728,14 @@ icvReadGraph( CvFileStorage* fs, CvFileNode* node ) read_buf_size = MAX( src_edge_size*3, read_buf_size ); CV_CALL( read_buf = (char*)cvAlloc( read_buf_size )); CV_CALL( vtx_buf = (CvGraphVtx**)cvAlloc( vtx_count * sizeof(vtx_buf[0]) )); - + vtx_node = cvGetFileNodeByName( fs, node, "vertices" ); edge_node = cvGetFileNodeByName( fs, node, "edges" ); if( !edge_node ) CV_ERROR( CV_StsBadArg, "No edges data" ); if( vtx_dt && !vtx_node ) CV_ERROR( CV_StsBadArg, "No vertices data" ); - + // as vertices and edges are read in similar way, // do it as a parametrized 2-iteration loop for( k = 0; k < 2; k++ ) @@ -4855,13 +4855,13 @@ CvType seq_graph_type( CV_TYPE_NAME_GRAPH, icvIsGraph, icvReleaseGraph, CvType sparse_mat_type( CV_TYPE_NAME_SPARSE_MAT, icvIsSparseMat, (CvReleaseFunc)cvReleaseSparseMat, icvReadSparseMat, icvWriteSparseMat, (CvCloneFunc)cvCloneSparseMat ); - + CvType image_type( CV_TYPE_NAME_IMAGE, icvIsImage, (CvReleaseFunc)cvReleaseImage, icvReadImage, icvWriteImage, (CvCloneFunc)cvCloneImage ); CvType mat_type( CV_TYPE_NAME_MAT, icvIsMat, (CvReleaseFunc)cvReleaseMat, icvReadMat, icvWriteMat, (CvCloneFunc)cvCloneMat ); - + CvType matnd_type( CV_TYPE_NAME_MATND, icvIsMatND, (CvReleaseFunc)cvReleaseMatND, icvReadMatND, icvWriteMatND, (CvCloneFunc)cvCloneMatND ); @@ -4875,7 +4875,7 @@ cvRegisterType( const CvTypeInfo* _info ) CvTypeInfo* info = 0; int i, len; char c; - + //if( !CvType::first ) // icvCreateStandardTypes(); @@ -5047,7 +5047,7 @@ CV_IMPL void* cvRead( CvFileStorage* fs, CvFileNode* node, CvAttrList* list ) { void* obj = 0; - + CV_FUNCNAME( "cvRead" ); __BEGIN__; @@ -5106,7 +5106,7 @@ cvSave( const char* filename, const void* struct_ptr, const char* _name, const char* comment, CvAttrList attributes ) { CvFileStorage* fs = 0; - + CV_FUNCNAME( "cvSave" ); __BEGIN__; @@ -5126,7 +5126,7 @@ cvSave( const char* filename, const void* struct_ptr, static const char* stubname = "unnamed"; const char* ptr2 = filename + strlen( filename ); const char* ptr = ptr2 - 1; - + while( ptr >= filename && *ptr != '\\' && *ptr != '/' && *ptr != ':' ) { if( *ptr == '.' && !*ptr2 ) @@ -5136,7 +5136,7 @@ cvSave( const char* filename, const void* struct_ptr, ptr++; if( ptr == ptr2 ) CV_ERROR( CV_StsBadArg, "Invalid filename" ); - + name=name_buf; // name must start with letter or '_' @@ -5181,7 +5181,7 @@ cvLoad( const char* filename, CvMemStorage* memstorage, CvFileNode* node = 0; CV_CALL( fs = cvOpenFileStorage( filename, memstorage, CV_STORAGE_READ )); - + if( !fs ) EXIT; @@ -5196,7 +5196,7 @@ cvLoad( const char* filename, CvMemStorage* memstorage, { CvSeq* seq; CvSeqReader reader; - + node = (CvFileNode*)cvGetSeqElem( fs->roots, k ); if( !CV_NODE_IS_MAP( node->tag )) EXIT; diff --git a/cxcore/src/cxutils.cpp b/cxcore/src/cxutils.cpp index 97bd02d..75f85ae 100644 --- a/cxcore/src/cxutils.cpp +++ b/cxcore/src/cxutils.cpp @@ -410,6 +410,267 @@ cvSolveCubic( const CvMat* coeffs, CvMat* roots ) } +/* + Finds real and complex roots of polynomials of any degree with real + coefficients. The original code has been taken from Ken Turkowski's web + page (http://www.worldserver.com/turk/opensource/) and adopted for OpenCV. + Here is the copyright notice. + + ----------------------------------------------------------------------- + Copyright (C) 1981-1999 Ken Turkowski. + + All rights reserved. + + Warranty Information + Even though I have reviewed this software, I make no warranty + or representation, either express or implied, with respect to this + software, its quality, accuracy, merchantability, or fitness for a + particular purpose. As a result, this software is provided "as is," + and you, its user, are assuming the entire risk as to its quality + and accuracy. + + This code may be used and freely distributed as long as it includes + this copyright notice and the above warranty information. +*/ + + +/******************************************************************************* + * FindPolynomialRoots + * + * The Bairstow and Newton correction formulae are used for a simultaneous + * linear and quadratic iterated synthetic division. The coefficients of + * a polynomial of degree n are given as a[i] (i=0,i,..., n) where a[0] is + * the constant term. The coefficients are scaled by dividing them by + * their geometric mean. The Bairstow or Newton iteration method will + * nearly always converge to the number of figures carried, fig, either to + * root values or to their reciprocals. If the simultaneous Newton and + * Bairstow iteration fails to converge on root values or their + * reciprocals in maxiter iterations, the convergence requirement will be + * successively reduced by one decimal figure. This program anticipates + * and protects against loss of significance in the quadratic synthetic + * division. (Refer to "On Programming the Numerical Solution of + * Polynomial Equations," by K. W. Ellenberger, Commun. ACM 3 (Dec. 1960), + * 644-647.) The real and imaginary part of each root is stated as u[i] + * and v[i], respectively. + * + * ACM algorithm #30 - Numerical Solution of the Polynomial Equation + * K. W. Ellenberger + * Missle Division, North American Aviation, Downey, California + * Converted to C, modified, optimized, and structured by + * Ken Turkowski + * CADLINC, Inc., Palo Alto, California + *******************************************************************************/ + +#define MAXN 16 + +template +static void icvFindPolynomialRoots(const T *a, T *u, int n, int maxiter, int fig) { + int i; + int j; + T h[MAXN + 3], b[MAXN + 3], c[MAXN + 3], d[MAXN + 3], e[MAXN + 3]; + // [-2 : n] + T K, ps, qs, pt, qt, s, rev, r; + int t; + T p, q, qq; + + // Zero elements with negative indices + b[2 + -1] = b[2 + -2] = + c[2 + -1] = c[2 + -2] = + d[2 + -1] = d[2 + -2] = + e[2 + -1] = e[2 + -2] = + h[2 + -1] = h[2 + -2] = 0.0; + + // Copy polynomial coefficients to working storage + for (j = n; j >= 0; j--) + h[2 + j] = *a++; // Note reversal of coefficients + + t = 1; + K = pow(10.0, (double)(fig)); // Relative accuracy + + for (; h[2 + n] == 0.0; n--) { // Look for zero high-order coeff. + *u++ = 0.0; + *u++ = 0.0; + } + + INIT: + if (n == 0) + return; + + ps = qs = pt = qt = s = 0.0; + rev = 1.0; + K = pow(10.0, (double)(fig)); + + if (n == 1) { + r = -h[2 + 1] / h[2 + 0]; + goto LINEAR; + } + + for (j = n; j >= 0; j--) // Find geometric mean of coeff's + if (h[2 + j] != 0.0) + s += log(fabs(h[2 + j])); + s = exp(s / (n + 1)); + + for (j = n; j >= 0; j--) // Normalize coeff's by mean + h[2 + j] /= s; + + if (fabs(h[2 + 1] / h[2 + 0]) < fabs(h[2 + n - 1] / h[2 + n])) { + REVERSE: + t = -t; + for (j = (n - 1) / 2; j >= 0; j--) { + s = h[2 + j]; + h[2 + j] = h[2 + n - j]; + h[2 + n - j] = s; + } + } + if (qs != 0.0) { + p = ps; + q = qs; + } else { + if (h[2 + n - 2] == 0.0) { + q = 1.0; + p = -2.0; + } else { + q = h[2 + n] / h[2 + n - 2]; + p = (h[2 + n - 1] - q * h[2 + n - 3]) / h[2 + n - 2]; + } + if (n == 2) + goto QADRTIC; + r = 0.0; + } + ITERATE: + for (i = maxiter; i > 0; i--) { + + for (j = 0; j <= n; j++) { // BAIRSTOW + b[2 + j] = h[2 + j] - p * b[2 + j - 1] - q * b[2 + j - 2]; + c[2 + j] = b[2 + j] - p * c[2 + j - 1] - q * c[2 + j - 2]; + } + if ((h[2 + n - 1] != 0.0) && (b[2 + n - 1] != 0.0)) { + if (fabs(h[2 + n - 1] / b[2 + n - 1]) >= K) { + b[2 + n] = h[2 + n] - q * b[2 + n - 2]; + } + if (b[2 + n] == 0.0) + goto QADRTIC; + if (K < fabs(h[2 + n] / b[2 + n])) + goto QADRTIC; + } + + for (j = 0; j <= n; j++) { // NEWTON + d[2 + j] = h[2 + j] + r * d[2 + j - 1]; // Calculate polynomial at r + e[2 + j] = d[2 + j] + r * e[2 + j - 1]; // Calculate derivative at r + } + if (d[2 + n] == 0.0) + goto LINEAR; + if (K < fabs(h[2 + n] / d[2 + n])) + goto LINEAR; + + c[2 + n - 1] = -p * c[2 + n - 2] - q * c[2 + n - 3]; + s = c[2 + n - 2] * c[2 + n - 2] - c[2 + n - 1] * c[2 + n - 3]; + if (s == 0.0) { + p -= 2.0; + q *= (q + 1.0); + } else { + p += (b[2 + n - 1] * c[2 + n - 2] - b[2 + n] * c[2 + n - 3]) / s; + q += (-b[2 + n - 1] * c[2 + n - 1] + b[2 + n] * c[2 + n - 2]) / s; + } + if (e[2 + n - 1] == 0.0) + r -= 1.0; // Minimum step + else + r -= d[2 + n] / e[2 + n - 1]; // Newton's iteration + } + ps = pt; + qs = qt; + pt = p; + qt = q; + if (rev < 0.0) + K /= 10.0; + rev = -rev; + goto REVERSE; + + LINEAR: + if (t < 0) + r = 1.0 / r; + n--; + *u++ = r; + *u++ = 0.0; + + for (j = n; j >= 0; j--) { // Polynomial deflation by lin-nomial + if ((d[2 + j] != 0.0) && (fabs(h[2 + j] / d[2 + j]) < K)) + h[2 + j] = d[2 + j]; + else + h[2 + j] = 0.0; + } + + if (n == 0) + return; + goto ITERATE; + + QADRTIC: + if (t < 0) { + p /= q; + q = 1.0 / q; + } + n -= 2; + + if (0.0 < (q - (p * p / 4.0))) { // Two complex roots + s = sqrt(q - (p * p / 4.0)); + *u++ = -p / 2.0; + *u++ = s; + *u++ = -p / 2.0; + *u++ = -s; + } else { // Two real roots + s = sqrt(((p * p / 4.0)) - q); + if (p < 0.0) + *u++ = qq = -p / 2.0 + s; + else + *u++ = qq = -p / 2.0 - s; + *u++ = 0.0; + *u++ = q / qq; + *u++ = 0.0; + } + + for (j = n; j >= 0; j--) { // Polynomial deflation by quadratic + if ((b[2 + j] != 0.0) && (fabs(h[2 + j] / b[2 + j]) < K)) + h[2 + j] = b[2 + j]; + else + h[2 + j] = 0.0; + } + goto INIT; +} + +#undef MAXN + +void cvSolvePoly(const CvMat* a, CvMat *r, int maxiter, int fig) { + int m = a->rows * a->cols; + int n = r->rows * r->cols; + + __BEGIN__; + CV_FUNCNAME("cvSolvePoly"); + + if (CV_MAT_TYPE(a->type) != CV_32FC1 && + CV_MAT_TYPE(a->type) != CV_64FC1) + CV_ERROR(CV_StsUnsupportedFormat, "coeffs must be either CV_32FC1 or CV_64FC1"); + if (CV_MAT_TYPE(r->type) != CV_32FC2 && + CV_MAT_TYPE(r->type) != CV_64FC2) + CV_ERROR(CV_StsUnsupportedFormat, "roots must be either CV_32FC2 or CV_64FC2"); + if (CV_MAT_DEPTH(a->type) != CV_MAT_DEPTH(r->type)) + CV_ERROR(CV_StsUnmatchedFormats, "coeffs and roots must have same depth"); + + if (m - 1 != n) + CV_ERROR(CV_StsUnmatchedFormats, "must have n + 1 coefficients"); + + switch (CV_MAT_DEPTH(a->type)) { + case CV_32F: + icvFindPolynomialRoots(a->data.fl, r->data.fl, n, maxiter, fig); + break; + case CV_64F: + icvFindPolynomialRoots(a->data.db, r->data.db, n, maxiter, fig); + break; + } + + __END__; +} + + CV_IMPL void cvNormalize( const CvArr* src, CvArr* dst, double a, double b, int norm_type, const CvArr* mask ) { diff --git a/data/Makefile.in b/data/Makefile.in index 43eecf5..6210298 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -82,10 +82,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -108,8 +112,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -120,6 +126,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -138,11 +146,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -162,10 +175,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/debian/control b/debian/control index 6f62ae8..7044d62 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Section: devel Maintainer: Ubuntu MOTU Developers XSBC-Original-Maintainer: Debian Scientific Computing Team Uploaders: Sam Hocevar (Debian packages) -Build-Depends: debhelper (>= 5.0), quilt, libjpeg62-dev, zlib1g-dev, libpng12-dev, libtiff4-dev, libraw1394-dev, libdc1394-13-dev, libgtk2.0-dev, libavcodec-dev (>= 0.cvs20060329-1), libavformat-dev, python-dev, swig, python-support (>= 0.4.1) +Build-Depends: debhelper (>= 5.0), libjpeg62-dev, zlib1g-dev, libpng12-dev, libtiff4-dev, libgtk2.0-dev Standards-Version: 3.7.2 XS-Vcs-Svn: svn://svn.debian.org/svn/pkg-scicomp/opencv/ XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-scicomp/opencv/ @@ -68,7 +68,7 @@ Description: development files for libcvaux Package: libhighgui-dev Section: libdevel Architecture: any -Depends: libhighgui1 (= ${Source-Version}), libcv-dev (>= ${Source-Version}), libpng12-dev, libjpeg-dev, zlib1g-dev, libtiff4-dev, libgtk2.0-dev, libavcodec-dev (>= 0.cvs20050918-2), libavformat-dev, pkg-config +Depends: libhighgui1 (= ${Source-Version}), libcv-dev (>= ${Source-Version}), libpng12-dev, libjpeg-dev, zlib1g-dev, libtiff4-dev, libgtk2.0-dev, pkg-config Description: development files for libhighgui This package contains the header files and static library needed to compile applications that use the OpenCV (Open Computer Vision) GUI. @@ -134,25 +134,3 @@ Description: computer vision GUI library of high level functionalities for video acquisition, image processing and analysis, structural analysis, motion analysis and object tracking, object recognition, camera calibration and 3D reconstruction. - -Package: python-opencv -Section: python -Architecture: any -Depends: ${python:Depends}, ${shlibs:Depends} -Provides: ${python:Provides} -Replaces: python2.3-opencv (<= 0.9.7-3), python2.4-opencv (<= 0.9.7-3) -Conflicts: python2.3-opencv (<= 0.9.7-3), python2.4-opencv (<= 0.9.7-3) -Description: Python bindings for the computer vision library - This package contains Python bindings for the OpenCV (Open Computer Vision) - library. - . - The Open Computer Vision Library is a collection of algorithms and sample - code for various computer vision problems. The library is compatible with - IPL (Intel's Image Processing Library) and, if available, can use IPP - (Intel's Integrated Performance Primitives) for better performance. - . - OpenCV provides low level portable data types and operators, and a set - of high level functionalities for video acquisition, image processing and - analysis, structural analysis, motion analysis and object tracking, object - recognition, camera calibration and 3D reconstruction. - diff --git a/debian/rules b/debian/rules index b10665a..3a6812d 100644 --- a/debian/rules +++ b/debian/rules @@ -24,14 +24,13 @@ endif config.status: configure dh_testdir - QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2 touch configure.in touch aclocal.m4 touch configure touch cvconfig.h.in touch `find . -name Makefile.in` touch stamp-h.in - CFLAGS="$(CFLAGS)" ./configure $(confflags) --enable-static --enable-python --with-apps + CFLAGS="$(CFLAGS)" ./configure $(confflags) --enable-static --without-python --with-apps build: build-stamp build-stamp: config.status @@ -45,7 +44,6 @@ clean: rm -f build-stamp -$(MAKE) distclean rm -f tests/cv/src/lt-cvtest.lst tests/cv/src/lt-cvtest.sum - QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2 dh_clean install: build @@ -69,10 +67,8 @@ binary-indep: build install dh_testdir dh_testroot dh_installchangelogs -i ChangeLog - dh_installdocs -i AUTHORS THANKS TODO debian/README.Debian - dh_installexamples -p opencv-doc samples/c/*.c samples/c/*.png samples/c/*.jpg samples/c/Makefile.debian - mv debian/opencv-doc/usr/share/doc/opencv-doc/examples/Makefile.debian debian/opencv-doc/usr/share/doc/opencv-doc/examples/Makefile - (cd debian/opencv-doc/usr/share/doc/opencv-doc/examples/python/; cp minidemo.py tmp ; echo '#!/usr/bin/python' >| minidemo.py ; cat tmp >> minidemo.py ; rm -f tmp) + dh_installdocs -i AUTHORS THANKS TODO + dh_installexamples -p opencv-doc samples/c/*.c samples/c/*.png samples/c/*.jpg #dh_install -p opencv-doc docs/*.rtf usr/share/doc/opencv-doc #dh_install -p opencv-doc docs/*.pdf usr/share/doc/opencv-doc #dh_install -p opencv-doc docs/*.htm usr/share/doc/opencv-doc/html @@ -106,7 +102,7 @@ binary-arch: build install dh_testdir dh_testroot dh_installchangelogs -a ChangeLog - dh_installdocs -a AUTHORS THANKS TODO debian/README.Debian + dh_installdocs -a AUTHORS THANKS TODO dh_installexamples -a # dh_install # dh_installmenu @@ -124,7 +120,6 @@ binary-arch: build install dh_compress -a dh_fixperms -a # dh_perl - dh_pysupport -a dh_makeshlibs dh_installdeb -a dh_shlibdeps -a diff --git a/docs/Makefile.in b/docs/Makefile.in index 94f3107..74ea495 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -82,10 +82,14 @@ BUILD_DC1394_FALSE = @BUILD_DC1394_FALSE@ BUILD_DC1394_TRUE = @BUILD_DC1394_TRUE@ BUILD_FFMPEG_FALSE = @BUILD_FFMPEG_FALSE@ BUILD_FFMPEG_TRUE = @BUILD_FFMPEG_TRUE@ +BUILD_GSTREAMER_FALSE = @BUILD_GSTREAMER_FALSE@ +BUILD_GSTREAMER_TRUE = @BUILD_GSTREAMER_TRUE@ BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ BUILD_IMAGEIO_FALSE = @BUILD_IMAGEIO_FALSE@ BUILD_IMAGEIO_TRUE = @BUILD_IMAGEIO_TRUE@ +BUILD_OCTAVE_WRAPPERS_FALSE = @BUILD_OCTAVE_WRAPPERS_FALSE@ +BUILD_OCTAVE_WRAPPERS_TRUE = @BUILD_OCTAVE_WRAPPERS_TRUE@ BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@ BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@ BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@ @@ -108,8 +112,10 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG = @DEBUG@ DEFS = @DEFS@ +DEF_CXXFLAGS = @DEF_CXXFLAGS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -120,6 +126,8 @@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEGLIBS = @FFMPEGLIBS@ GREP = @GREP@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ @@ -138,11 +146,16 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_VERSION = @LT_VERSION@ MAKEINFO = @MAKEINFO@ +MKOCTFILE = @MKOCTFILE@ MMAJOR = @MMAJOR@ MMINOR = @MMINOR@ MSUBMINOR = @MSUBMINOR@ +NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OCTAVE = @OCTAVE@ +OCTAVE_ARCH = @OCTAVE_ARCH@ +OCT_CXXFLAGS = @OCT_CXXFLAGS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -162,10 +175,12 @@ PY_CXXFLAGS = @PY_CXXFLAGS@ QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@ QUICKTIME_LIBS = @QUICKTIME_LIBS@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ +SWIG_OCTAVE_OPT = @SWIG_OCTAVE_OPT@ SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ diff --git a/docs/appPage/appindex.htm b/docs/appPage/appindex.htm index 0a6820f..15f4b50 100644 --- a/docs/appPage/appindex.htm +++ b/docs/appPage/appindex.htm @@ -20,7 +20,7 @@ OpenCV Applications - +
Camera Calibration Tool
Camera Calibration Tool
@@ -37,7 +37,7 @@ OpenCV Applications @@ -49,7 +49,7 @@ OpenCV Applications
- +
Camshift Tracker
Camshift Tracker
- +
ConDensation Tracker
ConDensation Tracker
diff --git a/docs/ref/opencvref_cv.htm b/docs/ref/opencvref_cv.htm index 0f98b15..da057d8 100644 --- a/docs/ref/opencvref_cv.htm +++ b/docs/ref/opencvref_cv.htm @@ -32,6 +32,7 @@
  • Motion Templates
  • Object Tracking
  • Optical Flow +
  • Feature Matching
  • Estimators
  • Pattern Recognition @@ -434,7 +435,7 @@ void cvResize( const CvArr* src, CvArr* dst, int interpolation=CV_INTER_LINEAR )
    interpolation
    Interpolation method: