完善目录结构

完善了目录结构,添加了以前的web段com组件调用的代码(在/测试目录下)(部署没有使用到)
This commit is contained in:
yanshui177
2017-05-17 20:43:16 +08:00
parent ad754709a5
commit 6dcd378738
1246 changed files with 671388 additions and 517 deletions

View File

@@ -0,0 +1,538 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = cxcore
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/autotools/aclocal/az_python.m4 \
$(top_srcdir)/autotools/aclocal/pkg.m4 \
$(top_srcdir)/autotools/aclocal/swig_complete.m4 \
$(top_srcdir)/autotools/aclocal/version_at_least.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/autotools/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/cvconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_APPS_FALSE = @BUILD_APPS_FALSE@
BUILD_APPS_TRUE = @BUILD_APPS_TRUE@
BUILD_CARBON_FALSE = @BUILD_CARBON_FALSE@
BUILD_CARBON_TRUE = @BUILD_CARBON_TRUE@
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_GTK_FALSE = @BUILD_GTK_FALSE@
BUILD_GTK_TRUE = @BUILD_GTK_TRUE@
BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@
BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@
BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@
BUILD_QUICKTIME_TRUE = @BUILD_QUICKTIME_TRUE@
BUILD_V4L_FALSE = @BUILD_V4L_FALSE@
BUILD_V4L_TRUE = @BUILD_V4L_TRUE@
BUILD_XINE_FALSE = @BUILD_XINE_FALSE@
BUILD_XINE_TRUE = @BUILD_XINE_TRUE@
CARBON_CFLAGS = @CARBON_CFLAGS@
CARBON_LIBS = @CARBON_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG = @DEBUG@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FFMPEGLIBS = @FFMPEGLIBS@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
IEEE1394LIBS = @IEEE1394LIBS@
IMAGELIBS = @IMAGELIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_VERSION = @LT_VERSION@
MAKEINFO = @MAKEINFO@
MMAJOR = @MMAJOR@
MMINOR = @MMINOR@
MSUBMINOR = @MSUBMINOR@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PYTHON = @PYTHON@
PYTHON_CSPEC = @PYTHON_CSPEC@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_LSPEC = @PYTHON_LSPEC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@
QUICKTIME_LIBS = @QUICKTIME_LIBS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SWIG = @SWIG@
SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@
SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@
SWIG_VERSION = @SWIG_VERSION@
UPDATE_SWIG_WRAPPERS_FALSE = @UPDATE_SWIG_WRAPPERS_FALSE@
UPDATE_SWIG_WRAPPERS_TRUE = @UPDATE_SWIG_WRAPPERS_TRUE@
VERSION = @VERSION@
XINE_LIBS = @XINE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
SUBDIRS = src include
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cxcore/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu cxcore/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
clean clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,5 @@
# The directory where the include files will be installed
libcxcoreincludedir = $(includedir)/opencv
# Which header files to install
libcxcoreinclude_HEADERS = cxcore.h cxerror.h cxtypes.h cxmisc.h cxcore.hpp cvver.h

View File

@@ -0,0 +1,464 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = cxcore/include
DIST_COMMON = $(libcxcoreinclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/autotools/aclocal/az_python.m4 \
$(top_srcdir)/autotools/aclocal/pkg.m4 \
$(top_srcdir)/autotools/aclocal/swig_complete.m4 \
$(top_srcdir)/autotools/aclocal/version_at_least.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/autotools/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/cvconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libcxcoreincludedir)"
libcxcoreincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(libcxcoreinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_APPS_FALSE = @BUILD_APPS_FALSE@
BUILD_APPS_TRUE = @BUILD_APPS_TRUE@
BUILD_CARBON_FALSE = @BUILD_CARBON_FALSE@
BUILD_CARBON_TRUE = @BUILD_CARBON_TRUE@
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_GTK_FALSE = @BUILD_GTK_FALSE@
BUILD_GTK_TRUE = @BUILD_GTK_TRUE@
BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@
BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@
BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@
BUILD_QUICKTIME_TRUE = @BUILD_QUICKTIME_TRUE@
BUILD_V4L_FALSE = @BUILD_V4L_FALSE@
BUILD_V4L_TRUE = @BUILD_V4L_TRUE@
BUILD_XINE_FALSE = @BUILD_XINE_FALSE@
BUILD_XINE_TRUE = @BUILD_XINE_TRUE@
CARBON_CFLAGS = @CARBON_CFLAGS@
CARBON_LIBS = @CARBON_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG = @DEBUG@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FFMPEGLIBS = @FFMPEGLIBS@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
IEEE1394LIBS = @IEEE1394LIBS@
IMAGELIBS = @IMAGELIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_VERSION = @LT_VERSION@
MAKEINFO = @MAKEINFO@
MMAJOR = @MMAJOR@
MMINOR = @MMINOR@
MSUBMINOR = @MSUBMINOR@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PYTHON = @PYTHON@
PYTHON_CSPEC = @PYTHON_CSPEC@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_LSPEC = @PYTHON_LSPEC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@
QUICKTIME_LIBS = @QUICKTIME_LIBS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SWIG = @SWIG@
SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@
SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@
SWIG_VERSION = @SWIG_VERSION@
UPDATE_SWIG_WRAPPERS_FALSE = @UPDATE_SWIG_WRAPPERS_FALSE@
UPDATE_SWIG_WRAPPERS_TRUE = @UPDATE_SWIG_WRAPPERS_TRUE@
VERSION = @VERSION@
XINE_LIBS = @XINE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
# The directory where the include files will be installed
libcxcoreincludedir = $(includedir)/opencv
# Which header files to install
libcxcoreinclude_HEADERS = cxcore.h cxerror.h cxtypes.h cxmisc.h cxcore.hpp cvver.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cxcore/include/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu cxcore/include/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-libcxcoreincludeHEADERS: $(libcxcoreinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(libcxcoreincludedir)" || $(mkdir_p) "$(DESTDIR)$(libcxcoreincludedir)"
@list='$(libcxcoreinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(libcxcoreincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libcxcoreincludedir)/$$f'"; \
$(libcxcoreincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libcxcoreincludedir)/$$f"; \
done
uninstall-libcxcoreincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(libcxcoreinclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libcxcoreincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(libcxcoreincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libcxcoreincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-libcxcoreincludeHEADERS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libcxcoreincludeHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-libcxcoreincludeHEADERS install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
uninstall-libcxcoreincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,55 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright( C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
//(including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort(including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/*
definition of the current version of OpenCV
Usefull to test in user programs
*/
#ifndef _CVVERSION_H_
#define _CVVERSION_H_
#define CV_MAJOR_VERSION 1
#define CV_MINOR_VERSION 0
#define CV_SUBMINOR_VERSION 0
#define CV_VERSION "1.0.0"
#endif /*_CVVERSION_H_*/

View File

@@ -0,0 +1,382 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CXCORE_HPP_
#define _CXCORE_HPP_
class CV_EXPORTS CvImage
{
public:
CvImage() : image(0), refcount(0) {}
CvImage( CvSize size, int depth, int channels )
{
image = cvCreateImage( size, depth, channels );
refcount = image ? new int(1) : 0;
}
CvImage( IplImage* img ) : image(img)
{
refcount = image ? new int(1) : 0;
}
CvImage( const CvImage& img ) : image(img.image), refcount(img.refcount)
{
if( refcount ) ++(*refcount);
}
CvImage( const char* filename, const char* imgname=0, int color=-1 ) : image(0), refcount(0)
{ load( filename, imgname, color ); }
CvImage( CvFileStorage* fs, const char* mapname, const char* imgname ) : image(0), refcount(0)
{ read( fs, mapname, imgname ); }
CvImage( CvFileStorage* fs, const char* seqname, int idx ) : image(0), refcount(0)
{ read( fs, seqname, idx ); }
~CvImage()
{
if( refcount && !(--*refcount) )
{
cvReleaseImage( &image );
delete refcount;
}
}
CvImage clone() { return CvImage(image ? cvCloneImage(image) : 0); }
void create( CvSize size, int depth, int channels )
{
attach( cvCreateImage( size, depth, channels ));
}
void release() { detach(); }
void clear() { detach(); }
void attach( IplImage* img, bool use_refcount=true )
{
if( refcount )
{
if( --*refcount == 0 )
cvReleaseImage( &image );
delete refcount;
}
image = img;
refcount = use_refcount && image ? new int(1) : 0;
}
void detach()
{
if( refcount )
{
if( --*refcount == 0 )
cvReleaseImage( &image );
delete refcount;
refcount = 0;
}
image = 0;
}
bool load( const char* filename, const char* imgname=0, int color=-1 );
bool read( CvFileStorage* fs, const char* mapname, const char* imgname );
bool read( CvFileStorage* fs, const char* seqname, int idx );
void save( const char* filename, const char* imgname );
void write( CvFileStorage* fs, const char* imgname );
void show( const char* window_name );
bool is_valid() { return image != 0; }
int width() const { return image ? image->width : 0; }
int height() const { return image ? image->height : 0; }
CvSize size() const { return image ? cvSize(image->width, image->height) : cvSize(0,0); }
CvSize roi_size() const
{
return !image ? cvSize(0,0) :
!image->roi ? cvSize(image->width,image->height) :
cvSize(image->roi->width, image->roi->height);
}
CvRect roi() const
{
return !image ? cvRect(0,0,0,0) :
!image->roi ? cvRect(0,0,image->width,image->height) :
cvRect(image->roi->xOffset,image->roi->yOffset,
image->roi->width,image->roi->height);
}
int coi() const { return !image || !image->roi ? 0 : image->roi->coi; }
void set_roi(CvRect roi) { cvSetImageROI(image,roi); }
void reset_roi() { cvResetImageROI(image); }
void set_coi(int coi) { cvSetImageCOI(image,coi); }
int depth() const { return image ? image->depth : 0; }
int channels() const { return image ? image->nChannels : 0; }
int pix_size() const { return image ? ((image->depth & 255)>>3)*image->nChannels : 0; }
uchar* data() { return image ? (uchar*)image->imageData : 0; }
const uchar* data() const { return image ? (const uchar*)image->imageData : 0; }
int step() const { return image ? image->widthStep : 0; }
int origin() const { return image ? image->origin : 0; }
uchar* roi_row(int y)
{
assert(0<=y);
assert(!image ?
1 : image->roi ?
y<image->roi->height : y<image->height);
return !image ? 0 :
!image->roi ?
(uchar*)(image->imageData + y*image->widthStep) :
(uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
}
const uchar* roi_row(int y) const
{
assert(0<=y);
assert(!image ?
1 : image->roi ?
y<image->roi->height : y<image->height);
return !image ? 0 :
!image->roi ?
(const uchar*)(image->imageData + y*image->widthStep) :
(const uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
}
operator const IplImage* () const { return image; }
operator IplImage* () { return image; }
CvImage& operator = (const CvImage& img)
{
if( img.refcount )
++*img.refcount;
if( refcount && !(--*refcount) )
cvReleaseImage( &image );
image=img.image;
refcount=img.refcount;
return *this;
}
protected:
IplImage* image;
int* refcount;
};
class CV_EXPORTS CvMatrix
{
public:
CvMatrix() : matrix(0) {}
CvMatrix( int rows, int cols, int type )
{ matrix = cvCreateMat( rows, cols, type ); }
CvMatrix( int rows, int cols, int type, CvMat* hdr,
void* data=0, int step=CV_AUTOSTEP )
{ matrix = cvInitMatHeader( hdr, rows, cols, type, data, step ); }
CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data=true );
CvMatrix( int rows, int cols, int type, void* data, int step=CV_AUTOSTEP )
{ matrix = cvCreateMatHeader( rows, cols, type );
cvSetData( matrix, data, step ); }
CvMatrix( CvMat* m )
{ matrix = m; }
CvMatrix( const CvMatrix& m )
{
matrix = m.matrix;
addref();
}
CvMatrix( const char* filename, const char* matname=0, int color=-1 ) : matrix(0)
{ load( filename, matname, color ); }
CvMatrix( CvFileStorage* fs, const char* mapname, const char* matname ) : matrix(0)
{ read( fs, mapname, matname ); }
CvMatrix( CvFileStorage* fs, const char* seqname, int idx ) : matrix(0)
{ read( fs, seqname, idx ); }
~CvMatrix()
{
release();
}
CvMatrix clone() { return CvMatrix(matrix ? cvCloneMat(matrix) : 0); }
void set( CvMat* m, bool add_ref )
{
release();
matrix = m;
if( add_ref )
addref();
}
void create( int rows, int cols, int type )
{
set( cvCreateMat( rows, cols, type ), false );
}
void addref() const
{
if( matrix )
{
if( matrix->hdr_refcount )
++matrix->hdr_refcount;
else if( matrix->refcount )
++*matrix->refcount;
}
}
void release()
{
if( matrix )
{
if( matrix->hdr_refcount )
{
if( --matrix->hdr_refcount == 0 )
cvReleaseMat( &matrix );
}
else if( matrix->refcount )
{
if( --*matrix->refcount == 0 )
cvFree( &matrix->refcount );
}
matrix = 0;
}
}
void clear()
{
release();
}
bool load( const char* filename, const char* matname=0, int color=-1 );
bool read( CvFileStorage* fs, const char* mapname, const char* matname );
bool read( CvFileStorage* fs, const char* seqname, int idx );
void save( const char* filename, const char* matname );
void write( CvFileStorage* fs, const char* matname );
void show( const char* window_name );
bool is_valid() { return matrix != 0; }
int rows() const { return matrix ? matrix->rows : 0; }
int cols() const { return matrix ? matrix->cols : 0; }
CvSize size() const
{
return !matrix ? cvSize(0,0) : cvSize(matrix->rows,matrix->cols);
}
int type() const { return matrix ? CV_MAT_TYPE(matrix->type) : 0; }
int depth() const { return matrix ? CV_MAT_DEPTH(matrix->type) : 0; }
int channels() const { return matrix ? CV_MAT_CN(matrix->type) : 0; }
int pix_size() const { return matrix ? CV_ELEM_SIZE(matrix->type) : 0; }
uchar* data() { return matrix ? matrix->data.ptr : 0; }
const uchar* data() const { return matrix ? matrix->data.ptr : 0; }
int step() const { return matrix ? matrix->step : 0; }
void set_data( void* data, int step=CV_AUTOSTEP )
{ cvSetData( matrix, data, step ); }
uchar* row(int i) { return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
const uchar* row(int i) const
{ return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
operator const CvMat* () const { return matrix; }
operator CvMat* () { return matrix; }
CvMatrix& operator = (const CvMatrix& _m)
{
_m.addref();
release();
matrix = _m.matrix;
return *this;
}
protected:
CvMat* matrix;
};
typedef IplImage* (CV_CDECL * CvLoadImageFunc)( const char* filename, int colorness );
typedef CvMat* (CV_CDECL * CvLoadImageMFunc)( const char* filename, int colorness );
typedef int (CV_CDECL * CvSaveImageFunc)( const char* filename, const CvArr* image );
typedef void (CV_CDECL * CvShowImageFunc)( const char* windowname, const CvArr* image );
CVAPI(int) cvSetImageIOFunctions( CvLoadImageFunc _load_image, CvLoadImageMFunc _load_image_m,
CvSaveImageFunc _save_image, CvShowImageFunc _show_image );
#define CV_SET_IMAGE_IO_FUNCTIONS() \
cvSetImageIOFunctions( cvLoadImage, cvLoadImageM, cvSaveImage, cvShowImage )
// classes for automatic module/RTTI data registration/unregistration
struct CV_EXPORTS CvModule
{
CvModule( CvModuleInfo* _info );
~CvModule();
CvModuleInfo* info;
static CvModuleInfo* first;
static CvModuleInfo* last;
};
struct CV_EXPORTS CvType
{
CvType( const char* type_name,
CvIsInstanceFunc is_instance, CvReleaseFunc release=0,
CvReadFunc read=0, CvWriteFunc write=0, CvCloneFunc clone=0 );
~CvType();
CvTypeInfo* info;
static CvTypeInfo* first;
static CvTypeInfo* last;
};
#endif /*_CXCORE_HPP_*/

View File

@@ -0,0 +1,189 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CXCORE_ERROR_H_
#define _CXCORE_ERROR_H_
/************Below is declaration of error handling stuff in PLSuite manner**/
typedef int CVStatus;
/* this part of CVStatus is compatible with IPLStatus
Some of below symbols are not [yet] used in OpenCV
*/
#define CV_StsOk 0 /* everithing is ok */
#define CV_StsBackTrace -1 /* pseudo error for back trace */
#define CV_StsError -2 /* unknown /unspecified error */
#define CV_StsInternal -3 /* internal error (bad state) */
#define CV_StsNoMem -4 /* insufficient memory */
#define CV_StsBadArg -5 /* function arg/param is bad */
#define CV_StsBadFunc -6 /* unsupported function */
#define CV_StsNoConv -7 /* iter. didn't converge */
#define CV_StsAutoTrace -8 /* tracing */
#define CV_HeaderIsNull -9 /* image header is NULL */
#define CV_BadImageSize -10 /* image size is invalid */
#define CV_BadOffset -11 /* offset is invalid */
#define CV_BadDataPtr -12 /**/
#define CV_BadStep -13 /**/
#define CV_BadModelOrChSeq -14 /**/
#define CV_BadNumChannels -15 /**/
#define CV_BadNumChannel1U -16 /**/
#define CV_BadDepth -17 /**/
#define CV_BadAlphaChannel -18 /**/
#define CV_BadOrder -19 /**/
#define CV_BadOrigin -20 /**/
#define CV_BadAlign -21 /**/
#define CV_BadCallBack -22 /**/
#define CV_BadTileSize -23 /**/
#define CV_BadCOI -24 /**/
#define CV_BadROISize -25 /**/
#define CV_MaskIsTiled -26 /**/
#define CV_StsNullPtr -27 /* null pointer */
#define CV_StsVecLengthErr -28 /* incorrect vector length */
#define CV_StsFilterStructContentErr -29 /* incorr. filter structure content */
#define CV_StsKernelStructContentErr -30 /* incorr. transform kernel content */
#define CV_StsFilterOffsetErr -31 /* incorrect filter ofset value */
/*extra for CV */
#define CV_StsBadSize -201 /* the input/output structure size is incorrect */
#define CV_StsDivByZero -202 /* division by zero */
#define CV_StsInplaceNotSupported -203 /* in-place operation is not supported */
#define CV_StsObjectNotFound -204 /* request can't be completed */
#define CV_StsUnmatchedFormats -205 /* formats of input/output arrays differ */
#define CV_StsBadFlag -206 /* flag is wrong or not supported */
#define CV_StsBadPoint -207 /* bad CvPoint */
#define CV_StsBadMask -208 /* bad format of mask (neither 8uC1 nor 8sC1)*/
#define CV_StsUnmatchedSizes -209 /* sizes of input/output structures do not match */
#define CV_StsUnsupportedFormat -210 /* the data format/type is not supported by the function*/
#define CV_StsOutOfRange -211 /* some of parameters are out of range */
#define CV_StsParseError -212 /* invalid syntax/structure of the parsed file */
#define CV_StsNotImplemented -213 /* the requested function/feature is not implemented */
#define CV_StsBadMemBlock -214 /* an allocated block has been corrupted */
/********************************* Error handling Macros ********************************/
#define OPENCV_ERROR(status,func,context) \
cvError((status),(func),(context),__FILE__,__LINE__)
#define OPENCV_ERRCHK(func,context) \
{if (cvGetErrStatus() >= 0) \
{OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
#define OPENCV_ASSERT(expr,func,context) \
{if (! (expr)) \
{OPENCV_ERROR(CV_StsInternal,(func),(context));}}
#define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
#define OPENCV_CALL( Func ) \
{ \
Func; \
}
/**************************** OpenCV-style error handling *******************************/
/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
#ifdef CV_NO_FUNC_NAMES
#define CV_FUNCNAME( Name )
#define cvFuncName ""
#else
#define CV_FUNCNAME( Name ) \
static char cvFuncName[] = Name
#endif
/*
CV_ERROR macro unconditionally raises error with passed code and message.
After raising error, control will be transferred to the exit label.
*/
#define CV_ERROR( Code, Msg ) \
{ \
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
EXIT; \
}
/* Simplified form of CV_ERROR */
#define CV_ERROR_FROM_CODE( code ) \
CV_ERROR( code, "" )
/*
CV_CHECK macro checks error status after CV (or IPL)
function call. If error detected, control will be transferred to the exit
label.
*/
#define CV_CHECK() \
{ \
if( cvGetErrStatus() < 0 ) \
CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \
}
/*
CV_CALL macro calls CV (or IPL) function, checks error status and
signals a error if the function failed. Useful in "parent node"
error procesing mode
*/
#define CV_CALL( Func ) \
{ \
Func; \
CV_CHECK(); \
}
/* Runtime assertion macro */
#define CV_ASSERT( Condition ) \
{ \
if( !(Condition) ) \
CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
}
#define __BEGIN__ {
#define __END__ goto exit; exit: ; }
#define __CLEANUP__
#define EXIT goto exit
#endif /* _CXCORE_ERROR_H_ */
/* End of file. */

View File

@@ -0,0 +1,922 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/* The header is mostly for internal use and it is likely to change.
It contains some macro definitions that are used in cxcore, cv, cvaux
and, probably, other libraries. If you need some of this functionality,
the safe way is to copy it into your code and rename the macros.
*/
#ifndef _CXCORE_MISC_H_
#define _CXCORE_MISC_H_
#ifdef HAVE_CONFIG_H
#include "cvconfig.h"
#endif
#include <limits.h>
#ifdef _OPENMP
#include "omp.h"
#endif
/****************************************************************************************\
* Compile-time tuning parameters *
\****************************************************************************************/
/* maximal size of vector to run matrix operations on it inline (i.e. w/o ipp calls) */
#define CV_MAX_INLINE_MAT_OP_SIZE 10
/* maximal linear size of matrix to allocate it on stack. */
#define CV_MAX_LOCAL_MAT_SIZE 32
/* maximal size of local memory storage */
#define CV_MAX_LOCAL_SIZE \
(CV_MAX_LOCAL_MAT_SIZE*CV_MAX_LOCAL_MAT_SIZE*(int)sizeof(double))
/* default image row align (in bytes) */
#define CV_DEFAULT_IMAGE_ROW_ALIGN 4
/* matrices are continuous by default */
#define CV_DEFAULT_MAT_ROW_ALIGN 1
/* maximum size of dynamic memory buffer.
cvAlloc reports an error if a larger block is requested. */
#define CV_MAX_ALLOC_SIZE (((size_t)1 << (sizeof(size_t)*8-2)))
/* the alignment of all the allocated buffers */
#define CV_MALLOC_ALIGN 32
/* default alignment for dynamic data strucutures, resided in storages. */
#define CV_STRUCT_ALIGN ((int)sizeof(double))
/* default storage block size */
#define CV_STORAGE_BLOCK_SIZE ((1<<16) - 128)
/* default memory block for sparse array elements */
#define CV_SPARSE_MAT_BLOCK (1<<12)
/* initial hash table size */
#define CV_SPARSE_HASH_SIZE0 (1<<10)
/* maximal average node_count/hash_size ratio beyond which hash table is resized */
#define CV_SPARSE_HASH_RATIO 3
/* max length of strings */
#define CV_MAX_STRLEN 1024
/* maximum possible number of threads in parallel implementations */
#ifdef _OPENMP
#define CV_MAX_THREADS 128
#else
#define CV_MAX_THREADS 1
#endif
#if 0 /*def CV_CHECK_FOR_NANS*/
#define CV_CHECK_NANS( arr ) cvCheckArray((arr))
#else
#define CV_CHECK_NANS( arr )
#endif
/****************************************************************************************\
* Common declarations *
\****************************************************************************************/
/* get alloca declaration */
#ifdef __GNUC__
#undef alloca
#define alloca __builtin_alloca
#elif defined WIN32 || defined WIN64
#if defined _MSC_VER || defined __BORLANDC__
#include <malloc.h>
#endif
#elif defined HAVE_ALLOCA_H
#include <alloca.h>
#elif defined HAVE_ALLOCA
#include <stdlib.h>
#elif
#error
#endif
/* ! DO NOT make it an inline function */
#define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
#if defined _MSC_VER || defined __BORLANDC__
#define CV_BIG_INT(n) n##I64
#define CV_BIG_UINT(n) n##UI64
#else
#define CV_BIG_INT(n) n##LL
#define CV_BIG_UINT(n) n##ULL
#endif
#define CV_IMPL CV_EXTERN_C
#if defined WIN32 && !defined WIN64 && (_MSC_VER >= 1200 || defined CV_ICC)
#define CV_DBG_BREAK() __asm int 3
#else
#define CV_DBG_BREAK() assert(0);
#endif
/* default step, set in case of continuous data
to work around checks for valid step in some ipp functions */
#define CV_STUB_STEP (1 << 30)
#define CV_SIZEOF_FLOAT ((int)sizeof(float))
#define CV_SIZEOF_SHORT ((int)sizeof(short))
#define CV_ORIGIN_TL 0
#define CV_ORIGIN_BL 1
/* IEEE754 constants and macros */
#define CV_POS_INF 0x7f800000
#define CV_NEG_INF 0x807fffff /* CV_TOGGLE_FLT(0xff800000) */
#define CV_1F 0x3f800000
#define CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
#define CV_TOGGLE_DBL(x) \
((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
#define CV_NOP(a) (a)
#define CV_ADD(a, b) ((a) + (b))
#define CV_SUB(a, b) ((a) - (b))
#define CV_MUL(a, b) ((a) * (b))
#define CV_AND(a, b) ((a) & (b))
#define CV_OR(a, b) ((a) | (b))
#define CV_XOR(a, b) ((a) ^ (b))
#define CV_ANDN(a, b) (~(a) & (b))
#define CV_ORN(a, b) (~(a) | (b))
#define CV_SQR(a) ((a) * (a))
#define CV_LT(a, b) ((a) < (b))
#define CV_LE(a, b) ((a) <= (b))
#define CV_EQ(a, b) ((a) == (b))
#define CV_NE(a, b) ((a) != (b))
#define CV_GT(a, b) ((a) > (b))
#define CV_GE(a, b) ((a) >= (b))
#define CV_NONZERO(a) ((a) != 0)
#define CV_NONZERO_FLT(a) (((a)+(a)) != 0)
/* 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_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)
#define CV_CAST_64S(t) (int64)(t)
#define CV_CAST_32F(t) (float)(t)
#define CV_CAST_64F(t) (double)(t)
#define CV_PASTE2(a,b) a##b
#define CV_PASTE(a,b) CV_PASTE2(a,b)
#define CV_EMPTY
#define CV_MAKE_STR(a) #a
#define CV_DEFINE_MASK \
float maskTab[2]; maskTab[0] = 0.f; maskTab[1] = 1.f;
#define CV_ANDMASK( m, x ) ((x) & (((m) == 0) - 1))
/* (x) * ((m) == 1 ? 1.f : (m) == 0 ? 0.f : <ERR> */
#define CV_MULMASK( m, x ) (maskTab[(m) != 0]*(x))
/* (x) * ((m) == -1 ? 1.f : (m) == 0 ? 0.f : <ERR> */
#define CV_MULMASK1( m, x ) (maskTab[(m)+1]*(x))
#define CV_ZERO_OBJ(x) memset((x), 0, sizeof(*(x)))
#define CV_DIM(static_array) ((int)(sizeof(static_array)/sizeof((static_array)[0])))
#define CV_UN_ENTRY_C1(worktype) \
worktype s0 = scalar[0]
#define CV_UN_ENTRY_C2(worktype) \
worktype s0 = scalar[0], s1 = scalar[1]
#define CV_UN_ENTRY_C3(worktype) \
worktype s0 = scalar[0], s1 = scalar[1], s2 = scalar[2]
#define CV_UN_ENTRY_C4(worktype) \
worktype s0 = scalar[0], s1 = scalar[1], s2 = scalar[2], s3 = scalar[3]
#define cvUnsupportedFormat "Unsupported format"
CV_INLINE void* cvAlignPtr( const void* ptr, int align=32 )
{
assert( (align & (align-1)) == 0 );
return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
}
CV_INLINE int cvAlign( int size, int align )
{
assert( (align & (align-1)) == 0 && size < INT_MAX );
return (size + align - 1) & -align;
}
CV_INLINE CvSize cvGetMatSize( const CvMat* mat )
{
CvSize size = { mat->width, mat->height };
return size;
}
#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))
#define CV_FLT_TO_FIX(x,n) cvRound((x)*(1<<(n)))
#if 0
/* This is a small engine for performing fast division of multiple numbers
by the same constant. Most compilers do it too if they know the divisor value
at compile-time. The algorithm was taken from Agner Fog's optimization guide
at http://www.agner.org/assem */
typedef struct CvFastDiv
{
unsigned delta, scale, divisor;
}
CvFastDiv;
#define CV_FAST_DIV_SHIFT 32
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;
}
#define CV_FAST_DIV( x, fastdiv ) \
((int)(((int64)((x)*2 + (int)(fastdiv).delta))*(int)(fastdiv).scale>>CV_FAST_DIV_SHIFT))
#define CV_FAST_UDIV( x, fastdiv ) \
((int)(((uint64)((x)*2 + (fastdiv).delta))*(fastdiv).scale>>CV_FAST_DIV_SHIFT))
#endif
#define CV_MEMCPY_CHAR( dst, src, len ) \
{ \
size_t _icv_memcpy_i_, _icv_memcpy_len_ = (len); \
char* _icv_memcpy_dst_ = (char*)(dst); \
const char* _icv_memcpy_src_ = (const char*)(src); \
\
for( _icv_memcpy_i_ = 0; _icv_memcpy_i_ < _icv_memcpy_len_; _icv_memcpy_i_++ ) \
_icv_memcpy_dst_[_icv_memcpy_i_] = _icv_memcpy_src_[_icv_memcpy_i_]; \
}
#define CV_MEMCPY_INT( dst, src, len ) \
{ \
size_t _icv_memcpy_i_, _icv_memcpy_len_ = (len); \
int* _icv_memcpy_dst_ = (int*)(dst); \
const int* _icv_memcpy_src_ = (const int*)(src); \
assert( ((size_t)_icv_memcpy_src_&(sizeof(int)-1)) == 0 && \
((size_t)_icv_memcpy_dst_&(sizeof(int)-1)) == 0 ); \
\
for(_icv_memcpy_i_=0;_icv_memcpy_i_<_icv_memcpy_len_;_icv_memcpy_i_++) \
_icv_memcpy_dst_[_icv_memcpy_i_] = _icv_memcpy_src_[_icv_memcpy_i_]; \
}
#define CV_MEMCPY_AUTO( dst, src, len ) \
{ \
size_t _icv_memcpy_i_, _icv_memcpy_len_ = (len); \
char* _icv_memcpy_dst_ = (char*)(dst); \
const char* _icv_memcpy_src_ = (const char*)(src); \
if( (_icv_memcpy_len_ & (sizeof(int)-1)) == 0 ) \
{ \
assert( ((size_t)_icv_memcpy_src_&(sizeof(int)-1)) == 0 && \
((size_t)_icv_memcpy_dst_&(sizeof(int)-1)) == 0 ); \
for( _icv_memcpy_i_ = 0; _icv_memcpy_i_ < _icv_memcpy_len_; \
_icv_memcpy_i_+=sizeof(int) ) \
{ \
*(int*)(_icv_memcpy_dst_+_icv_memcpy_i_) = \
*(const int*)(_icv_memcpy_src_+_icv_memcpy_i_); \
} \
} \
else \
{ \
for(_icv_memcpy_i_ = 0; _icv_memcpy_i_ < _icv_memcpy_len_; _icv_memcpy_i_++)\
_icv_memcpy_dst_[_icv_memcpy_i_] = _icv_memcpy_src_[_icv_memcpy_i_]; \
} \
}
#define CV_ZERO_CHAR( dst, len ) \
{ \
size_t _icv_memcpy_i_, _icv_memcpy_len_ = (len); \
char* _icv_memcpy_dst_ = (char*)(dst); \
\
for( _icv_memcpy_i_ = 0; _icv_memcpy_i_ < _icv_memcpy_len_; _icv_memcpy_i_++ ) \
_icv_memcpy_dst_[_icv_memcpy_i_] = '\0'; \
}
#define CV_ZERO_INT( dst, len ) \
{ \
size_t _icv_memcpy_i_, _icv_memcpy_len_ = (len); \
int* _icv_memcpy_dst_ = (int*)(dst); \
assert( ((size_t)_icv_memcpy_dst_&(sizeof(int)-1)) == 0 ); \
\
for(_icv_memcpy_i_=0;_icv_memcpy_i_<_icv_memcpy_len_;_icv_memcpy_i_++) \
_icv_memcpy_dst_[_icv_memcpy_i_] = 0; \
}
/****************************************************************************************\
Generic implementation of QuickSort algorithm.
----------------------------------------------
Using this macro user can declare customized sort function that can be much faster
than built-in qsort function because of lower overhead on elements
comparison and exchange. The macro takes less_than (or LT) argument - a macro or function
that takes 2 arguments returns non-zero if the first argument should be before the second
one in the sorted sequence and zero otherwise.
Example:
Suppose that the task is to sort points by ascending of y coordinates and if
y's are equal x's should ascend.
The code is:
------------------------------------------------------------------------------
#define cmp_pts( pt1, pt2 ) \
((pt1).y < (pt2).y || ((pt1).y < (pt2).y && (pt1).x < (pt2).x))
[static] CV_IMPLEMENT_QSORT( icvSortPoints, CvPoint, cmp_pts )
------------------------------------------------------------------------------
After that the function "void icvSortPoints( CvPoint* array, size_t total, int aux );"
is available to user.
aux is an additional parameter, which can be used when comparing elements.
The current implementation was derived from *BSD system qsort():
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
\****************************************************************************************/
#define CV_IMPLEMENT_QSORT_EX( func_name, T, LT, user_data_type ) \
void func_name( T *array, size_t total, user_data_type aux ) \
{ \
int isort_thresh = 7; \
T t; \
int sp = 0; \
\
struct \
{ \
T *lb; \
T *ub; \
} \
stack[48]; \
\
aux = aux; \
\
if( total <= 1 ) \
return; \
\
stack[0].lb = array; \
stack[0].ub = array + (total - 1); \
\
while( sp >= 0 ) \
{ \
T* left = stack[sp].lb; \
T* right = stack[sp--].ub; \
\
for(;;) \
{ \
int i, n = (int)(right - left) + 1, m; \
T* ptr; \
T* ptr2; \
\
if( n <= isort_thresh ) \
{ \
insert_sort: \
for( ptr = left + 1; ptr <= right; ptr++ ) \
{ \
for( ptr2 = ptr; ptr2 > left && LT(ptr2[0],ptr2[-1]); ptr2--) \
CV_SWAP( ptr2[0], ptr2[-1], t ); \
} \
break; \
} \
else \
{ \
T* left0; \
T* left1; \
T* right0; \
T* right1; \
T* pivot; \
T* a; \
T* b; \
T* c; \
int swap_cnt = 0; \
\
left0 = left; \
right0 = right; \
pivot = left + (n/2); \
\
if( n > 40 ) \
{ \
int d = n / 8; \
a = left, b = left + d, c = left + 2*d; \
left = LT(*a, *b) ? (LT(*b, *c) ? b : (LT(*a, *c) ? c : a)) \
: (LT(*c, *b) ? b : (LT(*a, *c) ? a : c)); \
\
a = pivot - d, b = pivot, c = pivot + d; \
pivot = LT(*a, *b) ? (LT(*b, *c) ? b : (LT(*a, *c) ? c : a)) \
: (LT(*c, *b) ? b : (LT(*a, *c) ? a : c)); \
\
a = right - 2*d, b = right - d, c = right; \
right = LT(*a, *b) ? (LT(*b, *c) ? b : (LT(*a, *c) ? c : a)) \
: (LT(*c, *b) ? b : (LT(*a, *c) ? a : c)); \
} \
\
a = left, b = pivot, c = right; \
pivot = LT(*a, *b) ? (LT(*b, *c) ? b : (LT(*a, *c) ? c : a)) \
: (LT(*c, *b) ? b : (LT(*a, *c) ? a : c)); \
if( pivot != left0 ) \
{ \
CV_SWAP( *pivot, *left0, t ); \
pivot = left0; \
} \
left = left1 = left0 + 1; \
right = right1 = right0; \
\
for(;;) \
{ \
while( left <= right && !LT(*pivot, *left) ) \
{ \
if( !LT(*left, *pivot) ) \
{ \
if( left > left1 ) \
CV_SWAP( *left1, *left, t ); \
swap_cnt = 1; \
left1++; \
} \
left++; \
} \
\
while( left <= right && !LT(*right, *pivot) ) \
{ \
if( !LT(*pivot, *right) ) \
{ \
if( right < right1 ) \
CV_SWAP( *right1, *right, t ); \
swap_cnt = 1; \
right1--; \
} \
right--; \
} \
\
if( left > right ) \
break; \
CV_SWAP( *left, *right, t ); \
swap_cnt = 1; \
left++; \
right--; \
} \
\
if( swap_cnt == 0 ) \
{ \
left = left0, right = right0; \
goto insert_sort; \
} \
\
n = MIN( (int)(left1 - left0), (int)(left - left1) ); \
for( i = 0; i < n; i++ ) \
CV_SWAP( left0[i], left[i-n], t ); \
\
n = MIN( (int)(right0 - right1), (int)(right1 - right) ); \
for( i = 0; i < n; i++ ) \
CV_SWAP( left[i], right0[i-n+1], t ); \
n = (int)(left - left1); \
m = (int)(right1 - right); \
if( n > 1 ) \
{ \
if( m > 1 ) \
{ \
if( n > m ) \
{ \
stack[++sp].lb = left0; \
stack[sp].ub = left0 + n - 1; \
left = right0 - m + 1, right = right0; \
} \
else \
{ \
stack[++sp].lb = right0 - m + 1; \
stack[sp].ub = right0; \
left = left0, right = left0 + n - 1; \
} \
} \
else \
left = left0, right = left0 + n - 1; \
} \
else if( m > 1 ) \
left = right0 - m + 1, right = right0; \
else \
break; \
} \
} \
} \
}
#define CV_IMPLEMENT_QSORT( func_name, T, cmp ) \
CV_IMPLEMENT_QSORT_EX( func_name, T, cmp, int )
/****************************************************************************************\
* Structures and macros for integration with IPP *
\****************************************************************************************/
/* IPP-compatible return codes */
typedef enum CvStatus
{
CV_BADMEMBLOCK_ERR = -113,
CV_INPLACE_NOT_SUPPORTED_ERR= -112,
CV_UNMATCHED_ROI_ERR = -111,
CV_NOTFOUND_ERR = -110,
CV_BADCONVERGENCE_ERR = -109,
CV_BADDEPTH_ERR = -107,
CV_BADROI_ERR = -106,
CV_BADHEADER_ERR = -105,
CV_UNMATCHED_FORMATS_ERR = -104,
CV_UNSUPPORTED_COI_ERR = -103,
CV_UNSUPPORTED_CHANNELS_ERR = -102,
CV_UNSUPPORTED_DEPTH_ERR = -101,
CV_UNSUPPORTED_FORMAT_ERR = -100,
CV_BADARG_ERR = -49, //ipp comp
CV_NOTDEFINED_ERR = -48, //ipp comp
CV_BADCHANNELS_ERR = -47, //ipp comp
CV_BADRANGE_ERR = -44, //ipp comp
CV_BADSTEP_ERR = -29, //ipp comp
CV_BADFLAG_ERR = -12,
CV_DIV_BY_ZERO_ERR = -11, //ipp comp
CV_BADCOEF_ERR = -10,
CV_BADFACTOR_ERR = -7,
CV_BADPOINT_ERR = -6,
CV_BADSCALE_ERR = -4,
CV_OUTOFMEM_ERR = -3,
CV_NULLPTR_ERR = -2,
CV_BADSIZE_ERR = -1,
CV_NO_ERR = 0,
CV_OK = CV_NO_ERR
}
CvStatus;
#define CV_ERROR_FROM_STATUS( result ) \
CV_ERROR( cvErrorFromIppStatus( result ), "OpenCV function failed" )
#define IPPI_CALL( Func ) \
{ \
CvStatus ippi_call_result; \
ippi_call_result = Func; \
\
if( ippi_call_result < 0 ) \
CV_ERROR_FROM_STATUS( (ippi_call_result)); \
}
#define CV_PLUGIN_NONE 0
#define CV_PLUGIN_OPTCV 1 /* custom "emerged" ippopencv library */
#define CV_PLUGIN_IPPCV 2 /* IPP: computer vision */
#define CV_PLUGIN_IPPI 3 /* IPP: image processing */
#define CV_PLUGIN_IPPS 4 /* IPP: signal processing */
#define CV_PLUGIN_IPPVM 5 /* IPP: vector math functions */
#define CV_PLUGIN_IPPCC 6 /* IPP: color space conversion */
#define CV_PLUGIN_MKL 8 /* Intel Math Kernel Library */
#define CV_PLUGIN_MAX 16
#define CV_PLUGINS1(lib1) ((lib1)&15)
#define CV_PLUGINS2(lib1,lib2) (((lib1)&15)|(((lib2)&15)<<4))
#define CV_PLUGINS3(lib1,lib2,lib3) (((lib1)&15)|(((lib2)&15)<<4)|(((lib2)&15)<<8))
#define CV_NOTHROW throw()
#ifndef IPCVAPI
#define IPCVAPI(type,declspec,name,args) \
/* function pointer */ \
typedef type (declspec* name##_t) args; \
extern name##_t name##_p; \
type declspec name args;
#endif
#define IPCVAPI_EX(type,name,ipp_name,ipp_search_modules,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)
#ifndef IPCVAPI_IMPL
#define IPCVAPI_IMPL(type,name,args,arg_names) \
static type CV_STDCALL name##_f args; \
name##_t name##_p = name##_f; \
type CV_STDCALL name args { return name##_p arg_names; } \
static type CV_STDCALL name##_f args
#endif
/* IPP types' enumeration */
typedef enum CvDataType {
cv1u,
cv8u, cv8s,
cv16u, cv16s, cv16sc,
cv32u, cv32s, cv32sc,
cv32f, cv32fc,
cv64u, cv64s, cv64sc,
cv64f, cv64fc
} CvDataType;
typedef enum CvHintAlgorithm {
cvAlgHintNone,
cvAlgHintFast,
cvAlgHintAccurate
} CvHintAlgorithm;
typedef enum CvCmpOp {
cvCmpLess,
cvCmpLessEq,
cvCmpEq,
cvCmpGreaterEq,
cvCmpGreater
} CvCmpOp;
typedef struct CvFuncTable
{
void* fn_2d[CV_DEPTH_MAX];
}
CvFuncTable;
typedef struct CvBigFuncTable
{
void* fn_2d[CV_DEPTH_MAX*CV_CN_MAX];
}
CvBigFuncTable;
typedef struct CvBtFuncTable
{
void* fn_2d[33];
}
CvBtFuncTable;
typedef CvStatus (CV_STDCALL *CvFunc2D_1A)(void* arr, int step, CvSize size);
typedef CvStatus (CV_STDCALL *CvFunc2D_1A1P)(void* arr, int step, CvSize size, void* param);
typedef CvStatus (CV_STDCALL *CvFunc2D_1A1P1I)(void* arr, int step, CvSize size,
void* param, int flag);
typedef CvStatus (CV_STDCALL *CvFunc2DnC_1A1P)( void* arr, int step, CvSize size,
int cn, int coi, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_1A1P)( void* arr, int step, CvSize size,
int cn, int coi, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2D_1A2P)( void* arr, int step, CvSize size,
void* param1, void* param2 );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_1A2P)( void* arr, int step,
CvSize size, int cn, int coi,
void* param1, void* param2 );
typedef CvStatus (CV_STDCALL *CvFunc2D_1A4P)( void* arr, int step, CvSize size,
void* param1, void* param2,
void* param3, void* param4 );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_1A4P)( void* arr, int step,
CvSize size, int cn, int coi,
void* param1, void* param2,
void* param3, void* param4 );
typedef CvStatus (CV_STDCALL *CvFunc2D_2A)( void* arr0, int step0,
void* arr1, int step1, CvSize size );
typedef CvStatus (CV_STDCALL *CvFunc2D_2A1P)( void* arr0, int step0,
void* arr1, int step1,
CvSize size, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_2A1P)( void* arr0, int step0,
void* arr1, int step1,
CvSize size, int cn,
int coi, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_2A1P)( void* arr0, int step0,
void* arr1, int step1,
CvSize size, int cn,
int coi, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2D_2A2P)( void* arr0, int step0,
void* arr1, int step1, CvSize size,
void* param1, void* param2 );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_2A2P)( void* arr0, int step0,
void* arr1, int step1,
CvSize size, int cn, int coi,
void* param1, void* param2 );
typedef CvStatus (CV_STDCALL *CvFunc2D_2A1P1I)( void* arr0, int step0,
void* arr1, int step1, CvSize size,
void* param, int flag );
typedef CvStatus (CV_STDCALL *CvFunc2D_2A4P)( void* arr0, int step0,
void* arr1, int step1, CvSize size,
void* param1, void* param2,
void* param3, void* param4 );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_2A4P)( void* arr0, int step0,
void* arr1, int step1, CvSize size,
int cn, int coi,
void* param1, void* param2,
void* param3, void* param4 );
typedef CvStatus (CV_STDCALL *CvFunc2D_3A)( void* arr0, int step0,
void* arr1, int step1,
void* arr2, int step2, CvSize size );
typedef CvStatus (CV_STDCALL *CvFunc2D_3A1P)( void* arr0, int step0,
void* arr1, int step1,
void* arr2, int step2,
CvSize size, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2D_3A1I)( void* arr0, int step0,
void* arr1, int step1,
void* arr2, int step2,
CvSize size, int flag );
typedef CvStatus (CV_STDCALL *CvFunc2DnC_3A1P)( void* arr0, int step0,
void* arr1, int step1,
void* arr2, int step2,
CvSize size, int cn,
int coi, void* param );
typedef CvStatus (CV_STDCALL *CvFunc2D_4A)( void* arr0, int step0,
void* arr1, int step1,
void* arr2, int step2,
void* arr3, int step3,
CvSize size );
typedef CvStatus (CV_STDCALL *CvFunc0D)( const void* src, void* dst, int param );
#define CV_DEF_INIT_FUNC_TAB_2D( FUNCNAME, FLAG ) \
static void icvInit##FUNCNAME##FLAG##Table( CvFuncTable* tab ) \
{ \
assert( tab ); \
\
tab->fn_2d[CV_8U] = (void*)icv##FUNCNAME##_8u_##FLAG; \
tab->fn_2d[CV_8S] = (void*)icv##FUNCNAME##_8s_##FLAG; \
tab->fn_2d[CV_16U] = (void*)icv##FUNCNAME##_16u_##FLAG; \
tab->fn_2d[CV_16S] = (void*)icv##FUNCNAME##_16s_##FLAG; \
tab->fn_2d[CV_32S] = (void*)icv##FUNCNAME##_32s_##FLAG; \
tab->fn_2d[CV_32F] = (void*)icv##FUNCNAME##_32f_##FLAG; \
tab->fn_2d[CV_64F] = (void*)icv##FUNCNAME##_64f_##FLAG; \
}
#define CV_DEF_INIT_BIG_FUNC_TAB_2D( FUNCNAME, FLAG ) \
static void icvInit##FUNCNAME##FLAG##Table( CvBigFuncTable* tab ) \
{ \
assert( tab ); \
\
tab->fn_2d[CV_8UC1] = (void*)icv##FUNCNAME##_8u_C1##FLAG; \
tab->fn_2d[CV_8UC2] = (void*)icv##FUNCNAME##_8u_C2##FLAG; \
tab->fn_2d[CV_8UC3] = (void*)icv##FUNCNAME##_8u_C3##FLAG; \
tab->fn_2d[CV_8UC4] = (void*)icv##FUNCNAME##_8u_C4##FLAG; \
\
tab->fn_2d[CV_8SC1] = (void*)icv##FUNCNAME##_8s_C1##FLAG; \
tab->fn_2d[CV_8SC2] = (void*)icv##FUNCNAME##_8s_C2##FLAG; \
tab->fn_2d[CV_8SC3] = (void*)icv##FUNCNAME##_8s_C3##FLAG; \
tab->fn_2d[CV_8SC4] = (void*)icv##FUNCNAME##_8s_C4##FLAG; \
\
tab->fn_2d[CV_16UC1] = (void*)icv##FUNCNAME##_16u_C1##FLAG; \
tab->fn_2d[CV_16UC2] = (void*)icv##FUNCNAME##_16u_C2##FLAG; \
tab->fn_2d[CV_16UC3] = (void*)icv##FUNCNAME##_16u_C3##FLAG; \
tab->fn_2d[CV_16UC4] = (void*)icv##FUNCNAME##_16u_C4##FLAG; \
\
tab->fn_2d[CV_16SC1] = (void*)icv##FUNCNAME##_16s_C1##FLAG; \
tab->fn_2d[CV_16SC2] = (void*)icv##FUNCNAME##_16s_C2##FLAG; \
tab->fn_2d[CV_16SC3] = (void*)icv##FUNCNAME##_16s_C3##FLAG; \
tab->fn_2d[CV_16SC4] = (void*)icv##FUNCNAME##_16s_C4##FLAG; \
\
tab->fn_2d[CV_32SC1] = (void*)icv##FUNCNAME##_32s_C1##FLAG; \
tab->fn_2d[CV_32SC2] = (void*)icv##FUNCNAME##_32s_C2##FLAG; \
tab->fn_2d[CV_32SC3] = (void*)icv##FUNCNAME##_32s_C3##FLAG; \
tab->fn_2d[CV_32SC4] = (void*)icv##FUNCNAME##_32s_C4##FLAG; \
\
tab->fn_2d[CV_32FC1] = (void*)icv##FUNCNAME##_32f_C1##FLAG; \
tab->fn_2d[CV_32FC2] = (void*)icv##FUNCNAME##_32f_C2##FLAG; \
tab->fn_2d[CV_32FC3] = (void*)icv##FUNCNAME##_32f_C3##FLAG; \
tab->fn_2d[CV_32FC4] = (void*)icv##FUNCNAME##_32f_C4##FLAG; \
\
tab->fn_2d[CV_64FC1] = (void*)icv##FUNCNAME##_64f_C1##FLAG; \
tab->fn_2d[CV_64FC2] = (void*)icv##FUNCNAME##_64f_C2##FLAG; \
tab->fn_2d[CV_64FC3] = (void*)icv##FUNCNAME##_64f_C3##FLAG; \
tab->fn_2d[CV_64FC4] = (void*)icv##FUNCNAME##_64f_C4##FLAG; \
}
#define CV_DEF_INIT_FUNC_TAB_0D( FUNCNAME ) \
static void icvInit##FUNCNAME##Table( CvFuncTable* tab ) \
{ \
tab->fn_2d[CV_8U] = (void*)icv##FUNCNAME##_8u; \
tab->fn_2d[CV_8S] = (void*)icv##FUNCNAME##_8s; \
tab->fn_2d[CV_16U] = (void*)icv##FUNCNAME##_16u; \
tab->fn_2d[CV_16S] = (void*)icv##FUNCNAME##_16s; \
tab->fn_2d[CV_32S] = (void*)icv##FUNCNAME##_32s; \
tab->fn_2d[CV_32F] = (void*)icv##FUNCNAME##_32f; \
tab->fn_2d[CV_64F] = (void*)icv##FUNCNAME##_64f; \
}
#define CV_DEF_INIT_FUNC_TAB_1D CV_DEF_INIT_FUNC_TAB_0D
#define CV_DEF_INIT_PIXSIZE_TAB_2D( FUNCNAME, FLAG ) \
static void icvInit##FUNCNAME##FLAG##Table( CvBtFuncTable* table ) \
{ \
table->fn_2d[1] = (void*)icv##FUNCNAME##_8u_C1##FLAG; \
table->fn_2d[2] = (void*)icv##FUNCNAME##_8u_C2##FLAG; \
table->fn_2d[3] = (void*)icv##FUNCNAME##_8u_C3##FLAG; \
table->fn_2d[4] = (void*)icv##FUNCNAME##_16u_C2##FLAG; \
table->fn_2d[6] = (void*)icv##FUNCNAME##_16u_C3##FLAG; \
table->fn_2d[8] = (void*)icv##FUNCNAME##_32s_C2##FLAG; \
table->fn_2d[12] = (void*)icv##FUNCNAME##_32s_C3##FLAG; \
table->fn_2d[16] = (void*)icv##FUNCNAME##_64s_C2##FLAG; \
table->fn_2d[24] = (void*)icv##FUNCNAME##_64s_C3##FLAG; \
table->fn_2d[32] = (void*)icv##FUNCNAME##_64s_C4##FLAG; \
}
#define CV_GET_FUNC_PTR( func, table_entry ) \
func = (table_entry); \
\
if( !func ) \
CV_ERROR( CV_StsUnsupportedFormat, "" )
#endif /*_CXCORE_MISC_H_*/

View File

@@ -0,0 +1 @@
*.aps *.plg *.o *.lo Makefile .libs

View File

@@ -0,0 +1,22 @@
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
noinst_LTLIBRARIES = lib_cxcore.la
lib_LTLIBRARIES = libcxcore.la
# convenience library
lib_cxcore_la_SOURCES = cxalloc.cpp cxarithm.cpp cxarray.cpp cxcmp.cpp \
cxconvert.cpp cxcopy.cpp cxdatastructs.cpp cxdrawing.cpp \
cxdxt.cpp cxerror.cpp cximage.cpp cxjacobieigens.cpp cxlogic.cpp cxlut.cpp \
cxmathfuncs.cpp cxmatmul.cpp cxmatrix.cpp cxmean.cpp \
cxmeansdv.cpp cxminmaxloc.cpp cxnorm.cpp cxouttext.cpp \
cxpersistence.cpp cxprecomp.cpp cxrand.cpp cxsumpixels.cpp \
cxsvd.cpp cxswitcher.cpp cxtables.cpp cxutils.cpp
lib_cxcore_la_LDFLAGS = -no-undefined @LDFLAGS@
# real library
libcxcore_la_SOURCES = dummy.cpp
libcxcore_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
libcxcore_la_LIBADD = lib_cxcore.la @LTLIBOBJS@

View File

@@ -0,0 +1,621 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = cxcore/src
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/autotools/aclocal/az_python.m4 \
$(top_srcdir)/autotools/aclocal/pkg.m4 \
$(top_srcdir)/autotools/aclocal/swig_complete.m4 \
$(top_srcdir)/autotools/aclocal/version_at_least.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/autotools/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/cvconfig.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
lib_cxcore_la_LIBADD =
am_lib_cxcore_la_OBJECTS = cxalloc.lo cxarithm.lo cxarray.lo cxcmp.lo \
cxconvert.lo cxcopy.lo cxdatastructs.lo cxdrawing.lo cxdxt.lo \
cxerror.lo cximage.lo cxjacobieigens.lo cxlogic.lo cxlut.lo \
cxmathfuncs.lo cxmatmul.lo cxmatrix.lo cxmean.lo cxmeansdv.lo \
cxminmaxloc.lo cxnorm.lo cxouttext.lo cxpersistence.lo \
cxprecomp.lo cxrand.lo cxsumpixels.lo cxsvd.lo cxswitcher.lo \
cxtables.lo cxutils.lo
lib_cxcore_la_OBJECTS = $(am_lib_cxcore_la_OBJECTS)
libcxcore_la_DEPENDENCIES = lib_cxcore.la @LTLIBOBJS@
am_libcxcore_la_OBJECTS = dummy.lo
libcxcore_la_OBJECTS = $(am_libcxcore_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(lib_cxcore_la_SOURCES) $(libcxcore_la_SOURCES)
DIST_SOURCES = $(lib_cxcore_la_SOURCES) $(libcxcore_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_APPS_FALSE = @BUILD_APPS_FALSE@
BUILD_APPS_TRUE = @BUILD_APPS_TRUE@
BUILD_CARBON_FALSE = @BUILD_CARBON_FALSE@
BUILD_CARBON_TRUE = @BUILD_CARBON_TRUE@
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_GTK_FALSE = @BUILD_GTK_FALSE@
BUILD_GTK_TRUE = @BUILD_GTK_TRUE@
BUILD_PYTHON_WRAPPERS_FALSE = @BUILD_PYTHON_WRAPPERS_FALSE@
BUILD_PYTHON_WRAPPERS_TRUE = @BUILD_PYTHON_WRAPPERS_TRUE@
BUILD_QUICKTIME_FALSE = @BUILD_QUICKTIME_FALSE@
BUILD_QUICKTIME_TRUE = @BUILD_QUICKTIME_TRUE@
BUILD_V4L_FALSE = @BUILD_V4L_FALSE@
BUILD_V4L_TRUE = @BUILD_V4L_TRUE@
BUILD_XINE_FALSE = @BUILD_XINE_FALSE@
BUILD_XINE_TRUE = @BUILD_XINE_TRUE@
CARBON_CFLAGS = @CARBON_CFLAGS@
CARBON_LIBS = @CARBON_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG = @DEBUG@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FFMPEGLIBS = @FFMPEGLIBS@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
IEEE1394LIBS = @IEEE1394LIBS@
IMAGELIBS = @IMAGELIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_VERSION = @LT_VERSION@
MAKEINFO = @MAKEINFO@
MMAJOR = @MMAJOR@
MMINOR = @MMINOR@
MSUBMINOR = @MSUBMINOR@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PYTHON = @PYTHON@
PYTHON_CSPEC = @PYTHON_CSPEC@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_LSPEC = @PYTHON_LSPEC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
QUICKTIME_CFLAGS = @QUICKTIME_CFLAGS@
QUICKTIME_LIBS = @QUICKTIME_LIBS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
SWIG = @SWIG@
SWIG_PYTHON_LIBS = @SWIG_PYTHON_LIBS@
SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@
SWIG_VERSION = @SWIG_VERSION@
UPDATE_SWIG_WRAPPERS_FALSE = @UPDATE_SWIG_WRAPPERS_FALSE@
UPDATE_SWIG_WRAPPERS_TRUE = @UPDATE_SWIG_WRAPPERS_TRUE@
VERSION = @VERSION@
XINE_LIBS = @XINE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
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
noinst_LTLIBRARIES = lib_cxcore.la
lib_LTLIBRARIES = libcxcore.la
# convenience library
lib_cxcore_la_SOURCES = cxalloc.cpp cxarithm.cpp cxarray.cpp cxcmp.cpp \
cxconvert.cpp cxcopy.cpp cxdatastructs.cpp cxdrawing.cpp \
cxdxt.cpp cxerror.cpp cximage.cpp cxjacobieigens.cpp cxlogic.cpp cxlut.cpp \
cxmathfuncs.cpp cxmatmul.cpp cxmatrix.cpp cxmean.cpp \
cxmeansdv.cpp cxminmaxloc.cpp cxnorm.cpp cxouttext.cpp \
cxpersistence.cpp cxprecomp.cpp cxrand.cpp cxsumpixels.cpp \
cxsvd.cpp cxswitcher.cpp cxtables.cpp cxutils.cpp
lib_cxcore_la_LDFLAGS = -no-undefined @LDFLAGS@
# real library
libcxcore_la_SOURCES = dummy.cpp
libcxcore_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
libcxcore_la_LIBADD = lib_cxcore.la @LTLIBOBJS@
all: all-am
.SUFFIXES:
.SUFFIXES: .c .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cxcore/src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu cxcore/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
lib_cxcore.la: $(lib_cxcore_la_OBJECTS) $(lib_cxcore_la_DEPENDENCIES)
$(CXXLINK) $(lib_cxcore_la_LDFLAGS) $(lib_cxcore_la_OBJECTS) $(lib_cxcore_la_LIBADD) $(LIBS)
libcxcore.la: $(libcxcore_la_OBJECTS) $(libcxcore_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libcxcore_la_LDFLAGS) $(libcxcore_la_OBJECTS) $(libcxcore_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxalloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxarithm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxarray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxcmp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxconvert.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxcopy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxdatastructs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxdrawing.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxdxt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxerror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cximage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxjacobieigens.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxlogic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxlut.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmathfuncs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmatmul.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmatrix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmean.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxmeansdv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxminmaxloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxnorm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxouttext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxpersistence.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxprecomp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxrand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxsumpixels.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxsvd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxswitcher.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxtables.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxutils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-info-am uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,346 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CXCORE_INTERNAL_H_
#define _CXCORE_INTERNAL_H_
#if defined _MSC_VER && _MSC_VER >= 1200
/* disable warnings related to inline functions */
#pragma warning( disable: 4711 4710 4514 )
#endif
typedef unsigned long ulong;
#ifdef __BORLANDC__
#define WIN32
#define CV_DLL
#undef _CV_ALWAYS_PROFILE_
#define _CV_ALWAYS_NO_PROFILE_
#endif
#include "cxcore.h"
#include "cxmisc.h"
#include "_cxipp.h"
#include <math.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>
// -128.f ... 255.f
extern const float icv8x32fTab[];
#define CV_8TO32F(x) icv8x32fTab[(x)+128]
extern const ushort icv8x16uSqrTab[];
#define CV_SQR_8U(x) icv8x16uSqrTab[(x)+255]
extern const char* icvHersheyGlyphs[];
extern const signed char icvDepthToType[];
#define icvIplToCvDepth( depth ) \
icvDepthToType[(((depth) & 255) >> 2) + ((depth) < 0)]
extern const uchar icvSaturate8u[];
#define CV_FAST_CAST_8U(t) (assert(-256 <= (t) && (t) <= 512), icvSaturate8u[(t)+256])
#define CV_MIN_8U(a,b) ((a) - CV_FAST_CAST_8U((a) - (b)))
#define CV_MAX_8U(a,b) ((a) + CV_FAST_CAST_8U((b) - (a)))
typedef CvFunc2D_3A1I CvArithmBinMaskFunc2D;
typedef CvFunc2D_2A1P1I CvArithmUniMaskFunc2D;
/****************************************************************************************\
* Complex arithmetics *
\****************************************************************************************/
struct CvComplex32f;
struct CvComplex64f;
struct CvComplex32f
{
float re, im;
CvComplex32f() {}
CvComplex32f( float _re, float _im=0 ) : re(_re), im(_im) {}
explicit CvComplex32f( const CvComplex64f& v );
//CvComplex32f( const CvComplex32f& v ) : re(v.re), im(v.im) {}
//CvComplex32f& operator = (const CvComplex32f& v ) { re = v.re; im = v.im; return *this; }
operator CvComplex64f() const;
};
struct CvComplex64f
{
double re, im;
CvComplex64f() {}
CvComplex64f( double _re, double _im=0 ) : re(_re), im(_im) {}
explicit CvComplex64f( const CvComplex32f& v );
//CvComplex64f( const CvComplex64f& v ) : re(v.re), im(v.im) {}
//CvComplex64f& operator = (const CvComplex64f& v ) { re = v.re; im = v.im; return *this; }
operator CvComplex32f() const;
};
inline CvComplex32f::CvComplex32f( const CvComplex64f& v ) : re((float)v.re), im((float)v.im) {}
inline CvComplex64f::CvComplex64f( const CvComplex32f& v ) : re(v.re), im(v.im) {}
inline CvComplex32f operator + (CvComplex32f a, CvComplex32f b)
{
return CvComplex32f( a.re + b.re, a.im + b.im );
}
inline CvComplex32f& operator += (CvComplex32f& a, CvComplex32f b)
{
a.re += b.re;
a.im += b.im;
return a;
}
inline CvComplex32f operator - (CvComplex32f a, CvComplex32f b)
{
return CvComplex32f( a.re - b.re, a.im - b.im );
}
inline CvComplex32f& operator -= (CvComplex32f& a, CvComplex32f b)
{
a.re -= b.re;
a.im -= b.im;
return a;
}
inline CvComplex32f operator - (CvComplex32f a)
{
return CvComplex32f( -a.re, -a.im );
}
inline CvComplex32f operator * (CvComplex32f a, CvComplex32f b)
{
return CvComplex32f( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
}
inline double abs(CvComplex32f a)
{
return sqrt( (double)a.re*a.re + (double)a.im*a.im );
}
inline CvComplex32f conj(CvComplex32f a)
{
return CvComplex32f( a.re, -a.im );
}
inline CvComplex32f operator / (CvComplex32f a, CvComplex32f b)
{
double t = 1./((double)b.re*b.re + (double)b.im*b.im);
return CvComplex32f( (float)((a.re*b.re + a.im*b.im)*t),
(float)((-a.re*b.im + a.im*b.re)*t) );
}
inline CvComplex32f operator * (double a, CvComplex32f b)
{
return CvComplex32f( (float)(a*b.re), (float)(a*b.im) );
}
inline CvComplex32f operator * (CvComplex32f a, double b)
{
return CvComplex32f( (float)(a.re*b), (float)(a.im*b) );
}
inline CvComplex32f::operator CvComplex64f() const
{
return CvComplex64f(re,im);
}
inline CvComplex64f operator + (CvComplex64f a, CvComplex64f b)
{
return CvComplex64f( a.re + b.re, a.im + b.im );
}
inline CvComplex64f& operator += (CvComplex64f& a, CvComplex64f b)
{
a.re += b.re;
a.im += b.im;
return a;
}
inline CvComplex64f operator - (CvComplex64f a, CvComplex64f b)
{
return CvComplex64f( a.re - b.re, a.im - b.im );
}
inline CvComplex64f& operator -= (CvComplex64f& a, CvComplex64f b)
{
a.re -= b.re;
a.im -= b.im;
return a;
}
inline CvComplex64f operator - (CvComplex64f a)
{
return CvComplex64f( -a.re, -a.im );
}
inline CvComplex64f operator * (CvComplex64f a, CvComplex64f b)
{
return CvComplex64f( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
}
inline double abs(CvComplex64f a)
{
return sqrt( (double)a.re*a.re + (double)a.im*a.im );
}
inline CvComplex64f operator / (CvComplex64f a, CvComplex64f b)
{
double t = 1./((double)b.re*b.re + (double)b.im*b.im);
return CvComplex64f( (a.re*b.re + a.im*b.im)*t,
(-a.re*b.im + a.im*b.re)*t );
}
inline CvComplex64f operator * (double a, CvComplex64f b)
{
return CvComplex64f( a*b.re, a*b.im );
}
inline CvComplex64f operator * (CvComplex64f a, double b)
{
return CvComplex64f( a.re*b, a.im*b );
}
inline CvComplex64f::operator CvComplex32f() const
{
return CvComplex32f((float)re,(float)im);
}
inline CvComplex64f conj(CvComplex64f a)
{
return CvComplex64f( a.re, -a.im );
}
inline CvComplex64f operator + (CvComplex64f a, CvComplex32f b)
{
return CvComplex64f( a.re + b.re, a.im + b.im );
}
inline CvComplex64f operator + (CvComplex32f a, CvComplex64f b)
{
return CvComplex64f( a.re + b.re, a.im + b.im );
}
inline CvComplex64f operator - (CvComplex64f a, CvComplex32f b)
{
return CvComplex64f( a.re - b.re, a.im - b.im );
}
inline CvComplex64f operator - (CvComplex32f a, CvComplex64f b)
{
return CvComplex64f( a.re - b.re, a.im - b.im );
}
inline CvComplex64f operator * (CvComplex64f a, CvComplex32f b)
{
return CvComplex64f( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
}
inline CvComplex64f operator * (CvComplex32f a, CvComplex64f b)
{
return CvComplex64f( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
}
typedef CvStatus (CV_STDCALL * CvCopyMaskFunc)(const void* src, int src_step,
void* dst, int dst_step, CvSize size,
const void* mask, int mask_step);
CvCopyMaskFunc icvGetCopyMaskFunc( int elem_size );
CvStatus CV_STDCALL icvSetZero_8u_C1R( uchar* dst, int dststep, CvSize size );
CvStatus CV_STDCALL icvScale_32f( const float* src, float* dst, int len, float a, float b );
CvStatus CV_STDCALL icvScale_64f( const double* src, double* dst, int len, double a, double b );
CvStatus CV_STDCALL icvLUT_Transform8u_8u_C1R( const uchar* src, int srcstep, uchar* dst,
int dststep, CvSize size, const uchar* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_16u_C1R( const uchar* src, int srcstep, ushort* dst,
int dststep, CvSize size, const ushort* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_32s_C1R( const uchar* src, int srcstep, int* dst,
int dststep, CvSize size, const int* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_64f_C1R( const uchar* src, int srcstep, double* dst,
int dststep, CvSize size, const double* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_8u_C2R( const uchar* src, int srcstep, uchar* dst,
int dststep, CvSize size, const uchar* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_8u_C3R( const uchar* src, int srcstep, uchar* dst,
int dststep, CvSize size, const uchar* lut );
CvStatus CV_STDCALL icvLUT_Transform8u_8u_C4R( const uchar* src, int srcstep, uchar* dst,
int dststep, CvSize size, const uchar* lut );
typedef CvStatus (CV_STDCALL * CvLUT_TransformFunc)( const void* src, int srcstep, void* dst,
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 )
{
return icvLUT_Transform8u_8u_C1R( src, srcstep, (uchar*)dst,
dststep, size, (const uchar*)lut );
}
CV_INLINE CvStatus
icvLUT_Transform8u_16s_C1R( const uchar* src, int srcstep, short* dst,
int dststep, CvSize size, const short* lut )
{
return icvLUT_Transform8u_16u_C1R( src, srcstep, (ushort*)dst,
dststep, size, (const ushort*)lut );
}
CV_INLINE CvStatus
icvLUT_Transform8u_32f_C1R( const uchar* src, int srcstep, float* dst,
int dststep, CvSize size, const float* lut )
{
return icvLUT_Transform8u_32s_C1R( src, srcstep, (int*)dst,
dststep, size, (const int*)lut );
}
#endif /*_CXCORE_INTERNAL_H_*/

View File

@@ -0,0 +1,667 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CXCORE_IPP_H_
#define _CXCORE_IPP_H_
/****************************************************************************************\
* Copy/Set *
\****************************************************************************************/
/* temporary disable ipp zero and copy functions as they affect subsequent functions' performance */
IPCVAPI_EX( CvStatus, icvCopy_8u_C1R, "ippiCopy_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,
( const uchar* src, int src_step,
uchar* dst, int dst_step, CvSize size ))
IPCVAPI_EX( CvStatus, icvSetByte_8u_C1R, "ippiSet_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,
( uchar value, uchar* dst, int dst_step, CvSize size ))
IPCVAPI_EX( CvStatus, icvCvt_32f64f, "ippsConvert_32f64f",
CV_PLUGINS1(CV_PLUGIN_IPPS), ( const float* src, double* dst, int len ))
IPCVAPI_EX( CvStatus, icvCvt_64f32f, "ippsConvert_64f32f",
CV_PLUGINS1(CV_PLUGIN_IPPS), ( const double* src, float* dst, int len ))
#define IPCV_COPYSET( flavor, arrtype, scalartype ) \
IPCVAPI_EX( CvStatus, icvCopy##flavor, "ippiCopy" #flavor, \
CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* src, int srcstep, \
arrtype* dst, int dststep, CvSize size, \
const uchar* mask, int maskstep )) \
IPCVAPI_EX( CvStatus, icvSet##flavor, "ippiSet" #flavor, \
0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( arrtype* dst, int dststep, \
const uchar* mask, int maskstep, \
CvSize size, const arrtype* scalar ))
IPCV_COPYSET( _8u_C1MR, uchar, int )
IPCV_COPYSET( _16s_C1MR, ushort, int )
IPCV_COPYSET( _8u_C3MR, uchar, int )
IPCV_COPYSET( _8u_C4MR, int, int )
IPCV_COPYSET( _16s_C3MR, ushort, int )
IPCV_COPYSET( _16s_C4MR, int64, int64 )
IPCV_COPYSET( _32f_C3MR, int, int )
IPCV_COPYSET( _32f_C4MR, int, int )
IPCV_COPYSET( _64s_C3MR, int64, int64 )
IPCV_COPYSET( _64s_C4MR, int64, int64 )
/****************************************************************************************\
* Arithmetics *
\****************************************************************************************/
#define IPCV_BIN_ARITHM( name ) \
IPCVAPI_EX( CvStatus, icv##name##_8u_C1R, \
"ippi" #name "_8u_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const uchar* src1, int srcstep1, const uchar* src2, int srcstep2, \
uchar* dst, int dststep, CvSize size, int scalefactor )) \
IPCVAPI_EX( CvStatus, icv##name##_16u_C1R, \
"ippi" #name "_16u_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const ushort* src1, int srcstep1, const ushort* src2, int srcstep2,\
ushort* dst, int dststep, CvSize size, int scalefactor )) \
IPCVAPI_EX( CvStatus, icv##name##_16s_C1R, \
"ippi" #name "_16s_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const short* src1, int srcstep1, const short* src2, int srcstep2, \
short* dst, int dststep, CvSize size, int scalefactor )) \
IPCVAPI_EX( CvStatus, icv##name##_32s_C1R, \
"ippi" #name "_32s_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const int* src1, int srcstep1, const int* src2, int srcstep2, \
int* dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icv##name##_32f_C1R, \
"ippi" #name "_32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const float* src1, int srcstep1, const float* src2, int srcstep2, \
float* dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icv##name##_64f_C1R, \
"ippi" #name "_64f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const double* src1, int srcstep1, const double* src2, int srcstep2,\
double* dst, int dststep, CvSize size ))
IPCV_BIN_ARITHM( Add )
IPCV_BIN_ARITHM( Sub )
#undef IPCV_BIN_ARITHM
/****************************************************************************************\
* Logical operations *
\****************************************************************************************/
#define IPCV_LOGIC( name ) \
IPCVAPI_EX( CvStatus, icv##name##_8u_C1R, \
"ippi" #name "_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const uchar* src1, int srcstep1, const uchar* src2, int srcstep2, \
uchar* dst, int dststep, CvSize size ))
IPCV_LOGIC( And )
IPCV_LOGIC( Or )
IPCV_LOGIC( Xor )
#undef IPCV_LOGIC
IPCVAPI_EX( CvStatus, icvNot_8u_C1R, "ippiNot_8u_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),
( const uchar* src, int step1, uchar* dst, int step, CvSize size ))
/****************************************************************************************\
* Image Statistics *
\****************************************************************************************/
///////////////////////////////////////// Mean //////////////////////////////////////////
#define IPCV_DEF_MEAN_MASK( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvMean_##flavor##_C1MR, \
"ippiMean_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img, int imgstep, const uchar* mask, \
int maskStep, CvSize size, double* mean )) \
IPCVAPI_EX( CvStatus, icvMean_##flavor##_C2MR, \
"ippiMean_" #flavor "_C2MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const srctype* img, int imgstep, const uchar* mask, \
int maskStep, CvSize size, double* mean )) \
IPCVAPI_EX( CvStatus, icvMean_##flavor##_C3MR, \
"ippiMean_" #flavor "_C3MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const srctype* img, int imgstep, const uchar* mask, \
int maskStep, CvSize size, double* mean )) \
IPCVAPI_EX( CvStatus, icvMean_##flavor##_C4MR, \
"ippiMean_" #flavor "_C4MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const srctype* img, int imgstep, const uchar* mask, \
int maskStep, CvSize size, double* mean ))
IPCV_DEF_MEAN_MASK( 8u, uchar )
IPCV_DEF_MEAN_MASK( 16u, ushort )
IPCV_DEF_MEAN_MASK( 16s, short )
IPCV_DEF_MEAN_MASK( 32s, int )
IPCV_DEF_MEAN_MASK( 32f, float )
IPCV_DEF_MEAN_MASK( 64f, double )
#undef IPCV_DEF_MEAN_MASK
//////////////////////////////////// Mean_StdDev ////////////////////////////////////////
#undef IPCV_MEAN_SDV_PLUGIN
#define ICV_MEAN_SDV_PLUGIN 0 /* CV_PLUGINS1(IPPCV) */
#define IPCV_DEF_MEAN_SDV( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C1R, \
"ippiMean_StdDev_" #flavor "_C1R", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C2R, \
"ippiMean_StdDev_" #flavor "_C2R", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C3R, \
"ippiMean_StdDev_" #flavor "_C3R", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C4R, \
"ippiMean_StdDev_" #flavor "_C4R", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
\
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C1MR, \
"ippiMean_StdDev_" #flavor "_C1MR", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, \
const uchar* mask, int maskStep, \
CvSize size, double* mean, double* sdv )) \
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C2MR, \
"ippiMean_StdDev_" #flavor "_C2MR", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, const uchar* mask, int maskStep, \
CvSize size, double* mean, double* sdv )) \
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C3MR, \
"ippiMean_StdDev_" #flavor "_C3MR", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, \
const uchar* mask, int maskStep, \
CvSize size, double* mean, double* sdv )) \
IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C4MR, \
"ippiMean_StdDev_" #flavor "_C4MR", ICV_MEAN_SDV_PLUGIN, \
( const srctype* img, int imgstep, \
const uchar* mask, int maskStep, \
CvSize size, double* mean, double* sdv ))
IPCV_DEF_MEAN_SDV( 8u, uchar )
IPCV_DEF_MEAN_SDV( 16u, ushort )
IPCV_DEF_MEAN_SDV( 16s, short )
IPCV_DEF_MEAN_SDV( 32s, int )
IPCV_DEF_MEAN_SDV( 32f, float )
IPCV_DEF_MEAN_SDV( 64f, double )
#undef IPCV_DEF_MEAN_SDV
#undef IPCV_MEAN_SDV_PLUGIN
//////////////////////////////////// MinMaxIndx /////////////////////////////////////////
#define IPCV_DEF_MIN_MAX_LOC( flavor, srctype, extrtype ) \
IPCVAPI_EX( CvStatus, icvMinMaxIndx_##flavor##_C1R, \
"ippiMinMaxIndx_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img, int imgstep, \
CvSize size, extrtype* minVal, extrtype* maxVal, \
CvPoint* minLoc, CvPoint* maxLoc )) \
\
IPCVAPI_EX( CvStatus, icvMinMaxIndx_##flavor##_C1MR, \
"ippiMinMaxIndx_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV),\
( const srctype* img, int imgstep, \
const uchar* mask, int maskStep, \
CvSize size, extrtype* minVal, extrtype* maxVal, \
CvPoint* minLoc, CvPoint* maxLoc ))
IPCV_DEF_MIN_MAX_LOC( 8u, uchar, float )
IPCV_DEF_MIN_MAX_LOC( 16u, ushort, float )
IPCV_DEF_MIN_MAX_LOC( 16s, short, float )
IPCV_DEF_MIN_MAX_LOC( 32s, int, double )
IPCV_DEF_MIN_MAX_LOC( 32f, int, float )
IPCV_DEF_MIN_MAX_LOC( 64f, int64, double )
#undef IPCV_DEF_MIN_MAX_LOC
////////////////////////////////////////// Sum //////////////////////////////////////////
#define IPCV_DEF_SUM_NOHINT( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C1R, \
"ippiSum_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C2R, \
"ippiSum_" #flavor "_C2R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C3R, \
"ippiSum_" #flavor "_C3R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C4R, \
"ippiSum_" #flavor "_C4R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum ))
#define IPCV_DEF_SUM_NOHINT_NO_IPP( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C1R, \
"ippiSum_" #flavor "_C1R", 0, \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C2R, \
"ippiSum_" #flavor "_C2R", 0, \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C3R, \
"ippiSum_" #flavor "_C3R", 0, \
( const srctype* img, int imgstep, \
CvSize size, double* sum )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C4R, \
"ippiSum_" #flavor "_C4R", 0, \
( const srctype* img, int imgstep, \
CvSize size, double* sum ))
#define IPCV_DEF_SUM_HINT( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C1R, \
"ippiSum_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C2R, \
"ippiSum_" #flavor "_C2R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C3R, \
"ippiSum_" #flavor "_C3R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvSum_##flavor##_C4R, \
"ippiSum_" #flavor "_C4R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* sum, CvHintAlgorithm ))
IPCV_DEF_SUM_NOHINT( 8u, uchar )
IPCV_DEF_SUM_NOHINT( 16s, short )
IPCV_DEF_SUM_NOHINT_NO_IPP( 16u, ushort )
IPCV_DEF_SUM_NOHINT( 32s, int )
IPCV_DEF_SUM_HINT( 32f, float )
IPCV_DEF_SUM_NOHINT( 64f, double )
#undef IPCV_DEF_SUM_NOHINT
#undef IPCV_DEF_SUM_HINT
////////////////////////////////////////// CountNonZero /////////////////////////////////
#define IPCV_DEF_NON_ZERO( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvCountNonZero_##flavor##_C1R, \
"ippiCountNonZero_" #flavor "_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const srctype* img, int imgstep, CvSize size, int* nonzero ))
IPCV_DEF_NON_ZERO( 8u, uchar )
IPCV_DEF_NON_ZERO( 16s, ushort )
IPCV_DEF_NON_ZERO( 32s, int )
IPCV_DEF_NON_ZERO( 32f, int )
IPCV_DEF_NON_ZERO( 64f, int64 )
#undef IPCV_DEF_NON_ZERO
////////////////////////////////////////// Norms /////////////////////////////////
#define IPCV_DEF_NORM_NOHINT_C1( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1R, \
"ippiNorm_Inf_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1R, \
"ippiNorm_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1R, \
"ippiNorm_L2_" #flavor "_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const srctype* img, int imgstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1R, \
"ippiNormDiff_Inf_" #flavor "_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1R, \
"ippiNormDiff_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1R, \
"ippiNormDiff_L2_" #flavor "_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm ))
#define IPCV_DEF_NORM_HINT_C1( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1R, \
"ippiNorm_Inf_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1R, \
"ippiNorm_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* norm, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1R, \
"ippiNorm_L2_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img, int imgstep, \
CvSize size, double* norm, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1R, \
"ippiNormDiff_Inf_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1R, \
"ippiNormDiff_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm, CvHintAlgorithm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1R, \
"ippiNormDiff_L2_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
CvSize size, double* norm, CvHintAlgorithm ))
#define IPCV_DEF_NORM_MASK_C1( flavor, srctype ) \
IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1MR, \
"ippiNorm_Inf_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img, int imgstep, \
const uchar* mask, int maskstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1MR, \
"ippiNorm_L1_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img, int imgstep, \
const uchar* mask, int maskstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1MR, \
"ippiNorm_L2_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img, int imgstep, \
const uchar* mask, int maskstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1MR, \
"ippiNormDiff_Inf_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
const uchar* mask, int maskstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1MR, \
"ippiNormDiff_L1_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
const uchar* mask, int maskstep, \
CvSize size, double* norm )) \
IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1MR, \
"ippiNormDiff_L2_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
( const srctype* img1, int imgstep1, \
const srctype* img2, int imgstep2, \
const uchar* mask, int maskstep, \
CvSize size, double* norm ))
IPCV_DEF_NORM_NOHINT_C1( 8u, uchar )
IPCV_DEF_NORM_MASK_C1( 8u, uchar )
IPCV_DEF_NORM_NOHINT_C1( 16u, ushort )
IPCV_DEF_NORM_MASK_C1( 16u, ushort )
IPCV_DEF_NORM_NOHINT_C1( 16s, short )
IPCV_DEF_NORM_MASK_C1( 16s, short )
IPCV_DEF_NORM_NOHINT_C1( 32s, int )
IPCV_DEF_NORM_MASK_C1( 32s, int )
IPCV_DEF_NORM_HINT_C1( 32f, float )
IPCV_DEF_NORM_MASK_C1( 32f, float )
IPCV_DEF_NORM_NOHINT_C1( 64f, double )
IPCV_DEF_NORM_MASK_C1( 64f, double )
#undef IPCV_DEF_NORM_HONINT_C1
#undef IPCV_DEF_NORM_HINT_C1
#undef IPCV_DEF_NORM_MASK_C1
////////////////////////////////////// AbsDiff ///////////////////////////////////////////
#define IPCV_ABS_DIFF( flavor, arrtype ) \
IPCVAPI_EX( CvStatus, icvAbsDiff_##flavor##_C1R, \
"ippiAbsDiff_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV),\
( const arrtype* src1, int srcstep1, \
const arrtype* src2, int srcstep2, \
arrtype* dst, int dststep, CvSize size ))
IPCV_ABS_DIFF( 8u, uchar )
IPCV_ABS_DIFF( 16u, ushort )
IPCV_ABS_DIFF( 16s, short )
IPCV_ABS_DIFF( 32s, int )
IPCV_ABS_DIFF( 32f, float )
IPCV_ABS_DIFF( 64f, double )
#undef IPCV_ABS_DIFF
////////////////////////////// Comparisons //////////////////////////////////////////
#define IPCV_CMP( arrtype, flavor ) \
IPCVAPI_EX( CvStatus, icvCompare_##flavor##_C1R, \
"ippiCompare_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* src1, int srcstep1, const arrtype* src2, int srcstep2, \
arrtype* dst, int dststep, CvSize size, int cmp_op )) \
IPCVAPI_EX( CvStatus, icvCompareC_##flavor##_C1R, \
"ippiCompareC_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* src1, int srcstep1, arrtype scalar, \
arrtype* dst, int dststep, CvSize size, int cmp_op )) \
IPCVAPI_EX( CvStatus, icvThreshold_GT_##flavor##_C1R, \
"ippiThreshold_GT_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* pSrc, int srcstep, arrtype* pDst, int dststep, \
CvSize size, arrtype threshold )) \
IPCVAPI_EX( CvStatus, icvThreshold_LT_##flavor##_C1R, \
"ippiThreshold_LT_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* pSrc, int srcstep, arrtype* pDst, int dststep, \
CvSize size, arrtype threshold ))
IPCV_CMP( uchar, 8u )
IPCV_CMP( short, 16s )
IPCV_CMP( float, 32f )
#undef IPCV_CMP
/****************************************************************************************\
* Utilities *
\****************************************************************************************/
////////////////////////////// Copy Pixel <-> Plane /////////////////////////////////
#define IPCV_PIX_PLANE( flavor, arrtype ) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C2P2R, \
"ippiCopy_" #flavor "_C2P2R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C3P3R, \
"ippiCopy_" #flavor "_C3P3R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C4P4R, \
"ippiCopy_" #flavor "_C4P4R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_CnC1CR, \
"ippiCopy_" #flavor "_CnC1CR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const arrtype* src, int srcstep, arrtype* dst, int dststep, \
CvSize size, int cn, int coi )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C1CnCR, \
"ippiCopy_" #flavor "_CnC1CR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
( const arrtype* src, int srcstep, arrtype* dst, int dststep, \
CvSize size, int cn, int coi )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P2C2R, \
"ippiCopy_" #flavor "_P2C2R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/, \
( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P3C3R, \
"ippiCopy_" #flavor "_P3C3R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size )) \
IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P4C4R, \
"ippiCopy_" #flavor "_P4C4R", CV_PLUGINS1(CV_PLUGIN_IPPI), \
( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size ))
IPCV_PIX_PLANE( 8u, uchar )
IPCV_PIX_PLANE( 16s, ushort )
IPCV_PIX_PLANE( 32f, int )
IPCV_PIX_PLANE( 64f, int64 )
#undef IPCV_PIX_PLANE
/****************************************************************************************/
/* Math routines and RNGs */
/****************************************************************************************/
IPCVAPI_EX( CvStatus, icvInvSqrt_32f, "ippsInvSqrt_32f_A21",
CV_PLUGINS1(CV_PLUGIN_IPPVM),
( const float* src, float* dst, int len ))
IPCVAPI_EX( CvStatus, icvSqrt_32f, "ippsSqrt_32f_A21, ippsSqrt_32f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const float* src, float* dst, int len ))
IPCVAPI_EX( CvStatus, icvInvSqrt_64f, "ippsInvSqrt_64f_A50",
CV_PLUGINS1(CV_PLUGIN_IPPVM),
( const double* src, double* dst, int len ))
IPCVAPI_EX( CvStatus, icvSqrt_64f, "ippsSqrt_64f_A50, ippsSqrt_64f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const double* src, double* dst, int len ))
IPCVAPI_EX( CvStatus, icvLog_32f, "ippsLn_32f_A21, ippsLn_32f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const float *x, float *y, int n ) )
IPCVAPI_EX( CvStatus, icvLog_64f, "ippsLn_64f_A50, ippsLn_64f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const double *x, double *y, int n ) )
IPCVAPI_EX( CvStatus, icvExp_32f, "ippsExp_32f_A21, ippsExp_32f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const float *x, float *y, int n ) )
IPCVAPI_EX( CvStatus, icvExp_64f, "ippsExp_64f_A50, ippsExp_64f",
CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
( const double *x, double *y, int n ) )
IPCVAPI_EX( CvStatus, icvFastArctan_32f, "ippibFastArctan_32f",
CV_PLUGINS1(CV_PLUGIN_IPPCV),
( const float* y, const float* x, float* angle, int len ))
/****************************************************************************************/
/* Error handling functions */
/****************************************************************************************/
IPCVAPI_EX( CvStatus, icvCheckArray_32f_C1R,
"ippiCheckArray_32f_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,
( const float* src, int srcstep,
CvSize size, int flags,
double min_val, double max_val ))
IPCVAPI_EX( CvStatus, icvCheckArray_64f_C1R,
"ippiCheckArray_64f_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,
( const double* src, int srcstep,
CvSize size, int flags,
double min_val, double max_val ))
/****************************************************************************************/
/* Affine transformations of matrix/image elements */
/****************************************************************************************/
#define IPCV_TRANSFORM( suffix, ipp_suffix, cn ) \
IPCVAPI_EX( CvStatus, icvColorTwist##suffix##_C##cn##R, \
"ippiColorTwist" #ipp_suffix "_C" #cn \
"R,ippiColorTwist" #ipp_suffix "_C" #cn "R", \
CV_PLUGINS2(CV_PLUGIN_IPPI, CV_PLUGIN_IPPCC), \
( const void* src, int srcstep, void* dst, int dststep, \
CvSize roisize, const float* twist_matrix ))
IPCV_TRANSFORM( _8u, 32f_8u, 3 )
IPCV_TRANSFORM( _16u, 32f_16u, 3 )
IPCV_TRANSFORM( _16s, 32f_16s, 3 )
IPCV_TRANSFORM( _32f, _32f, 3 )
IPCV_TRANSFORM( _32f, _32f, 4 )
#undef IPCV_TRANSFORM
#define IPCV_TRANSFORM_N1( suffix ) \
IPCVAPI_EX( CvStatus, icvColorToGray##suffix, \
"ippiColorToGray" #suffix ",ippiColorToGray" #suffix, \
CV_PLUGINS2(CV_PLUGIN_IPPI,CV_PLUGIN_IPPCC), \
( const void* src, int srcstep, void* dst, int dststep, \
CvSize roisize, const float* coeffs ))
IPCV_TRANSFORM_N1( _8u_C3C1R )
IPCV_TRANSFORM_N1( _16u_C3C1R )
IPCV_TRANSFORM_N1( _16s_C3C1R )
IPCV_TRANSFORM_N1( _32f_C3C1R )
IPCV_TRANSFORM_N1( _8u_AC4C1R )
IPCV_TRANSFORM_N1( _16u_AC4C1R )
IPCV_TRANSFORM_N1( _16s_AC4C1R )
IPCV_TRANSFORM_N1( _32f_AC4C1R )
#undef IPCV_TRANSFORM_N1
/****************************************************************************************/
/* Matrix routines from BLAS/LAPACK compatible libraries */
/****************************************************************************************/
IPCVAPI_C_EX( void, icvBLAS_GEMM_32f, "sgemm, mkl_sgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
(const char *transa, const char *transb, int *n, int *m, int *k,
const void *alpha, const void *a, int *lda, const void *b, int *ldb,
const void *beta, void *c, int *ldc ))
IPCVAPI_C_EX( void, icvBLAS_GEMM_64f, "dgemm, mkl_dgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
(const char *transa, const char *transb, int *n, int *m, int *k,
const void *alpha, const void *a, int *lda, const void *b, int *ldb,
const void *beta, void *c, int *ldc ))
IPCVAPI_C_EX( void, icvBLAS_GEMM_32fc, "cgemm, mkl_cgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
(const char *transa, const char *transb, int *n, int *m, int *k,
const void *alpha, const void *a, int *lda, const void *b, int *ldb,
const void *beta, void *c, int *ldc ))
IPCVAPI_C_EX( void, icvBLAS_GEMM_64fc, "zgemm, mkl_zgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
(const char *transa, const char *transb, int *n, int *m, int *k,
const void *alpha, const void *a, int *lda, const void *b, int *ldb,
const void *beta, void *c, int *ldc ))
#define IPCV_DFT( init_flavor, fwd_flavor, inv_flavor ) \
IPCVAPI_EX( CvStatus, icvDFTInitAlloc_##init_flavor, "ippsDFTInitAlloc_" #init_flavor, \
CV_PLUGINS1(CV_PLUGIN_IPPS), ( void**, int, int, CvHintAlgorithm )) \
\
IPCVAPI_EX( CvStatus, icvDFTFree_##init_flavor, "ippsDFTFree_" #init_flavor, \
CV_PLUGINS1(CV_PLUGIN_IPPS), ( void* )) \
\
IPCVAPI_EX( CvStatus, icvDFTGetBufSize_##init_flavor, "ippsDFTGetBufSize_" #init_flavor,\
CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* spec, int* buf_size )) \
\
IPCVAPI_EX( CvStatus, icvDFTFwd_##fwd_flavor, "ippsDFTFwd_" #fwd_flavor, \
CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* src, void* dst, \
const void* spec, void* buffer )) \
\
IPCVAPI_EX( CvStatus, icvDFTInv_##inv_flavor, "ippsDFTInv_" #inv_flavor, \
CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* src, void* dst, \
const void* spec, void* buffer ))
IPCV_DFT( C_32fc, CToC_32fc, CToC_32fc )
IPCV_DFT( R_32f, RToPack_32f, PackToR_32f )
IPCV_DFT( C_64fc, CToC_64fc, CToC_64fc )
IPCV_DFT( R_64f, RToPack_64f, PackToR_64f )
#undef IPCV_DFT
#endif /*_CXCORE_IPP_H_*/

View File

@@ -0,0 +1,135 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
// default <malloc>
static void*
icvDefaultAlloc( size_t size, void* )
{
char *ptr, *ptr0 = (char*)malloc(
(size_t)(size + CV_MALLOC_ALIGN*((size >= 4096) + 1) + sizeof(char*)));
if( !ptr0 )
return 0;
// align the pointer
ptr = (char*)cvAlignPtr(ptr0 + sizeof(char*) + 1, CV_MALLOC_ALIGN);
*(char**)(ptr - sizeof(char*)) = ptr0;
return ptr;
}
// default <free>
static int
icvDefaultFree( void* ptr, void* )
{
// Pointer must be aligned by CV_MALLOC_ALIGN
if( ((size_t)ptr & (CV_MALLOC_ALIGN-1)) != 0 )
return CV_BADARG_ERR;
free( *((char**)ptr - 1) );
return CV_OK;
}
// pointers to allocation functions, initially set to default
static CvAllocFunc p_cvAlloc = icvDefaultAlloc;
static CvFreeFunc p_cvFree = icvDefaultFree;
static void* p_cvAllocUserData = 0;
CV_IMPL void cvSetMemoryManager( CvAllocFunc alloc_func, CvFreeFunc free_func, void* userdata )
{
CV_FUNCNAME( "cvSetMemoryManager" );
__BEGIN__;
if( (alloc_func == 0) ^ (free_func == 0) )
CV_ERROR( CV_StsNullPtr, "Either both pointers should be NULL or none of them");
p_cvAlloc = alloc_func ? alloc_func : icvDefaultAlloc;
p_cvFree = free_func ? free_func : icvDefaultFree;
p_cvAllocUserData = userdata;
__END__;
}
CV_IMPL void* cvAlloc( size_t size )
{
void* ptr = 0;
CV_FUNCNAME( "cvAlloc" );
__BEGIN__;
if( (size_t)size > CV_MAX_ALLOC_SIZE )
CV_ERROR( CV_StsOutOfRange,
"Negative or too large argument of cvAlloc function" );
ptr = p_cvAlloc( size, p_cvAllocUserData );
if( !ptr )
CV_ERROR( CV_StsNoMem, "Out of memory" );
__END__;
return ptr;
}
CV_IMPL void cvFree_( void* ptr )
{
CV_FUNCNAME( "cvFree_" );
__BEGIN__;
if( ptr )
{
CVStatus status = p_cvFree( ptr, p_cvAllocUserData );
if( status < 0 )
CV_ERROR( status, "Deallocation error" );
}
__END__;
}
/* End of file. */

View File

@@ -0,0 +1,392 @@
# Microsoft Developer Studio Project File - Name="cxcore" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=cxcore - Win32 Debug64 Itanium
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "cxcore.mak".
!MESSAGE
!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
!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
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "cxcore - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# 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 Ignore_Export_Lib 0
# PROP Target_Dir ""
LIB32=link.exe -lib
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD 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 /Qopenmp /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 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
!ELSEIF "$(CFG)" == "cxcore - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# 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 Ignore_Export_Lib 1
# PROP Target_Dir ""
LIB32=link.exe -lib
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
# ADD 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 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 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 ""
# Begin Source File
SOURCE=.\cxalloc.cpp
# End Source File
# Begin Source File
SOURCE=.\cxarithm.cpp
# End Source File
# Begin Source File
SOURCE=.\cxarray.cpp
# End Source File
# Begin Source File
SOURCE=.\cxcmp.cpp
# End Source File
# Begin Source File
SOURCE=.\cxconvert.cpp
# End Source File
# Begin Source File
SOURCE=.\cxcopy.cpp
# End Source File
# Begin Source File
SOURCE=.\cxcore.rc
# End Source File
# Begin Source File
SOURCE=.\cxdatastructs.cpp
# End Source File
# Begin Source File
SOURCE=.\cxdrawing.cpp
# End Source File
# Begin Source File
SOURCE=.\cxdxt.cpp
# End Source File
# Begin Source File
SOURCE=.\cxerror.cpp
# End Source File
# Begin Source File
SOURCE=.\cximage.cpp
# End Source File
# Begin Source File
SOURCE=.\cxjacobieigens.cpp
# End Source File
# Begin Source File
SOURCE=.\cxlogic.cpp
# End Source File
# Begin Source File
SOURCE=.\cxlut.cpp
# End Source File
# Begin Source File
SOURCE=.\cxmathfuncs.cpp
# End Source File
# Begin Source File
SOURCE=.\cxmatmul.cpp
# End Source File
# Begin Source File
SOURCE=.\cxmatrix.cpp
# End Source File
# Begin Source File
SOURCE=.\cxmean.cpp
# End Source File
# Begin Source File
SOURCE=.\cxmeansdv.cpp
# End Source File
# Begin Source File
SOURCE=.\cxminmaxloc.cpp
# End Source File
# Begin Source File
SOURCE=.\cxnorm.cpp
# End Source File
# Begin Source File
SOURCE=.\cxouttext.cpp
# End Source File
# Begin Source File
SOURCE=.\cxpersistence.cpp
# End Source File
# Begin Source File
SOURCE=.\cxprecomp.cpp
# ADD CPP /Yc"_cxcore.h"
# End Source File
# Begin Source File
SOURCE=.\cxrand.cpp
# End Source File
# Begin Source File
SOURCE=.\cxsumpixels.cpp
# End Source File
# Begin Source File
SOURCE=.\cxsvd.cpp
# End Source File
# Begin Source File
SOURCE=.\cxswitcher.cpp
# End Source File
# Begin Source File
SOURCE=.\cxtables.cpp
# End Source File
# Begin Source File
SOURCE=.\cxutils.cpp
# End Source File
# End Group
# Begin Group "Include"
# PROP Default_Filter ""
# Begin Group "External"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Include\cxcore.h
# End Source File
# Begin Source File
SOURCE=..\include\cxcore.hpp
# End Source File
# Begin Source File
SOURCE=..\include\cxerror.h
# End Source File
# Begin Source File
SOURCE=..\include\cxmisc.h
# End Source File
# Begin Source File
SOURCE=..\include\cxtypes.h
# End Source File
# End Group
# Begin Group "Internal"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\_cxcore.h
# End Source File
# Begin Source File
SOURCE=.\_cxipp.h
# End Source File
# End Group
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,121 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Russian resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Intel® Open Source Computer Vision Library: The core part.\0"
VALUE "CompanyName", "Intel Corporation.\0"
VALUE "FileDescription", "The core component of OpenCV\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "cxcore100.dll\0"
VALUE "LegalCopyright", "Copyright © 2002-2006\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "cxcore100.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Intel® Open Source Computer Vision Library\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,462 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
#if defined WIN32 || defined WIN64
#include <windows.h>
#else
#include <pthread.h>
#endif
typedef struct
{
const char* file;
int line;
}
CvStackRecord;
typedef struct CvContext
{
int err_code;
int err_mode;
CvErrorCallback error_callback;
void* userdata;
char err_msg[4096];
CvStackRecord err_ctx;
} CvContext;
#if defined WIN32 || defined WIN64
#define CV_DEFAULT_ERROR_CALLBACK cvGuiBoxReport
#else
#define CV_DEFAULT_ERROR_CALLBACK cvStdErrReport
#endif
static CvContext*
icvCreateContext(void)
{
CvContext* context = (CvContext*)malloc( sizeof(*context) );
context->err_mode = CV_ErrModeLeaf;
context->err_code = CV_StsOk;
context->error_callback = CV_DEFAULT_ERROR_CALLBACK;
context->userdata = 0;
return context;
}
static void
icvDestroyContext(CvContext* context)
{
free(context);
}
#if defined WIN32 || defined WIN64
static DWORD g_TlsIndex = TLS_OUT_OF_INDEXES;
#else
static pthread_key_t g_TlsIndex;
#endif
static CvContext*
icvGetContext(void)
{
#ifdef CV_DLL
#if defined WIN32 || defined WIN64
CvContext* context;
//assert(g_TlsIndex != TLS_OUT_OF_INDEXES);
if( g_TlsIndex == TLS_OUT_OF_INDEXES )
{
g_TlsIndex = TlsAlloc();
if( g_TlsIndex == TLS_OUT_OF_INDEXES )
FatalAppExit( 0, "Only set CV_DLL for DLL usage" );
}
context = (CvContext*)TlsGetValue( g_TlsIndex );
if( !context )
{
context = icvCreateContext();
if( !context )
FatalAppExit( 0, "OpenCV. Problem to allocate memory for TLS OpenCV context." );
TlsSetValue( g_TlsIndex, context );
}
return context;
#else
CvContext* context = (CvContext*)pthread_getspecific( g_TlsIndex );
if( !context )
{
context = icvCreateContext();
if( !context )
{
fprintf(stderr,"OpenCV. Problem to allocate memory for OpenCV context.");
exit(1);
}
pthread_setspecific( g_TlsIndex, context );
}
return context;
#endif
#else /* static single-thread library case */
static CvContext* context = 0;
if( !context )
context = icvCreateContext();
return context;
#endif
}
CV_IMPL int
cvStdErrReport( int code, const char *func_name, const char *err_msg,
const char *file, int line, void* )
{
if( code == CV_StsBackTrace || code == CV_StsAutoTrace )
fprintf( stderr, "\tcalled from " );
else
fprintf( stderr, "OpenCV ERROR: %s (%s)\n\tin function ",
cvErrorStr(code), err_msg ? err_msg : "no description" );
fprintf( stderr, "%s, %s(%d)\n", func_name ? func_name : "<unknown>",
file != NULL ? file : "", line );
if( cvGetErrMode() == CV_ErrModeLeaf )
{
fprintf( stderr, "Terminating the application...\n" );
return 1;
}
else
return 0;
}
CV_IMPL int
cvGuiBoxReport( int code, const char *func_name, const char *err_msg,
const char *file, int line, void* )
{
#if !defined WIN32 && !defined WIN64
return cvStdErrReport( code, func_name, err_msg, file, line, 0 );
#else
if( code != CV_StsBackTrace && code != CV_StsAutoTrace )
{
size_t msg_len = strlen(err_msg ? err_msg : "") + 1024;
char* message = (char*)alloca(msg_len);
char title[100];
wsprintf( message, "%s (%s)\nin function %s, %s(%d)\n\n"
"Press \"Abort\" to terminate application.\n"
"Press \"Retry\" to debug (if the app is running under debugger).\n"
"Press \"Ignore\" to continue (this is not safe).\n",
cvErrorStr(code), err_msg ? err_msg : "no description",
func_name, file, line );
wsprintf( title, "OpenCV GUI Error Handler" );
int answer = MessageBox( NULL, message, title, MB_ICONERROR|MB_ABORTRETRYIGNORE|MB_SYSTEMMODAL );
if( answer == IDRETRY )
{
CV_DBG_BREAK();
}
return answer != IDIGNORE;
}
return 0;
#endif
}
CV_IMPL int cvNulDevReport( int /*code*/, const char* /*func_name*/,
const char* /*err_msg*/, const char* /*file*/, int /*line*/, void* )
{
return cvGetErrMode() == CV_ErrModeLeaf;
}
CV_IMPL CvErrorCallback
cvRedirectError( CvErrorCallback func, void* userdata, void** prev_userdata )
{
CvContext* context = icvGetContext();
CvErrorCallback old = context->error_callback;
if( prev_userdata )
*prev_userdata = context->userdata;
if( func )
{
context->error_callback = func;
context->userdata = userdata;
}
else
{
context->error_callback = CV_DEFAULT_ERROR_CALLBACK;
context->userdata = 0;
}
return old;
}
CV_IMPL int cvGetErrInfo( const char** errorcode_desc, const char** description,
const char** filename, int* line )
{
int code = cvGetErrStatus();
if( errorcode_desc )
*errorcode_desc = cvErrorStr( code );
if( code >= 0 )
{
if( description )
*description = 0;
if( filename )
*filename = 0;
if( line )
*line = 0;
}
else
{
CvContext* ctx = icvGetContext();
if( description )
*description = ctx->err_msg;
if( filename )
*filename = ctx->err_ctx.file;
if( line )
*line = ctx->err_ctx.line;
}
return code;
}
CV_IMPL const char* cvErrorStr( int status )
{
static char buf[256];
switch (status)
{
case CV_StsOk : return "No Error";
case CV_StsBackTrace : return "Backtrace";
case CV_StsError : return "Unspecified error";
case CV_StsInternal : return "Internal error";
case CV_StsNoMem : return "Insufficient memory";
case CV_StsBadArg : return "Bad argument";
case CV_StsNoConv : return "Iterations do not converge";
case CV_StsAutoTrace : return "Autotrace call";
case CV_StsBadSize : return "Incorrect size of input array";
case CV_StsNullPtr : return "Null pointer";
case CV_StsDivByZero : return "Divizion by zero occured";
case CV_BadStep : return "Image step is wrong";
case CV_StsInplaceNotSupported : return "Inplace operation is not supported";
case CV_StsObjectNotFound : return "Requested object was not found";
case CV_BadDepth : return "Input image depth is not supported by function";
case CV_StsUnmatchedFormats : return "Formats of input arguments do not match";
case CV_StsUnmatchedSizes : return "Sizes of input arguments do not match";
case CV_StsOutOfRange : return "One of arguments\' values is out of range";
case CV_StsUnsupportedFormat : return "Unsupported format or combination of formats";
case CV_BadCOI : return "Input COI is not supported";
case CV_BadNumChannels : return "Bad number of channels";
case CV_StsBadFlag : return "Bad flag (parameter or structure field)";
case CV_StsBadPoint : return "Bad parameter of type CvPoint";
case CV_StsBadMask : return "Bad type of mask argument";
case CV_StsParseError : return "Parsing error";
case CV_StsNotImplemented : return "The function/feature is not implemented";
case CV_StsBadMemBlock : return "Memory block has been corrupted";
};
sprintf(buf, "Unknown %s code %d", status >= 0 ? "status":"error", status);
return buf;
}
CV_IMPL int cvGetErrMode(void)
{
return icvGetContext()->err_mode;
}
CV_IMPL int cvSetErrMode( int mode )
{
CvContext* context = icvGetContext();
int prev_mode = context->err_mode;
context->err_mode = mode;
return prev_mode;
}
CV_IMPL int cvGetErrStatus()
{
return icvGetContext()->err_code;
}
CV_IMPL void cvSetErrStatus( int code )
{
icvGetContext()->err_code = code;
}
CV_IMPL void cvError( int code, const char* func_name,
const char* err_msg,
const char* file_name, int line )
{
if( code == CV_StsOk )
cvSetErrStatus( code );
else
{
CvContext* context = icvGetContext();
if( code != CV_StsBackTrace && code != CV_StsAutoTrace )
{
char* message = context->err_msg;
context->err_code = code;
strcpy( message, err_msg );
context->err_ctx.file = file_name;
context->err_ctx.line = line;
}
if( context->err_mode != CV_ErrModeSilent )
{
int terminate = context->error_callback( code, func_name, err_msg,
file_name, line, context->userdata );
if( terminate )
{
#if !defined WIN32 && !defined WIN64
assert(0); // for post-mortem analysis with GDB
#endif
exit(-abs(terminate));
}
}
}
}
/******************** End of implementation of profiling stuff *********************/
/**********************DllMain********************************/
#if defined WIN32 || defined WIN64
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
{
CvContext *pContext;
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
g_TlsIndex = TlsAlloc();
if( g_TlsIndex == TLS_OUT_OF_INDEXES ) return FALSE;
//break;
case DLL_THREAD_ATTACH:
pContext = icvCreateContext();
if( pContext == NULL)
return FALSE;
TlsSetValue( g_TlsIndex, (LPVOID)pContext );
break;
case DLL_THREAD_DETACH:
if( g_TlsIndex != TLS_OUT_OF_INDEXES )
{
pContext = (CvContext*)TlsGetValue( g_TlsIndex );
if( pContext != NULL )
icvDestroyContext( pContext );
}
break;
case DLL_PROCESS_DETACH:
if( g_TlsIndex != TLS_OUT_OF_INDEXES )
{
pContext = (CvContext*)TlsGetValue( g_TlsIndex );
if( pContext != NULL )
icvDestroyContext( pContext );
}
TlsFree( g_TlsIndex );
break;
default:
;
}
return TRUE;
}
#else
/* POSIX pthread */
/* function - destructor of thread */
void icvPthreadDestructor(void* key_val)
{
CvContext* context = (CvContext*) key_val;
icvDestroyContext( context );
}
int pthrerr = pthread_key_create( &g_TlsIndex, icvPthreadDestructor );
#endif
/* function, which converts int to int */
CV_IMPL int
cvErrorFromIppStatus( int status )
{
switch (status)
{
case CV_BADSIZE_ERR: return CV_StsBadSize;
case CV_BADMEMBLOCK_ERR: return CV_StsBadMemBlock;
case CV_NULLPTR_ERR: return CV_StsNullPtr;
case CV_DIV_BY_ZERO_ERR: return CV_StsDivByZero;
case CV_BADSTEP_ERR: return CV_BadStep ;
case CV_OUTOFMEM_ERR: return CV_StsNoMem;
case CV_BADARG_ERR: return CV_StsBadArg;
case CV_NOTDEFINED_ERR: return CV_StsError;
case CV_INPLACE_NOT_SUPPORTED_ERR: return CV_StsInplaceNotSupported;
case CV_NOTFOUND_ERR: return CV_StsObjectNotFound;
case CV_BADCONVERGENCE_ERR: return CV_StsNoConv;
case CV_BADDEPTH_ERR: return CV_BadDepth;
case CV_UNMATCHED_FORMATS_ERR: return CV_StsUnmatchedFormats;
case CV_UNSUPPORTED_COI_ERR: return CV_BadCOI;
case CV_UNSUPPORTED_CHANNELS_ERR: return CV_BadNumChannels;
case CV_BADFLAG_ERR: return CV_StsBadFlag;
case CV_BADRANGE_ERR: return CV_StsBadArg;
case CV_BADCOEF_ERR: return CV_StsBadArg;
case CV_BADFACTOR_ERR: return CV_StsBadArg;
case CV_BADPOINT_ERR: return CV_StsBadPoint;
default: return CV_StsError;
}
}
/* End of file */

View File

@@ -0,0 +1,433 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/* ////////////////////////////////////////////////////////////////////
//
// C++ classes for image and matrices
//
// */
#include "_cxcore.h"
/////////////////////////////// CvImage implementation //////////////////////////////////
static CvLoadImageFunc load_image = 0;
static CvLoadImageMFunc load_image_m = 0;
static CvSaveImageFunc save_image = 0;
static CvShowImageFunc show_image = 0;
static bool
icvIsXmlOrYaml( const char* filename )
{
const char* suffix = strrchr( filename, '.' );
return suffix &&
strcmp( suffix, ".xml" ) == 0 ||
strcmp( suffix, ".Xml" ) == 0 ||
strcmp( suffix, ".XML" ) == 0 ||
strcmp( suffix, ".yml" ) == 0 ||
strcmp( suffix, ".Yml" ) == 0 ||
strcmp( suffix, ".YML" ) == 0 ||
strcmp( suffix, ".yaml" ) == 0 ||
strcmp( suffix, ".Yaml" ) == 0 ||
strcmp( suffix, ".YAML" ) == 0;
}
static IplImage*
icvRetrieveImage( void* obj )
{
IplImage* img = 0;
CV_FUNCNAME( "icvRetrieveImage" );
__BEGIN__;
if( CV_IS_IMAGE(obj) )
img = (IplImage*)obj;
else if( CV_IS_MAT(obj) )
{
CvMat* m = (CvMat*)obj;
CV_CALL( img = cvCreateImageHeader( cvSize(m->cols,m->rows),
CV_MAT_DEPTH(m->type), CV_MAT_CN(m->type) ));
cvSetData( img, m->data.ptr, m->step );
img->imageDataOrigin = (char*)m->refcount;
m->data.ptr = 0; m->step = 0;
cvReleaseMat( &m );
}
else if( obj )
{
cvRelease( &obj );
CV_ERROR( CV_StsUnsupportedFormat, "The object is neither an image, nor a matrix" );
}
__END__;
return img;
}
bool CvImage::load( const char* filename, const char* imgname, int color )
{
IplImage* img = 0;
CV_FUNCNAME( "CvImage::read" );
__BEGIN__;
if( icvIsXmlOrYaml(filename) )
{
img = icvRetrieveImage(cvLoad(filename,0,imgname));
if( (img->nChannels > 1) != (color == 0) )
CV_ERROR( CV_StsNotImplemented,
"RGB<->Grayscale conversion is not implemented for images stored in XML/YAML" );
/*{
IplImage* temp_img = 0;
CV_CALL( temp_img = cvCreateImage( cvGetSize(img), img->depth, color > 0 ? 3 : 1 ));
cvCvtColor( img, temp_img, color > 0 ? CV_GRAY2BGR : CV_BGR2GRAY );
cvReleaseImage( &img );
img = temp_img;
}*/
}
else
{
if( load_image )
img = load_image( filename, color );
else
CV_ERROR( CV_StsNotImplemented,
"Loading an image stored in such a format requires HigGUI.\n"
"Link it to your program and call any function from it\n" );
}
attach( img );
__END__;
return img != 0;
}
bool CvImage::read( CvFileStorage* fs, const char* mapname, const char* imgname )
{
void* obj = 0;
IplImage* img = 0;
if( mapname )
{
CvFileNode* mapnode = cvGetFileNodeByName( fs, 0, mapname );
if( !mapnode )
obj = cvReadByName( fs, mapnode, imgname );
}
else
obj = cvReadByName( fs, 0, imgname );
img = icvRetrieveImage(obj);
attach( img );
return img != 0;
}
bool CvImage::read( CvFileStorage* fs, const char* seqname, int idx )
{
void* obj = 0;
IplImage* img = 0;
CvFileNode* seqnode = seqname ?
cvGetFileNodeByName( fs, 0, seqname ) : cvGetRootFileNode(fs,0);
if( seqnode && CV_NODE_IS_SEQ(seqnode->tag) )
obj = cvRead( fs, (CvFileNode*)cvGetSeqElem( seqnode->data.seq, idx ));
img = icvRetrieveImage(obj);
attach( img );
return img != 0;
}
void CvImage::save( const char* filename, const char* imgname )
{
CV_FUNCNAME( "CvImage::write" );
__BEGIN__;
if( !image )
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, image, imgname );
else
{
if( save_image )
save_image( filename, image );
else
CV_ERROR( CV_StsNotImplemented,
"Saving an image in such a format requires HigGUI.\n"
"Link it to your program and call any function from it\n" );
}
__END__;
}
void CvImage::write( CvFileStorage* fs, const char* imgname )
{
if( image )
cvWrite( fs, imgname, image );
}
void CvImage::show( const char* window_name )
{
CV_FUNCNAME( "CvMatrix::show" );
__BEGIN__;
if( image )
{
if( !show_image )
CV_ERROR( CV_StsNotImplemented,
"CvImage::show method requires HighGUI.\n"
"Link it to your program and call any function from it\n" );
show_image( window_name, image );
}
__END__;
}
/////////////////////////////// CvMatrix implementation //////////////////////////////////
CvMatrix::CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data )
{
if( storage )
{
matrix = (CvMat*)cvMemStorageAlloc( storage, sizeof(*matrix) );
cvInitMatHeader( matrix, rows, cols, type, alloc_data ?
cvMemStorageAlloc( storage, rows*cols*CV_ELEM_SIZE(type) ) : 0 );
}
else
matrix = 0;
}
static CvMat*
icvRetrieveMatrix( void* obj )
{
CvMat* m = 0;
CV_FUNCNAME( "icvRetrieveMatrix" );
__BEGIN__;
if( CV_IS_MAT(obj) )
m = (CvMat*)obj;
else if( CV_IS_IMAGE(obj) )
{
IplImage* img = (IplImage*)obj;
CvMat hdr, *src = cvGetMat( img, &hdr );
CV_CALL( m = cvCreateMat( src->rows, src->cols, src->type ));
CV_CALL( cvCopy( src, m ));
cvReleaseImage( &img );
}
else if( obj )
{
cvRelease( &obj );
CV_ERROR( CV_StsUnsupportedFormat, "The object is neither an image, nor a matrix" );
}
__END__;
return m;
}
bool CvMatrix::load( const char* filename, const char* matname, int color )
{
CvMat* m = 0;
CV_FUNCNAME( "CvMatrix::read" );
__BEGIN__;
if( icvIsXmlOrYaml(filename) )
{
m = icvRetrieveMatrix(cvLoad(filename,0,matname));
if( (CV_MAT_CN(m->type) > 1) != (color == 0) )
CV_ERROR( CV_StsNotImplemented,
"RGB<->Grayscale conversion is not implemented for matrices stored in XML/YAML" );
/*{
CvMat* temp_mat;
CV_CALL( temp_mat = cvCreateMat( m->rows, m->cols,
CV_MAKETYPE(CV_MAT_DEPTH(m->type), color > 0 ? 3 : 1 )));
cvCvtColor( m, temp_mat, color > 0 ? CV_GRAY2BGR : CV_BGR2GRAY );
cvReleaseMat( &m );
m = temp_mat;
}*/
}
else
{
if( load_image_m )
m = load_image_m( filename, color );
else
CV_ERROR( CV_StsNotImplemented,
"Loading an image stored in such a format requires HigGUI.\n"
"Link it to your program and call any function from it\n" );
}
set( m, false );
__END__;
return m != 0;
}
bool CvMatrix::read( CvFileStorage* fs, const char* mapname, const char* matname )
{
void* obj = 0;
CvMat* m = 0;
if( mapname )
{
CvFileNode* mapnode = cvGetFileNodeByName( fs, 0, mapname );
if( !mapnode )
obj = cvReadByName( fs, mapnode, matname );
}
else
obj = cvReadByName( fs, 0, matname );
m = icvRetrieveMatrix(obj);
set( m, false );
return m != 0;
}
bool CvMatrix::read( CvFileStorage* fs, const char* seqname, int idx )
{
void* obj = 0;
CvMat* m = 0;
CvFileNode* seqnode = seqname ?
cvGetFileNodeByName( fs, 0, seqname ) : cvGetRootFileNode(fs,0);
if( seqnode && CV_NODE_IS_SEQ(seqnode->tag) )
obj = cvRead( fs, (CvFileNode*)cvGetSeqElem( seqnode->data.seq, idx ));
m = icvRetrieveMatrix(obj);
set( m, false );
return m != 0;
}
void CvMatrix::save( const char* filename, const char* matname )
{
CV_FUNCNAME( "CvMatrix::write" );
__BEGIN__;
if( !matrix )
return;
if( icvIsXmlOrYaml( filename ) )
cvSave( filename, matrix, matname );
else
{
if( save_image )
save_image( filename, matrix );
else
CV_ERROR( CV_StsNotImplemented,
"Saving a matrixe in such a format requires HigGUI.\n"
"Link it to your program and call any function from it\n" );
}
__END__;
}
void CvMatrix::write( CvFileStorage* fs, const char* matname )
{
if( matrix )
cvWrite( fs, matname, matrix );
}
void CvMatrix::show( const char* window_name )
{
CV_FUNCNAME( "CvMatrix::show" );
__BEGIN__;
if( matrix )
{
if( !show_image )
CV_ERROR( CV_StsNotImplemented,
"CvMatrix::show method requires HighGUI.\n"
"Link it to your program and call any function from it\n" );
show_image( window_name, matrix );
}
__END__;
}
CV_IMPL int
cvSetImageIOFunctions( CvLoadImageFunc _load_image, CvLoadImageMFunc _load_image_m,
CvSaveImageFunc _save_image, CvShowImageFunc _show_image )
{
load_image = _load_image;
load_image_m = _load_image_m;
save_image = _save_image;
show_image = _show_image;
return 1;
}
/*void main(void)
{
CvImage a(cvSize(300,200),8,3), b(cvSize(300,200),8,3);
CvRNG rng = cvRNG(-1);
CV_SET_IMAGE_IO_FUNCTIONS();
cvNamedWindow( "test", 1 );
//cvZero( a );
cvZero( b );
cvRandArr( &rng, a, CV_RAND_UNI, cvScalarAll(0), cvScalarAll(100) );
cvCircle( b, cvPoint(100,100), 70, cvScalar(0,255,0), -1, CV_AA, 0 );
cvAdd( a, b, a );
a.show( "test" );
cvWaitKey();
}*/
/* End of file. */

View File

@@ -0,0 +1,431 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
/*F///////////////////////////////////////////////////////////////////////////////////////
// Names: icvJacobiEigens_32f, icvJacobiEigens_64d
// Purpose: Eigenvalues & eigenvectors calculation of a symmetric matrix:
// A Vi = Ei Vi
// Context:
// Parameters: A(n, n) - source symmetric matrix (n - rows & columns number),
// V(n, n) - matrix of its eigenvectors
// (i-th row is an eigenvector Vi),
// E(n) - vector of its eigenvalues
// (i-th element is an eigenvalue Ei),
// eps - accuracy of diagonalization.
//
// Returns:
// CV_NO_ERROR or error code
// Notes:
// 1. The functions destroy source matrix A, so if you need it further, you
// have to copy it before the processing.
// 2. Eigenvalies and eigenvectors are sorted in Ei absolute value descending.
// 3. Calculation time depends on eps value. If the time isn't very important,
// we recommend to set eps = 0.
//F*/
/*=========================== Single precision function ================================*/
static CvStatus CV_STDCALL
icvJacobiEigens_32f(float *A, float *V, float *E, int n, float eps)
{
int i, j, k, ind, iters = 0;
float *AA = A, *VV = V;
double Amax, anorm = 0, ax;
if( A == NULL || V == NULL || E == NULL )
return CV_NULLPTR_ERR;
if( n <= 0 )
return CV_BADSIZE_ERR;
if( eps < DBL_EPSILON )
eps = DBL_EPSILON;
/*-------- Prepare --------*/
for( i = 0; i < n; i++, VV += n, AA += n )
{
for( j = 0; j < i; j++ )
{
double Am = AA[j];
anorm += Am * Am;
}
for( j = 0; j < n; j++ )
VV[j] = 0.f;
VV[i] = 1.f;
}
anorm = sqrt( anorm + anorm );
ax = anorm * eps / n;
Amax = anorm;
while( Amax > ax && iters++ < 100 )
{
Amax /= n;
do /* while (ind) */
{
int p, q;
float *V1 = V, *A1 = A;
ind = 0;
for( p = 0; p < n - 1; p++, A1 += n, V1 += n )
{
float *A2 = A + n * (p + 1), *V2 = V + n * (p + 1);
for( q = p + 1; q < n; q++, A2 += n, V2 += n )
{
double x, y, c, s, c2, s2, a;
float *A3, Apq = A1[q], App, Aqq, Aip, Aiq, Vpi, Vqi;
if( fabs( Apq ) < Amax )
continue;
ind = 1;
/*---- Calculation of rotation angle's sine & cosine ----*/
App = A1[p];
Aqq = A2[q];
y = 5.0e-1 * (App - Aqq);
x = -Apq / sqrt( (double)Apq * Apq + (double)y * y );
if( y < 0.0 )
x = -x;
s = x / sqrt( 2.0 * (1.0 + sqrt( 1.0 - (double)x * x )));
s2 = s * s;
c = sqrt( 1.0 - s2 );
c2 = c * c;
a = 2.0 * Apq * c * s;
/*---- Apq annulation ----*/
A3 = A;
for( i = 0; i < p; i++, A3 += n )
{
Aip = A3[p];
Aiq = A3[q];
Vpi = V1[i];
Vqi = V2[i];
A3[p] = (float) (Aip * c - Aiq * s);
A3[q] = (float) (Aiq * c + Aip * s);
V1[i] = (float) (Vpi * c - Vqi * s);
V2[i] = (float) (Vqi * c + Vpi * s);
}
for( ; i < q; i++, A3 += n )
{
Aip = A1[i];
Aiq = A3[q];
Vpi = V1[i];
Vqi = V2[i];
A1[i] = (float) (Aip * c - Aiq * s);
A3[q] = (float) (Aiq * c + Aip * s);
V1[i] = (float) (Vpi * c - Vqi * s);
V2[i] = (float) (Vqi * c + Vpi * s);
}
for( ; i < n; i++ )
{
Aip = A1[i];
Aiq = A2[i];
Vpi = V1[i];
Vqi = V2[i];
A1[i] = (float) (Aip * c - Aiq * s);
A2[i] = (float) (Aiq * c + Aip * s);
V1[i] = (float) (Vpi * c - Vqi * s);
V2[i] = (float) (Vqi * c + Vpi * s);
}
A1[p] = (float) (App * c2 + Aqq * s2 - a);
A2[q] = (float) (App * s2 + Aqq * c2 + a);
A1[q] = A2[p] = 0.0f;
} /*q */
} /*p */
}
while( ind );
Amax /= n;
} /* while ( Amax > ax ) */
for( i = 0, k = 0; i < n; i++, k += n + 1 )
E[i] = A[k];
/*printf(" M = %d\n", M); */
/* -------- ordering -------- */
for( i = 0; i < n; i++ )
{
int m = i;
float Em = (float) fabs( E[i] );
for( j = i + 1; j < n; j++ )
{
float Ej = (float) fabs( E[j] );
m = (Em < Ej) ? j : m;
Em = (Em < Ej) ? Ej : Em;
}
if( m != i )
{
int l;
float b = E[i];
E[i] = E[m];
E[m] = b;
for( j = 0, k = i * n, l = m * n; j < n; j++, k++, l++ )
{
b = V[k];
V[k] = V[l];
V[l] = b;
}
}
}
return CV_NO_ERR;
}
/*=========================== Double precision function ================================*/
static CvStatus CV_STDCALL
icvJacobiEigens_64d(double *A, double *V, double *E, int n, double eps)
{
int i, j, k, p, q, ind, iters = 0;
double *A1 = A, *V1 = V, *A2 = A, *V2 = V;
double Amax = 0.0, anorm = 0.0, ax;
if( A == NULL || V == NULL || E == NULL )
return CV_NULLPTR_ERR;
if( n <= 0 )
return CV_BADSIZE_ERR;
if( eps < DBL_EPSILON )
eps = DBL_EPSILON;
/*-------- Prepare --------*/
for( i = 0; i < n; i++, V1 += n, A1 += n )
{
for( j = 0; j < i; j++ )
{
double Am = A1[j];
anorm += Am * Am;
}
for( j = 0; j < n; j++ )
V1[j] = 0.0;
V1[i] = 1.0;
}
anorm = sqrt( anorm + anorm );
ax = anorm * eps / n;
Amax = anorm;
while( Amax > ax && iters++ < 100 )
{
Amax /= n;
do /* while (ind) */
{
ind = 0;
A1 = A;
V1 = V;
for( p = 0; p < n - 1; p++, A1 += n, V1 += n )
{
A2 = A + n * (p + 1);
V2 = V + n * (p + 1);
for( q = p + 1; q < n; q++, A2 += n, V2 += n )
{
double x, y, c, s, c2, s2, a;
double *A3, Apq, App, Aqq, App2, Aqq2, Aip, Aiq, Vpi, Vqi;
if( fabs( A1[q] ) < Amax )
continue;
Apq = A1[q];
ind = 1;
/*---- Calculation of rotation angle's sine & cosine ----*/
App = A1[p];
Aqq = A2[q];
y = 5.0e-1 * (App - Aqq);
x = -Apq / sqrt( Apq * Apq + (double)y * y );
if( y < 0.0 )
x = -x;
s = x / sqrt( 2.0 * (1.0 + sqrt( 1.0 - (double)x * x )));
s2 = s * s;
c = sqrt( 1.0 - s2 );
c2 = c * c;
a = 2.0 * Apq * c * s;
/*---- Apq annulation ----*/
A3 = A;
for( i = 0; i < p; i++, A3 += n )
{
Aip = A3[p];
Aiq = A3[q];
Vpi = V1[i];
Vqi = V2[i];
A3[p] = Aip * c - Aiq * s;
A3[q] = Aiq * c + Aip * s;
V1[i] = Vpi * c - Vqi * s;
V2[i] = Vqi * c + Vpi * s;
}
for( ; i < q; i++, A3 += n )
{
Aip = A1[i];
Aiq = A3[q];
Vpi = V1[i];
Vqi = V2[i];
A1[i] = Aip * c - Aiq * s;
A3[q] = Aiq * c + Aip * s;
V1[i] = Vpi * c - Vqi * s;
V2[i] = Vqi * c + Vpi * s;
}
for( ; i < n; i++ )
{
Aip = A1[i];
Aiq = A2[i];
Vpi = V1[i];
Vqi = V2[i];
A1[i] = Aip * c - Aiq * s;
A2[i] = Aiq * c + Aip * s;
V1[i] = Vpi * c - Vqi * s;
V2[i] = Vqi * c + Vpi * s;
}
App2 = App * c2 + Aqq * s2 - a;
Aqq2 = App * s2 + Aqq * c2 + a;
A1[p] = App2;
A2[q] = Aqq2;
A1[q] = A2[p] = 0.0;
} /*q */
} /*p */
}
while( ind );
} /* while ( Amax > ax ) */
for( i = 0, k = 0; i < n; i++, k += n + 1 )
E[i] = A[k];
/* -------- ordering -------- */
for( i = 0; i < n; i++ )
{
int m = i;
double Em = fabs( E[i] );
for( j = i + 1; j < n; j++ )
{
double Ej = fabs( E[j] );
m = (Em < Ej) ? j : m;
Em = (Em < Ej) ? Ej : Em;
}
if( m != i )
{
int l;
double b = E[i];
E[i] = E[m];
E[m] = b;
for( j = 0, k = i * n, l = m * n; j < n; j++, k++, l++ )
{
b = V[k];
V[k] = V[l];
V[l] = b;
}
}
}
return CV_NO_ERR;
}
CV_IMPL void
cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double eps )
{
CV_FUNCNAME( "cvEigenVV" );
__BEGIN__;
CvMat sstub, *src = (CvMat*)srcarr;
CvMat estub1, *evects = (CvMat*)evectsarr;
CvMat estub2, *evals = (CvMat*)evalsarr;
if( !CV_IS_MAT( src ))
CV_CALL( src = cvGetMat( src, &sstub ));
if( !CV_IS_MAT( evects ))
CV_CALL( evects = cvGetMat( evects, &estub1 ));
if( !CV_IS_MAT( evals ))
CV_CALL( evals = cvGetMat( evals, &estub2 ));
if( src->cols != src->rows )
CV_ERROR( CV_StsUnmatchedSizes, "source is not quadratic matrix" );
if( !CV_ARE_SIZES_EQ( src, evects) )
CV_ERROR( CV_StsUnmatchedSizes, "eigenvectors matrix has inappropriate size" );
if( (evals->rows != src->rows || evals->cols != 1) &&
(evals->cols != src->rows || evals->rows != 1))
CV_ERROR( CV_StsBadSize, "eigenvalues vector has inappropriate size" );
if( !CV_ARE_TYPES_EQ( src, evects ) || !CV_ARE_TYPES_EQ( src, evals ))
CV_ERROR( CV_StsUnmatchedFormats,
"input matrix, eigenvalues and eigenvectors must have the same type" );
if( !CV_IS_MAT_CONT( src->type & evals->type & evects->type ))
CV_ERROR( CV_BadStep, "all the matrices must be continuous" );
if( CV_MAT_TYPE(src->type) == CV_32FC1 )
{
IPPI_CALL( icvJacobiEigens_32f( src->data.fl,
evects->data.fl,
evals->data.fl, src->cols, (float)eps ));
}
else if( CV_MAT_TYPE(src->type) == CV_64FC1 )
{
IPPI_CALL( icvJacobiEigens_64d( src->data.db,
evects->data.db,
evals->data.db, src->cols, eps ));
}
else
{
CV_ERROR( CV_StsUnsupportedFormat, "Only 32fC1 and 64fC1 types are supported" );
}
CV_CHECK_NANS( evects );
CV_CHECK_NANS( evals );
__END__;
}
/* End of file */

View File

@@ -0,0 +1,696 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/* ////////////////////////////////////////////////////////////////////
//
// CvMat logical operations: &, |, ^ ...
//
// */
#include "_cxcore.h"
/////////////////////////////////////////////////////////////////////////////////////////
// //
// Macros for logic operations //
// //
/////////////////////////////////////////////////////////////////////////////////////////
/* //////////////////////////////////////////////////////////////////////////////////////
Mat op Mat
////////////////////////////////////////////////////////////////////////////////////// */
#define ICV_DEF_BIN_LOG_OP_2D( __op__, name ) \
IPCVAPI_IMPL( CvStatus, icv##name##_8u_C1R, \
( const uchar* src1, int step1, const uchar* src2, int step2, \
uchar* dst, int step, CvSize size ), (src1, step1, src2, step2, dst, step, size) )\
{ \
for( ; size.height--; src1 += step1, src2 += step2, dst += step ) \
{ \
int i = 0; \
\
if( (((size_t)src1 | (size_t)src2 | (size_t)dst) & 3) == 0 ) \
{ \
for( ; i <= size.width - 16; i += 16 ) \
{ \
int t0 = __op__(((const int*)(src1+i))[0], ((const int*)(src2+i))[0]);\
int t1 = __op__(((const int*)(src1+i))[1], ((const int*)(src2+i))[1]);\
\
((int*)(dst+i))[0] = t0; \
((int*)(dst+i))[1] = t1; \
\
t0 = __op__(((const int*)(src1+i))[2], ((const int*)(src2+i))[2]); \
t1 = __op__(((const int*)(src1+i))[3], ((const int*)(src2+i))[3]); \
\
((int*)(dst+i))[2] = t0; \
((int*)(dst+i))[3] = t1; \
} \
\
for( ; i <= size.width - 4; i += 4 ) \
{ \
int t = __op__(*(const int*)(src1+i), *(const int*)(src2+i)); \
*(int*)(dst+i) = t; \
} \
} \
\
for( ; i < size.width; i++ ) \
{ \
int t = __op__(((const uchar*)src1)[i],((const uchar*)src2)[i]); \
dst[i] = (uchar)t; \
} \
} \
\
return CV_OK; \
}
/* //////////////////////////////////////////////////////////////////////////////////////
Mat op Scalar
////////////////////////////////////////////////////////////////////////////////////// */
#define ICV_DEF_UN_LOG_OP_2D( __op__, name ) \
static CvStatus CV_STDCALL icv##name##_8u_CnR \
( const uchar* src0, int step1, uchar* dst0, int step, CvSize size, \
const uchar* scalar, int pix_size ) \
{ \
int delta = 12*pix_size; \
\
for( ; size.height--; src0 += step1, dst0 += step ) \
{ \
const uchar* src = (const uchar*)src0; \
uchar* dst = dst0; \
int i, len = size.width; \
\
if( (((size_t)src|(size_t)dst) & 3) == 0 ) \
{ \
while( (len -= delta) >= 0 ) \
{ \
for( i = 0; i < (delta); i += 12 ) \
{ \
int t0 = __op__(((const int*)(src+i))[0], ((const int*)(scalar+i))[0]); \
int t1 = __op__(((const int*)(src+i))[1], ((const int*)(scalar+i))[1]); \
((int*)(dst+i))[0] = t0; \
((int*)(dst+i))[1] = t1; \
\
t0 = __op__(((const int*)(src+i))[2], ((const int*)(scalar+i))[2]); \
((int*)(dst+i))[2] = t0; \
} \
src += delta; \
dst += delta; \
} \
} \
else \
{ \
while( (len -= delta) >= 0 ) \
{ \
for( i = 0; i < (delta); i += 4 ) \
{ \
int t0 = __op__(src[i], scalar[i]); \
int t1 = __op__(src[i+1], scalar[i+1]); \
dst[i] = (uchar)t0; \
dst[i+1] = (uchar)t1; \
\
t0 = __op__(src[i+2], scalar[i+2]); \
t1 = __op__(src[i+3], scalar[i+3]); \
dst[i+2] = (uchar)t0; \
dst[i+3] = (uchar)t1; \
} \
src += delta; \
dst += delta; \
} \
} \
\
for( len += delta, i = 0; i < len; i++ ) \
{ \
int t = __op__(src[i],scalar[i]); \
dst[i] = (uchar)t; \
} \
} \
\
return CV_OK; \
}
/////////////////////////////////////////////////////////////////////////////////////////
// //
// LOGIC OPERATIONS //
// //
/////////////////////////////////////////////////////////////////////////////////////////
static void
icvLogicS( const void* srcarr, CvScalar* scalar, void* dstarr,
const void* maskarr, CvFunc2D_2A1P1I fn_2d )
{
uchar* buffer = 0;
int local_alloc = 1;
CV_FUNCNAME( "icvLogicS" );
__BEGIN__;
CvMat srcstub, *src = (CvMat*)srcarr;
CvMat dststub, *dst = (CvMat*)dstarr;
CvMat maskstub, *mask = (CvMat*)maskarr;
CvMat dstbuf, *tdst;
CvCopyMaskFunc copym_func = 0;
int y, dy;
int coi1 = 0, coi2 = 0;
int is_nd = 0, cont_flag = 0;
int elem_size, elem_size1, type, depth;
double buf[12];
CvSize size, tsize;
int src_step, dst_step, tdst_step, mask_step;
if( !CV_IS_MAT(src))
{
if( CV_IS_MATND(src) )
is_nd = 1;
else
CV_CALL( src = cvGetMat( src, &srcstub, &coi1 ));
}
if( !CV_IS_MAT(dst))
{
if( CV_IS_MATND(dst) )
is_nd = 1;
else
CV_CALL( dst = cvGetMat( dst, &dststub, &coi2 ));
}
if( is_nd )
{
CvArr* arrs[] = { src, dst };
CvMatND stubs[2];
CvNArrayIterator iterator;
if( maskarr )
CV_ERROR( CV_StsBadMask,
"This operation on multi-dimensional arrays does not support mask" );
CV_CALL( cvInitNArrayIterator( 2, arrs, 0, stubs, &iterator ));
type = CV_MAT_TYPE(iterator.hdr[0]->type);
depth = CV_MAT_DEPTH(type);
iterator.size.width *= CV_ELEM_SIZE(type);
elem_size1 = CV_ELEM_SIZE1(depth);
CV_CALL( cvScalarToRawData( scalar, buf, type, 1 ));
do
{
IPPI_CALL( fn_2d( iterator.ptr[0], CV_STUB_STEP,
iterator.ptr[1], CV_STUB_STEP,
iterator.size, buf, elem_size1 ));
}
while( cvNextNArraySlice( &iterator ));
EXIT;
}
if( coi1 != 0 || coi2 != 0 )
CV_ERROR( CV_BadCOI, "" );
if( !CV_ARE_TYPES_EQ( src, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
if( !CV_ARE_SIZES_EQ( src, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
size = cvGetMatSize( src );
type = CV_MAT_TYPE(src->type);
depth = CV_MAT_DEPTH(type);
elem_size = CV_ELEM_SIZE(type);
elem_size1 = CV_ELEM_SIZE1(depth);
if( !mask )
{
cont_flag = CV_IS_MAT_CONT( src->type & dst->type );
dy = size.height;
tdst = dst;
}
else
{
int buf_size;
if( !CV_IS_MAT(mask) )
CV_CALL( mask = cvGetMat( mask, &maskstub ));
if( !CV_IS_MASK_ARR(mask))
CV_ERROR( CV_StsBadMask, "" );
if( !CV_ARE_SIZES_EQ( mask, dst ))
CV_ERROR( CV_StsUnmatchedSizes, "" );
cont_flag = CV_IS_MAT_CONT( src->type & dst->type & mask->type );
dy = CV_MAX_LOCAL_SIZE/(elem_size*size.height);
dy = MAX(dy,1);
dy = MIN(dy,size.height);
dstbuf = cvMat( dy, size.width, type );
if( !cont_flag )
dstbuf.step = cvAlign( dstbuf.step, 8 );
buf_size = dstbuf.step ? dstbuf.step*dy : size.width*elem_size;
if( buf_size > CV_MAX_LOCAL_SIZE )
{
CV_CALL( buffer = (uchar*)cvAlloc( buf_size ));
local_alloc = 0;
}
else
buffer = (uchar*)cvStackAlloc( buf_size );
dstbuf.data.ptr = buffer;
tdst = &dstbuf;
copym_func = icvGetCopyMaskFunc( elem_size );
}
src_step = src->step;
dst_step = dst->step;
tdst_step = tdst->step;
mask_step = mask ? mask->step : 0;
CV_CALL( cvScalarToRawData( scalar, buf, type, 1 ));
for( y = 0; y < size.height; y += dy )
{
tsize.width = size.width;
tsize.height = dy;
if( y + dy > size.height )
tsize.height = size.height - y;
if( cont_flag || tsize.height == 1 )
{
tsize.width *= tsize.height;
tsize.height = 1;
src_step = tdst_step = dst_step = mask_step = CV_STUB_STEP;
}
IPPI_CALL( fn_2d( src->data.ptr + y*src->step, src_step, tdst->data.ptr, tdst_step,
cvSize(tsize.width*elem_size, tsize.height), buf, elem_size1 ));
if( mask )
{
IPPI_CALL( copym_func( tdst->data.ptr, tdst_step, dst->data.ptr + y*dst->step,
dst_step, tsize, mask->data.ptr + y*mask->step, mask_step ));
}
}
__END__;
if( !local_alloc )
cvFree( &buffer );
}
static void
icvLogic( const void* srcarr1, const void* srcarr2, void* dstarr,
const void* maskarr, CvFunc2D_3A fn_2d )
{
uchar* buffer = 0;
int local_alloc = 1;
CV_FUNCNAME( "icvLogic" );
__BEGIN__;
int y, dy;
int coi1 = 0, coi2 = 0, coi3 = 0;
int type, elem_size;
int is_nd = 0, cont_flag = 0;
CvMat srcstub1, *src1 = (CvMat*)srcarr1;
CvMat srcstub2, *src2 = (CvMat*)srcarr2;
CvMat dststub, *dst = (CvMat*)dstarr;
CvMat maskstub, *mask = (CvMat*)maskarr;
CvMat dstbuf, *tdst;
int src1_step, src2_step, tdst_step, dst_step, mask_step;
CvSize size, tsize;
CvCopyMaskFunc copym_func = 0;
if( !CV_IS_MAT(src1))
{
if( CV_IS_MATND(src1) )
is_nd = 1;
else
CV_CALL( src1 = cvGetMat( src1, &srcstub1, &coi1 ));
}
if( !CV_IS_MAT(src2))
{
if( CV_IS_MATND(src2) )
is_nd = 1;
else
CV_CALL( src2 = cvGetMat( src2, &srcstub2, &coi2 ));
}
if( !CV_IS_MAT(dst))
{
if( CV_IS_MATND(dst) )
is_nd = 1;
else
CV_CALL( dst = cvGetMat( dst, &dststub, &coi3 ));
}
if( is_nd )
{
CvArr* arrs[] = { src1, src2, dst };
CvMatND stubs[3];
CvNArrayIterator iterator;
if( maskarr )
CV_ERROR( CV_StsBadMask,
"This operation on multi-dimensional arrays does not support mask" );
CV_CALL( cvInitNArrayIterator( 3, arrs, 0, stubs, &iterator ));
type = CV_MAT_TYPE(iterator.hdr[0]->type);
iterator.size.width *= CV_ELEM_SIZE(type);
do
{
IPPI_CALL( fn_2d( iterator.ptr[0], CV_STUB_STEP,
iterator.ptr[1], CV_STUB_STEP,
iterator.ptr[2], CV_STUB_STEP,
iterator.size ));
}
while( cvNextNArraySlice( &iterator ));
EXIT;
}
if( coi1 != 0 || coi2 != 0 || coi3 != 0 )
CV_ERROR_FROM_CODE( CV_BadCOI );
if( !CV_ARE_TYPES_EQ( src1, src2 ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
if( !CV_ARE_SIZES_EQ( src1, src2 ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
if( !CV_ARE_TYPES_EQ( src1, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
if( !CV_ARE_SIZES_EQ( src1, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
size = cvGetMatSize( src1 );
type = CV_MAT_TYPE( src1->type );
elem_size = CV_ELEM_SIZE(type);
if( !mask )
{
cont_flag = CV_IS_MAT_CONT( src1->type & src2->type & dst->type );
dy = size.height;
tdst = dst;
}
else
{
int buf_size;
if( !CV_IS_MAT(mask) )
CV_CALL( mask = cvGetMat( mask, &maskstub ));
if( !CV_IS_MASK_ARR(mask))
CV_ERROR( CV_StsBadMask, "" );
if( !CV_ARE_SIZES_EQ( mask, dst ))
CV_ERROR( CV_StsUnmatchedSizes, "" );
cont_flag = CV_IS_MAT_CONT( src1->type & src2->type & dst->type & mask->type );
dy = CV_MAX_LOCAL_SIZE/(elem_size*size.height);
dy = MAX(dy,1);
dy = MIN(dy,size.height);
dstbuf = cvMat( dy, size.width, type );
if( !cont_flag )
dstbuf.step = cvAlign( dstbuf.step, 8 );
buf_size = dstbuf.step ? dstbuf.step*dy : size.width*elem_size;
if( buf_size > CV_MAX_LOCAL_SIZE )
{
CV_CALL( buffer = (uchar*)cvAlloc( buf_size ));
local_alloc = 0;
}
else
buffer = (uchar*)cvStackAlloc( buf_size );
dstbuf.data.ptr = buffer;
tdst = &dstbuf;
copym_func = icvGetCopyMaskFunc( elem_size );
}
src1_step = src1->step;
src2_step = src2->step;
dst_step = dst->step;
tdst_step = tdst->step;
mask_step = mask ? mask->step : 0;
for( y = 0; y < size.height; y += dy )
{
tsize.width = size.width;
tsize.height = dy;
if( y + dy > size.height )
tsize.height = size.height - y;
if( cont_flag || tsize.height == 1 )
{
tsize.width *= tsize.height;
tsize.height = 1;
src1_step = src2_step = tdst_step = dst_step = mask_step = CV_STUB_STEP;
}
IPPI_CALL( fn_2d( src1->data.ptr + y*src1->step, src1_step,
src2->data.ptr + y*src2->step, src2_step,
tdst->data.ptr, tdst_step,
cvSize(tsize.width*elem_size, tsize.height) ));
if( mask )
{
IPPI_CALL( copym_func( tdst->data.ptr, tdst_step, dst->data.ptr + y*dst->step,
dst_step, tsize, mask->data.ptr + y*mask->step, mask_step ));
}
}
__END__;
if( !local_alloc )
cvFree( &buffer );
}
ICV_DEF_BIN_LOG_OP_2D( CV_XOR, Xor )
ICV_DEF_UN_LOG_OP_2D( CV_XOR, XorC )
ICV_DEF_BIN_LOG_OP_2D( CV_AND, And )
ICV_DEF_UN_LOG_OP_2D( CV_AND, AndC )
ICV_DEF_BIN_LOG_OP_2D( CV_OR, Or )
ICV_DEF_UN_LOG_OP_2D( CV_OR, OrC )
/////////////////////////////////////////////////////////////////////////////////////////
// X O R //
/////////////////////////////////////////////////////////////////////////////////////////
CV_IMPL void
cvXorS( const void* src, CvScalar scalar, void* dst, const void* mask )
{
icvLogicS( src, &scalar, dst, mask, (CvFunc2D_2A1P1I)icvXorC_8u_CnR );
}
CV_IMPL void
cvXor( const void* src1, const void* src2, void* dst, const void* mask )
{
icvLogic( src1, src2, dst, mask, (CvFunc2D_3A)icvXor_8u_C1R );
}
/////////////////////////////////////////////////////////////////////////////////////////
// A N D //
/////////////////////////////////////////////////////////////////////////////////////////
CV_IMPL void
cvAndS( const void* src, CvScalar scalar, void* dst, const void* mask )
{
icvLogicS( src, &scalar, dst, mask, (CvFunc2D_2A1P1I)icvAndC_8u_CnR );
}
CV_IMPL void
cvAnd( const void* src1, const void* src2, void* dst, const void* mask )
{
icvLogic( src1, src2, dst, mask, (CvFunc2D_3A)icvAnd_8u_C1R );
}
/////////////////////////////////////////////////////////////////////////////////////////
// O R //
/////////////////////////////////////////////////////////////////////////////////////////
CV_IMPL void
cvOrS( const void* src, CvScalar scalar, void* dst, const void* mask )
{
icvLogicS( src, &scalar, dst, mask, (CvFunc2D_2A1P1I)icvOrC_8u_CnR );
}
CV_IMPL void
cvOr( const void* src1, const void* src2, void* dst, const void* mask )
{
icvLogic( src1, src2, dst, mask, (CvFunc2D_3A)icvOr_8u_C1R );
}
/////////////////////////////////////////////////////////////////////////////////////////
// N O T //
/////////////////////////////////////////////////////////////////////////////////////////
IPCVAPI_IMPL( CvStatus, icvNot_8u_C1R,
( const uchar* src1, int step1, uchar* dst, int step, CvSize size ),
(src1, step1, dst, step, size) )
{
for( ; size.height--; src1 += step1, dst += step )
{
int i = 0;
if( (((size_t)src1 | (size_t)dst) & 3) == 0 )
{
for( ; i <= size.width - 16; i += 16 )
{
int t0 = ~((const int*)(src1+i))[0];
int t1 = ~((const int*)(src1+i))[1];
((int*)(dst+i))[0] = t0;
((int*)(dst+i))[1] = t1;
t0 = ~((const int*)(src1+i))[2];
t1 = ~((const int*)(src1+i))[3];
((int*)(dst+i))[2] = t0;
((int*)(dst+i))[3] = t1;
}
for( ; i <= size.width - 4; i += 4 )
{
int t = ~*(const int*)(src1+i);
*(int*)(dst+i) = t;
}
}
for( ; i < size.width; i++ )
{
int t = ~((const uchar*)src1)[i];
dst[i] = (uchar)t;
}
}
return CV_OK;
}
CV_IMPL void
cvNot( const void* srcarr, void* dstarr )
{
CV_FUNCNAME( "cvNot" );
__BEGIN__;
CvMat srcstub, *src = (CvMat*)srcarr;
CvMat dststub, *dst = (CvMat*)dstarr;
int coi1 = 0, coi2 = 0;
int type, is_nd = 0;
CvSize size;
int src_step, dst_step;
if( !CV_IS_MAT(src))
{
if( CV_IS_MATND(src) )
is_nd = 1;
else
CV_CALL( src = cvGetMat( src, &srcstub, &coi1 ));
}
if( !CV_IS_MAT(dst))
{
if( CV_IS_MATND(src) )
is_nd = 1;
else
CV_CALL( dst = cvGetMat( dst, &dststub, &coi2 ));
}
if( is_nd )
{
CvArr* arrs[] = { src, dst };
CvMatND stubs[2];
CvNArrayIterator iterator;
CV_CALL( cvInitNArrayIterator( 2, arrs, 0, stubs, &iterator ));
type = CV_MAT_TYPE(iterator.hdr[0]->type);
iterator.size.width *= CV_ELEM_SIZE(type);
do
{
IPPI_CALL( icvNot_8u_C1R( iterator.ptr[0], CV_STUB_STEP,
iterator.ptr[1], CV_STUB_STEP,
iterator.size ));
}
while( cvNextNArraySlice( &iterator ));
EXIT;
}
if( coi1 != 0 || coi2 != 0 )
CV_ERROR( CV_BadCOI, "" );
if( !CV_ARE_TYPES_EQ( src, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedFormats );
if( !CV_ARE_SIZES_EQ( src, dst ) )
CV_ERROR_FROM_CODE( CV_StsUnmatchedSizes );
size = cvGetMatSize( src );
src_step = src->step;
dst_step = dst->step;
if( CV_IS_MAT_CONT( src->type & dst->type ))
{
size.width *= size.height;
src_step = dst_step = CV_STUB_STEP;
size.height = 1;
}
type = CV_MAT_TYPE( src->type );
size.width *= CV_ELEM_SIZE(type);
IPPI_CALL( icvNot_8u_C1R( src->data.ptr, src_step, dst->data.ptr, dst_step, size ));
__END__;
}
/* End of file. */

View File

@@ -0,0 +1,324 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
/****************************************************************************************\
* LUT Transform *
\****************************************************************************************/
#define ICV_LUT_CASE_C1( type ) \
for( i = 0; i <= size.width-4; i += 4 ) \
{ \
type t0 = lut[src[i]]; \
type t1 = lut[src[i+1]]; \
dst[i] = t0; \
dst[i+1] = t1; \
\
t0 = lut[src[i+2]]; \
t1 = lut[src[i+3]]; \
dst[i+2] = t0; \
dst[i+3] = t1; \
} \
\
for( ; i < size.width; i++ ) \
{ \
type t0 = lut[src[i]]; \
dst[i] = t0; \
}
#define ICV_LUT_CASE_C2( type ) \
for( i = 0; i < size.width; i += 2 ) \
{ \
type t0 = lut[src[i]*2]; \
type t1 = lut[src[i+1]*2 + 1]; \
dst[i] = t0; \
dst[i+1] = t1; \
}
#define ICV_LUT_CASE_C3( type ) \
for( i = 0; i < size.width; i += 3 ) \
{ \
type t0 = lut[src[i]*3]; \
type t1 = lut[src[i+1]*3 + 1]; \
type t2 = lut[src[i+2]*3 + 2]; \
dst[i] = t0; \
dst[i+1] = t1; \
dst[i+2] = t2; \
}
#define ICV_LUT_CASE_C4( type ) \
for( i = 0; i < size.width; i += 4 ) \
{ \
type t0 = lut[src[i]*4]; \
type t1 = lut[src[i+1]*4 + 1]; \
dst[i] = t0; \
dst[i+1] = t1; \
t0 = lut[src[i+2]*4 + 2]; \
t1 = lut[src[i+3]*4 + 3]; \
dst[i+2] = t0; \
dst[i+3] = t1; \
}
#define ICV_DEF_LUT_FUNC_8U_CN( flavor, dsttype, cn ) \
CvStatus CV_STDCALL icvLUT_Transform8u_##flavor##_C##cn##R( \
const uchar* src, int srcstep, \
dsttype* dst, int dststep, CvSize size, \
const dsttype* lut ) \
{ \
size.width *= cn; \
dststep /= sizeof(dst[0]); \
for( ; size.height--; src += srcstep, dst += dststep ) \
{ \
int i; \
ICV_LUT_CASE_C##cn( dsttype ) \
} \
\
return CV_OK; \
}
ICV_DEF_LUT_FUNC_8U_CN( 8u, uchar, 1 )
ICV_DEF_LUT_FUNC_8U_CN( 16u, ushort, 1 )
ICV_DEF_LUT_FUNC_8U_CN( 32s, int, 1 )
ICV_DEF_LUT_FUNC_8U_CN( 64f, double, 1 )
ICV_DEF_LUT_FUNC_8U_CN( 8u, uchar, 2 )
ICV_DEF_LUT_FUNC_8U_CN( 8u, uchar, 3 )
ICV_DEF_LUT_FUNC_8U_CN( 8u, uchar, 4 )
#define ICV_DEF_LUT_FUNC_8U( flavor, dsttype ) \
static CvStatus CV_STDCALL \
icvLUT_Transform8u_##flavor##_CnR( \
const uchar* src, int srcstep, \
dsttype* dst, int dststep, CvSize size, \
const dsttype* _lut, int cn ) \
{ \
int max_block_size = (1 << 10)*cn; \
dsttype lutp[1024]; \
int i, k; \
\
size.width *= cn; \
dststep /= sizeof(dst[0]); \
\
if( size.width*size.height < 256 ) \
{ \
for( ; size.height--; src+=srcstep, dst+=dststep ) \
for( k = 0; k < cn; k++ ) \
for( i = 0; i < size.width; i += cn ) \
dst[i+k] = _lut[src[i+k]*cn+k]; \
return CV_OK; \
} \
\
/* repack the lut to planar layout */ \
for( k = 0; k < cn; k++ ) \
for( i = 0; i < 256; i++ ) \
lutp[i+k*256] = _lut[i*cn+k]; \
\
for( ; size.height--; src += srcstep, dst += dststep ) \
{ \
for( i = 0; i < size.width; ) \
{ \
int j, limit = MIN(size.width,i+max_block_size);\
for( k=0; k<cn; k++, src++, dst++ ) \
{ \
const dsttype* lut = lutp + k*256; \
for( j = i; j <= limit - cn*2; j += cn*2 ) \
{ \
dsttype t0 = lut[src[j]]; \
dsttype t1 = lut[src[j+cn]]; \
dst[j] = t0; dst[j+cn] = t1; \
} \
\
for( ; j < limit; j += cn ) \
dst[j] = lut[src[j]]; \
} \
src -= cn; \
dst -= cn; \
i += limit; \
} \
} \
\
return CV_OK; \
}
ICV_DEF_LUT_FUNC_8U( 8u, uchar )
ICV_DEF_LUT_FUNC_8U( 16u, ushort )
ICV_DEF_LUT_FUNC_8U( 32s, int )
ICV_DEF_LUT_FUNC_8U( 64f, double )
#undef icvLUT_Transform8u_8s_C1R
#undef icvLUT_Transform8u_16s_C1R
#undef icvLUT_Transform8u_32f_C1R
#define icvLUT_Transform8u_8s_C1R icvLUT_Transform8u_8u_C1R
#define icvLUT_Transform8u_16s_C1R icvLUT_Transform8u_16u_C1R
#define icvLUT_Transform8u_32f_C1R icvLUT_Transform8u_32s_C1R
#define icvLUT_Transform8u_8s_CnR icvLUT_Transform8u_8u_CnR
#define icvLUT_Transform8u_16s_CnR icvLUT_Transform8u_16u_CnR
#define icvLUT_Transform8u_32f_CnR icvLUT_Transform8u_32s_CnR
CV_DEF_INIT_FUNC_TAB_2D( LUT_Transform8u, C1R )
CV_DEF_INIT_FUNC_TAB_2D( LUT_Transform8u, CnR )
typedef CvStatus (CV_STDCALL * CvLUT_TransformCnFunc)(
const void* src, int srcstep, void* dst,
int dststep, CvSize size, const void* lut, int cn );
CV_IMPL void
cvLUT( const void* srcarr, void* dstarr, const void* lutarr )
{
static CvFuncTable lut_c1_tab, lut_cn_tab;
static CvLUT_TransformFunc lut_8u_tab[4];
static int inittab = 0;
CV_FUNCNAME( "cvLUT" );
__BEGIN__;
int coi1 = 0, coi2 = 0;
int depth, cn, lut_cn;
CvMat srcstub, *src = (CvMat*)srcarr;
CvMat dststub, *dst = (CvMat*)dstarr;
CvMat lutstub, *lut = (CvMat*)lutarr;
uchar* lut_data;
uchar* shuffled_lut = 0;
CvSize size;
if( !inittab )
{
icvInitLUT_Transform8uC1RTable( &lut_c1_tab );
icvInitLUT_Transform8uCnRTable( &lut_cn_tab );
lut_8u_tab[0] = (CvLUT_TransformFunc)icvLUT_Transform8u_8u_C1R;
lut_8u_tab[1] = (CvLUT_TransformFunc)icvLUT_Transform8u_8u_C2R;
lut_8u_tab[2] = (CvLUT_TransformFunc)icvLUT_Transform8u_8u_C3R;
lut_8u_tab[3] = (CvLUT_TransformFunc)icvLUT_Transform8u_8u_C4R;
inittab = 1;
}
if( !CV_IS_MAT(src) )
CV_CALL( src = cvGetMat( src, &srcstub, &coi1 ));
if( !CV_IS_MAT(dst) )
CV_CALL( dst = cvGetMat( dst, &dststub, &coi2 ));
if( !CV_IS_MAT(lut) )
CV_CALL( lut = cvGetMat( lut, &lutstub ));
if( coi1 != 0 || coi2 != 0 )
CV_ERROR( CV_BadCOI, "" );
if( !CV_ARE_SIZES_EQ( src, dst ))
CV_ERROR( CV_StsUnmatchedSizes, "" );
if( !CV_ARE_CNS_EQ( src, dst ))
CV_ERROR( CV_StsUnmatchedFormats, "" );
if( CV_MAT_DEPTH( src->type ) > CV_8S )
CV_ERROR( CV_StsUnsupportedFormat, "" );
depth = CV_MAT_DEPTH( dst->type );
cn = CV_MAT_CN( dst->type );
lut_cn = CV_MAT_CN( lut->type );
if( !CV_IS_MAT_CONT(lut->type) || (lut_cn != 1 && lut_cn != cn) ||
!CV_ARE_DEPTHS_EQ( dst, lut ) || lut->width*lut->height != 256 )
CV_ERROR( CV_StsBadArg, "The LUT must be continuous array \n"
"with 256 elements of the same type as destination" );
size = cvGetMatSize( src );
if( lut_cn == 1 )
{
size.width *= cn;
cn = 1;
}
if( CV_IS_MAT_CONT( src->type & dst->type ))
{
size.width *= size.height;
size.height = 1;
}
lut_data = lut->data.ptr;
if( CV_MAT_DEPTH( src->type ) == CV_8S )
{
int half_size = CV_ELEM_SIZE1(depth)*cn*128;
shuffled_lut = (uchar*)cvStackAlloc(half_size*2);
// shuffle lut
memcpy( shuffled_lut, lut_data + half_size, half_size );
memcpy( shuffled_lut + half_size, lut_data, half_size );
lut_data = shuffled_lut;
}
if( lut_cn == 1 || lut_cn <= 4 && depth == CV_8U )
{
CvLUT_TransformFunc func = depth == CV_8U ? lut_8u_tab[cn-1] :
(CvLUT_TransformFunc)(lut_c1_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsUnsupportedFormat, "" );
IPPI_CALL( func( src->data.ptr, src->step, dst->data.ptr,
dst->step, size, lut_data ));
}
else
{
CvLUT_TransformCnFunc func =
(CvLUT_TransformCnFunc)(lut_cn_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsUnsupportedFormat, "" );
IPPI_CALL( func( src->data.ptr, src->step, dst->data.ptr,
dst->step, size, lut_data, cn ));
}
__END__;
}
/* End of file. */

View File

@@ -0,0 +1,481 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
#include <float.h>
/****************************************************************************************\
* Mean value over the region *
\****************************************************************************************/
#define ICV_MEAN_CASE_C1( len ) \
for( ; x <= (len) - 2; x += 2 ) \
{ \
if( mask[x] ) \
s0 += src[x], pix++; \
if( mask[x+1] ) \
s0 += src[x+1], pix++; \
} \
\
for( ; x < (len); x++ ) \
if( mask[x] ) \
s0 += src[x], pix++
#define ICV_MEAN_CASE_C2( len ) \
for( ; x < (len); x++ ) \
if( mask[x] ) \
{ \
s0 += src[x*2]; \
s1 += src[x*2+1]; \
pix++; \
}
#define ICV_MEAN_CASE_C3( len ) \
for( ; x < (len); x++ ) \
if( mask[x] ) \
{ \
s0 += src[x*3]; \
s1 += src[x*3+1]; \
s2 += src[x*3+2]; \
pix++; \
}
#define ICV_MEAN_CASE_C4( len ) \
for( ; x < (len); x++ ) \
if( mask[x] ) \
{ \
s0 += src[x*4]; \
s1 += src[x*4+1]; \
s2 += src[x*4+2]; \
s3 += src[x*4+3]; \
pix++; \
}
#define ICV_MEAN_COI_CASE( len, cn ) \
for( ; x <= (len) - 2; x += 2 ) \
{ \
if( mask[x] ) \
s0 += src[x*(cn)], pix++; \
if( mask[x+1] ) \
s0+=src[(x+1)*(cn)], pix++; \
} \
\
for( ; x < (len); x++ ) \
if( mask[x] ) \
s0 += src[x*(cn)], pix++;
////////////////////////////////////// entry macros //////////////////////////////////////
#define ICV_MEAN_ENTRY_COMMON() \
int pix = 0; \
step /= sizeof(src[0])
#define ICV_MEAN_ENTRY_C1( sumtype ) \
sumtype s0 = 0; \
ICV_MEAN_ENTRY_COMMON()
#define ICV_MEAN_ENTRY_C2( sumtype ) \
sumtype s0 = 0, s1 = 0; \
ICV_MEAN_ENTRY_COMMON()
#define ICV_MEAN_ENTRY_C3( sumtype ) \
sumtype s0 = 0, s1 = 0, s2 = 0; \
ICV_MEAN_ENTRY_COMMON()
#define ICV_MEAN_ENTRY_C4( sumtype ) \
sumtype s0 = 0, s1 = 0, s2 = 0, s3 = 0; \
ICV_MEAN_ENTRY_COMMON()
#define ICV_MEAN_ENTRY_BLOCK_COMMON( block_size ) \
int remaining = block_size; \
ICV_MEAN_ENTRY_COMMON()
#define ICV_MEAN_ENTRY_BLOCK_C1( sumtype, worktype, block_size )\
sumtype sum0 = 0; \
worktype s0 = 0; \
ICV_MEAN_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_ENTRY_BLOCK_C2( sumtype, worktype, block_size )\
sumtype sum0 = 0, sum1 = 0; \
worktype s0 = 0, s1 = 0; \
ICV_MEAN_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_ENTRY_BLOCK_C3( sumtype, worktype, block_size )\
sumtype sum0 = 0, sum1 = 0, sum2 = 0; \
worktype s0 = 0, s1 = 0, s2 = 0; \
ICV_MEAN_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_ENTRY_BLOCK_C4( sumtype, worktype, block_size )\
sumtype sum0 = 0, sum1 = 0, sum2 = 0, sum3 = 0; \
worktype s0 = 0, s1 = 0, s2 = 0, s3 = 0; \
ICV_MEAN_ENTRY_BLOCK_COMMON( block_size )
/////////////////////////////////////// exit macros //////////////////////////////////////
#define ICV_MEAN_EXIT_COMMON() \
double scale = pix ? 1./pix : 0
#define ICV_MEAN_EXIT_C1( tmp ) \
ICV_MEAN_EXIT_COMMON(); \
mean[0] = scale*(double)tmp##0
#define ICV_MEAN_EXIT_C2( tmp ) \
ICV_MEAN_EXIT_COMMON(); \
double t0 = scale*(double)tmp##0; \
double t1 = scale*(double)tmp##1; \
mean[0] = t0; \
mean[1] = t1
#define ICV_MEAN_EXIT_C3( tmp ) \
ICV_MEAN_EXIT_COMMON(); \
double t0 = scale*(double)tmp##0; \
double t1 = scale*(double)tmp##1; \
double t2 = scale*(double)tmp##2; \
mean[0] = t0; \
mean[1] = t1; \
mean[2] = t2
#define ICV_MEAN_EXIT_C4( tmp ) \
ICV_MEAN_EXIT_COMMON(); \
double t0 = scale*(double)tmp##0; \
double t1 = scale*(double)tmp##1; \
mean[0] = t0; \
mean[1] = t1; \
t0 = scale*(double)tmp##2; \
t1 = scale*(double)tmp##3; \
mean[2] = t0; \
mean[3] = t1
#define ICV_MEAN_EXIT_BLOCK_C1() \
sum0 += s0; \
ICV_MEAN_EXIT_C1( sum )
#define ICV_MEAN_EXIT_BLOCK_C2() \
sum0 += s0; sum1 += s1; \
ICV_MEAN_EXIT_C2( sum )
#define ICV_MEAN_EXIT_BLOCK_C3() \
sum0 += s0; sum1 += s1; \
sum2 += s2; \
ICV_MEAN_EXIT_C3( sum )
#define ICV_MEAN_EXIT_BLOCK_C4() \
sum0 += s0; sum1 += s1; \
sum2 += s2; sum3 += s3; \
ICV_MEAN_EXIT_C4( sum )
////////////////////////////////////// update macros /////////////////////////////////////
#define ICV_MEAN_UPDATE_COMMON( block_size )\
remaining = block_size
#define ICV_MEAN_UPDATE_C1( block_size ) \
ICV_MEAN_UPDATE_COMMON( block_size ); \
sum0 += s0; \
s0 = 0
#define ICV_MEAN_UPDATE_C2( block_size ) \
ICV_MEAN_UPDATE_COMMON( block_size ); \
sum0 += s0; sum1 += s1; \
s0 = s1 = 0
#define ICV_MEAN_UPDATE_C3( block_size ) \
ICV_MEAN_UPDATE_COMMON( block_size ); \
sum0 += s0; sum1 += s1; sum2 += s2; \
s0 = s1 = s2 = 0
#define ICV_MEAN_UPDATE_C4( block_size ) \
ICV_MEAN_UPDATE_COMMON( block_size ); \
sum0 += s0; sum1 += s1; \
sum2 += s2; sum3 += s3; \
s0 = s1 = s2 = s3 = 0
#define ICV_IMPL_MEAN_BLOCK_FUNC_2D( flavor, cn, \
arrtype, sumtype, worktype, block_size ) \
IPCVAPI_IMPL( CvStatus, icvMean_##flavor##_C##cn##MR, \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, double* mean ), \
(src, step, mask, maskstep, size, mean)) \
{ \
ICV_MEAN_ENTRY_BLOCK_C##cn( sumtype, worktype, block_size );\
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_CASE_C##cn( limit ); \
if( remaining == 0 ) \
{ \
ICV_MEAN_UPDATE_C##cn( block_size ); \
} \
} \
} \
\
{ ICV_MEAN_EXIT_BLOCK_C##cn(); } \
return CV_OK; \
}
#define ICV_IMPL_MEAN_FUNC_2D( flavor, cn, \
arrtype, sumtype, worktype ) \
IPCVAPI_IMPL( CvStatus, icvMean_##flavor##_C##cn##MR, \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, double* mean), \
(src, step, mask, maskstep, size, mean)) \
{ \
ICV_MEAN_ENTRY_C##cn( sumtype ); \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
ICV_MEAN_CASE_C##cn( size.width ); \
} \
\
{ ICV_MEAN_EXIT_C##cn( s ); } \
return CV_OK; \
}
#define ICV_IMPL_MEAN_BLOCK_FUNC_2D_COI( flavor, \
arrtype, sumtype, worktype, block_size ) \
static CvStatus CV_STDCALL \
icvMean_##flavor##_CnCMR( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, int cn, \
int coi, double* mean ) \
{ \
ICV_MEAN_ENTRY_BLOCK_C1( sumtype, worktype, block_size ); \
src += coi - 1; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_COI_CASE( limit, cn ); \
if( remaining == 0 ) \
{ \
ICV_MEAN_UPDATE_C1( block_size ); \
} \
} \
} \
\
{ ICV_MEAN_EXIT_BLOCK_C1(); } \
return CV_OK; \
}
#define ICV_IMPL_MEAN_FUNC_2D_COI( flavor, \
arrtype, sumtype, worktype ) \
static CvStatus CV_STDCALL \
icvMean_##flavor##_CnCMR( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, int cn, \
int coi, double* mean ) \
{ \
ICV_MEAN_ENTRY_C1( sumtype ); \
src += coi - 1; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
ICV_MEAN_COI_CASE( size.width, cn ); \
} \
\
{ ICV_MEAN_EXIT_C1( s ); } \
return CV_OK; \
}
#define ICV_IMPL_MEAN_BLOCK_ALL( flavor, arrtype, sumtype, \
worktype, block_size ) \
ICV_IMPL_MEAN_BLOCK_FUNC_2D( flavor, 1, arrtype, sumtype, \
worktype, block_size ) \
ICV_IMPL_MEAN_BLOCK_FUNC_2D( flavor, 2, arrtype, sumtype, \
worktype, block_size ) \
ICV_IMPL_MEAN_BLOCK_FUNC_2D( flavor, 3, arrtype, sumtype, \
worktype, block_size ) \
ICV_IMPL_MEAN_BLOCK_FUNC_2D( flavor, 4, arrtype, sumtype, \
worktype, block_size ) \
ICV_IMPL_MEAN_BLOCK_FUNC_2D_COI( flavor, arrtype, sumtype, \
worktype, block_size )
#define ICV_IMPL_MEAN_ALL( flavor, arrtype, sumtype, worktype ) \
ICV_IMPL_MEAN_FUNC_2D( flavor, 1, arrtype, sumtype, worktype ) \
ICV_IMPL_MEAN_FUNC_2D( flavor, 2, arrtype, sumtype, worktype ) \
ICV_IMPL_MEAN_FUNC_2D( flavor, 3, arrtype, sumtype, worktype ) \
ICV_IMPL_MEAN_FUNC_2D( flavor, 4, arrtype, sumtype, worktype ) \
ICV_IMPL_MEAN_FUNC_2D_COI( flavor, arrtype, sumtype, worktype )
ICV_IMPL_MEAN_BLOCK_ALL( 8u, uchar, int64, unsigned, 1 << 24 )
ICV_IMPL_MEAN_BLOCK_ALL( 16u, ushort, int64, unsigned, 1 << 16 )
ICV_IMPL_MEAN_BLOCK_ALL( 16s, short, int64, int, 1 << 16 )
ICV_IMPL_MEAN_ALL( 32s, int, double, double )
ICV_IMPL_MEAN_ALL( 32f, float, double, double )
ICV_IMPL_MEAN_ALL( 64f, double, double, double )
#define icvMean_8s_C1MR 0
#define icvMean_8s_C2MR 0
#define icvMean_8s_C3MR 0
#define icvMean_8s_C4MR 0
#define icvMean_8s_CnCMR 0
CV_DEF_INIT_BIG_FUNC_TAB_2D( Mean, MR )
CV_DEF_INIT_FUNC_TAB_2D( Mean, CnCMR )
CV_IMPL CvScalar
cvAvg( const void* img, const void* maskarr )
{
CvScalar mean = {{0,0,0,0}};
static CvBigFuncTable mean_tab;
static CvFuncTable meancoi_tab;
static int inittab = 0;
CV_FUNCNAME("cvAvg");
__BEGIN__;
CvSize size;
double scale;
if( !maskarr )
{
CV_CALL( mean = cvSum(img));
size = cvGetSize( img );
size.width *= size.height;
scale = size.width ? 1./size.width : 0;
mean.val[0] *= scale;
mean.val[1] *= scale;
mean.val[2] *= scale;
mean.val[3] *= scale;
}
else
{
int type, coi = 0;
int mat_step, mask_step;
CvMat stub, maskstub, *mat = (CvMat*)img, *mask = (CvMat*)maskarr;
if( !inittab )
{
icvInitMeanMRTable( &mean_tab );
icvInitMeanCnCMRTable( &meancoi_tab );
inittab = 1;
}
if( !CV_IS_MAT(mat) )
CV_CALL( mat = cvGetMat( mat, &stub, &coi ));
if( !CV_IS_MAT(mask) )
CV_CALL( mask = cvGetMat( mask, &maskstub ));
if( !CV_IS_MASK_ARR(mask) )
CV_ERROR( CV_StsBadMask, "" );
if( !CV_ARE_SIZES_EQ( mat, mask ) )
CV_ERROR( CV_StsUnmatchedSizes, "" );
type = CV_MAT_TYPE( mat->type );
size = cvGetMatSize( mat );
mat_step = mat->step;
mask_step = mask->step;
if( CV_IS_MAT_CONT( mat->type & mask->type ))
{
size.width *= size.height;
size.height = 1;
mat_step = mask_step = CV_STUB_STEP;
}
if( CV_MAT_CN(type) == 1 || coi == 0 )
{
CvFunc2D_2A1P func;
if( CV_MAT_CN(type) > 4 )
CV_ERROR( CV_StsOutOfRange, "The input array must have at most 4 channels unless COI is set" );
func = (CvFunc2D_2A1P)(mean_tab.fn_2d[type]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, mask->data.ptr,
mask_step, size, mean.val ));
}
else
{
CvFunc2DnC_2A1P func = (CvFunc2DnC_2A1P)(
meancoi_tab.fn_2d[CV_MAT_DEPTH(type)]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, mask->data.ptr,
mask_step, size, CV_MAT_CN(type), coi, mean.val ));
}
}
__END__;
return mean;
}
/* End of file */

View File

@@ -0,0 +1,799 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
/****************************************************************************************\
* Mean and StdDev calculation *
\****************************************************************************************/
#define ICV_MEAN_SDV_COI_CASE( worktype, sqsumtype, \
sqr_macro, len, cn ) \
for( ; x <= (len) - 4*(cn); x += 4*(cn))\
{ \
worktype t0 = src[x]; \
worktype t1 = src[x + (cn)]; \
\
s0 += t0 + t1; \
sq0 += (sqsumtype)(sqr_macro(t0)) + \
(sqsumtype)(sqr_macro(t1)); \
\
t0 = src[x + 2*(cn)]; \
t1 = src[x + 3*(cn)]; \
\
s0 += t0 + t1; \
sq0 += (sqsumtype)(sqr_macro(t0)) + \
(sqsumtype)(sqr_macro(t1)); \
} \
\
for( ; x < (len); x += (cn) ) \
{ \
worktype t0 = src[x]; \
\
s0 += t0; \
sq0 += (sqsumtype)(sqr_macro(t0)); \
}
#define ICV_MEAN_SDV_CASE_C1( worktype, sqsumtype, sqr_macro, len ) \
ICV_MEAN_SDV_COI_CASE( worktype, sqsumtype, sqr_macro, len, 1 )
#define ICV_MEAN_SDV_CASE_C2( worktype, sqsumtype, \
sqr_macro, len ) \
for( ; x < (len); x += 2 ) \
{ \
worktype t0 = (src)[x]; \
worktype t1 = (src)[x + 1]; \
\
s0 += t0; \
sq0 += (sqsumtype)(sqr_macro(t0)); \
s1 += t1; \
sq1 += (sqsumtype)(sqr_macro(t1)); \
}
#define ICV_MEAN_SDV_CASE_C3( worktype, sqsumtype, \
sqr_macro, len ) \
for( ; x < (len); x += 3 ) \
{ \
worktype t0 = (src)[x]; \
worktype t1 = (src)[x + 1]; \
worktype t2 = (src)[x + 2]; \
\
s0 += t0; \
sq0 += (sqsumtype)(sqr_macro(t0)); \
s1 += t1; \
sq1 += (sqsumtype)(sqr_macro(t1)); \
s2 += t2; \
sq2 += (sqsumtype)(sqr_macro(t2)); \
}
#define ICV_MEAN_SDV_CASE_C4( worktype, sqsumtype, \
sqr_macro, len ) \
for( ; x < (len); x += 4 ) \
{ \
worktype t0 = (src)[x]; \
worktype t1 = (src)[x + 1]; \
\
s0 += t0; \
sq0 += (sqsumtype)(sqr_macro(t0)); \
s1 += t1; \
sq1 += (sqsumtype)(sqr_macro(t1)); \
\
t0 = (src)[x + 2]; \
t1 = (src)[x + 3]; \
\
s2 += t0; \
sq2 += (sqsumtype)(sqr_macro(t0)); \
s3 += t1; \
sq3 += (sqsumtype)(sqr_macro(t1)); \
}
#define ICV_MEAN_SDV_MASK_COI_CASE( worktype, sqsumtype, \
sqr_macro, len, cn ) \
for( ; x <= (len) - 4; x += 4 ) \
{ \
worktype t0; \
if( mask[x] ) \
{ \
t0 = src[x*(cn)]; pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
} \
\
if( mask[x+1] ) \
{ \
t0 = src[(x+1)*(cn)]; pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
} \
\
if( mask[x+2] ) \
{ \
t0 = src[(x+2)*(cn)]; pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
} \
\
if( mask[x+3] ) \
{ \
t0 = src[(x+3)*(cn)]; pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
} \
} \
\
for( ; x < (len); x++ ) \
{ \
if( mask[x] ) \
{ \
worktype t0 = src[x*(cn)]; pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
} \
}
#define ICV_MEAN_SDV_MASK_CASE_C1( worktype, sqsumtype, sqr_macro, len ) \
ICV_MEAN_SDV_MASK_COI_CASE( worktype, sqsumtype, sqr_macro, len, 1 )
#define ICV_MEAN_SDV_MASK_CASE_C2( worktype, sqsumtype,\
sqr_macro, len ) \
for( ; x < (len); x++ ) \
{ \
if( mask[x] ) \
{ \
worktype t0 = src[x*2]; \
worktype t1 = src[x*2+1]; \
pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
s1 += t1; \
sq1 += sqsumtype(sqr_macro(t1)); \
} \
}
#define ICV_MEAN_SDV_MASK_CASE_C3( worktype, sqsumtype,\
sqr_macro, len ) \
for( ; x < (len); x++ ) \
{ \
if( mask[x] ) \
{ \
worktype t0 = src[x*3]; \
worktype t1 = src[x*3+1]; \
worktype t2 = src[x*3+2]; \
pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
s1 += t1; \
sq1 += sqsumtype(sqr_macro(t1)); \
s2 += t2; \
sq2 += sqsumtype(sqr_macro(t2)); \
} \
}
#define ICV_MEAN_SDV_MASK_CASE_C4( worktype, sqsumtype,\
sqr_macro, len ) \
for( ; x < (len); x++ ) \
{ \
if( mask[x] ) \
{ \
worktype t0 = src[x*4]; \
worktype t1 = src[x*4+1]; \
pix++; \
s0 += t0; \
sq0 += sqsumtype(sqr_macro(t0)); \
s1 += t1; \
sq1 += sqsumtype(sqr_macro(t1)); \
t0 = src[x*4+2]; \
t1 = src[x*4+3]; \
s2 += t0; \
sq2 += sqsumtype(sqr_macro(t0)); \
s3 += t1; \
sq3 += sqsumtype(sqr_macro(t1)); \
} \
}
////////////////////////////////////// entry macros //////////////////////////////////////
#define ICV_MEAN_SDV_ENTRY_COMMON() \
int pix; \
double scale, tmp; \
step /= sizeof(src[0])
#define ICV_MEAN_SDV_ENTRY_C1( sumtype, sqsumtype ) \
sumtype s0 = 0; \
sqsumtype sq0 = 0; \
ICV_MEAN_SDV_ENTRY_COMMON()
#define ICV_MEAN_SDV_ENTRY_C2( sumtype, sqsumtype ) \
sumtype s0 = 0, s1 = 0; \
sqsumtype sq0 = 0, sq1 = 0; \
ICV_MEAN_SDV_ENTRY_COMMON()
#define ICV_MEAN_SDV_ENTRY_C3( sumtype, sqsumtype ) \
sumtype s0 = 0, s1 = 0, s2 = 0; \
sqsumtype sq0 = 0, sq1 = 0, sq2 = 0; \
ICV_MEAN_SDV_ENTRY_COMMON()
#define ICV_MEAN_SDV_ENTRY_C4( sumtype, sqsumtype ) \
sumtype s0 = 0, s1 = 0, s2 = 0, s3 = 0; \
sqsumtype sq0 = 0, sq1 = 0, sq2 = 0, sq3 = 0; \
ICV_MEAN_SDV_ENTRY_COMMON()
#define ICV_MEAN_SDV_ENTRY_BLOCK_COMMON( block_size ) \
int remaining = block_size; \
ICV_MEAN_SDV_ENTRY_COMMON()
#define ICV_MEAN_SDV_ENTRY_BLOCK_C1( sumtype, sqsumtype, \
worktype, sqworktype, block_size ) \
sumtype sum0 = 0; \
sqsumtype sqsum0 = 0; \
worktype s0 = 0; \
sqworktype sq0 = 0; \
ICV_MEAN_SDV_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_SDV_ENTRY_BLOCK_C2( sumtype, sqsumtype, \
worktype, sqworktype, block_size ) \
sumtype sum0 = 0, sum1 = 0; \
sqsumtype sqsum0 = 0, sqsum1 = 0; \
worktype s0 = 0, s1 = 0; \
sqworktype sq0 = 0, sq1 = 0; \
ICV_MEAN_SDV_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_SDV_ENTRY_BLOCK_C3( sumtype, sqsumtype, \
worktype, sqworktype, block_size ) \
sumtype sum0 = 0, sum1 = 0, sum2 = 0; \
sqsumtype sqsum0 = 0, sqsum1 = 0, sqsum2 = 0; \
worktype s0 = 0, s1 = 0, s2 = 0; \
sqworktype sq0 = 0, sq1 = 0, sq2 = 0; \
ICV_MEAN_SDV_ENTRY_BLOCK_COMMON( block_size )
#define ICV_MEAN_SDV_ENTRY_BLOCK_C4( sumtype, sqsumtype, \
worktype, sqworktype, block_size ) \
sumtype sum0 = 0, sum1 = 0, sum2 = 0, sum3 = 0; \
sqsumtype sqsum0 = 0, sqsum1 = 0, sqsum2 = 0, sqsum3 = 0; \
worktype s0 = 0, s1 = 0, s2 = 0, s3 = 0; \
sqworktype sq0 = 0, sq1 = 0, sq2 = 0, sq3 = 0; \
ICV_MEAN_SDV_ENTRY_BLOCK_COMMON( block_size )
/////////////////////////////////////// exit macros //////////////////////////////////////
#define ICV_MEAN_SDV_EXIT_COMMON() \
scale = pix ? 1./pix : 0
#define ICV_MEAN_SDV_EXIT_CN( total, sqtotal, idx ) \
ICV_MEAN_SDV_EXIT_COMMON(); \
mean[idx] = tmp = scale*(double)total##idx; \
tmp = scale*(double)sqtotal##idx - tmp*tmp; \
sdv[idx] = sqrt(MAX(tmp,0.))
#define ICV_MEAN_SDV_EXIT_C1( total, sqtotal ) \
ICV_MEAN_SDV_EXIT_COMMON(); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 0 )
#define ICV_MEAN_SDV_EXIT_C2( total, sqtotal ) \
ICV_MEAN_SDV_EXIT_COMMON(); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 0 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 1 )
#define ICV_MEAN_SDV_EXIT_C3( total, sqtotal ) \
ICV_MEAN_SDV_EXIT_COMMON(); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 0 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 1 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 2 )
#define ICV_MEAN_SDV_EXIT_C4( total, sqtotal ) \
ICV_MEAN_SDV_EXIT_COMMON(); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 0 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 1 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 2 ); \
ICV_MEAN_SDV_EXIT_CN( total, sqtotal, 3 )
////////////////////////////////////// update macros /////////////////////////////////////
#define ICV_MEAN_SDV_UPDATE_COMMON( block_size )\
remaining = block_size
#define ICV_MEAN_SDV_UPDATE_C1( block_size ) \
ICV_MEAN_SDV_UPDATE_COMMON( block_size ); \
sum0 += s0; sqsum0 += sq0; \
s0 = 0; sq0 = 0
#define ICV_MEAN_SDV_UPDATE_C2( block_size ) \
ICV_MEAN_SDV_UPDATE_COMMON( block_size ); \
sum0 += s0; sqsum0 += sq0; \
sum1 += s1; sqsum1 += sq1; \
s0 = s1 = 0; sq0 = sq1 = 0
#define ICV_MEAN_SDV_UPDATE_C3( block_size ) \
ICV_MEAN_SDV_UPDATE_COMMON( block_size ); \
sum0 += s0; sqsum0 += sq0; \
sum1 += s1; sqsum1 += sq1; \
sum2 += s2; sqsum2 += sq2; \
s0 = s1 = s2 = 0; sq0 = sq1 = sq2 = 0
#define ICV_MEAN_SDV_UPDATE_C4( block_size ) \
ICV_MEAN_SDV_UPDATE_COMMON( block_size ); \
sum0 += s0; sqsum0 += sq0; \
sum1 += s1; sqsum1 += sq1; \
sum2 += s2; sqsum2 += sq2; \
sum3 += s3; sqsum3 += sq3; \
s0 = s1 = s2 = s3 = 0; sq0 = sq1 = sq2 = sq3 = 0
#define ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D( flavor, cn, arrtype, \
sumtype, sqsumtype, worktype, \
sqworktype, block_size, sqr_macro ) \
IPCVAPI_IMPL( CvStatus, icvMean_StdDev_##flavor##_C##cn##R, \
( const arrtype* src, int step, \
CvSize size, double* mean, double* sdv ), \
(src, step, size, mean, sdv) ) \
{ \
ICV_MEAN_SDV_ENTRY_BLOCK_C##cn( sumtype, sqsumtype, \
worktype, sqworktype, (block_size)*(cn) ); \
pix = size.width * size.height; \
size.width *= (cn); \
\
for( ; size.height--; src += step ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_SDV_CASE_C##cn( worktype, sqworktype, \
sqr_macro, limit ); \
if( remaining == 0 ) \
{ \
ICV_MEAN_SDV_UPDATE_C##cn( (block_size)*(cn) ); \
} \
} \
} \
\
ICV_MEAN_SDV_UPDATE_C##cn(0); \
ICV_MEAN_SDV_EXIT_C##cn( sum, sqsum ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_FUNC_2D( flavor, cn, arrtype, \
sumtype, sqsumtype, worktype ) \
IPCVAPI_IMPL( CvStatus, icvMean_StdDev_##flavor##_C##cn##R, \
( const arrtype* src, int step, \
CvSize size, double* mean, double* sdv ), \
(src, step, size, mean, sdv) ) \
{ \
ICV_MEAN_SDV_ENTRY_C##cn( sumtype, sqsumtype ); \
pix = size.width * size.height; \
size.width *= (cn); \
\
for( ; size.height--; src += step ) \
{ \
int x = 0; \
ICV_MEAN_SDV_CASE_C##cn( worktype, sqsumtype, \
CV_SQR, size.width ); \
} \
\
ICV_MEAN_SDV_EXIT_C##cn( s, sq ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D_COI( flavor, arrtype, \
sumtype, sqsumtype, worktype, \
sqworktype, block_size, sqr_macro ) \
static CvStatus CV_STDCALL icvMean_StdDev_##flavor##_CnCR \
( const arrtype* src, int step, \
CvSize size, int cn, int coi, \
double* mean, double* sdv ) \
{ \
ICV_MEAN_SDV_ENTRY_BLOCK_C1( sumtype, sqsumtype, \
worktype, sqworktype, (block_size)*(cn) ); \
pix = size.width * size.height; \
size.width *= (cn); \
src += coi - 1; \
\
for( ; size.height--; src += step ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_SDV_COI_CASE( worktype, sqworktype, \
sqr_macro, limit, cn); \
if( remaining == 0 ) \
{ \
ICV_MEAN_SDV_UPDATE_C1( (block_size)*(cn) ); \
} \
} \
} \
\
ICV_MEAN_SDV_UPDATE_C1(0); \
ICV_MEAN_SDV_EXIT_C1( sum, sqsum ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_FUNC_2D_COI( flavor, arrtype, \
sumtype, sqsumtype, worktype )\
static CvStatus CV_STDCALL icvMean_StdDev_##flavor##_CnCR \
( const arrtype* src, int step, CvSize size,\
int cn, int coi, double* mean, double* sdv )\
{ \
ICV_MEAN_SDV_ENTRY_C1( sumtype, sqsumtype ); \
pix = size.width * size.height; \
size.width *= (cn); \
src += coi - 1; \
\
for( ; size.height--; src += step ) \
{ \
int x = 0; \
ICV_MEAN_SDV_COI_CASE( worktype, sqsumtype, \
CV_SQR, size.width, cn ); \
} \
\
ICV_MEAN_SDV_EXIT_C1( s, sq ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D( flavor, cn, \
arrtype, sumtype, sqsumtype, worktype, \
sqworktype, block_size, sqr_macro ) \
IPCVAPI_IMPL( CvStatus, icvMean_StdDev_##flavor##_C##cn##MR, \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, double* mean, double* sdv ), \
(src, step, mask, maskstep, size, mean, sdv))\
{ \
ICV_MEAN_SDV_ENTRY_BLOCK_C##cn( sumtype, sqsumtype, \
worktype, sqworktype, block_size ); \
pix = 0; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_SDV_MASK_CASE_C##cn( worktype, sqworktype, \
sqr_macro, limit ); \
if( remaining == 0 ) \
{ \
ICV_MEAN_SDV_UPDATE_C##cn( block_size ); \
} \
} \
} \
\
ICV_MEAN_SDV_UPDATE_C##cn(0); \
ICV_MEAN_SDV_EXIT_C##cn( sum, sqsum ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_MASK_FUNC_2D( flavor, cn, arrtype, \
sumtype, sqsumtype, worktype)\
IPCVAPI_IMPL( CvStatus, icvMean_StdDev_##flavor##_C##cn##MR, \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, double* mean, double* sdv ), \
(src, step, mask, maskstep, size, mean, sdv))\
{ \
ICV_MEAN_SDV_ENTRY_C##cn( sumtype, sqsumtype ); \
pix = 0; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
ICV_MEAN_SDV_MASK_CASE_C##cn( worktype, sqsumtype, \
CV_SQR, size.width ); \
} \
\
ICV_MEAN_SDV_EXIT_C##cn( s, sq ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D_COI( flavor, \
arrtype, sumtype, sqsumtype, worktype, \
sqworktype, block_size, sqr_macro ) \
static CvStatus CV_STDCALL icvMean_StdDev_##flavor##_CnCMR \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, int cn, int coi, \
double* mean, double* sdv ) \
{ \
ICV_MEAN_SDV_ENTRY_BLOCK_C1( sumtype, sqsumtype, \
worktype, sqworktype, block_size ); \
pix = 0; \
src += coi - 1; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
while( x < size.width ) \
{ \
int limit = MIN( remaining, size.width - x ); \
remaining -= limit; \
limit += x; \
ICV_MEAN_SDV_MASK_COI_CASE( worktype, sqworktype, \
sqr_macro, limit, cn ); \
if( remaining == 0 ) \
{ \
ICV_MEAN_SDV_UPDATE_C1( block_size ); \
} \
} \
} \
\
ICV_MEAN_SDV_UPDATE_C1(0); \
ICV_MEAN_SDV_EXIT_C1( sum, sqsum ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_MASK_FUNC_2D_COI( flavor, arrtype, \
sumtype, sqsumtype, worktype ) \
static CvStatus CV_STDCALL icvMean_StdDev_##flavor##_CnCMR \
( const arrtype* src, int step, \
const uchar* mask, int maskstep, \
CvSize size, int cn, int coi, \
double* mean, double* sdv ) \
{ \
ICV_MEAN_SDV_ENTRY_C1( sumtype, sqsumtype ); \
pix = 0; \
src += coi - 1; \
\
for( ; size.height--; src += step, mask += maskstep ) \
{ \
int x = 0; \
ICV_MEAN_SDV_MASK_COI_CASE( worktype, sqsumtype, \
CV_SQR, size.width, cn ); \
} \
\
ICV_MEAN_SDV_EXIT_C1( s, sq ); \
return CV_OK; \
}
#define ICV_DEF_MEAN_SDV_BLOCK_ALL( flavor, arrtype, sumtype, sqsumtype,\
worktype, sqworktype, block_size, sqr_macro)\
ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D( flavor, 1, arrtype, sumtype, sqsumtype, \
worktype, sqworktype, block_size, sqr_macro)\
ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D( flavor, 2, arrtype, sumtype, sqsumtype, \
worktype, sqworktype, block_size, sqr_macro)\
ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D( flavor, 3, arrtype, sumtype, sqsumtype, \
worktype, sqworktype, block_size, sqr_macro)\
ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D( flavor, 4, arrtype, sumtype, sqsumtype, \
worktype, sqworktype, block_size, sqr_macro)\
ICV_DEF_MEAN_SDV_BLOCK_FUNC_2D_COI( flavor, arrtype, sumtype, sqsumtype,\
worktype, sqworktype, block_size, sqr_macro)\
\
ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D( flavor, 1, arrtype, sumtype, \
sqsumtype, worktype, sqworktype, block_size, sqr_macro ) \
ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D( flavor, 2, arrtype, sumtype, \
sqsumtype, worktype, sqworktype, block_size, sqr_macro ) \
ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D( flavor, 3, arrtype, sumtype, \
sqsumtype, worktype, sqworktype, block_size, sqr_macro ) \
ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D( flavor, 4, arrtype, sumtype, \
sqsumtype, worktype, sqworktype, block_size, sqr_macro ) \
ICV_DEF_MEAN_SDV_MASK_BLOCK_FUNC_2D_COI( flavor, arrtype, sumtype, \
sqsumtype, worktype, sqworktype, block_size, sqr_macro )
#define ICV_DEF_MEAN_SDV_ALL( flavor, arrtype, sumtype, sqsumtype, worktype ) \
ICV_DEF_MEAN_SDV_FUNC_2D( flavor, 1, arrtype, sumtype, sqsumtype, worktype ) \
ICV_DEF_MEAN_SDV_FUNC_2D( flavor, 2, arrtype, sumtype, sqsumtype, worktype ) \
ICV_DEF_MEAN_SDV_FUNC_2D( flavor, 3, arrtype, sumtype, sqsumtype, worktype ) \
ICV_DEF_MEAN_SDV_FUNC_2D( flavor, 4, arrtype, sumtype, sqsumtype, worktype ) \
ICV_DEF_MEAN_SDV_FUNC_2D_COI( flavor, arrtype, sumtype, sqsumtype, worktype ) \
\
ICV_DEF_MEAN_SDV_MASK_FUNC_2D(flavor, 1, arrtype, sumtype, sqsumtype, worktype) \
ICV_DEF_MEAN_SDV_MASK_FUNC_2D(flavor, 2, arrtype, sumtype, sqsumtype, worktype) \
ICV_DEF_MEAN_SDV_MASK_FUNC_2D(flavor, 3, arrtype, sumtype, sqsumtype, worktype) \
ICV_DEF_MEAN_SDV_MASK_FUNC_2D(flavor, 4, arrtype, sumtype, sqsumtype, worktype) \
ICV_DEF_MEAN_SDV_MASK_FUNC_2D_COI( flavor, arrtype, sumtype, sqsumtype, worktype )
ICV_DEF_MEAN_SDV_BLOCK_ALL( 8u, uchar, int64, int64, unsigned, unsigned, 1 << 16, CV_SQR_8U )
ICV_DEF_MEAN_SDV_BLOCK_ALL( 16u, ushort, int64, int64, unsigned, int64, 1 << 16, CV_SQR )
ICV_DEF_MEAN_SDV_BLOCK_ALL( 16s, short, int64, int64, int, int64, 1 << 16, CV_SQR )
ICV_DEF_MEAN_SDV_ALL( 32s, int, double, double, double )
ICV_DEF_MEAN_SDV_ALL( 32f, float, double, double, double )
ICV_DEF_MEAN_SDV_ALL( 64f, double, double, double, double )
#define icvMean_StdDev_8s_C1R 0
#define icvMean_StdDev_8s_C2R 0
#define icvMean_StdDev_8s_C3R 0
#define icvMean_StdDev_8s_C4R 0
#define icvMean_StdDev_8s_CnCR 0
#define icvMean_StdDev_8s_C1MR 0
#define icvMean_StdDev_8s_C2MR 0
#define icvMean_StdDev_8s_C3MR 0
#define icvMean_StdDev_8s_C4MR 0
#define icvMean_StdDev_8s_CnCMR 0
CV_DEF_INIT_BIG_FUNC_TAB_2D( Mean_StdDev, R )
CV_DEF_INIT_FUNC_TAB_2D( Mean_StdDev, CnCR )
CV_DEF_INIT_BIG_FUNC_TAB_2D( Mean_StdDev, MR )
CV_DEF_INIT_FUNC_TAB_2D( Mean_StdDev, CnCMR )
CV_IMPL void
cvAvgSdv( const CvArr* img, CvScalar* _mean, CvScalar* _sdv, const void* mask )
{
CvScalar mean = {{0,0,0,0}};
CvScalar sdv = {{0,0,0,0}};
static CvBigFuncTable meansdv_tab;
static CvFuncTable meansdvcoi_tab;
static CvBigFuncTable meansdvmask_tab;
static CvFuncTable meansdvmaskcoi_tab;
static int inittab = 0;
CV_FUNCNAME("cvMean_StdDev");
__BEGIN__;
int type, coi = 0;
int mat_step, mask_step = 0;
CvSize size;
CvMat stub, maskstub, *mat = (CvMat*)img, *matmask = (CvMat*)mask;
if( !inittab )
{
icvInitMean_StdDevRTable( &meansdv_tab );
icvInitMean_StdDevCnCRTable( &meansdvcoi_tab );
icvInitMean_StdDevMRTable( &meansdvmask_tab );
icvInitMean_StdDevCnCMRTable( &meansdvmaskcoi_tab );
inittab = 1;
}
if( !CV_IS_MAT(mat) )
CV_CALL( mat = cvGetMat( mat, &stub, &coi ));
type = CV_MAT_TYPE( mat->type );
if( CV_MAT_CN(type) > 4 && coi == 0 )
CV_ERROR( CV_StsOutOfRange, "The input array must have at most 4 channels unless COI is set" );
size = cvGetMatSize( mat );
mat_step = mat->step;
if( !mask )
{
if( CV_IS_MAT_CONT( mat->type ))
{
size.width *= size.height;
size.height = 1;
mat_step = CV_STUB_STEP;
}
if( CV_MAT_CN(type) == 1 || coi == 0 )
{
CvFunc2D_1A2P func = (CvFunc2D_1A2P)(meansdv_tab.fn_2d[type]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, size, mean.val, sdv.val ));
}
else
{
CvFunc2DnC_1A2P func = (CvFunc2DnC_1A2P)
(meansdvcoi_tab.fn_2d[CV_MAT_DEPTH(type)]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, size,
CV_MAT_CN(type), coi, mean.val, sdv.val ));
}
}
else
{
CV_CALL( matmask = cvGetMat( matmask, &maskstub ));
mask_step = matmask->step;
if( !CV_IS_MASK_ARR( matmask ))
CV_ERROR( CV_StsBadMask, "" );
if( !CV_ARE_SIZES_EQ( mat, matmask ))
CV_ERROR( CV_StsUnmatchedSizes, "" );
if( CV_IS_MAT_CONT( mat->type & matmask->type ))
{
size.width *= size.height;
size.height = 1;
mat_step = mask_step = CV_STUB_STEP;
}
if( CV_MAT_CN(type) == 1 || coi == 0 )
{
CvFunc2D_2A2P func = (CvFunc2D_2A2P)(meansdvmask_tab.fn_2d[type]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, matmask->data.ptr,
mask_step, size, mean.val, sdv.val ));
}
else
{
CvFunc2DnC_2A2P func = (CvFunc2DnC_2A2P)
(meansdvmaskcoi_tab.fn_2d[CV_MAT_DEPTH(type)]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step,
matmask->data.ptr, mask_step,
size, CV_MAT_CN(type), coi, mean.val, sdv.val ));
}
}
__END__;
if( _mean )
*_mean = mean;
if( _sdv )
*_sdv = sdv;
}
/* End of file */

View File

@@ -0,0 +1,452 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
/****************************************************************************************\
* MinMaxLoc *
\****************************************************************************************/
#define CV_MINMAXLOC_ENTRY( _toggle_, srctype, temptype, cn ) \
temptype min_val, max_val; \
int min_loc = 0, max_loc = 0; \
int x, loc = 0, width = size.width*(cn); \
step /= sizeof(src[0]); \
\
min_val = src[0]; \
min_val = max_val = _toggle_( min_val )
#define CV_MINMAXLOC_EXIT( _fin_cast_macro_ ) \
minLoc->x = min_loc; \
maxLoc->x = max_loc; \
minLoc->y = maxLoc->y = 0; \
*minVal = _fin_cast_macro_(min_val); \
*maxVal = _fin_cast_macro_(max_val); \
return CV_OK
#define ICV_DEF_MINMAXLOC_1D_CASE_COI( _toggle_, temptype, cn ) \
for( x = 0; x < width; x += (cn), loc++ ) \
{ \
temptype val = src[x]; \
val = _toggle_(val); \
\
if( val < min_val ) \
{ \
min_val = val; \
min_loc = loc; \
} \
else if( val > max_val ) \
{ \
max_val = val; \
max_loc = loc; \
} \
}
#define ICV_DEF_MINMAXLOC_FUNC_2D( _toggle_, _fin_cast_macro_, flavor, \
srctype, temptype, extrtype ) \
IPCVAPI_IMPL( CvStatus, \
icvMinMaxIndx_##flavor##_C1R,( const srctype* src, int step, CvSize size, \
extrtype* minVal, extrtype* maxVal, CvPoint* minLoc, CvPoint* maxLoc ), \
(src, step, size, minVal, maxVal, minLoc, maxLoc) ) \
{ \
CV_MINMAXLOC_ENTRY( _toggle_, srctype, temptype, 1 ); \
\
for( ; size.height--; src += step ) \
{ \
ICV_DEF_MINMAXLOC_1D_CASE_COI( _toggle_, temptype, 1 ); \
} \
\
CV_MINMAXLOC_EXIT( _fin_cast_macro_ ); \
}
#define ICV_DEF_MINMAXLOC_FUNC_2D_COI( _toggle_, _fin_cast_macro_, flavor, \
srctype, temptype, extrtype ) \
static CvStatus CV_STDCALL \
icvMinMaxIndx_##flavor##_CnCR( const srctype* src, int step, \
CvSize size, int cn, int coi, \
extrtype* minVal, extrtype* maxVal, \
CvPoint* minLoc, CvPoint* maxLoc ) \
{ \
(src) += coi - 1; \
CV_MINMAXLOC_ENTRY( _toggle_, srctype, temptype, cn ); \
\
for( ; size.height--; src += step ) \
{ \
ICV_DEF_MINMAXLOC_1D_CASE_COI( _toggle_, temptype, cn ); \
} \
\
CV_MINMAXLOC_EXIT( _fin_cast_macro_ ); \
}
#define ICV_DEF_MINMAXLOC_ALL_INT( flavor, srctype, \
_fin_cast_macro_, extrtype ) \
ICV_DEF_MINMAXLOC_FUNC_2D( CV_NOP, _fin_cast_macro_, flavor,\
srctype, int, extrtype ) \
ICV_DEF_MINMAXLOC_FUNC_2D_COI( CV_NOP, _fin_cast_macro_, \
flavor, srctype, int, extrtype )
CV_INLINE float minmax_to_float( int val )
{
Cv32suf v;
v.i = CV_TOGGLE_FLT(val);
return v.f;
}
CV_INLINE double minmax_to_double( int64 val )
{
Cv64suf v;
v.i = CV_TOGGLE_DBL(val);
return v.f;
}
#define ICV_DEF_MINMAXLOC_ALL_FLT( flavor, srctype, _toggle_, \
_fin_cast_macro_, extrtype ) \
\
ICV_DEF_MINMAXLOC_FUNC_2D( _toggle_, _fin_cast_macro_, flavor, \
srctype, srctype, extrtype ) \
ICV_DEF_MINMAXLOC_FUNC_2D_COI( _toggle_, _fin_cast_macro_, flavor, \
srctype, srctype, extrtype )
ICV_DEF_MINMAXLOC_ALL_INT( 8u, uchar, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_ALL_INT( 16u, ushort, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_ALL_INT( 16s, short, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_ALL_INT( 32s, int, CV_CAST_64F, double )
ICV_DEF_MINMAXLOC_ALL_FLT( 32f, int, CV_TOGGLE_FLT, minmax_to_float, float )
ICV_DEF_MINMAXLOC_ALL_FLT( 64f, int64, CV_TOGGLE_DBL, minmax_to_double, double )
/****************************************************************************************\
* MinMaxLoc with mask *
\****************************************************************************************/
#define CV_MINMAXLOC_MASK_ENTRY( _toggle_, srctype, temptype, cn ) \
temptype min_val = 0, max_val = 0; \
int min_loc = -1, max_loc = -1; \
int x = 0, y, loc = 0, width = size.width; \
step /= sizeof(src[0]); \
\
if( width*(cn) == step && width == maskStep ) \
{ \
width *= size.height; \
size.height = 1; \
} \
\
for( y = 0; y < size.height; y++, src += step, \
mask += maskStep ) \
{ \
for( x = 0; x < width; x++, loc++ ) \
if( mask[x] != 0 ) \
{ \
min_loc = max_loc = loc; \
min_val = (src)[x*(cn)]; \
min_val = max_val = _toggle_( min_val ); \
goto stop_scan; \
} \
} \
\
stop_scan:;
#define ICV_DEF_MINMAXLOC_1D_MASK_CASE_COI( _toggle_, temptype, cn ) \
for( ; x < width; x++, loc++ ) \
{ \
temptype val = src[x*(cn)]; \
int m = mask[x] != 0; \
val = _toggle_(val); \
\
if( val < min_val && m ) \
{ \
min_val = val; \
min_loc = loc; \
} \
else if( val > max_val && m ) \
{ \
max_val = val; \
max_loc = loc; \
} \
}
#define ICV_DEF_MINMAXLOC_MASK_FUNC_2D( _toggle_, _fin_cast_macro_, flavor, \
srctype, temptype, extrtype ) \
IPCVAPI_IMPL( CvStatus, \
icvMinMaxIndx_##flavor##_C1MR,( const srctype* src, int step, \
const uchar* mask, int maskStep, CvSize size, \
extrtype* minVal, extrtype* maxVal, CvPoint* minLoc, CvPoint* maxLoc ), \
( src, step, mask, maskStep, size, minVal, maxVal, minLoc, maxLoc) ) \
{ \
CV_MINMAXLOC_MASK_ENTRY( _toggle_, srctype, temptype, 1 ); \
\
for( ; y < size.height; y++, src += step, mask += maskStep ) \
{ \
ICV_DEF_MINMAXLOC_1D_MASK_CASE_COI( _toggle_, temptype, 1 ) \
x = 0; \
} \
\
CV_MINMAXLOC_EXIT( _fin_cast_macro_ ); \
}
#define ICV_DEF_MINMAXLOC_MASK_FUNC_2D_COI( _toggle_, _fin_cast_macro_, \
flavor, srctype, temptype, extrtype ) \
static CvStatus CV_STDCALL \
icvMinMaxIndx_##flavor##_CnCMR( const srctype* src, int step, \
const uchar* mask, int maskStep, CvSize size, int cn, int coi, \
extrtype* minVal, extrtype* maxVal, CvPoint* minLoc, CvPoint* maxLoc ) \
{ \
(src) += coi - 1; \
CV_MINMAXLOC_MASK_ENTRY( _toggle_, srctype, temptype, cn ); \
\
for( ; y < size.height; y++, src += step, mask += maskStep ) \
{ \
ICV_DEF_MINMAXLOC_1D_MASK_CASE_COI( _toggle_, temptype, cn ) \
x = 0; \
} \
\
CV_MINMAXLOC_EXIT( _fin_cast_macro_ ); \
}
#define ICV_DEF_MINMAXLOC_MASK_ALL_INT( flavor, srctype, \
_fin_cast_macro_, extrtype ) \
ICV_DEF_MINMAXLOC_MASK_FUNC_2D( CV_NOP, _fin_cast_macro_, flavor, \
srctype, int, extrtype ) \
ICV_DEF_MINMAXLOC_MASK_FUNC_2D_COI( CV_NOP, _fin_cast_macro_, flavor, \
srctype, int, extrtype )
#define ICV_DEF_MINMAXLOC_MASK_ALL_FLT( flavor, srctype, _toggle_, \
_fin_cast_macro_, extrtype ) \
ICV_DEF_MINMAXLOC_MASK_FUNC_2D( _toggle_, _fin_cast_macro_, flavor, \
srctype, srctype, extrtype ) \
ICV_DEF_MINMAXLOC_MASK_FUNC_2D_COI( _toggle_, _fin_cast_macro_, flavor, \
srctype, srctype, extrtype )
ICV_DEF_MINMAXLOC_MASK_ALL_INT( 8u, uchar, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_MASK_ALL_INT( 16u, ushort, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_MASK_ALL_INT( 16s, short, CV_CAST_32F, float )
ICV_DEF_MINMAXLOC_MASK_ALL_INT( 32s, int, CV_CAST_64F, double )
ICV_DEF_MINMAXLOC_MASK_ALL_FLT( 32f, int, CV_TOGGLE_FLT, minmax_to_float, float )
ICV_DEF_MINMAXLOC_MASK_ALL_FLT( 64f, int64, CV_TOGGLE_DBL, minmax_to_double, double )
#define icvMinMaxIndx_8s_C1R 0
#define icvMinMaxIndx_8s_CnCR 0
#define icvMinMaxIndx_8s_C1MR 0
#define icvMinMaxIndx_8s_CnCMR 0
CV_DEF_INIT_FUNC_TAB_2D( MinMaxIndx, C1R )
CV_DEF_INIT_FUNC_TAB_2D( MinMaxIndx, CnCR )
CV_DEF_INIT_FUNC_TAB_2D( MinMaxIndx, C1MR )
CV_DEF_INIT_FUNC_TAB_2D( MinMaxIndx, CnCMR )
CV_IMPL void
cvMinMaxLoc( const void* img, double* _minVal, double* _maxVal,
CvPoint* _minLoc, CvPoint* _maxLoc, const void* mask )
{
static CvFuncTable minmax_tab, minmaxcoi_tab;
static CvFuncTable minmaxmask_tab, minmaxmaskcoi_tab;
static int inittab = 0;
CV_FUNCNAME("cvMinMaxLoc");
__BEGIN__;
int type, depth, cn, coi = 0;
int mat_step, mask_step = 0, cont_flag;
CvSize size;
CvMat stub, maskstub, *mat = (CvMat*)img, *matmask = (CvMat*)mask;
CvPoint minloc, maxloc;
double minv = 0, maxv = 0;
float minvf = 0.f, maxvf = 0.f;
void *pmin = &minvf, *pmax = &maxvf;
if( !inittab )
{
icvInitMinMaxIndxC1RTable( &minmax_tab );
icvInitMinMaxIndxCnCRTable( &minmaxcoi_tab );
icvInitMinMaxIndxC1MRTable( &minmaxmask_tab );
icvInitMinMaxIndxCnCMRTable( &minmaxmaskcoi_tab );
inittab = 1;
}
if( !CV_IS_MAT(mat) )
CV_CALL( mat = cvGetMat( mat, &stub, &coi ));
type = CV_MAT_TYPE( mat->type );
depth = CV_MAT_DEPTH( type );
cn = CV_MAT_CN( type );
size = cvGetMatSize( mat );
if( cn > 1 && coi == 0 )
CV_ERROR( CV_StsBadArg, "" );
if( depth == CV_32S || depth == CV_64F )
pmin = &minv, pmax = &maxv;
mat_step = mat->step;
cont_flag = mat->type;
if( mask )
{
CV_CALL( matmask = cvGetMat( matmask, &maskstub ));
if( !CV_IS_MASK_ARR( matmask ))
CV_ERROR( CV_StsBadMask, "" );
if( !CV_ARE_SIZES_EQ( mat, matmask ))
CV_ERROR( CV_StsUnmatchedSizes, "" );
mask_step = matmask->step;
cont_flag &= matmask->type;
}
if( CV_IS_MAT_CONT(cont_flag) )
{
size.width *= size.height;
size.height = 1;
}
if( size.height == 1 )
mat_step = mask_step = CV_STUB_STEP;
if( !mask )
{
if( CV_MAT_CN(type) == 1 || coi == 0 )
{
CvFunc2D_1A4P func = (CvFunc2D_1A4P)(minmax_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, size,
pmin, pmax, &minloc, &maxloc ));
}
else
{
CvFunc2DnC_1A4P func = (CvFunc2DnC_1A4P)(minmaxcoi_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, size, cn, coi,
pmin, pmax, &minloc, &maxloc ));
}
}
else
{
if( CV_MAT_CN(type) == 1 || coi == 0 )
{
CvFunc2D_2A4P func = (CvFunc2D_2A4P)(minmaxmask_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step, matmask->data.ptr,
mask_step, size,
pmin, pmax, &minloc, &maxloc ));
}
else
{
CvFunc2DnC_2A4P func = (CvFunc2DnC_2A4P)(minmaxmaskcoi_tab.fn_2d[depth]);
if( !func )
CV_ERROR( CV_StsBadArg, cvUnsupportedFormat );
IPPI_CALL( func( mat->data.ptr, mat_step,
matmask->data.ptr, mask_step, size, cn, coi,
pmin, pmax, &minloc, &maxloc ));
}
}
if( matmask || _minLoc || _maxLoc )
{
if( minloc.x >= mat->cols )
{
minloc.y = minloc.x / mat->cols;
minloc.x -= minloc.y * mat->cols;
}
if( maxloc.x >= mat->cols )
{
maxloc.y = maxloc.x / mat->cols;
maxloc.x -= maxloc.y * mat->cols;
}
if( matmask && ((unsigned)minloc.x >= (unsigned)mat->cols ||
(unsigned)minloc.y >= (unsigned)mat->rows ||
matmask->data.ptr[minloc.y*matmask->step + minloc.x] == 0 ||
(unsigned)maxloc.x >= (unsigned)mat->cols ||
(unsigned)maxloc.y >= (unsigned)mat->rows ||
matmask->data.ptr[maxloc.y*matmask->step + maxloc.x] == 0) )
{
minloc.x = minloc.y = maxloc.x = maxloc.y = -1;
minv = maxv = minvf = maxvf = 0;
}
if( _minLoc )
*_minLoc = minloc;
if( _maxLoc )
*_maxLoc = maxloc;
}
if( depth != CV_32S && depth != CV_64F )
{
minv = minvf;
maxv = maxvf;
}
if( _minVal )
*_minVal = minv;
if( _maxVal )
*_maxVal = maxv;
__END__;
}
/* End of file */

View File

@@ -0,0 +1,44 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
/* End of file. */

View File

@@ -0,0 +1,600 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/* ////////////////////////////////////////////////////////////////////
//
// Filling CvMat/IplImage instances with random numbers
//
// */
#include "_cxcore.h"
///////////////////////////// Functions Declaration //////////////////////////////////////
/*
Multiply-with-carry generator is used here:
temp = ( A*X(n) + carry )
X(n+1) = temp mod (2^32)
carry = temp / (2^32)
*/
#define ICV_RNG_NEXT(x) ((uint64)(unsigned)(x)*1554115554 + ((x) >> 32))
#define ICV_CVT_FLT(x) (((unsigned)(x) >> 9)|CV_1F)
#define ICV_1D CV_BIG_INT(0x3FF0000000000000)
#define ICV_CVT_DBL(x) (((uint64)(unsigned)(x) << 20)|((x) >> 44)|ICV_1D)
/***************************************************************************************\
* Pseudo-Random Number Generators (PRNGs) *
\***************************************************************************************/
#define ICV_IMPL_RAND_BITS( flavor, arrtype, cast_macro ) \
static CvStatus CV_STDCALL \
icvRandBits_##flavor##_C1R( arrtype* arr, int step, CvSize size, \
uint64* state, const int* param ) \
{ \
uint64 temp = *state; \
int small_flag = (param[12]|param[13]|param[14]|param[15]) <= 255; \
step /= sizeof(arr[0]); \
\
for( ; size.height--; arr += step ) \
{ \
int i, k = 3; \
const int* p = param; \
\
if( !small_flag ) \
{ \
for( i = 0; i <= size.width - 4; i += 4 ) \
{ \
unsigned t0, t1; \
\
temp = ICV_RNG_NEXT(temp); \
t0 = ((unsigned)temp & p[i + 12]) + p[i]; \
temp = ICV_RNG_NEXT(temp); \
t1 = ((unsigned)temp & p[i + 13]) + p[i+1]; \
arr[i] = cast_macro((int)t0); \
arr[i+1] = cast_macro((int)t1); \
\
temp = ICV_RNG_NEXT(temp); \
t0 = ((unsigned)temp & p[i + 14]) + p[i+2]; \
temp = ICV_RNG_NEXT(temp); \
t1 = ((unsigned)temp & p[i + 15]) + p[i+3]; \
arr[i+2] = cast_macro((int)t0); \
arr[i+3] = cast_macro((int)t1); \
\
if( !--k ) \
{ \
k = 3; \
p -= 12; \
} \
} \
} \
else \
{ \
for( i = 0; i <= size.width - 4; i += 4 ) \
{ \
unsigned t0, t1, t; \
\
temp = ICV_RNG_NEXT(temp); \
t = (unsigned)temp; \
t0 = (t & p[i + 12]) + p[i]; \
t1 = ((t >> 8) & p[i + 13]) + p[i+1]; \
arr[i] = cast_macro((int)t0); \
arr[i+1] = cast_macro((int)t1); \
\
t0 = ((t >> 16) & p[i + 14]) + p[i + 2]; \
t1 = ((t >> 24) & p[i + 15]) + p[i + 3]; \
arr[i+2] = cast_macro((int)t0); \
arr[i+3] = cast_macro((int)t1); \
\
if( !--k ) \
{ \
k = 3; \
p -= 12; \
} \
} \
} \
\
for( ; i < size.width; i++ ) \
{ \
unsigned t0; \
temp = ICV_RNG_NEXT(temp); \
\
t0 = ((unsigned)temp & p[i + 12]) + p[i]; \
arr[i] = cast_macro((int)t0); \
} \
} \
\
*state = temp; \
return CV_OK; \
}
#define ICV_IMPL_RAND( flavor, arrtype, worktype, cast_macro1, cast_macro2 )\
static CvStatus CV_STDCALL \
icvRand_##flavor##_C1R( arrtype* arr, int step, CvSize size, \
uint64* state, const double* param ) \
{ \
uint64 temp = *state; \
step /= sizeof(arr[0]); \
\
for( ; size.height--; arr += step ) \
{ \
int i, k = 3; \
const double* p = param; \
\
for( i = 0; i <= size.width - 4; i += 4 ) \
{ \
worktype f0, f1; \
Cv32suf t0, t1; \
\
temp = ICV_RNG_NEXT(temp); \
t0.u = ICV_CVT_FLT(temp); \
temp = ICV_RNG_NEXT(temp); \
t1.u = ICV_CVT_FLT(temp); \
f0 = cast_macro1( t0.f * p[i + 12] + p[i] ); \
f1 = cast_macro1( t1.f * p[i + 13] + p[i + 1] ); \
arr[i] = cast_macro2(f0); \
arr[i+1] = cast_macro2(f1); \
\
temp = ICV_RNG_NEXT(temp); \
t0.u = ICV_CVT_FLT(temp); \
temp = ICV_RNG_NEXT(temp); \
t1.u = ICV_CVT_FLT(temp); \
f0 = cast_macro1( t0.f * p[i + 14] + p[i + 2] ); \
f1 = cast_macro1( t1.f * p[i + 15] + p[i + 3] ); \
arr[i+2] = cast_macro2(f0); \
arr[i+3] = cast_macro2(f1); \
\
if( !--k ) \
{ \
k = 3; \
p -= 12; \
} \
} \
\
for( ; i < size.width; i++ ) \
{ \
worktype f0; \
Cv32suf t0; \
\
temp = ICV_RNG_NEXT(temp); \
t0.u = ICV_CVT_FLT(temp); \
f0 = cast_macro1( t0.f * p[i + 12] + p[i] ); \
arr[i] = cast_macro2(f0); \
} \
} \
\
*state = temp; \
return CV_OK; \
}
static CvStatus CV_STDCALL
icvRand_64f_C1R( double* arr, int step, CvSize size,
uint64* state, const double* param )
{
uint64 temp = *state;
step /= sizeof(arr[0]);
for( ; size.height--; arr += step )
{
int i, k = 3;
const double* p = param;
for( i = 0; i <= size.width - 4; i += 4 )
{
double f0, f1;
Cv64suf t0, t1;
temp = ICV_RNG_NEXT(temp);
t0.u = ICV_CVT_DBL(temp);
temp = ICV_RNG_NEXT(temp);
t1.u = ICV_CVT_DBL(temp);
f0 = t0.f * p[i + 12] + p[i];
f1 = t1.f * p[i + 13] + p[i + 1];
arr[i] = f0;
arr[i+1] = f1;
temp = ICV_RNG_NEXT(temp);
t0.u = ICV_CVT_DBL(temp);
temp = ICV_RNG_NEXT(temp);
t1.u = ICV_CVT_DBL(temp);
f0 = t0.f * p[i + 14] + p[i + 2];
f1 = t1.f * p[i + 15] + p[i + 3];
arr[i+2] = f0;
arr[i+3] = f1;
if( !--k )
{
k = 3;
p -= 12;
}
}
for( ; i < size.width; i++ )
{
double f0;
Cv64suf t0;
temp = ICV_RNG_NEXT(temp);
t0.u = ICV_CVT_DBL(temp);
f0 = t0.f * p[i + 12] + p[i];
arr[i] = f0;
}
}
*state = temp;
return CV_OK;
}
/***************************************************************************************\
The code below implements algorithm from the paper:
G. Marsaglia and W.W. Tsang,
The Monty Python method for generating random variables,
ACM Transactions on Mathematical Software, Vol. 24, No. 3,
Pages 341-350, September, 1998.
\***************************************************************************************/
static CvStatus CV_STDCALL
icvRandn_0_1_32f_C1R( float* arr, int len, uint64* state )
{
uint64 temp = *state;
int i;
temp = ICV_RNG_NEXT(temp);
for( i = 0; i < len; i++ )
{
double x, y, v, ax, bx;
for(;;)
{
x = ((int)temp)*1.167239e-9;
temp = ICV_RNG_NEXT(temp);
ax = fabs(x);
v = 2.8658 - ax*(2.0213 - 0.3605*ax);
y = ((unsigned)temp)*2.328306e-10;
temp = ICV_RNG_NEXT(temp);
if( y < v || ax < 1.17741 )
break;
bx = x;
x = bx > 0 ? 0.8857913*(2.506628 - ax) : -0.8857913*(2.506628 - ax);
if( y > v + 0.0506 )
break;
if( log(y) < .6931472 - .5*bx*bx )
{
x = bx;
break;
}
if( log(1.8857913 - y) < .5718733-.5*x*x )
break;
do
{
v = ((int)temp)*4.656613e-10;
x = -log(fabs(v))*.3989423;
temp = ICV_RNG_NEXT(temp);
y = -log(((unsigned)temp)*2.328306e-10);
temp = ICV_RNG_NEXT(temp);
}
while( y+y < x*x );
x = v > 0 ? 2.506628 + x : -2.506628 - x;
break;
}
arr[i] = (float)x;
}
*state = temp;
return CV_OK;
}
#define RAND_BUF_SIZE 96
#define ICV_IMPL_RANDN( flavor, arrtype, worktype, cast_macro1, cast_macro2 ) \
static CvStatus CV_STDCALL \
icvRandn_##flavor##_C1R( arrtype* arr, int step, CvSize size, \
uint64* state, const double* param ) \
{ \
float buffer[RAND_BUF_SIZE]; \
step /= sizeof(arr[0]); \
\
for( ; size.height--; arr += step ) \
{ \
int i, j, len = RAND_BUF_SIZE; \
\
for( i = 0; i < size.width; i += RAND_BUF_SIZE ) \
{ \
int k = 3; \
const double* p = param; \
\
if( i + len > size.width ) \
len = size.width - i; \
\
icvRandn_0_1_32f_C1R( buffer, len, state ); \
\
for( j = 0; j <= len - 4; j += 4 ) \
{ \
worktype f0, f1; \
\
f0 = cast_macro1( buffer[j]*p[j+12] + p[j] ); \
f1 = cast_macro1( buffer[j+1]*p[j+13] + p[j+1] ); \
arr[i+j] = cast_macro2(f0); \
arr[i+j+1] = cast_macro2(f1); \
\
f0 = cast_macro1( buffer[j+2]*p[j+14] + p[j+2] ); \
f1 = cast_macro1( buffer[j+3]*p[j+15] + p[j+3] ); \
arr[i+j+2] = cast_macro2(f0); \
arr[i+j+3] = cast_macro2(f1); \
\
if( --k == 0 ) \
{ \
k = 3; \
p -= 12; \
} \
} \
\
for( ; j < len; j++ ) \
{ \
worktype f0 = cast_macro1( buffer[j]*p[j+12] + p[j] ); \
arr[i+j] = cast_macro2(f0); \
} \
} \
} \
\
return CV_OK; \
}
ICV_IMPL_RAND_BITS( 8u, uchar, CV_CAST_8U )
ICV_IMPL_RAND_BITS( 16u, ushort, CV_CAST_16U )
ICV_IMPL_RAND_BITS( 16s, short, CV_CAST_16S )
ICV_IMPL_RAND_BITS( 32s, int, CV_CAST_32S )
ICV_IMPL_RAND( 8u, uchar, int, cvFloor, CV_CAST_8U )
ICV_IMPL_RAND( 16u, ushort, int, cvFloor, CV_CAST_16U )
ICV_IMPL_RAND( 16s, short, int, cvFloor, CV_CAST_16S )
ICV_IMPL_RAND( 32s, int, int, cvFloor, CV_CAST_32S )
ICV_IMPL_RAND( 32f, float, float, CV_CAST_32F, CV_NOP )
ICV_IMPL_RANDN( 8u, uchar, int, cvRound, CV_CAST_8U )
ICV_IMPL_RANDN( 16u, ushort, int, cvRound, CV_CAST_16U )
ICV_IMPL_RANDN( 16s, short, int, cvRound, CV_CAST_16S )
ICV_IMPL_RANDN( 32s, int, int, cvRound, CV_CAST_32S )
ICV_IMPL_RANDN( 32f, float, float, CV_CAST_32F, CV_NOP )
ICV_IMPL_RANDN( 64f, double, double, CV_CAST_64F, CV_NOP )
static void icvInitRandTable( CvFuncTable* fastrng_tab,
CvFuncTable* rng_tab,
CvFuncTable* normal_tab )
{
fastrng_tab->fn_2d[CV_8U] = (void*)icvRandBits_8u_C1R;
fastrng_tab->fn_2d[CV_8S] = 0;
fastrng_tab->fn_2d[CV_16U] = (void*)icvRandBits_16u_C1R;
fastrng_tab->fn_2d[CV_16S] = (void*)icvRandBits_16s_C1R;
fastrng_tab->fn_2d[CV_32S] = (void*)icvRandBits_32s_C1R;
rng_tab->fn_2d[CV_8U] = (void*)icvRand_8u_C1R;
rng_tab->fn_2d[CV_8S] = 0;
rng_tab->fn_2d[CV_16U] = (void*)icvRand_16u_C1R;
rng_tab->fn_2d[CV_16S] = (void*)icvRand_16s_C1R;
rng_tab->fn_2d[CV_32S] = (void*)icvRand_32s_C1R;
rng_tab->fn_2d[CV_32F] = (void*)icvRand_32f_C1R;
rng_tab->fn_2d[CV_64F] = (void*)icvRand_64f_C1R;
normal_tab->fn_2d[CV_8U] = (void*)icvRandn_8u_C1R;
normal_tab->fn_2d[CV_8S] = 0;
normal_tab->fn_2d[CV_16U] = (void*)icvRandn_16u_C1R;
normal_tab->fn_2d[CV_16S] = (void*)icvRandn_16s_C1R;
normal_tab->fn_2d[CV_32S] = (void*)icvRandn_32s_C1R;
normal_tab->fn_2d[CV_32F] = (void*)icvRandn_32f_C1R;
normal_tab->fn_2d[CV_64F] = (void*)icvRandn_64f_C1R;
}
CV_IMPL void
cvRandArr( CvRNG* rng, CvArr* arr, int disttype, CvScalar param1, CvScalar param2 )
{
static CvFuncTable rng_tab[2], fastrng_tab;
static int inittab = 0;
CV_FUNCNAME( "cvRandArr" );
__BEGIN__;
int is_nd = 0;
CvMat stub, *mat = (CvMat*)arr;
int type, depth, channels;
double dparam[2][12];
int iparam[2][12];
void* param = dparam;
int i, fast_int_mode = 0;
int mat_step = 0;
CvSize size;
CvFunc2D_1A2P func = 0;
CvMatND stub_nd;
CvNArrayIterator iterator_state, *iterator = 0;
if( !inittab )
{
icvInitRandTable( &fastrng_tab, &rng_tab[CV_RAND_UNI],
&rng_tab[CV_RAND_NORMAL] );
inittab = 1;
}
if( !rng )
CV_ERROR( CV_StsNullPtr, "Null pointer to RNG state" );
if( CV_IS_MATND(mat) )
{
iterator = &iterator_state;
CV_CALL( cvInitNArrayIterator( 1, &arr, 0, &stub_nd, iterator ));
type = CV_MAT_TYPE(iterator->hdr[0]->type);
size = iterator->size;
is_nd = 1;
}
else
{
if( !CV_IS_MAT(mat))
{
int coi = 0;
CV_CALL( mat = cvGetMat( mat, &stub, &coi ));
if( coi != 0 )
CV_ERROR( CV_BadCOI, "COI is not supported" );
}
type = CV_MAT_TYPE( mat->type );
size = cvGetMatSize( mat );
mat_step = mat->step;
if( mat->height > 1 && CV_IS_MAT_CONT( mat->type ))
{
size.width *= size.height;
mat_step = CV_STUB_STEP;
size.height = 1;
}
}
depth = CV_MAT_DEPTH( type );
channels = CV_MAT_CN( type );
size.width *= channels;
if( disttype == CV_RAND_UNI )
{
if( depth <= CV_32S )
{
for( i = 0, fast_int_mode = 1; i < channels; i++ )
{
int t0 = iparam[0][i] = cvCeil( param1.val[i] );
int t1 = iparam[1][i] = cvFloor( param2.val[i] ) - t0;
double diff = param1.val[i] - param2.val[i];
fast_int_mode &= INT_MIN <= diff && diff <= INT_MAX && (t1 & (t1 - 1)) == 0;
}
}
if( fast_int_mode )
{
for( i = 0; i < channels; i++ )
iparam[1][i]--;
for( ; i < 12; i++ )
{
int t0 = iparam[0][i - channels];
int t1 = iparam[1][i - channels];
iparam[0][i] = t0;
iparam[1][i] = t1;
}
CV_GET_FUNC_PTR( func, (CvFunc2D_1A2P)(fastrng_tab.fn_2d[depth]));
param = iparam;
}
else
{
for( i = 0; i < channels; i++ )
{
double t0 = param1.val[i];
double t1 = param2.val[i];
dparam[0][i] = t0 - (t1 - t0);
dparam[1][i] = t1 - t0;
}
CV_GET_FUNC_PTR( func, (CvFunc2D_1A2P)(rng_tab[0].fn_2d[depth]));
}
}
else if( disttype == CV_RAND_NORMAL )
{
for( i = 0; i < channels; i++ )
{
double t0 = param1.val[i];
double t1 = param2.val[i];
dparam[0][i] = t0;
dparam[1][i] = t1;
}
CV_GET_FUNC_PTR( func, (CvFunc2D_1A2P)(rng_tab[1].fn_2d[depth]));
}
else
{
CV_ERROR( CV_StsBadArg, "Unknown distribution type" );
}
if( !fast_int_mode )
{
for( i = channels; i < 12; i++ )
{
double t0 = dparam[0][i - channels];
double t1 = dparam[1][i - channels];
dparam[0][i] = t0;
dparam[1][i] = t1;
}
}
if( !is_nd )
{
IPPI_CALL( func( mat->data.ptr, mat_step, size, rng, param ));
}
else
{
do
{
IPPI_CALL( func( iterator->ptr[0], CV_STUB_STEP, size, rng, param ));
}
while( cvNextNArraySlice( iterator ));
}
__END__;
}
/* End of file. */

View File

@@ -0,0 +1,801 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/****************************************************************************************/
/* Dynamic detection and loading of IPP modules */
/****************************************************************************************/
#include "_cxcore.h"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4115 ) /* type definition in () */
#endif
#if defined _MSC_VER && defined WIN64 && !defined EM64T
#pragma optimize( "", off )
#endif
#if defined WIN32 || defined WIN64
#include <windows.h>
#else
#include <dlfcn.h>
#include <sys/time.h>
#endif
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#define CV_PROC_GENERIC 0
#define CV_PROC_SHIFT 10
#define CV_PROC_ARCH_MASK ((1 << CV_PROC_SHIFT) - 1)
#define CV_PROC_IA32_GENERIC 1
#define CV_PROC_IA32_WITH_MMX (CV_PROC_IA32_GENERIC|(2 << CV_PROC_SHIFT))
#define CV_PROC_IA32_WITH_SSE (CV_PROC_IA32_GENERIC|(3 << CV_PROC_SHIFT))
#define CV_PROC_IA32_WITH_SSE2 (CV_PROC_IA32_GENERIC|(4 << CV_PROC_SHIFT))
#define CV_PROC_IA64 2
#define CV_PROC_EM64T 3
#define CV_GET_PROC_ARCH(model) ((model) & CV_PROC_ARCH_MASK)
typedef struct CvProcessorInfo
{
int model;
int count;
double frequency; // clocks per microsecond
}
CvProcessorInfo;
#undef MASM_INLINE_ASSEMBLY
#if defined WIN32 && !defined WIN64
#if defined _MSC_VER
#define MASM_INLINE_ASSEMBLY 1
#elif defined __BORLANDC__
#if __BORLANDC__ >= 0x560
#define MASM_INLINE_ASSEMBLY 1
#endif
#endif
#endif
/*
determine processor type
*/
static void
icvInitProcessorInfo( CvProcessorInfo* cpu_info )
{
memset( cpu_info, 0, sizeof(*cpu_info) );
cpu_info->model = CV_PROC_GENERIC;
#if defined WIN32 || defined WIN64
#ifndef PROCESSOR_ARCHITECTURE_AMD64
#define PROCESSOR_ARCHITECTURE_AMD64 9
#endif
#ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
#endif
SYSTEM_INFO sys;
LARGE_INTEGER freq;
GetSystemInfo( &sys );
if( sys.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL &&
sys.dwProcessorType == PROCESSOR_INTEL_PENTIUM && sys.wProcessorLevel >= 6 )
{
int version = 0, features = 0, family = 0;
int id = 0;
HKEY key = 0;
cpu_info->count = (int)sys.dwNumberOfProcessors;
unsigned long val = 0, sz = sizeof(val);
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\SYSTEM\\CentralProcessor\\0\\",
0, KEY_QUERY_VALUE, &key ) >= 0 )
{
if( RegQueryValueEx( key, "~MHz", 0, 0, (uchar*)&val, &sz ) >= 0 )
cpu_info->frequency = (double)val;
RegCloseKey( key );
}
#ifdef MASM_INLINE_ASSEMBLY
__asm
{
/* use CPUID to determine the features supported */
pushfd
mov eax, 1
push ebx
push esi
push edi
#ifdef __BORLANDC__
db 0fh
db 0a2h
#else
_emit 0x0f
_emit 0xa2
#endif
pop edi
pop esi
pop ebx
mov version, eax
mov features, edx
popfd
}
#elif defined WIN32 && __GNUC__ > 2
asm volatile
(
"movl $1,%%eax\n\t"
".byte 0x0f; .byte 0xa2\n\t"
"movl %%eax, %0\n\t"
"movl %%edx, %1\n\t"
: "=r"(version), "=r" (features)
:
: "%ebx", "%esi", "%edi"
);
#else
{
static const char cpuid_code[] =
"\x53\x56\x57\xb8\x01\x00\x00\x00\x0f\xa2\x5f\x5e\x5b\xc3";
typedef int64 (CV_CDECL * func_ptr)(void);
func_ptr cpuid = (func_ptr)(void*)cpuid_code;
int64 cpuid_val = cpuid();
version = (int)cpuid_val;
features = (int)(cpuid_val >> 32);
}
#endif
#define ICV_CPUID_M6 ((1<<15)|(1<<23)) /* cmov + MMX */
#define ICV_CPUID_A6 ((1<<25)|ICV_CPUID_M6) /* <all above> + SSE */
#define ICV_CPUID_W7 ((1<<26)|ICV_CPUID_A6) /* <all above> + SSE2 */
family = (version >> 8) & 15;
if( family >= 6 && (features & ICV_CPUID_M6) != 0 ) /* Pentium II or higher */
id = features & ICV_CPUID_W7;
cpu_info->model = id == ICV_CPUID_W7 ? CV_PROC_IA32_WITH_SSE2 :
id == ICV_CPUID_A6 ? CV_PROC_IA32_WITH_SSE :
id == ICV_CPUID_M6 ? CV_PROC_IA32_WITH_MMX :
CV_PROC_IA32_GENERIC;
}
else
{
#if defined EM64T
if( sys.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 )
cpu_info->model = CV_PROC_EM64T;
#elif defined WIN64
if( sys.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
cpu_info->model = CV_PROC_IA64;
#endif
if( QueryPerformanceFrequency( &freq ) )
cpu_info->frequency = (double)freq.QuadPart;
}
#else
cpu_info->frequency = 1;
#ifdef __x86_64__
cpu_info->model = CV_PROC_EM64T;
#elif defined __ia64__
cpu_info->model = CV_PROC_IA64;
#elif !defined __i386__
cpu_info->model = CV_PROC_GENERIC;
#else
// reading /proc/cpuinfo file (proc file system must be supported)
FILE *file = fopen( "/proc/cpuinfo", "r" );
if( file )
{
char buffer[1024];
int max_size = sizeof(buffer)-1;
for(;;)
{
const char* ptr = fgets( buffer, max_size, file );
if( !ptr )
break;
if( strncmp( buffer, "flags", 5 ) == 0 )
{
if( strstr( buffer, "mmx" ) && strstr( buffer, "cmov" ))
{
cpu_info->model = CV_PROC_IA32_WITH_MMX;
if( strstr( buffer, "xmm" ) || strstr( buffer, "sse" ))
{
cpu_info->model = CV_PROC_IA32_WITH_SSE;
if( strstr( buffer, "emm" ))
cpu_info->model = CV_PROC_IA32_WITH_SSE2;
}
}
}
else if( strncmp( buffer, "cpu MHz", 7 ) == 0 )
{
char* pos = strchr( buffer, ':' );
if( pos )
cpu_info->frequency = strtod( pos + 1, &pos );
}
}
fclose( file );
if( CV_GET_PROC_ARCH(cpu_info->model) != CV_PROC_IA32_GENERIC )
cpu_info->frequency = 1;
else
assert( cpu_info->frequency > 1 );
}
#endif
#endif
}
CV_INLINE const CvProcessorInfo*
icvGetProcessorInfo()
{
static CvProcessorInfo cpu_info;
static int init_cpu_info = 0;
if( !init_cpu_info )
{
icvInitProcessorInfo( &cpu_info );
init_cpu_info = 1;
}
return &cpu_info;
}
/****************************************************************************************/
/* Make functions descriptions */
/****************************************************************************************/
#undef IPCVAPI_EX
#define IPCVAPI_EX(type,func_name,names,modules,arg) \
{ (void**)&func_name##_p, (void*)(size_t)-1, names, modules, 0 },
#undef IPCVAPI_C_EX
#define IPCVAPI_C_EX(type,func_name,names,modules,arg) \
{ (void**)&func_name##_p, (void*)(size_t)-1, names, modules, 0 },
static CvPluginFuncInfo cxcore_ipp_tab[] =
{
#undef _CXCORE_IPP_H_
#include "_cxipp.h"
#undef _CXCORE_IPP_H_
{0, 0, 0, 0, 0}
};
/*
determine processor type, load appropriate dll and
initialize all function pointers
*/
#if defined WIN32 || defined WIN64
#define DLL_PREFIX ""
#define DLL_SUFFIX ".dll"
#else
#define DLL_PREFIX "lib"
#define DLL_SUFFIX ".so"
#define LoadLibrary(name) dlopen(name, RTLD_LAZY)
#define FreeLibrary(name) dlclose(name)
#define GetProcAddress dlsym
typedef void* HMODULE;
#endif
#if 0 /*def _DEBUG*/
#define DLL_DEBUG_FLAG "d"
#else
#define DLL_DEBUG_FLAG ""
#endif
#define VERBOSE_LOADING 0
#if VERBOSE_LOADING
#define ICV_PRINTF(args) printf args; fflush(stdout)
#else
#define ICV_PRINTF(args)
#endif
typedef struct CvPluginInfo
{
const char* basename;
HMODULE handle;
char name[100];
}
CvPluginInfo;
static CvPluginInfo plugins[CV_PLUGIN_MAX];
static CvModuleInfo cxcore_info = { 0, "cxcore", CV_VERSION, cxcore_ipp_tab };
CvModuleInfo *CvModule::first = 0, *CvModule::last = 0;
CvModule::CvModule( CvModuleInfo* _info )
{
cvRegisterModule( _info );
info = last;
}
CvModule::~CvModule()
{
if( info )
{
CvModuleInfo* p = first;
for( ; p != 0 && p->next != info; p = p->next )
;
if( p )
p->next = info->next;
if( first == info )
first = info->next;
if( last == info )
last = p;
cvFree( &info );
info = 0;
}
}
static int
icvUpdatePluginFuncTab( CvPluginFuncInfo* func_tab )
{
int i, loaded_functions = 0;
// 1. reset pointers
for( i = 0; func_tab[i].func_addr != 0; i++ )
{
if( func_tab[i].default_func_addr == (void*)(size_t)-1 )
func_tab[i].default_func_addr = *func_tab[i].func_addr;
else
*func_tab[i].func_addr = func_tab[i].default_func_addr;
func_tab[i].loaded_from = 0;
}
// ippopencv substitutes all the other IPP modules
if( plugins[CV_PLUGIN_OPTCV].handle != 0 )
{
for( i = 2; i < CV_PLUGIN_MKL; i++ )
{
assert( plugins[i].handle == 0 );
plugins[i].handle = plugins[CV_PLUGIN_OPTCV].handle;
}
}
// 2. try to find corresponding functions in ipp* and reassign pointers to them
for( i = 0; func_tab[i].func_addr != 0; i++ )
{
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4054 4055 ) /* converting pointers to code<->data */
#endif
char name[100];
int j = 0, idx = 0;
assert( func_tab[i].loaded_from == 0 );
if( func_tab[i].search_modules )
{
uchar* addr = 0;
const char* name_ptr = func_tab[i].func_names;
for( ; j < 10 && name_ptr; j++ )
{
const char* name_start = name_ptr;
const char* name_end;
while( !isalpha(name_start[0]) && name_start[0] != '\0' )
name_start++;
if( !name_start[0] )
name_start = 0;
name_end = name_start ? strchr( name_start, ',' ) : 0;
idx = (func_tab[i].search_modules / (1<<j*4)) % CV_PLUGIN_MAX;
if( plugins[idx].handle != 0 && name_start )
{
if( name_end != 0 )
{
strncpy( name, name_start, name_end - name_start );
name[name_end - name_start] = '\0';
}
else
strcpy( name, name_start );
addr = (uchar*)GetProcAddress( plugins[idx].handle, name );
if( addr )
break;
}
name_ptr = name_end;
}
if( addr )
{
/*#ifdef WIN32
while( *addr == 0xE9 )
addr += 5 + *((int*)(addr + 1));
#endif*/
*func_tab[i].func_addr = addr;
func_tab[i].loaded_from = idx; // store index of the module
// that contain the loaded function
loaded_functions++;
ICV_PRINTF(("%s: \t%s\n", name, plugins[idx].name ));
}
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( default: 4054 4055 )
#endif
}
}
#if VERBOSE_LOADING
{
int not_loaded = 0;
ICV_PRINTF(("\nTotal loaded: %d\n\n", loaded_functions ));
printf( "***************************************************\nNot loaded ...\n\n" );
for( i = 0; func_tab[i].func_addr != 0; i++ )
if( !func_tab[i].loaded_from )
{
ICV_PRINTF(( "%s\n", func_tab[i].func_names ));
not_loaded++;
}
ICV_PRINTF(("\nTotal: %d\n", not_loaded ));
}
#endif
if( plugins[CV_PLUGIN_OPTCV].handle != 0 )
{
for( i = 2; i < CV_PLUGIN_MKL; i++ )
plugins[i].handle = 0;
}
return loaded_functions;
}
CV_IMPL int
cvRegisterModule( const CvModuleInfo* module )
{
CvModuleInfo* module_copy = 0;
CV_FUNCNAME( "cvRegisterModule" );
__BEGIN__;
size_t name_len, version_len;
CV_ASSERT( module != 0 && module->name != 0 && module->version != 0 );
name_len = strlen(module->name);
version_len = strlen(module->version);
CV_CALL( module_copy = (CvModuleInfo*)cvAlloc( sizeof(*module_copy) +
name_len + 1 + version_len + 1 ));
*module_copy = *module;
module_copy->name = (char*)(module_copy + 1);
module_copy->version = (char*)(module_copy + 1) + name_len + 1;
memcpy( (void*)module_copy->name, module->name, name_len + 1 );
memcpy( (void*)module_copy->version, module->version, version_len + 1 );
module_copy->next = 0;
if( CvModule::first == 0 )
CvModule::first = module_copy;
else
CvModule::last->next = module_copy;
CvModule::last = module_copy;
if( CvModule::first == CvModule::last )
{
CV_CALL( cvUseOptimized(1));
}
else
{
CV_CALL( icvUpdatePluginFuncTab( module_copy->func_tab ));
}
__END__;
if( cvGetErrStatus() < 0 && module_copy )
cvFree( &module_copy );
return module_copy ? 0 : -1;
}
CV_IMPL int
cvUseOptimized( int load_flag )
{
int i, loaded_modules = 0, loaded_functions = 0;
CvModuleInfo* module;
const CvProcessorInfo* cpu_info = icvGetProcessorInfo();
int arch = CV_GET_PROC_ARCH(cpu_info->model);
// TODO: implement some more elegant way
// to find the latest and the greatest IPP/MKL libraries
static const char* opencv_sfx[] = { "100", "099", "097", 0 };
static const char* ipp_sfx_ia32[] = { "-6.1", "-6.0", "-5.2", "-5.1", "", 0 };
static const char* ipp_sfx_ia64[] = { "64-6.1", "64-6.0", "64-5.2", "64-5.1", "64", 0 };
static const char* ipp_sfx_em64t[] = { "em64t-6.1", "em64t-6.0", "em64t-5.2", "em64t-5.1", "em64t", 0 };
static const char* mkl_sfx_ia32[] = { "p4", "p3", "def", 0 };
static const char* mkl_sfx_ia64[] = { "i2p", "itp", 0 };
static const char* mkl_sfx_em64t[] = { "def", 0 };
const char** ipp_suffix = arch == CV_PROC_IA64 ? ipp_sfx_ia64 :
arch == CV_PROC_EM64T ? ipp_sfx_em64t : ipp_sfx_ia32;
const char** mkl_suffix = arch == CV_PROC_IA64 ? mkl_sfx_ia64 :
arch == CV_PROC_EM64T ? mkl_sfx_em64t : mkl_sfx_ia32;
for( i = 0; i < CV_PLUGIN_MAX; i++ )
plugins[i].basename = 0;
plugins[CV_PLUGIN_NONE].basename = 0;
plugins[CV_PLUGIN_NONE].name[0] = '\0';
plugins[CV_PLUGIN_OPTCV].basename = "ippopencv";
plugins[CV_PLUGIN_IPPCV].basename = "ippcv";
plugins[CV_PLUGIN_IPPI].basename = "ippi";
plugins[CV_PLUGIN_IPPS].basename = "ipps";
plugins[CV_PLUGIN_IPPVM].basename = "ippvm";
plugins[CV_PLUGIN_IPPCC].basename = "ippcc";
plugins[CV_PLUGIN_MKL].basename = "mkl_";
// try to load optimized dlls
for( i = 1; i < CV_PLUGIN_MAX; i++ )
{
// unload previously loaded optimized modules
if( plugins[i].handle )
{
FreeLibrary( plugins[i].handle );
plugins[i].handle = 0;
}
// do not load regular IPP modules if the custom merged IPP module is already found.
if( i < CV_PLUGIN_MKL && load_flag && plugins[CV_PLUGIN_OPTCV].handle != 0 )
continue;
if( load_flag && plugins[i].basename &&
(arch == CV_PROC_IA32_GENERIC || arch == CV_PROC_IA64 || arch == CV_PROC_EM64T) )
{
const char** suffix = i == CV_PLUGIN_OPTCV ? opencv_sfx :
i < CV_PLUGIN_MKL ? ipp_suffix : mkl_suffix;
for( ; *suffix != 0; suffix++ )
{
sprintf( plugins[i].name, DLL_PREFIX "%s%s" DLL_DEBUG_FLAG DLL_SUFFIX,
plugins[i].basename, *suffix );
ICV_PRINTF(("loading %s...\n", plugins[i].name ));
plugins[i].handle = LoadLibrary( plugins[i].name );
if( plugins[i].handle != 0 )
{
ICV_PRINTF(("%s loaded\n", plugins[i].name ));
loaded_modules++;
break;
}
#ifndef WIN32
// temporary workaround for MacOSX
sprintf( plugins[i].name, DLL_PREFIX "%s%s" DLL_DEBUG_FLAG ".dylib",
plugins[i].basename, *suffix );
ICV_PRINTF(("loading %s...\n", plugins[i].name ));
plugins[i].handle = LoadLibrary( plugins[i].name );
if( plugins[i].handle != 0 )
{
ICV_PRINTF(("%s loaded\n", plugins[i].name ));
loaded_modules++;
break;
}
#endif
}
}
}
for( module = CvModule::first; module != 0; module = module->next )
loaded_functions += icvUpdatePluginFuncTab( module->func_tab );
return loaded_functions;
}
CvModule cxcore_module( &cxcore_info );
CV_IMPL void
cvGetModuleInfo( const char* name, const char **version, const char **plugin_list )
{
static char joint_verinfo[1024] = "";
static char plugin_list_buf[1024] = "";
CV_FUNCNAME( "cvGetLibraryInfo" );
if( version )
*version = 0;
if( plugin_list )
*plugin_list = 0;
__BEGIN__;
CvModuleInfo* module;
if( version )
{
if( name )
{
size_t i, name_len = strlen(name);
for( module = CvModule::first; module != 0; module = module->next )
{
if( strlen(module->name) == name_len )
{
for( i = 0; i < name_len; i++ )
{
int c0 = toupper(module->name[i]), c1 = toupper(name[i]);
if( c0 != c1 )
break;
}
if( i == name_len )
break;
}
}
if( !module )
CV_ERROR( CV_StsObjectNotFound, "The module is not found" );
*version = module->version;
}
else
{
char* ptr = joint_verinfo;
for( module = CvModule::first; module != 0; module = module->next )
{
sprintf( ptr, "%s: %s%s", module->name, module->version, module->next ? ", " : "" );
ptr += strlen(ptr);
}
*version = joint_verinfo;
}
}
if( plugin_list )
{
char* ptr = plugin_list_buf;
int i;
for( i = 0; i < CV_PLUGIN_MAX; i++ )
if( plugins[i].handle != 0 )
{
sprintf( ptr, "%s, ", plugins[i].name );
ptr += strlen(ptr);
}
if( ptr > plugin_list_buf )
{
ptr[-2] = '\0';
*plugin_list = plugin_list_buf;
}
else
*plugin_list = "";
}
__END__;
}
typedef int64 (CV_CDECL * rdtsc_func)(void);
/* helper functions for RNG initialization and accurate time measurement */
CV_IMPL int64 cvGetTickCount( void )
{
const CvProcessorInfo* cpu_info = icvGetProcessorInfo();
if( CV_GET_PROC_ARCH(cpu_info->model) == CV_PROC_IA32_GENERIC )
{
#ifdef MASM_INLINE_ASSEMBLY
#ifdef __BORLANDC__
__asm db 0fh
__asm db 31h
#else
__asm _emit 0x0f;
__asm _emit 0x31;
#endif
#elif (defined __GNUC__ || defined CV_ICC) && defined __i386__
int64 t;
asm volatile (".byte 0xf; .byte 0x31" /* "rdtsc" */ : "=A" (t));
return t;
#else
static const char code[] = "\x0f\x31\xc3";
rdtsc_func func = (rdtsc_func)(void*)code;
return func();
#endif
}
else
{
#if defined WIN32 || defined WIN64
LARGE_INTEGER counter;
QueryPerformanceCounter( &counter );
return (int64)counter.QuadPart;
#else
struct timeval tv;
struct timezone tz;
gettimeofday( &tv, &tz );
return (int64)tv.tv_sec*1000000 + tv.tv_usec;
#endif
}
}
CV_IMPL double cvGetTickFrequency()
{
return icvGetProcessorInfo()->frequency;
}
static int icvNumThreads = 0;
static int icvNumProcs = 0;
CV_IMPL int cvGetNumThreads(void)
{
if( !icvNumProcs )
cvSetNumThreads(0);
return icvNumThreads;
}
CV_IMPL void cvSetNumThreads( int threads )
{
if( !icvNumProcs )
{
#ifdef _OPENMP
icvNumProcs = omp_get_num_procs();
icvNumProcs = MIN( icvNumProcs, CV_MAX_THREADS );
#else
icvNumProcs = 1;
#endif
}
if( threads <= 0 )
threads = icvNumProcs;
else
threads = MIN( threads, icvNumProcs );
icvNumThreads = threads;
}
CV_IMPL int cvGetThreadNum(void)
{
#ifdef _OPENMP
return omp_get_thread_num();
#else
return 0;
#endif
}
/* End of file. */

View File

@@ -0,0 +1,210 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
/* ////////////////////////////////////////////////////////////////////
//
// CvMat helper tables
//
// */
#include "_cxcore.h"
const signed char icvDepthToType[] =
{
-1, -1, CV_8U, CV_8S, CV_16U, CV_16S, -1, -1,
CV_32F, CV_32S, -1, -1, -1, -1, -1, -1, CV_64F, -1
};
const float icv8x32fTab[] =
{
-128.f, -127.f, -126.f, -125.f, -124.f, -123.f, -122.f, -121.f,
-120.f, -119.f, -118.f, -117.f, -116.f, -115.f, -114.f, -113.f,
-112.f, -111.f, -110.f, -109.f, -108.f, -107.f, -106.f, -105.f,
-104.f, -103.f, -102.f, -101.f, -100.f, -99.f, -98.f, -97.f,
-96.f, -95.f, -94.f, -93.f, -92.f, -91.f, -90.f, -89.f,
-88.f, -87.f, -86.f, -85.f, -84.f, -83.f, -82.f, -81.f,
-80.f, -79.f, -78.f, -77.f, -76.f, -75.f, -74.f, -73.f,
-72.f, -71.f, -70.f, -69.f, -68.f, -67.f, -66.f, -65.f,
-64.f, -63.f, -62.f, -61.f, -60.f, -59.f, -58.f, -57.f,
-56.f, -55.f, -54.f, -53.f, -52.f, -51.f, -50.f, -49.f,
-48.f, -47.f, -46.f, -45.f, -44.f, -43.f, -42.f, -41.f,
-40.f, -39.f, -38.f, -37.f, -36.f, -35.f, -34.f, -33.f,
-32.f, -31.f, -30.f, -29.f, -28.f, -27.f, -26.f, -25.f,
-24.f, -23.f, -22.f, -21.f, -20.f, -19.f, -18.f, -17.f,
-16.f, -15.f, -14.f, -13.f, -12.f, -11.f, -10.f, -9.f,
-8.f, -7.f, -6.f, -5.f, -4.f, -3.f, -2.f, -1.f,
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f,
8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f,
16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f, 23.f,
24.f, 25.f, 26.f, 27.f, 28.f, 29.f, 30.f, 31.f,
32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f, 39.f,
40.f, 41.f, 42.f, 43.f, 44.f, 45.f, 46.f, 47.f,
48.f, 49.f, 50.f, 51.f, 52.f, 53.f, 54.f, 55.f,
56.f, 57.f, 58.f, 59.f, 60.f, 61.f, 62.f, 63.f,
64.f, 65.f, 66.f, 67.f, 68.f, 69.f, 70.f, 71.f,
72.f, 73.f, 74.f, 75.f, 76.f, 77.f, 78.f, 79.f,
80.f, 81.f, 82.f, 83.f, 84.f, 85.f, 86.f, 87.f,
88.f, 89.f, 90.f, 91.f, 92.f, 93.f, 94.f, 95.f,
96.f, 97.f, 98.f, 99.f, 100.f, 101.f, 102.f, 103.f,
104.f, 105.f, 106.f, 107.f, 108.f, 109.f, 110.f, 111.f,
112.f, 113.f, 114.f, 115.f, 116.f, 117.f, 118.f, 119.f,
120.f, 121.f, 122.f, 123.f, 124.f, 125.f, 126.f, 127.f,
128.f, 129.f, 130.f, 131.f, 132.f, 133.f, 134.f, 135.f,
136.f, 137.f, 138.f, 139.f, 140.f, 141.f, 142.f, 143.f,
144.f, 145.f, 146.f, 147.f, 148.f, 149.f, 150.f, 151.f,
152.f, 153.f, 154.f, 155.f, 156.f, 157.f, 158.f, 159.f,
160.f, 161.f, 162.f, 163.f, 164.f, 165.f, 166.f, 167.f,
168.f, 169.f, 170.f, 171.f, 172.f, 173.f, 174.f, 175.f,
176.f, 177.f, 178.f, 179.f, 180.f, 181.f, 182.f, 183.f,
184.f, 185.f, 186.f, 187.f, 188.f, 189.f, 190.f, 191.f,
192.f, 193.f, 194.f, 195.f, 196.f, 197.f, 198.f, 199.f,
200.f, 201.f, 202.f, 203.f, 204.f, 205.f, 206.f, 207.f,
208.f, 209.f, 210.f, 211.f, 212.f, 213.f, 214.f, 215.f,
216.f, 217.f, 218.f, 219.f, 220.f, 221.f, 222.f, 223.f,
224.f, 225.f, 226.f, 227.f, 228.f, 229.f, 230.f, 231.f,
232.f, 233.f, 234.f, 235.f, 236.f, 237.f, 238.f, 239.f,
240.f, 241.f, 242.f, 243.f, 244.f, 245.f, 246.f, 247.f,
248.f, 249.f, 250.f, 251.f, 252.f, 253.f, 254.f, 255.f
};
/* [-255..255].^2 */
const ushort icv8x16uSqrTab[] =
{
65025, 64516, 64009, 63504, 63001, 62500, 62001, 61504, 61009, 60516, 60025, 59536,
59049, 58564, 58081, 57600, 57121, 56644, 56169, 55696, 55225, 54756, 54289, 53824,
53361, 52900, 52441, 51984, 51529, 51076, 50625, 50176, 49729, 49284, 48841, 48400,
47961, 47524, 47089, 46656, 46225, 45796, 45369, 44944, 44521, 44100, 43681, 43264,
42849, 42436, 42025, 41616, 41209, 40804, 40401, 40000, 39601, 39204, 38809, 38416,
38025, 37636, 37249, 36864, 36481, 36100, 35721, 35344, 34969, 34596, 34225, 33856,
33489, 33124, 32761, 32400, 32041, 31684, 31329, 30976, 30625, 30276, 29929, 29584,
29241, 28900, 28561, 28224, 27889, 27556, 27225, 26896, 26569, 26244, 25921, 25600,
25281, 24964, 24649, 24336, 24025, 23716, 23409, 23104, 22801, 22500, 22201, 21904,
21609, 21316, 21025, 20736, 20449, 20164, 19881, 19600, 19321, 19044, 18769, 18496,
18225, 17956, 17689, 17424, 17161, 16900, 16641, 16384, 16129, 15876, 15625, 15376,
15129, 14884, 14641, 14400, 14161, 13924, 13689, 13456, 13225, 12996, 12769, 12544,
12321, 12100, 11881, 11664, 11449, 11236, 11025, 10816, 10609, 10404, 10201, 10000,
9801, 9604, 9409, 9216, 9025, 8836, 8649, 8464, 8281, 8100, 7921, 7744,
7569, 7396, 7225, 7056, 6889, 6724, 6561, 6400, 6241, 6084, 5929, 5776,
5625, 5476, 5329, 5184, 5041, 4900, 4761, 4624, 4489, 4356, 4225, 4096,
3969, 3844, 3721, 3600, 3481, 3364, 3249, 3136, 3025, 2916, 2809, 2704,
2601, 2500, 2401, 2304, 2209, 2116, 2025, 1936, 1849, 1764, 1681, 1600,
1521, 1444, 1369, 1296, 1225, 1156, 1089, 1024, 961, 900, 841, 784,
729, 676, 625, 576, 529, 484, 441, 400, 361, 324, 289, 256,
225, 196, 169, 144, 121, 100, 81, 64, 49, 36, 25, 16,
9, 4, 1, 0, 1, 4, 9, 16, 25, 36, 49, 64,
81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400,
441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024,
1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936,
2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136,
3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624,
4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, 6400,
6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464,
8649, 8836, 9025, 9216, 9409, 9604, 9801, 10000, 10201, 10404, 10609, 10816,
11025, 11236, 11449, 11664, 11881, 12100, 12321, 12544, 12769, 12996, 13225, 13456,
13689, 13924, 14161, 14400, 14641, 14884, 15129, 15376, 15625, 15876, 16129, 16384,
16641, 16900, 17161, 17424, 17689, 17956, 18225, 18496, 18769, 19044, 19321, 19600,
19881, 20164, 20449, 20736, 21025, 21316, 21609, 21904, 22201, 22500, 22801, 23104,
23409, 23716, 24025, 24336, 24649, 24964, 25281, 25600, 25921, 26244, 26569, 26896,
27225, 27556, 27889, 28224, 28561, 28900, 29241, 29584, 29929, 30276, 30625, 30976,
31329, 31684, 32041, 32400, 32761, 33124, 33489, 33856, 34225, 34596, 34969, 35344,
35721, 36100, 36481, 36864, 37249, 37636, 38025, 38416, 38809, 39204, 39601, 40000,
40401, 40804, 41209, 41616, 42025, 42436, 42849, 43264, 43681, 44100, 44521, 44944,
45369, 45796, 46225, 46656, 47089, 47524, 47961, 48400, 48841, 49284, 49729, 50176,
50625, 51076, 51529, 51984, 52441, 52900, 53361, 53824, 54289, 54756, 55225, 55696,
56169, 56644, 57121, 57600, 58081, 58564, 59049, 59536, 60025, 60516, 61009, 61504,
62001, 62500, 63001, 63504, 64009, 64516, 65025
};
const uchar icvSaturate8u[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255
};
/* End of file. */

View File

@@ -0,0 +1,698 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cxcore.h"
CV_IMPL void
cvKMeans2( const CvArr* samples_arr, int cluster_count,
CvArr* labels_arr, CvTermCriteria termcrit )
{
CvMat* centers = 0;
CvMat* old_centers = 0;
CvMat* counters = 0;
CV_FUNCNAME( "cvKMeans2" );
__BEGIN__;
CvMat samples_stub, labels_stub;
CvMat* samples = (CvMat*)samples_arr;
CvMat* labels = (CvMat*)labels_arr;
CvMat* temp = 0;
CvRNG rng = CvRNG(-1);
int i, j, k, sample_count, dims;
int ids_delta, iter;
double max_dist;
if( !CV_IS_MAT( samples ))
CV_CALL( samples = cvGetMat( samples, &samples_stub ));
if( !CV_IS_MAT( labels ))
CV_CALL( labels = cvGetMat( labels, &labels_stub ));
if( cluster_count < 1 )
CV_ERROR( CV_StsOutOfRange, "Number of clusters should be positive" );
if( CV_MAT_DEPTH(samples->type) != CV_32F || CV_MAT_TYPE(labels->type) != CV_32SC1 )
CV_ERROR( CV_StsUnsupportedFormat,
"samples should be floating-point matrix, cluster_idx - integer vector" );
if( labels->rows != 1 && (labels->cols != 1 || !CV_IS_MAT_CONT(labels->type)) ||
labels->rows + labels->cols - 1 != samples->rows )
CV_ERROR( CV_StsUnmatchedSizes,
"cluster_idx should be 1D vector of the same number of elements as samples' number of rows" );
CV_CALL( termcrit = cvCheckTermCriteria( termcrit, 1e-6, 100 ));
termcrit.epsilon *= termcrit.epsilon;
sample_count = samples->rows;
if( cluster_count > sample_count )
cluster_count = sample_count;
dims = samples->cols*CV_MAT_CN(samples->type);
ids_delta = labels->step ? labels->step/(int)sizeof(int) : 1;
CV_CALL( centers = cvCreateMat( cluster_count, dims, CV_64FC1 ));
CV_CALL( old_centers = cvCreateMat( cluster_count, dims, CV_64FC1 ));
CV_CALL( counters = cvCreateMat( 1, cluster_count, CV_32SC1 ));
// init centers
for( i = 0; i < sample_count; i++ )
labels->data.i[i] = cvRandInt(&rng) % cluster_count;
counters->cols = cluster_count; // cut down counters
max_dist = termcrit.epsilon*2;
for( iter = 0; iter < termcrit.max_iter; iter++ )
{
// computer centers
cvZero( centers );
cvZero( counters );
for( i = 0; i < sample_count; i++ )
{
float* s = (float*)(samples->data.ptr + i*samples->step);
k = labels->data.i[i*ids_delta];
double* c = (double*)(centers->data.ptr + k*centers->step);
for( j = 0; j <= dims - 4; j += 4 )
{
double t0 = c[j] + s[j];
double t1 = c[j+1] + s[j+1];
c[j] = t0;
c[j+1] = t1;
t0 = c[j+2] + s[j+2];
t1 = c[j+3] + s[j+3];
c[j+2] = t0;
c[j+3] = t1;
}
for( ; j < dims; j++ )
c[j] += s[j];
counters->data.i[k]++;
}
if( iter > 0 )
max_dist = 0;
for( k = 0; k < cluster_count; k++ )
{
double* c = (double*)(centers->data.ptr + k*centers->step);
if( counters->data.i[k] != 0 )
{
double scale = 1./counters->data.i[k];
for( j = 0; j < dims; j++ )
c[j] *= scale;
}
else
{
i = cvRandInt( &rng ) % sample_count;
float* s = (float*)(samples->data.ptr + i*samples->step);
for( j = 0; j < dims; j++ )
c[j] = s[j];
}
if( iter > 0 )
{
double dist = 0;
double* c_o = (double*)(old_centers->data.ptr + k*old_centers->step);
for( j = 0; j < dims; j++ )
{
double t = c[j] - c_o[j];
dist += t*t;
}
if( max_dist < dist )
max_dist = dist;
}
}
// assign labels
for( i = 0; i < sample_count; i++ )
{
float* s = (float*)(samples->data.ptr + i*samples->step);
int k_best = 0;
double min_dist = DBL_MAX;
for( k = 0; k < cluster_count; k++ )
{
double* c = (double*)(centers->data.ptr + k*centers->step);
double dist = 0;
j = 0;
for( ; j <= dims - 4; j += 4 )
{
double t0 = c[j] - s[j];
double t1 = c[j+1] - s[j+1];
dist += t0*t0 + t1*t1;
t0 = c[j+2] - s[j+2];
t1 = c[j+3] - s[j+3];
dist += t0*t0 + t1*t1;
}
for( ; j < dims; j++ )
{
double t = c[j] - s[j];
dist += t*t;
}
if( min_dist > dist )
{
min_dist = dist;
k_best = k;
}
}
labels->data.i[i*ids_delta] = k_best;
}
if( max_dist < termcrit.epsilon )
break;
CV_SWAP( centers, old_centers, temp );
}
cvZero( counters );
for( i = 0; i < sample_count; i++ )
counters->data.i[labels->data.i[i]]++;
// ensure that we do not have empty clusters
for( k = 0; k < cluster_count; k++ )
if( counters->data.i[k] == 0 )
for(;;)
{
i = cvRandInt(&rng) % sample_count;
j = labels->data.i[i];
if( counters->data.i[j] > 1 )
{
labels->data.i[i] = k;
counters->data.i[j]--;
counters->data.i[k]++;
break;
}
}
__END__;
cvReleaseMat( &centers );
cvReleaseMat( &old_centers );
cvReleaseMat( &counters );
}
/*
Finds real roots of cubic, quadratic or linear equation.
The original code has been taken from Ken Turkowski web page
(http://www.worldserver.com/turk/opensource/) and adopted for OpenCV.
Here is the copyright notice.
-----------------------------------------------------------------------
Copyright (C) 1978-1999 Ken Turkowski. <turk@computer.org>
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.
-----------------------------------------------------------------------
*/
CV_IMPL int
cvSolveCubic( const CvMat* coeffs, CvMat* roots )
{
int n = 0;
CV_FUNCNAME( "cvSolveCubic" );
__BEGIN__;
double a0 = 1., a1, a2, a3;
double x0 = 0., x1 = 0., x2 = 0.;
int step = 1, coeff_count;
if( !CV_IS_MAT(coeffs) )
CV_ERROR( !coeffs ? CV_StsNullPtr : CV_StsBadArg, "Input parameter is not a valid matrix" );
if( !CV_IS_MAT(roots) )
CV_ERROR( !roots ? CV_StsNullPtr : CV_StsBadArg, "Output parameter is not a valid matrix" );
if( CV_MAT_TYPE(coeffs->type) != CV_32FC1 && CV_MAT_TYPE(coeffs->type) != CV_64FC1 ||
CV_MAT_TYPE(roots->type) != CV_32FC1 && CV_MAT_TYPE(roots->type) != CV_64FC1 )
CV_ERROR( CV_StsUnsupportedFormat,
"Both matrices should be floating-point (single or double precision)" );
coeff_count = coeffs->rows + coeffs->cols - 1;
if( coeffs->rows != 1 && coeffs->cols != 1 || coeff_count != 3 && coeff_count != 4 )
CV_ERROR( CV_StsBadSize,
"The matrix of coefficients must be 1-dimensional vector of 3 or 4 elements" );
if( roots->rows != 1 && roots->cols != 1 ||
roots->rows + roots->cols - 1 != 3 )
CV_ERROR( CV_StsBadSize,
"The matrix of roots must be 1-dimensional vector of 3 elements" );
if( CV_MAT_TYPE(coeffs->type) == CV_32FC1 )
{
const float* c = coeffs->data.fl;
if( coeffs->rows > 1 )
step = coeffs->step/sizeof(c[0]);
if( coeff_count == 4 )
a0 = c[0], c += step;
a1 = c[0];
a2 = c[step];
a3 = c[step*2];
}
else
{
const double* c = coeffs->data.db;
if( coeffs->rows > 1 )
step = coeffs->step/sizeof(c[0]);
if( coeff_count == 4 )
a0 = c[0], c += step;
a1 = c[0];
a2 = c[step];
a3 = c[step*2];
}
if( a0 == 0 )
{
if( a1 == 0 )
{
if( a2 == 0 )
n = a3 == 0 ? -1 : 0;
else
{
// linear equation
x0 = a3/a2;
n = 1;
}
}
else
{
// quadratic equation
double d = a2*a2 - 4*a1*a3;
if( d >= 0 )
{
d = sqrt(d);
double q = (-a2 + (a2 < 0 ? -d : d)) * 0.5;
x0 = q / a1;
x1 = a3 / q;
n = d > 0 ? 2 : 1;
}
}
}
else
{
a0 = 1./a0;
a1 *= a0;
a2 *= a0;
a3 *= a0;
double Q = (a1 * a1 - 3 * a2) * (1./9);
double R = (2 * a1 * a1 * a1 - 9 * a1 * a2 + 27 * a3) * (1./54);
double Qcubed = Q * Q * Q;
double d = Qcubed - R * R;
if( d >= 0 )
{
double theta = acos(R / sqrt(Qcubed));
double sqrtQ = sqrt(Q);
double t0 = -2 * sqrtQ;
double t1 = theta * (1./3);
double t2 = a1 * (1./3);
x0 = t0 * cos(t1) - t2;
x1 = t0 * cos(t1 + (2.*CV_PI/3)) - t2;
x2 = t0 * cos(t1 + (4.*CV_PI/3)) - t2;
n = 3;
}
else
{
double e;
d = sqrt(-d);
e = pow(d + fabs(R), 0.333333333333);
if( R > 0 )
e = -e;
x0 = (e + Q / e) - a1 * (1./3);
n = 1;
}
}
step = 1;
if( CV_MAT_TYPE(roots->type) == CV_32FC1 )
{
float* r = roots->data.fl;
if( roots->rows > 1 )
step = roots->step/sizeof(r[0]);
r[0] = (float)x0;
r[step] = (float)x1;
r[step*2] = (float)x2;
}
else
{
double* r = roots->data.db;
if( roots->rows > 1 )
step = roots->step/sizeof(r[0]);
r[0] = x0;
r[step] = x1;
r[step*2] = x2;
}
__END__;
return n;
}
CV_IMPL void cvNormalize( const CvArr* src, CvArr* dst,
double a, double b, int norm_type, const CvArr* mask )
{
CvMat* tmp = 0;
CV_FUNCNAME( "cvNormalize" );
__BEGIN__;
double scale, shift;
if( norm_type == CV_MINMAX )
{
double smin = 0, smax = 0;
double dmin = MIN( a, b ), dmax = MAX( a, b );
cvMinMaxLoc( src, &smin, &smax, 0, 0, mask );
scale = (dmax - dmin)*(smax - smin > DBL_EPSILON ? 1./(smax - smin) : 0);
shift = dmin - smin*scale;
}
else if( norm_type == CV_L2 || norm_type == CV_L1 || norm_type == CV_C )
{
CvMat *s = (CvMat*)src, *d = (CvMat*)dst;
if( CV_IS_MAT(s) && CV_IS_MAT(d) && CV_IS_MAT_CONT(s->type & d->type) &&
CV_ARE_TYPES_EQ(s,d) && CV_ARE_SIZES_EQ(s,d) && !mask &&
s->cols*s->rows <= CV_MAX_INLINE_MAT_OP_SIZE*CV_MAX_INLINE_MAT_OP_SIZE )
{
int i, len = s->cols*s->rows;
double norm = 0, v;
if( CV_MAT_TYPE(s->type) == CV_32FC1 )
{
const float* sptr = s->data.fl;
float* dptr = d->data.fl;
if( norm_type == CV_L2 )
{
for( i = 0; i < len; i++ )
{
v = sptr[i];
norm += v*v;
}
norm = sqrt(norm);
}
else if( norm_type == CV_L1 )
for( i = 0; i < len; i++ )
{
v = fabs((double)sptr[i]);
norm += v;
}
else
for( i = 0; i < len; i++ )
{
v = fabs((double)sptr[i]);
norm = MAX(norm,v);
}
norm = norm > DBL_EPSILON ? 1./norm : 0.;
for( i = 0; i < len; i++ )
dptr[i] = (float)(sptr[i]*norm);
EXIT;
}
if( CV_MAT_TYPE(s->type) == CV_64FC1 )
{
const double* sptr = s->data.db;
double* dptr = d->data.db;
if( norm_type == CV_L2 )
{
for( i = 0; i < len; i++ )
{
v = sptr[i];
norm += v*v;
}
norm = sqrt(norm);
}
else if( norm_type == CV_L1 )
for( i = 0; i < len; i++ )
{
v = fabs(sptr[i]);
norm += v;
}
else
for( i = 0; i < len; i++ )
{
v = fabs(sptr[i]);
norm = MAX(norm,v);
}
norm = norm > DBL_EPSILON ? 1./norm : 0.;
for( i = 0; i < len; i++ )
dptr[i] = sptr[i]*norm;
EXIT;
}
}
scale = cvNorm( src, 0, norm_type, mask );
scale = scale > DBL_EPSILON ? 1./scale : 0.;
shift = 0;
}
else
CV_ERROR( CV_StsBadArg, "Unknown/unsupported norm type" );
if( !mask )
cvConvertScale( src, dst, scale, shift );
else
{
CvMat stub, *dmat;
CV_CALL( dmat = cvGetMat(dst, &stub));
CV_CALL( tmp = cvCreateMat(dmat->rows, dmat->cols, dmat->type) );
cvConvertScale( src, tmp, scale, shift );
cvCopy( tmp, dst, mask );
}
__END__;
if( tmp )
cvReleaseMat( &tmp );
}
CV_IMPL void cvRandShuffle( CvArr* arr, CvRNG* rng, double iter_factor )
{
CV_FUNCNAME( "cvRandShuffle" );
__BEGIN__;
const int sizeof_int = (int)sizeof(int);
CvMat stub, *mat = (CvMat*)arr;
int i, j, k, iters, delta = 0;
int cont_flag, arr_size, elem_size, cols, step;
const int pair_buf_sz = 100;
int* pair_buf = (int*)cvStackAlloc( pair_buf_sz*sizeof(pair_buf[0])*2 );
CvMat _pair_buf = cvMat( 1, pair_buf_sz*2, CV_32S, pair_buf );
CvRNG _rng = cvRNG(-1);
uchar* data = 0;
int* idata = 0;
if( !CV_IS_MAT(mat) )
CV_CALL( mat = cvGetMat( mat, &stub ));
if( !rng )
rng = &_rng;
cols = mat->cols;
step = mat->step;
arr_size = cols*mat->rows;
iters = cvRound(iter_factor*arr_size)*2;
cont_flag = CV_IS_MAT_CONT(mat->type);
elem_size = CV_ELEM_SIZE(mat->type);
if( elem_size % sizeof_int == 0 && (cont_flag || step % sizeof_int == 0) )
{
idata = mat->data.i;
step /= sizeof_int;
elem_size /= sizeof_int;
}
else
data = mat->data.ptr;
for( i = 0; i < iters; i += delta )
{
delta = MIN( iters - i, pair_buf_sz*2 );
_pair_buf.cols = delta;
cvRandArr( rng, &_pair_buf, CV_RAND_UNI, cvRealScalar(0), cvRealScalar(arr_size) );
if( cont_flag )
{
if( idata )
for( j = 0; j < delta; j += 2 )
{
int* p = idata + pair_buf[j]*elem_size, *q = idata + pair_buf[j+1]*elem_size, t;
for( k = 0; k < elem_size; k++ )
CV_SWAP( p[k], q[k], t );
}
else
for( j = 0; j < delta; j += 2 )
{
uchar* p = data + pair_buf[j]*elem_size, *q = data + pair_buf[j+1]*elem_size, t;
for( k = 0; k < elem_size; k++ )
CV_SWAP( p[k], q[k], t );
}
}
else
{
if( idata )
for( j = 0; j < delta; j += 2 )
{
int idx1 = pair_buf[j], idx2 = pair_buf[j+1], row1, row2;
int* p, *q, t;
row1 = idx1/step; row2 = idx2/step;
p = idata + row1*step + (idx1 - row1*cols)*elem_size;
q = idata + row2*step + (idx2 - row2*cols)*elem_size;
for( k = 0; k < elem_size; k++ )
CV_SWAP( p[k], q[k], t );
}
else
for( j = 0; j < delta; j += 2 )
{
int idx1 = pair_buf[j], idx2 = pair_buf[j+1], row1, row2;
uchar* p, *q, t;
row1 = idx1/step; row2 = idx2/step;
p = data + row1*step + (idx1 - row1*cols)*elem_size;
q = data + row2*step + (idx2 - row2*cols)*elem_size;
for( k = 0; k < elem_size; k++ )
CV_SWAP( p[k], q[k], t );
}
}
}
__END__;
}
CV_IMPL CvArr*
cvRange( CvArr* arr, double start, double end )
{
int ok = 0;
CV_FUNCNAME( "cvRange" );
__BEGIN__;
CvMat stub, *mat = (CvMat*)arr;
double delta;
int type, step;
double val = start;
int i, j;
int rows, cols;
if( !CV_IS_MAT(mat) )
CV_CALL( mat = cvGetMat( mat, &stub) );
rows = mat->rows;
cols = mat->cols;
type = CV_MAT_TYPE(mat->type);
delta = (end-start)/(rows*cols);
if( CV_IS_MAT_CONT(mat->type) )
{
cols *= rows;
rows = 1;
step = 1;
}
else
step = mat->step / CV_ELEM_SIZE(type);
if( type == CV_32SC1 )
{
int* idata = mat->data.i;
int ival = cvRound(val), idelta = cvRound(delta);
if( fabs(val - ival) < DBL_EPSILON &&
fabs(delta - idelta) < DBL_EPSILON )
{
for( i = 0; i < rows; i++, idata += step )
for( j = 0; j < cols; j++, ival += idelta )
idata[j] = ival;
}
else
{
for( i = 0; i < rows; i++, idata += step )
for( j = 0; j < cols; j++, val += delta )
idata[j] = cvRound(val);
}
}
else if( type == CV_32FC1 )
{
float* fdata = mat->data.fl;
for( i = 0; i < rows; i++, fdata += step )
for( j = 0; j < cols; j++, val += delta )
fdata[j] = (float)val;
}
else
CV_ERROR( CV_StsUnsupportedFormat, "The function only supports 32sC1 and 32fC1 datatypes" );
ok = 1;
__END__;
return ok ? arr : 0;
}
/* End of file. */

View File

@@ -0,0 +1 @@
// this file is empty but needed for libtool

View File

@@ -0,0 +1,14 @@
TARGET := cxcore
BINTYPE := DLL
SRC_ROOT := ../../cxcore/src
INC_ROOT := ../../cxcore/include
SRC_DIRS := . ../include
CXXFLAGS := -D"CVAPI_EXPORTS" -I"$(INC_ROOT)" -I"$(SRC_ROOT)"
#INCS := cxcore.h cxcore.hpp cxerror.h \
# cxmisc.h cxtypes.h $(SRC_ROOT)/_cxcore.h $(SRC_ROOT)/_cxipp.h
INCS := cxcore.h cxcore.hpp cxerror.h cxmisc.h cxtypes.h _cxcore.h _cxipp.h
include ../../_make/make_module_gnu.mak

View File

@@ -0,0 +1,23 @@
TARGET = cxcore
BINTYPE = DLL
ROOT = ..\..
PCH = _cxcore.h
PCH_STARTER = cxprecomp
OBJS = $(OBJPATH)/cxalloc.obj $(OBJPATH)/cxarithm.obj $(OBJPATH)/cxarray.obj \
$(OBJPATH)/cxcmp.obj $(OBJPATH)/cxconvert.obj $(OBJPATH)/cxcopy.obj \
$(OBJPATH)/cxdatastructs.obj $(OBJPATH)/cxdrawing.obj $(OBJPATH)/cxdxt.obj \
$(OBJPATH)/cxerror.obj $(OBJPATH)/cximage.obj $(OBJPATH)/cxjacobieigens.obj \
$(OBJPATH)/cxlogic.obj $(OBJPATH)/cxlut.obj $(OBJPATH)/cxmathfuncs.obj \
$(OBJPATH)/cxmatmul.obj $(OBJPATH)/cxmatrix.obj $(OBJPATH)/cxmean.obj \
$(OBJPATH)/cxmeansdv.obj $(OBJPATH)/cxminmaxloc.obj $(OBJPATH)/cxnorm.obj \
$(OBJPATH)/cxouttext.obj $(OBJPATH)/cxpersistence.obj \
$(OBJPATH)/cxrand.obj $(OBJPATH)/cxsumpixels.obj $(OBJPATH)/cxsvd.obj \
$(OBJPATH)/cxswitcher.obj $(OBJPATH)/cxtables.obj $(OBJPATH)/cxutils.obj
INC = ../include/cxcore.h ../include/cxcore.hpp ../include/cxerror.h \
../include/cxmisc.h ../include/cxtypes.h ./_cxcore.h ./_cxipp.h ../include/cvver.h
CXXFLAGS_PROJ = /I"." /I"../include"
!include $(ROOT)/_make/make_module_$(MS).mak

View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by cxcore.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif