diff --git a/.classpath b/.classpath
deleted file mode 100644
index d57ec02..0000000
--- a/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d0551f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+# AndroidStudio/Gradle files
+build
+.gradle
+.idea
+local.properties
+*.iml
+
+# NDK files
+obj
+
+#Swig
+bubblebot_lib/src/com/bubblebot/jni
+bubblebot_lib/jni/gen
+
+# ZXing files
+/.sconsign.dblite
+xcuserdata
+callgrind.out.*
+contents.xcworkspacedata
+*.pyc
+/.rbenv-version
+*.o
+sample
+testsuite
+testsuite.expected
+testsuite.out
+testsuite.err
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 6f8a193..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "jni/ODKScan-core"]
- path = jni/ODKScan-core
- url = git://github.com/nathanathan/ODKScan-core.git
-[submodule "assets/transcription"]
- path = assets/transcription
- url = git@github.com:nathanathan/transcription.git
diff --git a/.hgignore b/.hgignore
deleted file mode 100644
index cebb8f2..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,3 +0,0 @@
-syntax: glob
-bin/**
-gen/**
diff --git a/.hgtags b/.hgtags
index 4250627..617734f 100644
--- a/.hgtags
+++ b/.hgtags
@@ -13,3 +13,4 @@ bd26ee77c072eae363ac9ad23336f78aaf5135b5 rev 121 US Army Preparedness Demo 2014
b73d071314d2d5d64f0a96ba69d5747ac1faa979 ODK 2.0 REST 2014-07-15
60abd8aedbc7dcd2e1953e942b44b982ee1a8ffa jan2015
c3573dc4115ead49af29f022c75d89b1aae5aa73 VillageReach 01-21-2015
+9ba06421e76ef925911358e0c7faf0755f8480b6 ODK Scan 2.0 Alpha-1 rev 127
diff --git a/.project b/.project
deleted file mode 100644
index 82beb09..0000000
--- a/.project
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
- scan
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
-
- OpenCV-2.3.1_src
- 2
- _android_OpenCV_2_3_1_df28900a/src
-
-
-
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 0c53d89..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Fri Dec 09 12:26:04 PST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
deleted file mode 100644
index b6dee47..0000000
--- a/AndroidManifest.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100644
index dc9224d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-# The path to the NDK, requires crystax version r-4 for now, due to support
-# for the standard library
-
-# load environment from local make file
-LOCAL_ENV_MK=local.env.mk
-ifneq "$(wildcard $(LOCAL_ENV_MK))" ""
-include $(LOCAL_ENV_MK)
-else
-$(shell cp sample.$(LOCAL_ENV_MK) $(LOCAL_ENV_MK))
-$(info ERROR local environement not setup! try:)
-$(info gedit $(LOCAL_ENV_MK))
-$(error Please setup the $(LOCAL_ENV_MK) - the default was just created')
-endif
-ifndef ARM_TARGETS
-ARM_TARGETS="armeabi armeabi-v7a"
-endif
-ANDROID_NDK_BASE = $(ANDROID_NDK_ROOT)
-
-$(info OPENCV_CONFIG = $(OPENCV_CONFIG))
-
-ifndef PROJECT_PATH
-$(info PROJECT_PATH defaulting to this directory)
-PROJECT_PATH=.
-endif
-
-
-# The name of the native library
-LIBNAME = libbubblebot.so
-
-
-# Find all the C++ sources in the native folder
-SOURCES = $(wildcard jni/*.cpp)
-HEADERS = $(wildcard jni/*.h)
-
-ANDROID_MKS = $(wildcard jni/*.mk)
-
-SWIG_IS = $(wildcard jni/*.i)
-
-SWIG_MAIN = jni/bubblebot.i
-
-SWIG_JAVA_DIR = src/com/bubblebot/jni
-SWIG_JAVA_OUT = $(wildcard $(SWIG_JAVA_DIR)/*.java)
-
-SWIG_C_DIR = jni/gen
-SWIG_C_OUT = $(SWIG_C_DIR)/bubblebot.cpp
-
-BUILD_DEFS=OPENCV_CONFIG=$(OPENCV_CONFIG) \
- PROJECT_PATH=$(PROJECT_PATH) \
- V=$(V) \
- $(NDK_FLAGS) \
- ARM_TARGETS=$(ARM_TARGETS)
-
-# The real native library stripped of symbols
-LIB = libs/armeabi-v7a/$(LIBNAME) libs/armeabi/$(LIBNAME)
-
-all: $(LIB)
-
-#calls the ndk-build script, passing it OPENCV_ROOT and OPENCV_LIBS_DIR
-$(LIB): $(SWIG_C_OUT) $(SOURCES) $(HEADERS) $(ANDROID_MKS)
- $(ANDROID_NDK_BASE)/ndk-build $(BUILD_DEFS)
-
-#this creates the swig wrappers
-$(SWIG_C_OUT): $(SWIG_IS)
- make clean-swig &&\
- mkdir -p $(SWIG_C_DIR) &&\
- mkdir -p $(SWIG_JAVA_DIR) &&\
- swig -java -c++ -Iopencv/android/android-jni/jni -package "com.bubblebot.jni" \
- -outdir $(SWIG_JAVA_DIR) \
- -o $(SWIG_C_OUT) $(SWIG_MAIN)
-
-#clean targets
-.PHONY: clean clean-swig cleanall
-
-#this deletes the generated swig java and the generated c wrapper
-clean-swig:
- rm -f $(SWIG_JAVA_OUT) $(SWIG_C_OUT)
-
-#does clean-swig and then uses the ndk-build clean
-clean: clean-swig
- $(ANDROID_NDK_BASE)/ndk-build clean $(BUILD_DEFS)
-
diff --git a/OpenCV-2.3.1/.classpath b/OpenCV-2.3.1/.classpath
deleted file mode 100644
index d57ec02..0000000
--- a/OpenCV-2.3.1/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/OpenCV-2.3.1/.project b/OpenCV-2.3.1/.project
deleted file mode 100644
index 97b71b6..0000000
--- a/OpenCV-2.3.1/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- OpenCV-2.3.1
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/OpenCV-2.3.1/.settings/org.eclipse.jdt.core.prefs b/OpenCV-2.3.1/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 736b91d..0000000
--- a/OpenCV-2.3.1/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Fri Dec 09 12:26:08 PST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/OpenCV-2.3.1/AndroidManifest.xml b/OpenCV-2.3.1/AndroidManifest.xml
deleted file mode 100644
index 6e3abfd..0000000
--- a/OpenCV-2.3.1/AndroidManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/BuildConfig.class b/OpenCV-2.3.1/bin/classes/org/opencv/BuildConfig.class
deleted file mode 100644
index abecab2..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/BuildConfig.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/android.class b/OpenCV-2.3.1/bin/classes/org/opencv/android.class
deleted file mode 100644
index 3d539cc..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/android.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/Calib3d.class b/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/Calib3d.class
deleted file mode 100644
index 27d7a2a..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/Calib3d.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoBM.class b/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoBM.class
deleted file mode 100644
index 4ad8610..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoBM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoSGBM.class b/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoSGBM.class
deleted file mode 100644
index 4e3178a..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/calib3d/StereoSGBM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Core$MinMaxLocResult.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Core$MinMaxLocResult.class
deleted file mode 100644
index cf5353e..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Core$MinMaxLocResult.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Core.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Core.class
deleted file mode 100644
index c5d90f8..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Core.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/CvException.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/CvException.class
deleted file mode 100644
index 1a2457b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/CvException.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/CvType.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/CvType.class
deleted file mode 100644
index 538bf7a..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/CvType.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/KDTree.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/KDTree.class
deleted file mode 100644
index c248f14..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/KDTree.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Mat.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Mat.class
deleted file mode 100644
index 70beb51..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Mat.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Point.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Point.class
deleted file mode 100644
index 29d86ad..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Point.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Point3.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Point3.class
deleted file mode 100644
index ee915ad..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Point3.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Range.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Range.class
deleted file mode 100644
index 4b7c867..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Range.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Rect.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Rect.class
deleted file mode 100644
index e63943e..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Rect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/RotatedRect.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/RotatedRect.class
deleted file mode 100644
index fdcbb18..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/RotatedRect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Scalar.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Scalar.class
deleted file mode 100644
index 5f6867e..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Scalar.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/Size.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/Size.class
deleted file mode 100644
index ab3f0a5..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/Size.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/core/TermCriteria.class b/OpenCV-2.3.1/bin/classes/org/opencv/core/TermCriteria.class
deleted file mode 100644
index a33f641..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/core/TermCriteria.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/Features2d.class b/OpenCV-2.3.1/bin/classes/org/opencv/features2d/Features2d.class
deleted file mode 100644
index 540db92..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/Features2d.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/KeyPoint.class b/OpenCV-2.3.1/bin/classes/org/opencv/features2d/KeyPoint.class
deleted file mode 100644
index 3803f90..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/KeyPoint.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/MSER.class b/OpenCV-2.3.1/bin/classes/org/opencv/features2d/MSER.class
deleted file mode 100644
index c00c1e1..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/MSER.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/SURF.class b/OpenCV-2.3.1/bin/classes/org/opencv/features2d/SURF.class
deleted file mode 100644
index 5fb48f6..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/SURF.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/StarDetector.class b/OpenCV-2.3.1/bin/classes/org/opencv/features2d/StarDetector.class
deleted file mode 100644
index 2dc5695..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/features2d/StarDetector.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/highgui/Highgui.class b/OpenCV-2.3.1/bin/classes/org/opencv/highgui/Highgui.class
deleted file mode 100644
index 6124a44..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/highgui/Highgui.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/highgui/VideoCapture.class b/OpenCV-2.3.1/bin/classes/org/opencv/highgui/VideoCapture.class
deleted file mode 100644
index 559009f..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/highgui/VideoCapture.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Imgproc.class b/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Imgproc.class
deleted file mode 100644
index ebaf82d..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Imgproc.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Moments.class b/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Moments.class
deleted file mode 100644
index 8b03ceb..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/imgproc/Moments.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP.class
deleted file mode 100644
index 8fb9bb0..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP_TrainParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP_TrainParams.class
deleted file mode 100644
index c14ca4b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvANN_MLP_TrainParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoost.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoost.class
deleted file mode 100644
index cb32a4b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoost.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoostParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoostParams.class
deleted file mode 100644
index 9dac9ca..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvBoostParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTree.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTree.class
deleted file mode 100644
index 1459557..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTree.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTreeParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTreeParams.class
deleted file mode 100644
index 6845da5..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvDTreeParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEM.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEM.class
deleted file mode 100644
index c6f9a9b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEMParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEMParams.class
deleted file mode 100644
index 83ab63c..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvEMParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvERTrees.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvERTrees.class
deleted file mode 100644
index 47f9553..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvERTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTrees.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTrees.class
deleted file mode 100644
index aca727b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTreesParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTreesParams.class
deleted file mode 100644
index 620951b..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvGBTreesParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvKNearest.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvKNearest.class
deleted file mode 100644
index d311855..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvKNearest.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvNormalBayesClassifier.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvNormalBayesClassifier.class
deleted file mode 100644
index 91937a1..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvNormalBayesClassifier.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvParamGrid.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvParamGrid.class
deleted file mode 100644
index 7d3c386..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvParamGrid.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTParams.class
deleted file mode 100644
index 8ceb3f9..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTrees.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTrees.class
deleted file mode 100644
index d0a5015..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvRTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVM.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVM.class
deleted file mode 100644
index 843e3ea..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVMParams.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVMParams.class
deleted file mode 100644
index fdb4a28..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvSVMParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvStatModel.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvStatModel.class
deleted file mode 100644
index 6595210..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/CvStatModel.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/ml/Ml.class b/OpenCV-2.3.1/bin/classes/org/opencv/ml/Ml.class
deleted file mode 100644
index 2b7b1e0..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/ml/Ml.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/CascadeClassifier.class b/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/CascadeClassifier.class
deleted file mode 100644
index 531dfdf..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/CascadeClassifier.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/HOGDescriptor.class b/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/HOGDescriptor.class
deleted file mode 100644
index ea54a26..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/HOGDescriptor.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/Objdetect.class b/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/Objdetect.class
deleted file mode 100644
index 9660639..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/objdetect/Objdetect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/utils.class b/OpenCV-2.3.1/bin/classes/org/opencv/utils.class
deleted file mode 100644
index d5645d1..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/utils.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractor.class b/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractor.class
deleted file mode 100644
index 378fcd3..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractor.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractorMOG.class b/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractorMOG.class
deleted file mode 100644
index d399374..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/video/BackgroundSubtractorMOG.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/video/KalmanFilter.class b/OpenCV-2.3.1/bin/classes/org/opencv/video/KalmanFilter.class
deleted file mode 100644
index c2d9ed4..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/video/KalmanFilter.class and /dev/null differ
diff --git a/OpenCV-2.3.1/bin/classes/org/opencv/video/Video.class b/OpenCV-2.3.1/bin/classes/org/opencv/video/Video.class
deleted file mode 100644
index b67fa60..0000000
Binary files a/OpenCV-2.3.1/bin/classes/org/opencv/video/Video.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/android.class b/OpenCV-2.3.1/cls/org/opencv/android.class
deleted file mode 100644
index b030b32..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/android.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/calib3d/Calib3d.class b/OpenCV-2.3.1/cls/org/opencv/calib3d/Calib3d.class
deleted file mode 100644
index 6cc2828..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/calib3d/Calib3d.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoBM.class b/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoBM.class
deleted file mode 100644
index 7c41054..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoBM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoSGBM.class b/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoSGBM.class
deleted file mode 100644
index c8db978..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/calib3d/StereoSGBM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Core$MinMaxLocResult.class b/OpenCV-2.3.1/cls/org/opencv/core/Core$MinMaxLocResult.class
deleted file mode 100644
index 3dfabbf..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Core$MinMaxLocResult.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Core.class b/OpenCV-2.3.1/cls/org/opencv/core/Core.class
deleted file mode 100644
index 510018e..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Core.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/CvException.class b/OpenCV-2.3.1/cls/org/opencv/core/CvException.class
deleted file mode 100644
index 405bfe3..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/CvException.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/CvType.class b/OpenCV-2.3.1/cls/org/opencv/core/CvType.class
deleted file mode 100644
index 4127ee4..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/CvType.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/KDTree.class b/OpenCV-2.3.1/cls/org/opencv/core/KDTree.class
deleted file mode 100644
index 5611097..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/KDTree.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Mat.class b/OpenCV-2.3.1/cls/org/opencv/core/Mat.class
deleted file mode 100644
index da64bb5..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Mat.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Point.class b/OpenCV-2.3.1/cls/org/opencv/core/Point.class
deleted file mode 100644
index 4928468..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Point.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Point3.class b/OpenCV-2.3.1/cls/org/opencv/core/Point3.class
deleted file mode 100644
index 42bcd51..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Point3.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Range.class b/OpenCV-2.3.1/cls/org/opencv/core/Range.class
deleted file mode 100644
index 7085de8..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Range.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Rect.class b/OpenCV-2.3.1/cls/org/opencv/core/Rect.class
deleted file mode 100644
index 1be8e07..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Rect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/RotatedRect.class b/OpenCV-2.3.1/cls/org/opencv/core/RotatedRect.class
deleted file mode 100644
index d7060b8..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/RotatedRect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Scalar.class b/OpenCV-2.3.1/cls/org/opencv/core/Scalar.class
deleted file mode 100644
index 22514a0..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Scalar.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/Size.class b/OpenCV-2.3.1/cls/org/opencv/core/Size.class
deleted file mode 100644
index 442566d..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/Size.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/core/TermCriteria.class b/OpenCV-2.3.1/cls/org/opencv/core/TermCriteria.class
deleted file mode 100644
index 1eb9e24..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/core/TermCriteria.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/features2d/Features2d.class b/OpenCV-2.3.1/cls/org/opencv/features2d/Features2d.class
deleted file mode 100644
index 06773d3..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/features2d/Features2d.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/features2d/KeyPoint.class b/OpenCV-2.3.1/cls/org/opencv/features2d/KeyPoint.class
deleted file mode 100644
index 26e6bf8..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/features2d/KeyPoint.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/features2d/MSER.class b/OpenCV-2.3.1/cls/org/opencv/features2d/MSER.class
deleted file mode 100644
index 9b610df..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/features2d/MSER.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/features2d/SURF.class b/OpenCV-2.3.1/cls/org/opencv/features2d/SURF.class
deleted file mode 100644
index a09edb7..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/features2d/SURF.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/features2d/StarDetector.class b/OpenCV-2.3.1/cls/org/opencv/features2d/StarDetector.class
deleted file mode 100644
index d288d8e..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/features2d/StarDetector.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/highgui/Highgui.class b/OpenCV-2.3.1/cls/org/opencv/highgui/Highgui.class
deleted file mode 100644
index 2524ea9..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/highgui/Highgui.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/highgui/VideoCapture.class b/OpenCV-2.3.1/cls/org/opencv/highgui/VideoCapture.class
deleted file mode 100644
index 1dd8363..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/highgui/VideoCapture.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/imgproc/Imgproc.class b/OpenCV-2.3.1/cls/org/opencv/imgproc/Imgproc.class
deleted file mode 100644
index 3585b91..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/imgproc/Imgproc.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/imgproc/Moments.class b/OpenCV-2.3.1/cls/org/opencv/imgproc/Moments.class
deleted file mode 100644
index 04477f5..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/imgproc/Moments.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP.class
deleted file mode 100644
index cd2b955..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP_TrainParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP_TrainParams.class
deleted file mode 100644
index 1f87c05..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvANN_MLP_TrainParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvBoost.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvBoost.class
deleted file mode 100644
index 1d3e892..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvBoost.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvBoostParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvBoostParams.class
deleted file mode 100644
index 3ad7bc2..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvBoostParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvDTree.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvDTree.class
deleted file mode 100644
index 22906e1..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvDTree.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvDTreeParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvDTreeParams.class
deleted file mode 100644
index 7c14cf1..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvDTreeParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvEM.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvEM.class
deleted file mode 100644
index 1436281..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvEM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvEMParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvEMParams.class
deleted file mode 100644
index bd6123f..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvEMParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvERTrees.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvERTrees.class
deleted file mode 100644
index 24e6c17..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvERTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTrees.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTrees.class
deleted file mode 100644
index a88f314..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTreesParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTreesParams.class
deleted file mode 100644
index 4204e77..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvGBTreesParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvKNearest.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvKNearest.class
deleted file mode 100644
index 63be71b..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvKNearest.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvNormalBayesClassifier.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvNormalBayesClassifier.class
deleted file mode 100644
index 2a1a316..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvNormalBayesClassifier.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvParamGrid.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvParamGrid.class
deleted file mode 100644
index 32f18fe..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvParamGrid.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvRTParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvRTParams.class
deleted file mode 100644
index 1bae362..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvRTParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvRTrees.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvRTrees.class
deleted file mode 100644
index db5f49b..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvRTrees.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvSVM.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvSVM.class
deleted file mode 100644
index aa304ce..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvSVM.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvSVMParams.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvSVMParams.class
deleted file mode 100644
index 38e855c..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvSVMParams.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/CvStatModel.class b/OpenCV-2.3.1/cls/org/opencv/ml/CvStatModel.class
deleted file mode 100644
index b0736f5..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/CvStatModel.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/ml/Ml.class b/OpenCV-2.3.1/cls/org/opencv/ml/Ml.class
deleted file mode 100644
index edac147..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/ml/Ml.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/objdetect/CascadeClassifier.class b/OpenCV-2.3.1/cls/org/opencv/objdetect/CascadeClassifier.class
deleted file mode 100644
index 8e4fc95..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/objdetect/CascadeClassifier.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/objdetect/HOGDescriptor.class b/OpenCV-2.3.1/cls/org/opencv/objdetect/HOGDescriptor.class
deleted file mode 100644
index 98e9cd4..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/objdetect/HOGDescriptor.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/objdetect/Objdetect.class b/OpenCV-2.3.1/cls/org/opencv/objdetect/Objdetect.class
deleted file mode 100644
index 4afbe52..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/objdetect/Objdetect.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/utils.class b/OpenCV-2.3.1/cls/org/opencv/utils.class
deleted file mode 100644
index 211a354..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/utils.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractor.class b/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractor.class
deleted file mode 100644
index c7aefe6..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractor.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractorMOG.class b/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractorMOG.class
deleted file mode 100644
index 1024787..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/video/BackgroundSubtractorMOG.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/video/KalmanFilter.class b/OpenCV-2.3.1/cls/org/opencv/video/KalmanFilter.class
deleted file mode 100644
index 840116b..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/video/KalmanFilter.class and /dev/null differ
diff --git a/OpenCV-2.3.1/cls/org/opencv/video/Video.class b/OpenCV-2.3.1/cls/org/opencv/video/Video.class
deleted file mode 100644
index b715cd5..0000000
Binary files a/OpenCV-2.3.1/cls/org/opencv/video/Video.class and /dev/null differ
diff --git a/OpenCV-2.3.1/default.properties b/OpenCV-2.3.1/default.properties
deleted file mode 100644
index 12a996a..0000000
--- a/OpenCV-2.3.1/default.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-android.library=true
-# Project target.
-target=android-9
diff --git a/OpenCV-2.3.1/doc/acircles_pattern.png b/OpenCV-2.3.1/doc/acircles_pattern.png
deleted file mode 100644
index eb64ed2..0000000
Binary files a/OpenCV-2.3.1/doc/acircles_pattern.png and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/check_docs_whitelist.txt b/OpenCV-2.3.1/doc/check_docs_whitelist.txt
deleted file mode 100644
index 8359178..0000000
--- a/OpenCV-2.3.1/doc/check_docs_whitelist.txt
+++ /dev/null
@@ -1,193 +0,0 @@
-# this is a list of functions, classes and methods
-# that are not supposed to be documented in the near future,
-# to make the output of check_docs.py script more sensible.
-#
-# Syntax:
-# every line starting with # is a comment
-# there can be empty lines
-# each line includes either a class name (including all the necessary namespaces),
-# or a function/method name
-# or a full declaration of a function/method
-# if a class name is in the whitelist, all the methods are considered "white-listed" too
-# if a method/function name is listed, then all the overload variants are "white-listed".
-# that is, to white list a particular overloaded variant of a function/method you need to put
-# full declaration into the file
-#
-
-######################################### core #####################################
-cv::Mat::MSize
-cv::Mat::MStep
-cv::MatConstIterator
-cv::NAryMatIterator
-cv::Algorithm
-cv::_InputArray
-cv::_OutputArray
-
-######################################## imgproc ###################################
-CvLSHOperations
-cv::FilterEngine
-cv::BaseFilter
-cv::BaseRowFilter
-cv::BaseColumnFilter
-cv::Moments
-
-###################################### features2d###################################
-cv::BOWKMeansTrainer::cluster
-cv::BOWTrainer::BOWTrainer
-cv::BOWTrainer::clear
-cv::AdjusterAdapter::clone
-
-cv::MSER::MSER
-cv::StarDetector::StarDetector
-cv::SIFT::CommonParams::CommonParams
-cv::SIFT::SIFT
-cv::SURF::SURF
-cv::SimpleBlobDetector::Params::Params
-
-cv::FastFeatureDetector::read
-cv::MserFeatureDetector::read
-cv::StarFeatureDetector::read
-cv::SurfFeatureDetector::read
-cv::SiftFeatureDetector::read
-cv::GoodFeaturesToTrackDetector::read
-cv::OrbFeatureDetector::read
-
-cv::FastFeatureDetector::write
-cv::MserFeatureDetector::write
-cv::StarFeatureDetector::write
-cv::SurfFeatureDetector::write
-cv::SiftFeatureDetector::write
-cv::GoodFeaturesToTrackDetector::write
-cv::OrbFeatureDetector::write
-
-cv::DynamicAdaptedFeatureDetector::empty
-cv::GridAdaptedFeatureDetector::empty
-cv::PyramidAdaptedFeatureDetector::empty
-
-cv::BriefDescriptorExtractor::descriptorSize
-cv::SurfDescriptorExtractor::descriptorSize
-cv::SiftDescriptorExtractor::descriptorSize
-cv::OpponentColorDescriptorExtractor::descriptorSize
-cv::OrbDescriptorExtractor::descriptorSize
-
-cv::BriefDescriptorExtractor::descriptorType
-cv::SurfDescriptorExtractor::descriptorType
-cv::SiftDescriptorExtractor::descriptorType
-cv::OpponentColorDescriptorExtractor::descriptorType
-cv::OrbDescriptorExtractor::descriptorType
-
-cv::SurfDescriptorExtractor::read
-cv::SiftDescriptorExtractor::read
-cv::OpponentColorDescriptorExtractor::read
-cv::OrbDescriptorExtractor::read
-
-cv::SurfDescriptorExtractor::write
-cv::SiftDescriptorExtractor::write
-cv::OpponentColorDescriptorExtractor::write
-cv::OrbDescriptorExtractor::write
-
-cv::OpponentColorDescriptorExtractor::empty
-
-cv::FlannBasedMatcher::train
-
-cv::FlannBasedMatcher::clear
-
-cv::FlannBasedMatcher::clone
-
-cv::FlannBasedMatcher::isMaskSupported
-
-
-cv::GenericDescriptorMatcher::GenericDescriptorMatcher
-
-cv::VectorDescriptorMatcher::clear
-cv::FernDescriptorMatcher::clear
-cv::OneWayDescriptorMatcher::clear
-
-cv::VectorDescriptorMatcher::empty
-cv::FernDescriptorMatcher::empty
-cv::OneWayDescriptorMatcher::empty
-
-cv::OneWayDescriptorMatcher::read
-
-cv::VectorDescriptorMatcher::isMaskSupported
-cv::FernDescriptorMatcher::isMaskSupported
-cv::OneWayDescriptorMatcher::isMaskSupported
-
-cv::VectorDescriptorMatcher::train
-cv::FernDescriptorMatcher::train
-cv::OneWayDescriptorMatcher::train
-
-cv::VectorDescriptorMatcher::read
-cv::FernDescriptorMatcher::read
-
-cv::VectorDescriptorMatcher::write
-cv::FernDescriptorMatcher::write
-cv::OneWayDescriptorMatcher::write
-
-
-
-cv::FastAdjuster::good
-cv::StarAdjuster::good
-cv::SurfAdjuster::good
-cv::FastAdjuster::tooFew
-cv::StarAdjuster::tooFew
-cv::SurfAdjuster::tooFew
-cv::FastAdjuster::tooMany
-cv::StarAdjuster::tooMany
-cv::SurfAdjuster::tooMany
-cv::FastAdjuster::clone
-cv::StarAdjuster::clone
-cv::SurfAdjuster::clone
-
-######################################## calib3d ###################################
-CvLevMarq
-Mat cv::findFundamentalMat( InputArray points1, InputArray points2, OutputArray mask, int method=FM_RANSAC, double param1=3., double param2=0.99)
-Mat findHomography( InputArray srcPoints, InputArray dstPoints, OutputArray mask, int method=0, double ransacReprojThreshold=3);
-
-########################################## ml ######################################
-CvBoostTree
-CvForestTree
-CvSVMKernel
-CvSVMSolver
-CvDTreeTrainData
-CvERTreeTrainData
-CvKNearest::CvKNearest
-CvKNearest::clear
-CvDTreeNode::get_num_valid
-CvDTreeNode::set_num_valid
-CvDTree::CvDTree
-CvDTree::clear
-CvDTree::read
-CvDTree::write
-CvEM::CvEM
-CvEM::clear
-CvEM::read
-CvEM::write
-CvSVM::CvSVM
-CvSVM::clear
-CvSVM::read
-CvSVM::write
-CvMLData::CvMLData
-CvRTrees::CvRTrees
-CvRTrees::clear
-CvRTrees::read
-CvRTrees::write
-CvBoost::CvBoost
-CvBoost::clear
-CvBoost::read
-CvBoost::write
-CvGBTrees::CvGBTrees
-CvGBTrees::clear
-CvGBTrees::read
-CvGBTrees::write
-CvNormalBayesClassifier::CvNormalBayerClassifier
-CvNormalBayesClassifier::clear
-CvNormalBayesClassifier::read
-CvNormalBayesClassifier::write
-CvANN_MLP::CvANN_MLP
-CvANN_MLP::clear
-CvANN_MLP::read
-CvANN_MLP::write
-CvTrainTestSplit
-cvParamLattice
-cvDefaultParamLattice
diff --git a/OpenCV-2.3.1/doc/haartraining.htm b/OpenCV-2.3.1/doc/haartraining.htm
deleted file mode 100644
index c8c3a0e..0000000
--- a/OpenCV-2.3.1/doc/haartraining.htm
+++ /dev/null
@@ -1,676 +0,0 @@
-
-
-
-
-
-Object Detection Using Haar-like Features with Cascade of Boosted
-Classifiers
-
-
-
-
-
-
-
-
-
Rapid Object Detection With A Cascade of Boosted
-Classifiers Based on Haar-like Features
-
-
Introduction
-
-
This document describes how to train and
-use a cascade of boosted classifiers for rapid object detection. A large set of
-over-complete haar-like features provide the basis for the simple individual
-classifiers. Examples of object detection tasks are face, eye and nose
-detection, as well as logo detection.
-
-
-
-
The sample detection task in this document
-is logo detection, since logo detection does not require the collection of
-large set of registered and carefully marked object samples. Instead we assume
-that from one prototype image, a very large set of derived object examples can
-be derived (createsamples utility, see below).
-
-
-
-
A detailed description of the training/evaluation
-algorithm can be found in [1] and [2].
-
-
Samples Creation
-
-
For training a training samples must be
-collected. There are two sample types: negative samples and positive samples.
-Negative samples correspond to non-object images. Positive samples correspond
-to object images.
-
-
Negative Samples
-
-
Negative samples are taken from arbitrary
-images. These images must not contain object representations. Negative samples
-are passed through background description file. It is a text file in which each
-text line contains the filename (relative to the directory of the description
-file) of negative sample image. This file must be created manually. Note that
-the negative samples and sample images are also called background samples or
-background samples images, and are used interchangeably in this document
-
-
-
-
Example of negative description file:
-
-
-
-
Directory structure:
-
-
/img
-
-
img1.jpg
-
-
img2.jpg
-
-
bg.txt
-
-
-
-
File bg.txt:
-
-
img/img1.jpg
-
-
img/img2.jpg
-
-
Positive Samples
-
-
Positive samples are created by createsamples
-utility. They may be created from single object image or from collection of
-previously marked up images.
-
-
-
-
The single object image may for instance
-contain a company logo. Then are large set of positive samples are created from
-the given object image by randomly rotating, changing the logo color as well as
-placing the logo on arbitrary background.
-
-
The amount and range of randomness can be
-controlled by command line arguments.
-
-
Command line arguments:
-
-
- vec <vec_file_name>
-
-
name of the
-output file containing the positive samples for training
-
-
- img <image_file_name>
-
-
source object
-image (e.g., a company logo)
-
-
- bg <background_file_name>
-
-
background
-description file; contains a list of images into which randomly distorted
-versions of the object are pasted for positive sample generation
-
-
- num <number_of_samples>
-
-
number of
-positive samples to generate
-
-
- bgcolor <background_color>
-
-
background color (currently grayscale images are assumed); the
-background color denotes the transparent color. Since there might be
-compression artifacts, the amount of color tolerance can be specified by –bgthresh. All pixels between bgcolor-bgthresh and bgcolor+bgthresh are regarded as transparent.
-
-
- bgthresh <background_color_threshold>
-
-
- inv
-
-
if specified, the colors will be inverted
-
-
- randinv
-
-
if specified, the colors will be inverted randomly
-
-
- maxidev <max_intensity_deviation>
-
-
maximal
-intensity deviation of foreground samples pixels
-
-
- maxxangle <max_x_rotation_angle>,
-
-
- maxyangle <max_y_rotation_angle>,
-
-
- maxzangle <max_z_rotation_angle>
-
-
maximum rotation angles in radians
-
-
-show
-
-
if specified, each sample will be shown. Pressing ‘Esc’ will
-continue creation process without samples showing. Useful debugging option.
-
-
- w <sample_width>
-
-
width (in
-pixels) of the output samples
-
-
- h <sample_height>
-
-
height (in
-pixels) of the output samples
-
-
-
-
For following procedure is used to create a
-sample object instance:
-
-
The source image is rotated random around
-all three axes. The chosen angle is limited my -max?angle. Next pixels of
-intensities in the range of [bg_color-bg_color_threshold;
-bg_color+bg_color_threshold] are regarded as
-transparent. White noise is added to the intensities of the foreground. If –inv key is
-specified then foreground pixel intensities are inverted. If –randinv key is
-specified then it is randomly selected whether for this sample inversion will
-be applied. Finally, the obtained image is placed onto arbitrary background
-from the background description file, resized to the pixel size specified by –w and –h and stored
-into the file specified by the –vec command line parameter.
-
-
-
-
Positive samples also may be obtained from
-a collection of previously marked up images. This collection is described by
-text file similar to background description file. Each line of this file
-corresponds to collection image. The first element of the line is image file
-name. It is followed by number of object instances. The following numbers are
-the coordinates of bounding rectangles (x, y, width, height).
-
-
-
-
Example of description file:
-
-
-
-
Directory structure:
-
-
/img
-
-
img1.jpg
-
-
img2.jpg
-
-
info.dat
-
-
-
-
File info.dat:
-
-
img/img1.jpg 1 140
-100 45 45
-
-
img/img2.jpg 2 100
-200 50 50 50 30 25 25
-
-
-
-
Image img1.jpg contains single object
-instance with bounding rectangle (140, 100, 45, 45). Image img2.jpg contains
-two object instances.
-
-
-
-
In order to create positive samples from
-such collection –info argument should be specified instead of –img:
-
-
- info <collection_file_name>
-
-
description file
-of marked up images collection
-
-
-
-
The scheme of sample creation in this case
-is as follows. The object instances are taken from images. Then they are
-resized to samples size and stored in output file. No distortion is applied, so
-the only affecting arguments are –w, -h, -show and –num.
-
-
-
-
createsamples utility may be used for examining samples stored in positive samples
-file. In order to do this only –vec, –w and –h parameters
-should be specified.
-
-
-
-
Note that for training, it does not matter
-how positive samples files are generated. So the createsamples utility is only one way
-to collect/create a vector file of positive samples.
-
-
Training
-
-
The next step after samples creation is
-training of classifier. It is performed by the haartraining utility.
-
-
-
-
Command line arguments:
-
-
- data <dir_name>
-
-
directory name in which the trained classifier is stored
-
-
- vec <vec_file_name>
-
-
file name of positive sample file (created by trainingsamples utility or by any other means)
-
-
- bg <background_file_name>
-
-
background description file
-
-
- npos <number_of_positive_samples>,
-
-
- nneg <number_of_negative_samples>
-
-
number of positive/negative samples used in training of each
-classifier stage. Reasonable values are npos = 7000 and nneg = 3000.
-
-
- nstages <number_of_stages>
-
-
number of
-stages to be trained
-
-
- nsplits <number_of_splits>
-
-
determines the weak classifier used in stage classifiers. If 1, then a simple stump classifier is used, if 2 and more, then CART classifier with number_of_splits internal (split)
-nodes is used
-
-
- mem <memory_in_MB>
-
-
Available memory in MB for precalculation. The more memory you
-have the faster the training process
-
-
- sym (default),
-
-
- nonsym
-
-
specifies whether the object class under training has vertical
-symmetry or not. Vertical symmetry speeds up training process. For instance,
-frontal faces show off vertical symmetry
-
-
- minhitrate <min_hit_rate>
-
-
minimal desired hit rate for each stage classifier. Overall hit
-rate may be estimated as (min_hit_rate^number_of_stages)
-
-
- maxfalsealarm <max_false_alarm_rate>
-
-
maximal desired false alarm rate for each stage classifier. Overall
-false alarm rate may be estimated as (max_false_alarm_rate^number_of_stages)
-
-
- weighttrimming <weight_trimming>
-
-
Specifies
-wheter and how much weight trimming should be used. A decent choice is 0.90.
-
-
- eqw
-
-
- mode <BASIC (default) | CORE | ALL>
-
-
selects the type of haar features set used in training. BASIC use
-only upright features, while ALL uses the full set of upright and 45 degree
-rotated feature set. See [1] for more details.
-
-
- w <sample_width>,
-
-
- h <sample_height>
-
-
Size of training samples (in pixels). Must have exactly the same
-values as used during training samples creation (utility trainingsamples)
-
-
-
-
Note: in order to use multiprocessor
-advantage a compiler that supports OpenMP 1.0 standard should be used.
-
-
Application
-
-
OpenCV cvHaarDetectObjects() function (in
-particular haarFaceDetect demo) is used for detection.
-
-
Test Samples
-
-
In order to evaluate the performance of
-trained classifier a collection of marked up images is needed. When such
-collection is not available test samples may be created from single object
-image by createsamples utility. The scheme of test samples creation in this case is
-similar to training samples creation since each test sample is a background
-image into which a randomly distorted and randomly scaled instance of the
-object picture is pasted at a random position.
-
-
-
-
If both –img and –info arguments are specified then
-test samples will be created by createsamples utility. The sample image is arbitrary distorted as it was
-described below, then it is placed at random location to background image and
-stored. The corresponding description line is added to the file specified by –info argument.
-
-
-
-
The –w and –h keys determine the minimal size of
-placed object picture.
-
-
-
-
The test image file name format is as
-follows:
-
-
imageOrderNumber_x_y_width_height.jpg, where x, y, width and height are the coordinates of placed object bounding rectangle.
-
-
Note that you should use a background
-images set different from the background image set used during training.
-
-
Performance
-Evaluation
-
-
In order to evaluate the performance of the
-classifier performance utility may be used. It takes a collection of marked up images,
-applies the classifier and outputs the performance, i.e. number of found
-objects, number of missed objects, number of false alarms and other
-information.
-
-
-
-
Command line arguments:
-
-
- data <dir_name>
-
-
directory name in which the trained classifier is stored
-
-
- info <collection_file_name>
-
-
file with test samples description
-
-
- maxSizeDiff <max_size_difference>,
-
-
- maxPosDiff <max_position_difference>
-
-
determine the criterion of reference and detected rectangles
-coincidence. Default values are 1.5 and 0.3 respectively.
-
-
- sf <scale_factor>,
-
-
detection parameter. Default value is 1.2.
-
-
- w <sample_width>,
-
-
- h <sample_height>
-
-
Size of training samples (in pixels). Must have exactly the same
-values as used during training (utility haartraining)
-
-
References
-
-
[1] Rainer Lienhart and Jochen Maydt. An
-Extended Set of Haar-like Features for Rapid Object Detection. Submitted to
-ICIP2002.
-
-
[2] Alexander Kuranov, Rainer Lienhart, and
-Vadim Pisarevsky. An Empirical Analysis of Boosting Algorithms for Rapid
-Objects With an Extended Set of Haar-like Features. Intel Technical Report
-MRL-TR-July02-01, 2002.
-
-
-
-
-
-
diff --git a/OpenCV-2.3.1/doc/license.txt b/OpenCV-2.3.1/doc/license.txt
deleted file mode 100644
index af03307..0000000
--- a/OpenCV-2.3.1/doc/license.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-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.
-
-
- License Agreement
- For Open Source Computer Vision Library
-
-Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-Copyright (C) 2008-2011, Willow Garage Inc., 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:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- * 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.
-
- * The name of the copyright holders 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.
diff --git a/OpenCV-2.3.1/doc/opencv-logo.png b/OpenCV-2.3.1/doc/opencv-logo.png
deleted file mode 100644
index 76cc29f..0000000
Binary files a/OpenCV-2.3.1/doc/opencv-logo.png and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv-logo2.png b/OpenCV-2.3.1/doc/opencv-logo2.png
deleted file mode 100644
index 615fd2a..0000000
Binary files a/OpenCV-2.3.1/doc/opencv-logo2.png and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv.jpg b/OpenCV-2.3.1/doc/opencv.jpg
deleted file mode 100644
index 0e3b57b..0000000
Binary files a/OpenCV-2.3.1/doc/opencv.jpg and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv2refman.pdf b/OpenCV-2.3.1/doc/opencv2refman.pdf
deleted file mode 100644
index e851a09..0000000
Binary files a/OpenCV-2.3.1/doc/opencv2refman.pdf and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv_cheatsheet.pdf b/OpenCV-2.3.1/doc/opencv_cheatsheet.pdf
deleted file mode 100644
index 8ed1c36..0000000
Binary files a/OpenCV-2.3.1/doc/opencv_cheatsheet.pdf and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv_tutorials.pdf b/OpenCV-2.3.1/doc/opencv_tutorials.pdf
deleted file mode 100644
index 292f36f..0000000
Binary files a/OpenCV-2.3.1/doc/opencv_tutorials.pdf and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/opencv_user.pdf b/OpenCV-2.3.1/doc/opencv_user.pdf
deleted file mode 100644
index b3047af..0000000
Binary files a/OpenCV-2.3.1/doc/opencv_user.pdf and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/packaging.txt b/OpenCV-2.3.1/doc/packaging.txt
deleted file mode 100644
index ffa1263..0000000
--- a/OpenCV-2.3.1/doc/packaging.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-
-INSTRUCTIONS TO BUILD WIN32 PACKAGES WITH CMAKE+CPACK
-------------------------------------------------------
-
-- Install NSIS.
-- Generate OpenCV solutions for MSVC using CMake as usual.
-- In cmake-gui:
- - Mark BUILD_PACKAGE
- - Mark BUILD_EXAMPLES (If examples are desired to be shipped as binaries...)
- - Unmark ENABLE_OPENMP, since this feature seems to have some issues yet...
- - Mark INSTALL_*_EXAMPLES
-- Open the OpenCV solution and build ALL in Debug and Release.
-- Build PACKAGE, from the Release configuration. An NSIS installer package will be
- created with both release and debug LIBs and DLLs.
-
-
-Jose Luis Blanco, 2009/JUL/29
diff --git a/OpenCV-2.3.1/doc/pattern.png b/OpenCV-2.3.1/doc/pattern.png
deleted file mode 100644
index 5227c91..0000000
Binary files a/OpenCV-2.3.1/doc/pattern.png and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Modules.doc b/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Modules.doc
deleted file mode 100644
index c15ff1d..0000000
Binary files a/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Modules.doc and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Tests.doc b/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Tests.doc
deleted file mode 100644
index c461f1b..0000000
Binary files a/OpenCV-2.3.1/doc/vidsurv/Blob_Tracking_Tests.doc and /dev/null differ
diff --git a/OpenCV-2.3.1/doc/vidsurv/TestSeq.doc b/OpenCV-2.3.1/doc/vidsurv/TestSeq.doc
deleted file mode 100644
index 4fa6251..0000000
Binary files a/OpenCV-2.3.1/doc/vidsurv/TestSeq.doc and /dev/null differ
diff --git a/OpenCV-2.3.1/gen/org/opencv/BuildConfig.java b/OpenCV-2.3.1/gen/org/opencv/BuildConfig.java
deleted file mode 100644
index af62ca5..0000000
--- a/OpenCV-2.3.1/gen/org/opencv/BuildConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package org.opencv;
-
-public final class BuildConfig {
- public final static boolean DEBUG = true;
-}
\ No newline at end of file
diff --git a/OpenCV-2.3.1/include/opencv2/contrib/contrib.hpp b/OpenCV-2.3.1/include/opencv2/contrib/contrib.hpp
deleted file mode 100644
index 9907a94..0000000
--- a/OpenCV-2.3.1/include/opencv2/contrib/contrib.hpp
+++ /dev/null
@@ -1,614 +0,0 @@
-/*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.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 __OPENCV_CONTRIB_HPP__
-#define __OPENCV_CONTRIB_HPP__
-
-#include "opencv2/core/core.hpp"
-#include "opencv2/features2d/features2d.hpp"
-#include "opencv2/objdetect/objdetect.hpp"
-
-#ifdef __cplusplus
-
-/****************************************************************************************\
-* Adaptive Skin Detector *
-\****************************************************************************************/
-
-class CV_EXPORTS CvAdaptiveSkinDetector
-{
-private:
- enum {
- GSD_HUE_LT = 3,
- GSD_HUE_UT = 33,
- GSD_INTENSITY_LT = 15,
- GSD_INTENSITY_UT = 250
- };
-
- class CV_EXPORTS Histogram
- {
- private:
- enum {
- HistogramSize = (GSD_HUE_UT - GSD_HUE_LT + 1)
- };
-
- protected:
- int findCoverageIndex(double surfaceToCover, int defaultValue = 0);
-
- public:
- CvHistogram *fHistogram;
- Histogram();
- virtual ~Histogram();
-
- void findCurveThresholds(int &x1, int &x2, double percent = 0.05);
- void mergeWith(Histogram *source, double weight);
- };
-
- int nStartCounter, nFrameCount, nSkinHueLowerBound, nSkinHueUpperBound, nMorphingMethod, nSamplingDivider;
- double fHistogramMergeFactor, fHuePercentCovered;
- Histogram histogramHueMotion, skinHueHistogram;
- IplImage *imgHueFrame, *imgSaturationFrame, *imgLastGrayFrame, *imgMotionFrame, *imgFilteredFrame;
- IplImage *imgShrinked, *imgTemp, *imgGrayFrame, *imgHSVFrame;
-
-protected:
- void initData(IplImage *src, int widthDivider, int heightDivider);
- void adaptiveFilter();
-
-public:
-
- enum {
- MORPHING_METHOD_NONE = 0,
- MORPHING_METHOD_ERODE = 1,
- MORPHING_METHOD_ERODE_ERODE = 2,
- MORPHING_METHOD_ERODE_DILATE = 3
- };
-
- CvAdaptiveSkinDetector(int samplingDivider = 1, int morphingMethod = MORPHING_METHOD_NONE);
- virtual ~CvAdaptiveSkinDetector();
-
- virtual void process(IplImage *inputBGRImage, IplImage *outputHueMask);
-};
-
-
-/****************************************************************************************\
- * Fuzzy MeanShift Tracker *
- \****************************************************************************************/
-
-class CV_EXPORTS CvFuzzyPoint {
-public:
- double x, y, value;
-
- CvFuzzyPoint(double _x, double _y);
-};
-
-class CV_EXPORTS CvFuzzyCurve {
-private:
- std::vector points;
- double value, centre;
-
- bool between(double x, double x1, double x2);
-
-public:
- CvFuzzyCurve();
- ~CvFuzzyCurve();
-
- void setCentre(double _centre);
- double getCentre();
- void clear();
- void addPoint(double x, double y);
- double calcValue(double param);
- double getValue();
- void setValue(double _value);
-};
-
-class CV_EXPORTS CvFuzzyFunction {
-public:
- std::vector curves;
-
- CvFuzzyFunction();
- ~CvFuzzyFunction();
- void addCurve(CvFuzzyCurve *curve, double value = 0);
- void resetValues();
- double calcValue();
- CvFuzzyCurve *newCurve();
-};
-
-class CV_EXPORTS CvFuzzyRule {
-private:
- CvFuzzyCurve *fuzzyInput1, *fuzzyInput2;
- CvFuzzyCurve *fuzzyOutput;
-public:
- CvFuzzyRule();
- ~CvFuzzyRule();
- void setRule(CvFuzzyCurve *c1, CvFuzzyCurve *c2, CvFuzzyCurve *o1);
- double calcValue(double param1, double param2);
- CvFuzzyCurve *getOutputCurve();
-};
-
-class CV_EXPORTS CvFuzzyController {
-private:
- std::vector rules;
-public:
- CvFuzzyController();
- ~CvFuzzyController();
- void addRule(CvFuzzyCurve *c1, CvFuzzyCurve *c2, CvFuzzyCurve *o1);
- double calcOutput(double param1, double param2);
-};
-
-class CV_EXPORTS CvFuzzyMeanShiftTracker
-{
-private:
- class FuzzyResizer
- {
- private:
- CvFuzzyFunction iInput, iOutput;
- CvFuzzyController fuzzyController;
- public:
- FuzzyResizer();
- int calcOutput(double edgeDensity, double density);
- };
-
- class SearchWindow
- {
- public:
- FuzzyResizer *fuzzyResizer;
- int x, y;
- int width, height, maxWidth, maxHeight, ellipseHeight, ellipseWidth;
- int ldx, ldy, ldw, ldh, numShifts, numIters;
- int xGc, yGc;
- long m00, m01, m10, m11, m02, m20;
- double ellipseAngle;
- double density;
- unsigned int depthLow, depthHigh;
- int verticalEdgeLeft, verticalEdgeRight, horizontalEdgeTop, horizontalEdgeBottom;
-
- SearchWindow();
- ~SearchWindow();
- void setSize(int _x, int _y, int _width, int _height);
- void initDepthValues(IplImage *maskImage, IplImage *depthMap);
- bool shift();
- void extractInfo(IplImage *maskImage, IplImage *depthMap, bool initDepth);
- void getResizeAttribsEdgeDensityLinear(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
- void getResizeAttribsInnerDensity(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
- void getResizeAttribsEdgeDensityFuzzy(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
- bool meanShift(IplImage *maskImage, IplImage *depthMap, int maxIteration, bool initDepth);
- };
-
-public:
- enum TrackingState
- {
- tsNone = 0,
- tsSearching = 1,
- tsTracking = 2,
- tsSetWindow = 3,
- tsDisabled = 10
- };
-
- enum ResizeMethod {
- rmEdgeDensityLinear = 0,
- rmEdgeDensityFuzzy = 1,
- rmInnerDensity = 2
- };
-
- enum {
- MinKernelMass = 1000
- };
-
- SearchWindow kernel;
- int searchMode;
-
-private:
- enum
- {
- MaxMeanShiftIteration = 5,
- MaxSetSizeIteration = 5
- };
-
- void findOptimumSearchWindow(SearchWindow &searchWindow, IplImage *maskImage, IplImage *depthMap, int maxIteration, int resizeMethod, bool initDepth);
-
-public:
- CvFuzzyMeanShiftTracker();
- ~CvFuzzyMeanShiftTracker();
-
- void track(IplImage *maskImage, IplImage *depthMap, int resizeMethod, bool resetSearch, int minKernelMass = MinKernelMass);
-};
-
-
-namespace cv
-{
-
- class CV_EXPORTS Octree
- {
- public:
- struct Node
- {
- Node() {}
- int begin, end;
- float x_min, x_max, y_min, y_max, z_min, z_max;
- int maxLevels;
- bool isLeaf;
- int children[8];
- };
-
- Octree();
- Octree( const vector& points, int maxLevels = 10, int minPoints = 20 );
- virtual ~Octree();
-
- virtual void buildTree( const vector& points, int maxLevels = 10, int minPoints = 20 );
- virtual void getPointsWithinSphere( const Point3f& center, float radius,
- vector& points ) const;
- const vector& getNodes() const { return nodes; }
- private:
- int minPoints;
- vector points;
- vector nodes;
-
- virtual void buildNext(size_t node_ind);
- };
-
-
- class CV_EXPORTS Mesh3D
- {
- public:
- struct EmptyMeshException {};
-
- Mesh3D();
- Mesh3D(const vector& vtx);
- ~Mesh3D();
-
- void buildOctree();
- void clearOctree();
- float estimateResolution(float tryRatio = 0.1f);
- void computeNormals(float normalRadius, int minNeighbors = 20);
- void computeNormals(const vector& subset, float normalRadius, int minNeighbors = 20);
-
- void writeAsVrml(const String& file, const vector& colors = vector()) const;
-
- vector vtx;
- vector normals;
- float resolution;
- Octree octree;
-
- const static Point3f allzero;
- };
-
- class CV_EXPORTS SpinImageModel
- {
- public:
-
- /* model parameters, leave unset for default or auto estimate */
- float normalRadius;
- int minNeighbors;
-
- float binSize;
- int imageWidth;
-
- float lambda;
- float gamma;
-
- float T_GeometriccConsistency;
- float T_GroupingCorespondances;
-
- /* public interface */
- SpinImageModel();
- explicit SpinImageModel(const Mesh3D& mesh);
- ~SpinImageModel();
-
- void setLogger(std::ostream* log);
- void selectRandomSubset(float ratio);
- void setSubset(const vector& subset);
- void compute();
-
- void match(const SpinImageModel& scene, vector< vector >& result);
-
- Mat packRandomScaledSpins(bool separateScale = false, size_t xCount = 10, size_t yCount = 10) const;
-
- size_t getSpinCount() const { return spinImages.rows; }
- Mat getSpinImage(size_t index) const { return spinImages.row((int)index); }
- const Point3f& getSpinVertex(size_t index) const { return mesh.vtx[subset[index]]; }
- const Point3f& getSpinNormal(size_t index) const { return mesh.normals[subset[index]]; }
-
- const Mesh3D& getMesh() const { return mesh; }
- Mesh3D& getMesh() { return mesh; }
-
- /* static utility functions */
- static bool spinCorrelation(const Mat& spin1, const Mat& spin2, float lambda, float& result);
-
- static Point2f calcSpinMapCoo(const Point3f& point, const Point3f& vertex, const Point3f& normal);
-
- static float geometricConsistency(const Point3f& pointScene1, const Point3f& normalScene1,
- const Point3f& pointModel1, const Point3f& normalModel1,
- const Point3f& pointScene2, const Point3f& normalScene2,
- const Point3f& pointModel2, const Point3f& normalModel2);
-
- static float groupingCreteria(const Point3f& pointScene1, const Point3f& normalScene1,
- const Point3f& pointModel1, const Point3f& normalModel1,
- const Point3f& pointScene2, const Point3f& normalScene2,
- const Point3f& pointModel2, const Point3f& normalModel2,
- float gamma);
- protected:
- void defaultParams();
-
- void matchSpinToModel(const Mat& spin, vector& indeces,
- vector& corrCoeffs, bool useExtremeOutliers = true) const;
-
- void repackSpinImages(const vector& mask, Mat& spinImages, bool reAlloc = true) const;
-
- vector subset;
- Mesh3D mesh;
- Mat spinImages;
- std::ostream* out;
- };
-
- class CV_EXPORTS TickMeter
- {
- public:
- TickMeter();
- void start();
- void stop();
-
- int64 getTimeTicks() const;
- double getTimeMicro() const;
- double getTimeMilli() const;
- double getTimeSec() const;
- int64 getCounter() const;
-
- void reset();
- private:
- int64 counter;
- int64 sumTime;
- int64 startTime;
- };
-
- CV_EXPORTS std::ostream& operator<<(std::ostream& out, const TickMeter& tm);
-
- class CV_EXPORTS SelfSimDescriptor
- {
- public:
- SelfSimDescriptor();
- SelfSimDescriptor(int _ssize, int _lsize,
- int _startDistanceBucket=DEFAULT_START_DISTANCE_BUCKET,
- int _numberOfDistanceBuckets=DEFAULT_NUM_DISTANCE_BUCKETS,
- int _nangles=DEFAULT_NUM_ANGLES);
- SelfSimDescriptor(const SelfSimDescriptor& ss);
- virtual ~SelfSimDescriptor();
- SelfSimDescriptor& operator = (const SelfSimDescriptor& ss);
-
- size_t getDescriptorSize() const;
- Size getGridSize( Size imgsize, Size winStride ) const;
-
- virtual void compute(const Mat& img, vector& descriptors, Size winStride=Size(),
- const vector& locations=vector()) const;
- virtual void computeLogPolarMapping(Mat& mappingMask) const;
- virtual void SSD(const Mat& img, Point pt, Mat& ssd) const;
-
- int smallSize;
- int largeSize;
- int startDistanceBucket;
- int numberOfDistanceBuckets;
- int numberOfAngles;
-
- enum { DEFAULT_SMALL_SIZE = 5, DEFAULT_LARGE_SIZE = 41,
- DEFAULT_NUM_ANGLES = 20, DEFAULT_START_DISTANCE_BUCKET = 3,
- DEFAULT_NUM_DISTANCE_BUCKETS = 7 };
- };
-
-
- typedef bool (*BundleAdjustCallback)(int iteration, double norm_error, void* user_data);
-
- class LevMarqSparse {
- public:
- LevMarqSparse();
- LevMarqSparse(int npoints, // number of points
- int ncameras, // number of cameras
- int nPointParams, // number of params per one point (3 in case of 3D points)
- int nCameraParams, // number of parameters per one camera
- int nErrParams, // number of parameters in measurement vector
- // for 1 point at one camera (2 in case of 2D projections)
- Mat& visibility, // visibility matrix. rows correspond to points, columns correspond to cameras
- // 1 - point is visible for the camera, 0 - invisible
- Mat& P0, // starting vector of parameters, first cameras then points
- Mat& X, // measurements, in order of visibility. non visible cases are skipped
- TermCriteria criteria, // termination criteria
-
- // callback for estimation of Jacobian matrices
- void (CV_CDECL * fjac)(int i, int j, Mat& point_params,
- Mat& cam_params, Mat& A, Mat& B, void* data),
- // callback for estimation of backprojection errors
- void (CV_CDECL * func)(int i, int j, Mat& point_params,
- Mat& cam_params, Mat& estim, void* data),
- void* data, // user-specific data passed to the callbacks
- BundleAdjustCallback cb, void* user_data
- );
-
- virtual ~LevMarqSparse();
-
- virtual void run( int npoints, // number of points
- int ncameras, // number of cameras
- int nPointParams, // number of params per one point (3 in case of 3D points)
- int nCameraParams, // number of parameters per one camera
- int nErrParams, // number of parameters in measurement vector
- // for 1 point at one camera (2 in case of 2D projections)
- Mat& visibility, // visibility matrix. rows correspond to points, columns correspond to cameras
- // 1 - point is visible for the camera, 0 - invisible
- Mat& P0, // starting vector of parameters, first cameras then points
- Mat& X, // measurements, in order of visibility. non visible cases are skipped
- TermCriteria criteria, // termination criteria
-
- // callback for estimation of Jacobian matrices
- void (CV_CDECL * fjac)(int i, int j, Mat& point_params,
- Mat& cam_params, Mat& A, Mat& B, void* data),
- // callback for estimation of backprojection errors
- void (CV_CDECL * func)(int i, int j, Mat& point_params,
- Mat& cam_params, Mat& estim, void* data),
- void* data // user-specific data passed to the callbacks
- );
-
- virtual void clear();
-
- // useful function to do simple bundle adjustment tasks
- static void bundleAdjust(vector& points, // positions of points in global coordinate system (input and output)
- const vector >& imagePoints, // projections of 3d points for every camera
- const vector >& visibility, // visibility of 3d points for every camera
- vector& cameraMatrix, // intrinsic matrices of all cameras (input and output)
- vector& R, // rotation matrices of all cameras (input and output)
- vector& T, // translation vector of all cameras (input and output)
- vector& distCoeffs, // distortion coefficients of all cameras (input and output)
- const TermCriteria& criteria=
- TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON),
- BundleAdjustCallback cb = 0, void* user_data = 0);
-
- public:
- virtual void optimize(CvMat &_vis); //main function that runs minimization
-
- //iteratively asks for measurement for visible camera-point pairs
- void ask_for_proj(CvMat &_vis,bool once=false);
- //iteratively asks for Jacobians for every camera_point pair
- void ask_for_projac(CvMat &_vis);
-
- CvMat* err; //error X-hX
- double prevErrNorm, errNorm;
- double lambda;
- CvTermCriteria criteria;
- int iters;
-
- CvMat** U; //size of array is equal to number of cameras
- CvMat** V; //size of array is equal to number of points
- CvMat** inv_V_star; //inverse of V*
-
- CvMat** A;
- CvMat** B;
- CvMat** W;
-
- CvMat* X; //measurement
- CvMat* hX; //current measurement extimation given new parameter vector
-
- CvMat* prevP; //current already accepted parameter.
- CvMat* P; // parameters used to evaluate function with new params
- // this parameters may be rejected
-
- CvMat* deltaP; //computed increase of parameters (result of normal system solution )
-
- CvMat** ea; // sum_i AijT * e_ij , used as right part of normal equation
- // length of array is j = number of cameras
- CvMat** eb; // sum_j BijT * e_ij , used as right part of normal equation
- // length of array is i = number of points
-
- CvMat** Yj; //length of array is i = num_points
-
- CvMat* S; //big matrix of block Sjk , each block has size num_cam_params x num_cam_params
-
- CvMat* JtJ_diag; //diagonal of JtJ, used to backup diagonal elements before augmentation
-
- CvMat* Vis_index; // matrix which element is index of measurement for point i and camera j
-
- int num_cams;
- int num_points;
- int num_err_param;
- int num_cam_param;
- int num_point_param;
-
- //target function and jacobian pointers, which needs to be initialized
- void (*fjac)(int i, int j, Mat& point_params, Mat& cam_params, Mat& A, Mat& B, void* data);
- void (*func)(int i, int j, Mat& point_params, Mat& cam_params, Mat& estim, void* data);
-
- void* data;
-
- BundleAdjustCallback cb;
- void* user_data;
- };
-
- CV_EXPORTS int chamerMatching( Mat& img, Mat& templ,
- vector >& results, vector& cost,
- double templScale=1, int maxMatches = 20,
- double minMatchDistance = 1.0, int padX = 3,
- int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6,
- double orientationWeight = 0.5, double truncate = 20);
-
-
- class CV_EXPORTS StereoVar
- {
- public:
- // Flags
- enum {USE_INITIAL_DISPARITY = 1, USE_EQUALIZE_HIST = 2, USE_SMART_ID = 4, USE_AUTO_PARAMS = 8, USE_MEDIAN_FILTERING = 16};
- enum {CYCLE_O, CYCLE_V};
- enum {PENALIZATION_TICHONOV, PENALIZATION_CHARBONNIER, PENALIZATION_PERONA_MALIK};
-
- //! the default constructor
- CV_WRAP StereoVar();
-
- //! the full constructor taking all the necessary algorithm parameters
- CV_WRAP StereoVar(int levels, double pyrScale, int nIt, int minDisp, int maxDisp, int poly_n, double poly_sigma, float fi, float lambda, int penalization, int cycle, int flags);
-
- //! the destructor
- virtual ~StereoVar();
-
- //! the stereo correspondence operator that computes disparity map for the specified rectified stereo pair
- CV_WRAP_AS(compute) virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
-
- CV_PROP_RW int levels;
- CV_PROP_RW double pyrScale;
- CV_PROP_RW int nIt;
- CV_PROP_RW int minDisp;
- CV_PROP_RW int maxDisp;
- CV_PROP_RW int poly_n;
- CV_PROP_RW double poly_sigma;
- CV_PROP_RW float fi;
- CV_PROP_RW float lambda;
- CV_PROP_RW int penalization;
- CV_PROP_RW int cycle;
- CV_PROP_RW int flags;
-
- private:
- void autoParams();
- void FMG(Mat &I1, Mat &I2, Mat &I2x, Mat &u, int level);
- void VCycle_MyFAS(Mat &I1_h, Mat &I2_h, Mat &I2x_h, Mat &u_h, int level);
- void VariationalSolver(Mat &I1_h, Mat &I2_h, Mat &I2x_h, Mat &u_h, int level);
- };
-
- CV_EXPORTS void polyfit(const Mat& srcx, const Mat& srcy, Mat& dst, int order);
-}
-
-
-#endif
-
-#endif
-
diff --git a/OpenCV-2.3.1/include/opencv2/core/eigen.hpp b/OpenCV-2.3.1/include/opencv2/core/eigen.hpp
deleted file mode 100644
index 505652f..0000000
--- a/OpenCV-2.3.1/include/opencv2/core/eigen.hpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*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.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 __OPENCV_CORE_EIGEN_HPP__
-#define __OPENCV_CORE_EIGEN_HPP__
-
-#ifdef __cplusplus
-
-#include "cxcore.h"
-
-namespace cv
-{
-
-template
-void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
-{
- if( !(src.Flags & Eigen::RowMajorBit) )
- {
- Mat _src(src.cols(), src.rows(), DataType<_Tp>::type,
- (void*)src.data(), src.stride()*sizeof(_Tp));
- transpose(_src, dst);
- }
- else
- {
- Mat _src(src.rows(), src.cols(), DataType<_Tp>::type,
- (void*)src.data(), src.stride()*sizeof(_Tp));
- _src.copyTo(dst);
- }
-}
-
-template
-void cv2eigen( const Mat& src,
- Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
-{
- CV_DbgAssert(src.rows == _rows && src.cols == _cols);
- if( !(dst.Flags & Eigen::RowMajorBit) )
- {
- Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- if( src.type() == _dst.type() )
- transpose(src, _dst);
- else if( src.cols == src.rows )
- {
- src.convertTo(_dst, _dst.type());
- transpose(_dst, _dst);
- }
- else
- Mat(src.t()).convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
- else
- {
- Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- src.convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
-}
-
-template
-void cv2eigen( const Mat& src,
- Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
-{
- dst.resize(src.rows, src.cols);
- if( !(dst.Flags & Eigen::RowMajorBit) )
- {
- Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- if( src.type() == _dst.type() )
- transpose(src, _dst);
- else if( src.cols == src.rows )
- {
- src.convertTo(_dst, _dst.type());
- transpose(_dst, _dst);
- }
- else
- Mat(src.t()).convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
- else
- {
- Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- src.convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
-}
-
-
-template
-void cv2eigen( const Mat& src,
- Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
-{
- CV_Assert(src.cols == 1);
- dst.resize(src.rows);
-
- if( !(dst.Flags & Eigen::RowMajorBit) )
- {
- Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- if( src.type() == _dst.type() )
- transpose(src, _dst);
- else
- Mat(src.t()).convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
- else
- {
- Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- src.convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
-}
-
-
-template
-void cv2eigen( const Mat& src,
- Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
-{
- CV_Assert(src.rows == 1);
- dst.resize(src.cols);
- if( !(dst.Flags & Eigen::RowMajorBit) )
- {
- Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- if( src.type() == _dst.type() )
- transpose(src, _dst);
- else
- Mat(src.t()).convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
- else
- {
- Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
- dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
- src.convertTo(_dst, _dst.type());
- CV_DbgAssert(_dst.data == (uchar*)dst.data());
- }
-}
-
-}
-
-#endif
-
-#endif
-
diff --git a/OpenCV-2.3.1/include/opencv2/core/types_c.h b/OpenCV-2.3.1/include/opencv2/core/types_c.h
deleted file mode 100644
index 68164fa..0000000
--- a/OpenCV-2.3.1/include/opencv2/core/types_c.h
+++ /dev/null
@@ -1,1875 +0,0 @@
-/*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.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 __OPENCV_CORE_TYPES_H__
-#define __OPENCV_CORE_TYPES_H__
-
-#if !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300
-#define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
-#endif
-
-
-#ifndef SKIP_INCLUDES
- #include
- #include
- #include
- #include
-
-#if !defined _MSC_VER && !defined __BORLANDC__
- #include
-#endif
-
- #if defined __ICL
- #define CV_ICC __ICL
- #elif defined __ICC
- #define CV_ICC __ICC
- #elif defined __ECL
- #define CV_ICC __ECL
- #elif defined __ECC
- #define CV_ICC __ECC
- #elif defined __INTEL_COMPILER
- #define CV_ICC __INTEL_COMPILER
- #endif
-
- #if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__)
- #if defined WIN32
- #include
- #endif
- #include
- #endif
-
- #if defined __BORLANDC__
- #include
- #else
- #include
- #endif
-
- #ifdef HAVE_IPL
- #ifndef __IPL_H__
- #if defined WIN32 || defined _WIN32
- #include
- #else
- #include
- #endif
- #endif
- #elif defined __IPL_H__
- #define HAVE_IPL
- #endif
-#endif // SKIP_INCLUDES
-
-#if defined WIN32 || defined _WIN32
- #define CV_CDECL __cdecl
- #define CV_STDCALL __stdcall
-#else
- #define CV_CDECL
- #define CV_STDCALL
-#endif
-
-#ifndef CV_EXTERN_C
- #ifdef __cplusplus
- #define CV_EXTERN_C extern "C"
- #define CV_DEFAULT(val) = val
- #else
- #define CV_EXTERN_C
- #define CV_DEFAULT(val)
- #endif
-#endif
-
-#ifndef CV_EXTERN_C_FUNCPTR
- #ifdef __cplusplus
- #define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
- #else
- #define CV_EXTERN_C_FUNCPTR(x) typedef x
- #endif
-#endif
-
-#ifndef CV_INLINE
-#if defined __cplusplus
- #define CV_INLINE inline
-#elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__
- #define CV_INLINE __inline
-#else
- #define CV_INLINE static
-#endif
-#endif /* CV_INLINE */
-
-#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
- #define CV_EXPORTS __declspec(dllexport)
-#else
- #define CV_EXPORTS
-#endif
-
-#ifndef CVAPI
- #define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
-#endif
-
-#if defined _MSC_VER || defined __BORLANDC__
-typedef __int64 int64;
-typedef unsigned __int64 uint64;
-#define CV_BIG_INT(n) n##I64
-#define CV_BIG_UINT(n) n##UI64
-#else
-typedef int64_t int64;
-typedef uint64_t uint64;
-#define CV_BIG_INT(n) n##LL
-#define CV_BIG_UINT(n) n##ULL
-#endif
-
-#ifndef HAVE_IPL
-typedef unsigned char uchar;
-typedef unsigned short ushort;
-#endif
-
-typedef signed char schar;
-
-/* special informative macros for wrapper generators */
-#define CV_CARRAY(counter)
-#define CV_CUSTOM_CARRAY(args)
-#define CV_EXPORTS_W CV_EXPORTS
-#define CV_EXPORTS_W_SIMPLE CV_EXPORTS
-#define CV_EXPORTS_AS(synonym) CV_EXPORTS
-#define CV_EXPORTS_W_MAP CV_EXPORTS
-#define CV_IN_OUT
-#define CV_OUT
-#define CV_PROP
-#define CV_PROP_RW
-#define CV_WRAP
-#define CV_WRAP_AS(synonym)
-#define CV_WRAP_DEFAULT(value)
-
-/* CvArr* is used to pass arbitrary
- * array-like data structures
- * into functions where the particular
- * array type is recognized at runtime:
- */
-typedef void CvArr;
-
-typedef union Cv32suf
-{
- int i;
- unsigned u;
- float f;
-}
-Cv32suf;
-
-typedef union Cv64suf
-{
- int64 i;
- uint64 u;
- double f;
-}
-Cv64suf;
-
-typedef int CVStatus;
-
-enum {
- CV_StsOk= 0, /* everithing is ok */
- CV_StsBackTrace= -1, /* pseudo error for back trace */
- CV_StsError= -2, /* unknown /unspecified error */
- CV_StsInternal= -3, /* internal error (bad state) */
- CV_StsNoMem= -4, /* insufficient memory */
- CV_StsBadArg= -5, /* function arg/param is bad */
- CV_StsBadFunc= -6, /* unsupported function */
- CV_StsNoConv= -7, /* iter. didn't converge */
- CV_StsAutoTrace= -8, /* tracing */
- CV_HeaderIsNull= -9, /* image header is NULL */
- CV_BadImageSize= -10, /* image size is invalid */
- CV_BadOffset= -11, /* offset is invalid */
- CV_BadDataPtr= -12, /**/
- CV_BadStep= -13, /**/
- CV_BadModelOrChSeq= -14, /**/
- CV_BadNumChannels= -15, /**/
- CV_BadNumChannel1U= -16, /**/
- CV_BadDepth= -17, /**/
- CV_BadAlphaChannel= -18, /**/
- CV_BadOrder= -19, /**/
- CV_BadOrigin= -20, /**/
- CV_BadAlign= -21, /**/
- CV_BadCallBack= -22, /**/
- CV_BadTileSize= -23, /**/
- CV_BadCOI= -24, /**/
- CV_BadROISize= -25, /**/
- CV_MaskIsTiled= -26, /**/
- CV_StsNullPtr= -27, /* null pointer */
- CV_StsVecLengthErr= -28, /* incorrect vector length */
- CV_StsFilterStructContentErr= -29, /* incorr. filter structure content */
- CV_StsKernelStructContentErr= -30, /* incorr. transform kernel content */
- CV_StsFilterOffsetErr= -31, /* incorrect filter ofset value */
- CV_StsBadSize= -201, /* the input/output structure size is incorrect */
- CV_StsDivByZero= -202, /* division by zero */
- CV_StsInplaceNotSupported= -203, /* in-place operation is not supported */
- CV_StsObjectNotFound= -204, /* request can't be completed */
- CV_StsUnmatchedFormats= -205, /* formats of input/output arrays differ */
- CV_StsBadFlag= -206, /* flag is wrong or not supported */
- CV_StsBadPoint= -207, /* bad CvPoint */
- CV_StsBadMask= -208, /* bad format of mask (neither 8uC1 nor 8sC1)*/
- CV_StsUnmatchedSizes= -209, /* sizes of input/output structures do not match */
- CV_StsUnsupportedFormat= -210, /* the data format/type is not supported by the function*/
- CV_StsOutOfRange= -211, /* some of parameters are out of range */
- CV_StsParseError= -212, /* invalid syntax/structure of the parsed file */
- CV_StsNotImplemented= -213, /* the requested function/feature is not implemented */
- CV_StsBadMemBlock= -214, /* an allocated block has been corrupted */
- CV_StsAssert= -215, /* assertion failed */
- CV_GpuNotSupported= -216,
- CV_GpuApiCallError= -217,
- CV_GpuNppCallError= -218,
- CV_GpuCufftCallError= -219
-};
-
-/****************************************************************************************\
-* Common macros and inline functions *
-\****************************************************************************************/
-
-#define CV_PI 3.1415926535897932384626433832795
-#define CV_LOG2 0.69314718055994530941723212145818
-
-#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
-
-#ifndef MIN
-#define MIN(a,b) ((a) > (b) ? (b) : (a))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#endif
-
-/* min & max without jumps */
-#define CV_IMIN(a, b) ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
-
-#define CV_IMAX(a, b) ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
-
-/* absolute value without jumps */
-#ifndef __cplusplus
-#define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
-#else
-#define CV_IABS(a) abs(a)
-#endif
-#define CV_CMP(a,b) (((a) > (b)) - ((a) < (b)))
-#define CV_SIGN(a) CV_CMP((a),0)
-
-CV_INLINE int cvRound( double value )
-{
-#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && !defined __APPLE__)
- __m128d t = _mm_set_sd( value );
- return _mm_cvtsd_si32(t);
-#elif defined _MSC_VER && defined _M_IX86
- int t;
- __asm
- {
- fld value;
- fistp t;
- }
- return t;
-#elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
- return (int)lrint(value);
-#else
- // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
- return (int)(value + (value >= 0 ? 0.5 : -0.5));
-#endif
-}
-
-
-CV_INLINE int cvFloor( double value )
-{
-#ifdef __GNUC__
- int i = (int)value;
- return i - (i > value);
-#elif defined _MSC_VER && defined _M_X64
- __m128d t = _mm_set_sd( value );
- int i = _mm_cvtsd_si32(t);
- return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
-#else
- int i = cvRound(value);
- Cv32suf diff;
- diff.f = (float)(value - i);
- return i - (diff.i < 0);
-#endif
-}
-
-
-CV_INLINE int cvCeil( double value )
-{
-#ifdef __GNUC__
- int i = (int)value;
- return i + (i < value);
-#elif defined _MSC_VER && defined _M_X64
- __m128d t = _mm_set_sd( value );
- int i = _mm_cvtsd_si32(t);
- return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
-#else
- int i = cvRound(value);
- Cv32suf diff;
- diff.f = (float)(i - value);
- return i + (diff.i < 0);
-#endif
-}
-
-#define cvInvSqrt(value) ((float)(1./sqrt(value)))
-#define cvSqrt(value) ((float)sqrt(value))
-
-CV_INLINE int cvIsNaN( double value )
-{
-#if 1/*defined _MSC_VER || defined __BORLANDC__
- return _isnan(value);
-#elif defined __GNUC__
- return isnan(value);
-#else*/
- Cv64suf ieee754;
- ieee754.f = value;
- return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
- ((unsigned)ieee754.u != 0) > 0x7ff00000;
-#endif
-}
-
-
-CV_INLINE int cvIsInf( double value )
-{
-#if 1/*defined _MSC_VER || defined __BORLANDC__
- return !_finite(value);
-#elif defined __GNUC__
- return isinf(value);
-#else*/
- Cv64suf ieee754;
- ieee754.f = value;
- return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
- (unsigned)ieee754.u == 0;
-#endif
-}
-
-
-/*************** Random number generation *******************/
-
-typedef uint64 CvRNG;
-
-#define CV_RNG_COEFF 4164903690U
-
-CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
-{
- CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
- return rng;
-}
-
-/* Return random 32-bit unsigned integer: */
-CV_INLINE unsigned cvRandInt( CvRNG* rng )
-{
- uint64 temp = *rng;
- temp = (uint64)(unsigned)temp*CV_RNG_COEFF + (temp >> 32);
- *rng = temp;
- return (unsigned)temp;
-}
-
-/* Returns random floating-point number between 0 and 1: */
-CV_INLINE double cvRandReal( CvRNG* rng )
-{
- return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
-}
-
-/****************************************************************************************\
-* Image type (IplImage) *
-\****************************************************************************************/
-
-#ifndef HAVE_IPL
-
-/*
- * The following definitions (until #endif)
- * is an extract from IPL headers.
- * Copyright (c) 1995 Intel Corporation.
- */
-#define IPL_DEPTH_SIGN 0x80000000
-
-#define IPL_DEPTH_1U 1
-#define IPL_DEPTH_8U 8
-#define IPL_DEPTH_16U 16
-#define IPL_DEPTH_32F 32
-
-#define IPL_DEPTH_8S (IPL_DEPTH_SIGN| 8)
-#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
-#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
-
-#define IPL_DATA_ORDER_PIXEL 0
-#define IPL_DATA_ORDER_PLANE 1
-
-#define IPL_ORIGIN_TL 0
-#define IPL_ORIGIN_BL 1
-
-#define IPL_ALIGN_4BYTES 4
-#define IPL_ALIGN_8BYTES 8
-#define IPL_ALIGN_16BYTES 16
-#define IPL_ALIGN_32BYTES 32
-
-#define IPL_ALIGN_DWORD IPL_ALIGN_4BYTES
-#define IPL_ALIGN_QWORD IPL_ALIGN_8BYTES
-
-#define IPL_BORDER_CONSTANT 0
-#define IPL_BORDER_REPLICATE 1
-#define IPL_BORDER_REFLECT 2
-#define IPL_BORDER_WRAP 3
-
-typedef struct _IplImage
-{
- int nSize; /* sizeof(IplImage) */
- int ID; /* version (=0)*/
- int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
- int alphaChannel; /* Ignored by OpenCV */
- int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
- IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */
- char colorModel[4]; /* Ignored by OpenCV */
- char channelSeq[4]; /* ditto */
- int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
- cvCreateImage can only create interleaved images */
- int origin; /* 0 - top-left origin,
- 1 - bottom-left origin (Windows bitmaps style). */
- int align; /* Alignment of image rows (4 or 8).
- OpenCV ignores it and uses widthStep instead. */
- int width; /* Image width in pixels. */
- int height; /* Image height in pixels. */
- struct _IplROI *roi; /* Image ROI. If NULL, the whole image is selected. */
- struct _IplImage *maskROI; /* Must be NULL. */
- void *imageId; /* " " */
- struct _IplTileInfo *tileInfo; /* " " */
- int imageSize; /* Image data size in bytes
- (==image->height*image->widthStep
- in case of interleaved data)*/
- char *imageData; /* Pointer to aligned image data. */
- int widthStep; /* Size of aligned image row in bytes. */
- int BorderMode[4]; /* Ignored by OpenCV. */
- int BorderConst[4]; /* Ditto. */
- char *imageDataOrigin; /* Pointer to very origin of image data
- (not necessarily aligned) -
- needed for correct deallocation */
-}
-IplImage;
-
-typedef struct _IplTileInfo IplTileInfo;
-
-typedef struct _IplROI
-{
- int coi; /* 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
- int xOffset;
- int yOffset;
- int width;
- int height;
-}
-IplROI;
-
-typedef struct _IplConvKernel
-{
- int nCols;
- int nRows;
- int anchorX;
- int anchorY;
- int *values;
- int nShiftR;
-}
-IplConvKernel;
-
-typedef struct _IplConvKernelFP
-{
- int nCols;
- int nRows;
- int anchorX;
- int anchorY;
- float *values;
-}
-IplConvKernelFP;
-
-#define IPL_IMAGE_HEADER 1
-#define IPL_IMAGE_DATA 2
-#define IPL_IMAGE_ROI 4
-
-#endif/*HAVE_IPL*/
-
-/* extra border mode */
-#define IPL_BORDER_REFLECT_101 4
-#define IPL_BORDER_TRANSPARENT 5
-
-#define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage))
-#define CV_TYPE_NAME_IMAGE "opencv-image"
-
-#define CV_IS_IMAGE_HDR(img) \
- ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage))
-
-#define CV_IS_IMAGE(img) \
- (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL)
-
-/* for storing double-precision
- floating point data in IplImage's */
-#define IPL_DEPTH_64F 64
-
-/* get reference to pixel at (col,row),
- for multi-channel images (col) should be multiplied by number of channels */
-#define CV_IMAGE_ELEM( image, elemtype, row, col ) \
- (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
-
-/****************************************************************************************\
-* Matrix type (CvMat) *
-\****************************************************************************************/
-
-#define CV_CN_MAX 512
-#define CV_CN_SHIFT 3
-#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
-
-#define CV_8U 0
-#define CV_8S 1
-#define CV_16U 2
-#define CV_16S 3
-#define CV_32S 4
-#define CV_32F 5
-#define CV_64F 6
-#define CV_USRTYPE1 7
-
-#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
-#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
-
-#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
-#define CV_MAKE_TYPE CV_MAKETYPE
-
-#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
-#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
-#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
-#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
-#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
-
-#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
-#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
-#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
-#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
-#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
-
-#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
-#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
-#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
-#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
-#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
-
-#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
-#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
-#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
-#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
-#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
-
-#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
-#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
-#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
-#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
-#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
-
-#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
-#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
-#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
-#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
-#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
-
-#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
-#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
-#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
-#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
-#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
-
-#define CV_AUTO_STEP 0x7fffffff
-#define CV_WHOLE_ARR cvSlice( 0, 0x3fffffff )
-
-#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
-#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
-#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
-#define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
-#define CV_MAT_CONT_FLAG_SHIFT 14
-#define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
-#define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG)
-#define CV_IS_CONT_MAT CV_IS_MAT_CONT
-#define CV_SUBMAT_FLAG_SHIFT 15
-#define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
-#define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG)
-
-#define CV_MAGIC_MASK 0xFFFF0000
-#define CV_MAT_MAGIC_VAL 0x42420000
-#define CV_TYPE_NAME_MAT "opencv-matrix"
-
-typedef struct CvMat
-{
- int type;
- int step;
-
- /* for internal use only */
- int* refcount;
- int hdr_refcount;
-
- union
- {
- uchar* ptr;
- short* s;
- int* i;
- float* fl;
- double* db;
- } data;
-
-#ifdef __cplusplus
- union
- {
- int rows;
- int height;
- };
-
- union
- {
- int cols;
- int width;
- };
-#else
- int rows;
- int cols;
-#endif
-
-}
-CvMat;
-
-
-#define CV_IS_MAT_HDR(mat) \
- ((mat) != NULL && \
- (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
- ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
-
-#define CV_IS_MAT_HDR_Z(mat) \
- ((mat) != NULL && \
- (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
- ((const CvMat*)(mat))->cols >= 0 && ((const CvMat*)(mat))->rows >= 0)
-
-#define CV_IS_MAT(mat) \
- (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
-
-#define CV_IS_MASK_ARR(mat) \
- (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
-
-#define CV_ARE_TYPES_EQ(mat1, mat2) \
- ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
-
-#define CV_ARE_CNS_EQ(mat1, mat2) \
- ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
-
-#define CV_ARE_DEPTHS_EQ(mat1, mat2) \
- ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
-
-#define CV_ARE_SIZES_EQ(mat1, mat2) \
- ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
-
-#define CV_IS_MAT_CONST(mat) \
- (((mat)->rows|(mat)->cols) == 1)
-
-/* Size of each channel item,
- 0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
-#define CV_ELEM_SIZE1(type) \
- ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
-
-/* 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
-#define CV_ELEM_SIZE(type) \
- (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
-
-#define IPL2CV_DEPTH(depth) \
- ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
- (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
- (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
-
-/* Inline constructor. No data is allocated internally!!!
- * (Use together with cvCreateData, or use cvCreateMat instead to
- * get a matrix with allocated data):
- */
-CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
-{
- CvMat m;
-
- assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
- type = CV_MAT_TYPE(type);
- m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
- m.cols = cols;
- m.rows = rows;
- m.step = m.cols*CV_ELEM_SIZE(type);
- m.data.ptr = (uchar*)data;
- m.refcount = NULL;
- m.hdr_refcount = 0;
-
- return m;
-}
-
-
-#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
- (assert( (unsigned)(row) < (unsigned)(mat).rows && \
- (unsigned)(col) < (unsigned)(mat).cols ), \
- (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
-
-#define CV_MAT_ELEM_PTR( mat, row, col ) \
- CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
-
-#define CV_MAT_ELEM( mat, elemtype, row, col ) \
- (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
-
-
-CV_INLINE double cvmGet( const CvMat* mat, int row, int col )
-{
- int type;
-
- type = CV_MAT_TYPE(mat->type);
- assert( (unsigned)row < (unsigned)mat->rows &&
- (unsigned)col < (unsigned)mat->cols );
-
- if( type == CV_32FC1 )
- return ((float*)(mat->data.ptr + (size_t)mat->step*row))[col];
- else
- {
- assert( type == CV_64FC1 );
- return ((double*)(mat->data.ptr + (size_t)mat->step*row))[col];
- }
-}
-
-
-CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value )
-{
- int type;
- type = CV_MAT_TYPE(mat->type);
- assert( (unsigned)row < (unsigned)mat->rows &&
- (unsigned)col < (unsigned)mat->cols );
-
- if( type == CV_32FC1 )
- ((float*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
- else
- {
- assert( type == CV_64FC1 );
- ((double*)(mat->data.ptr + (size_t)mat->step*row))[col] = (double)value;
- }
-}
-
-
-CV_INLINE int cvIplDepth( int type )
-{
- int depth = CV_MAT_DEPTH(type);
- return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
- depth == CV_32S ? IPL_DEPTH_SIGN : 0);
-}
-
-
-/****************************************************************************************\
-* Multi-dimensional dense array (CvMatND) *
-\****************************************************************************************/
-
-#define CV_MATND_MAGIC_VAL 0x42430000
-#define CV_TYPE_NAME_MATND "opencv-nd-matrix"
-
-#define CV_MAX_DIM 32
-#define CV_MAX_DIM_HEAP 1024
-
-typedef struct CvMatND
-{
- int type;
- int dims;
-
- int* refcount;
- int hdr_refcount;
-
- union
- {
- uchar* ptr;
- float* fl;
- double* db;
- int* i;
- short* s;
- } data;
-
- struct
- {
- int size;
- int step;
- }
- dim[CV_MAX_DIM];
-}
-CvMatND;
-
-#define CV_IS_MATND_HDR(mat) \
- ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
-
-#define CV_IS_MATND(mat) \
- (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
-
-
-/****************************************************************************************\
-* Multi-dimensional sparse array (CvSparseMat) *
-\****************************************************************************************/
-
-#define CV_SPARSE_MAT_MAGIC_VAL 0x42440000
-#define CV_TYPE_NAME_SPARSE_MAT "opencv-sparse-matrix"
-
-struct CvSet;
-
-typedef struct CvSparseMat
-{
- int type;
- int dims;
- int* refcount;
- int hdr_refcount;
-
- struct CvSet* heap;
- void** hashtable;
- int hashsize;
- int valoffset;
- int idxoffset;
- int size[CV_MAX_DIM];
-}
-CvSparseMat;
-
-#define CV_IS_SPARSE_MAT_HDR(mat) \
- ((mat) != NULL && \
- (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
-
-#define CV_IS_SPARSE_MAT(mat) \
- CV_IS_SPARSE_MAT_HDR(mat)
-
-/**************** iteration through a sparse array *****************/
-
-typedef struct CvSparseNode
-{
- unsigned hashval;
- struct CvSparseNode* next;
-}
-CvSparseNode;
-
-typedef struct CvSparseMatIterator
-{
- CvSparseMat* mat;
- CvSparseNode* node;
- int curidx;
-}
-CvSparseMatIterator;
-
-#define CV_NODE_VAL(mat,node) ((void*)((uchar*)(node) + (mat)->valoffset))
-#define CV_NODE_IDX(mat,node) ((int*)((uchar*)(node) + (mat)->idxoffset))
-
-/****************************************************************************************\
-* Histogram *
-\****************************************************************************************/
-
-typedef int CvHistType;
-
-#define CV_HIST_MAGIC_VAL 0x42450000
-#define CV_HIST_UNIFORM_FLAG (1 << 10)
-
-/* indicates whether bin ranges are set already or not */
-#define CV_HIST_RANGES_FLAG (1 << 11)
-
-#define CV_HIST_ARRAY 0
-#define CV_HIST_SPARSE 1
-#define CV_HIST_TREE CV_HIST_SPARSE
-
-/* should be used as a parameter only,
- it turns to CV_HIST_UNIFORM_FLAG of hist->type */
-#define CV_HIST_UNIFORM 1
-
-typedef struct CvHistogram
-{
- int type;
- CvArr* bins;
- float thresh[CV_MAX_DIM][2]; /* For uniform histograms. */
- float** thresh2; /* For non-uniform histograms. */
- CvMatND mat; /* Embedded matrix header for array histograms. */
-}
-CvHistogram;
-
-#define CV_IS_HIST( hist ) \
- ((hist) != NULL && \
- (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
- (hist)->bins != NULL)
-
-#define CV_IS_UNIFORM_HIST( hist ) \
- (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
-
-#define CV_IS_SPARSE_HIST( hist ) \
- CV_IS_SPARSE_MAT((hist)->bins)
-
-#define CV_HIST_HAS_RANGES( hist ) \
- (((hist)->type & CV_HIST_RANGES_FLAG) != 0)
-
-/****************************************************************************************\
-* Other supplementary data type definitions *
-\****************************************************************************************/
-
-/*************************************** CvRect *****************************************/
-
-typedef struct CvRect
-{
- int x;
- int y;
- int width;
- int height;
-}
-CvRect;
-
-CV_INLINE CvRect cvRect( int x, int y, int width, int height )
-{
- CvRect r;
-
- r.x = x;
- r.y = y;
- r.width = width;
- r.height = height;
-
- return r;
-}
-
-
-CV_INLINE IplROI cvRectToROI( CvRect rect, int coi )
-{
- IplROI roi;
- roi.xOffset = rect.x;
- roi.yOffset = rect.y;
- roi.width = rect.width;
- roi.height = rect.height;
- roi.coi = coi;
-
- return roi;
-}
-
-
-CV_INLINE CvRect cvROIToRect( IplROI roi )
-{
- return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
-}
-
-/*********************************** CvTermCriteria *************************************/
-
-#define CV_TERMCRIT_ITER 1
-#define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER
-#define CV_TERMCRIT_EPS 2
-
-typedef struct CvTermCriteria
-{
- int type; /* may be combination of
- CV_TERMCRIT_ITER
- CV_TERMCRIT_EPS */
- int max_iter;
- double epsilon;
-}
-CvTermCriteria;
-
-CV_INLINE CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon )
-{
- CvTermCriteria t;
-
- t.type = type;
- t.max_iter = max_iter;
- t.epsilon = (float)epsilon;
-
- return t;
-}
-
-
-/******************************* CvPoint and variants ***********************************/
-
-typedef struct CvPoint
-{
- int x;
- int y;
-}
-CvPoint;
-
-
-CV_INLINE CvPoint cvPoint( int x, int y )
-{
- CvPoint p;
-
- p.x = x;
- p.y = y;
-
- return p;
-}
-
-
-typedef struct CvPoint2D32f
-{
- float x;
- float y;
-}
-CvPoint2D32f;
-
-
-CV_INLINE CvPoint2D32f cvPoint2D32f( double x, double y )
-{
- CvPoint2D32f p;
-
- p.x = (float)x;
- p.y = (float)y;
-
- return p;
-}
-
-
-CV_INLINE CvPoint2D32f cvPointTo32f( CvPoint point )
-{
- return cvPoint2D32f( (float)point.x, (float)point.y );
-}
-
-
-CV_INLINE CvPoint cvPointFrom32f( CvPoint2D32f point )
-{
- CvPoint ipt;
- ipt.x = cvRound(point.x);
- ipt.y = cvRound(point.y);
-
- return ipt;
-}
-
-
-typedef struct CvPoint3D32f
-{
- float x;
- float y;
- float z;
-}
-CvPoint3D32f;
-
-
-CV_INLINE CvPoint3D32f cvPoint3D32f( double x, double y, double z )
-{
- CvPoint3D32f p;
-
- p.x = (float)x;
- p.y = (float)y;
- p.z = (float)z;
-
- return p;
-}
-
-
-typedef struct CvPoint2D64f
-{
- double x;
- double y;
-}
-CvPoint2D64f;
-
-
-CV_INLINE CvPoint2D64f cvPoint2D64f( double x, double y )
-{
- CvPoint2D64f p;
-
- p.x = x;
- p.y = y;
-
- return p;
-}
-
-
-typedef struct CvPoint3D64f
-{
- double x;
- double y;
- double z;
-}
-CvPoint3D64f;
-
-
-CV_INLINE CvPoint3D64f cvPoint3D64f( double x, double y, double z )
-{
- CvPoint3D64f p;
-
- p.x = x;
- p.y = y;
- p.z = z;
-
- return p;
-}
-
-
-/******************************** CvSize's & CvBox **************************************/
-
-typedef struct
-{
- int width;
- int height;
-}
-CvSize;
-
-CV_INLINE CvSize cvSize( int width, int height )
-{
- CvSize s;
-
- s.width = width;
- s.height = height;
-
- return s;
-}
-
-typedef struct CvSize2D32f
-{
- float width;
- float height;
-}
-CvSize2D32f;
-
-
-CV_INLINE CvSize2D32f cvSize2D32f( double width, double height )
-{
- CvSize2D32f s;
-
- s.width = (float)width;
- s.height = (float)height;
-
- return s;
-}
-
-typedef struct CvBox2D
-{
- CvPoint2D32f center; /* Center of the box. */
- CvSize2D32f size; /* Box width and length. */
- float angle; /* Angle between the horizontal axis */
- /* and the first side (i.e. length) in degrees */
-}
-CvBox2D;
-
-
-/* Line iterator state: */
-typedef struct CvLineIterator
-{
- /* Pointer to the current point: */
- uchar* ptr;
-
- /* Bresenham algorithm state: */
- int err;
- int plus_delta;
- int minus_delta;
- int plus_step;
- int minus_step;
-}
-CvLineIterator;
-
-
-
-/************************************* CvSlice ******************************************/
-
-typedef struct CvSlice
-{
- int start_index, end_index;
-}
-CvSlice;
-
-CV_INLINE CvSlice cvSlice( int start, int end )
-{
- CvSlice slice;
- slice.start_index = start;
- slice.end_index = end;
-
- return slice;
-}
-
-#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
-#define CV_WHOLE_SEQ cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
-
-
-/************************************* CvScalar *****************************************/
-
-typedef struct CvScalar
-{
- double val[4];
-}
-CvScalar;
-
-CV_INLINE CvScalar cvScalar( double val0, double val1 CV_DEFAULT(0),
- double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
-{
- CvScalar scalar;
- scalar.val[0] = val0; scalar.val[1] = val1;
- scalar.val[2] = val2; scalar.val[3] = val3;
- return scalar;
-}
-
-
-CV_INLINE CvScalar cvRealScalar( double val0 )
-{
- CvScalar scalar;
- scalar.val[0] = val0;
- scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
- return scalar;
-}
-
-CV_INLINE CvScalar cvScalarAll( double val0123 )
-{
- CvScalar scalar;
- scalar.val[0] = val0123;
- scalar.val[1] = val0123;
- scalar.val[2] = val0123;
- scalar.val[3] = val0123;
- return scalar;
-}
-
-/****************************************************************************************\
-* Dynamic Data structures *
-\****************************************************************************************/
-
-/******************************** Memory storage ****************************************/
-
-typedef struct CvMemBlock
-{
- struct CvMemBlock* prev;
- struct CvMemBlock* next;
-}
-CvMemBlock;
-
-#define CV_STORAGE_MAGIC_VAL 0x42890000
-
-typedef struct CvMemStorage
-{
- int signature;
- CvMemBlock* bottom; /* First allocated block. */
- CvMemBlock* top; /* Current memory block - top of the stack. */
- struct CvMemStorage* parent; /* We get new blocks from parent as needed. */
- int block_size; /* Block size. */
- int free_space; /* Remaining free space in current block. */
-}
-CvMemStorage;
-
-#define CV_IS_STORAGE(storage) \
- ((storage) != NULL && \
- (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL)
-
-
-typedef struct CvMemStoragePos
-{
- CvMemBlock* top;
- int free_space;
-}
-CvMemStoragePos;
-
-
-/*********************************** Sequence *******************************************/
-
-typedef struct CvSeqBlock
-{
- struct CvSeqBlock* prev; /* Previous sequence block. */
- struct CvSeqBlock* next; /* Next sequence block. */
- int start_index; /* Index of the first element in the block + */
- /* sequence->first->start_index. */
- int count; /* Number of elements in the block. */
- schar* data; /* Pointer to the first element of the block. */
-}
-CvSeqBlock;
-
-
-#define CV_TREE_NODE_FIELDS(node_type) \
- int flags; /* Miscellaneous flags. */ \
- int header_size; /* Size of sequence header. */ \
- struct node_type* h_prev; /* Previous sequence. */ \
- struct node_type* h_next; /* Next sequence. */ \
- struct node_type* v_prev; /* 2nd previous sequence. */ \
- struct node_type* v_next /* 2nd next sequence. */
-
-/*
- Read/Write sequence.
- Elements can be dynamically inserted to or deleted from the sequence.
-*/
-#define CV_SEQUENCE_FIELDS() \
- CV_TREE_NODE_FIELDS(CvSeq); \
- int total; /* Total number of elements. */ \
- int elem_size; /* Size of sequence element in bytes. */ \
- schar* block_max; /* Maximal bound of the last block. */ \
- schar* ptr; /* Current write pointer. */ \
- int delta_elems; /* Grow seq this many at a time. */ \
- CvMemStorage* storage; /* Where the seq is stored. */ \
- CvSeqBlock* free_blocks; /* Free blocks list. */ \
- CvSeqBlock* first; /* Pointer to the first sequence block. */
-
-typedef struct CvSeq
-{
- CV_SEQUENCE_FIELDS()
-}
-CvSeq;
-
-#define CV_TYPE_NAME_SEQ "opencv-sequence"
-#define CV_TYPE_NAME_SEQ_TREE "opencv-sequence-tree"
-
-/*************************************** Set ********************************************/
-/*
- Set.
- Order is not preserved. There can be gaps between sequence elements.
- After the element has been inserted it stays in the same place all the time.
- The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
-*/
-#define CV_SET_ELEM_FIELDS(elem_type) \
- int flags; \
- struct elem_type* next_free;
-
-typedef struct CvSetElem
-{
- CV_SET_ELEM_FIELDS(CvSetElem)
-}
-CvSetElem;
-
-#define CV_SET_FIELDS() \
- CV_SEQUENCE_FIELDS() \
- CvSetElem* free_elems; \
- int active_count;
-
-typedef struct CvSet
-{
- CV_SET_FIELDS()
-}
-CvSet;
-
-
-#define CV_SET_ELEM_IDX_MASK ((1 << 26) - 1)
-#define CV_SET_ELEM_FREE_FLAG (1 << (sizeof(int)*8-1))
-
-/* Checks whether the element pointed by ptr belongs to a set or not */
-#define CV_IS_SET_ELEM( ptr ) (((CvSetElem*)(ptr))->flags >= 0)
-
-/************************************* Graph ********************************************/
-
-/*
- We represent a graph as a set of vertices.
- Vertices contain their adjacency lists (more exactly, pointers to first incoming or
- outcoming edge (or 0 if isolated vertex)). Edges are stored in another set.
- There is a singly-linked list of incoming/outcoming edges for each vertex.
-
- Each edge consists of
-
- o Two pointers to the starting and ending vertices
- (vtx[0] and vtx[1] respectively).
-
- A graph may be oriented or not. In the latter case, edges between
- vertex i to vertex j are not distinguished during search operations.
-
- o Two pointers to next edges for the starting and ending vertices, where
- next[0] points to the next edge in the vtx[0] adjacency list and
- next[1] points to the next edge in the vtx[1] adjacency list.
-*/
-#define CV_GRAPH_EDGE_FIELDS() \
- int flags; \
- float weight; \
- struct CvGraphEdge* next[2]; \
- struct CvGraphVtx* vtx[2];
-
-
-#define CV_GRAPH_VERTEX_FIELDS() \
- int flags; \
- struct CvGraphEdge* first;
-
-
-typedef struct CvGraphEdge
-{
- CV_GRAPH_EDGE_FIELDS()
-}
-CvGraphEdge;
-
-typedef struct CvGraphVtx
-{
- CV_GRAPH_VERTEX_FIELDS()
-}
-CvGraphVtx;
-
-typedef struct CvGraphVtx2D
-{
- CV_GRAPH_VERTEX_FIELDS()
- CvPoint2D32f* ptr;
-}
-CvGraphVtx2D;
-
-/*
- Graph is "derived" from the set (this is set a of vertices)
- and includes another set (edges)
-*/
-#define CV_GRAPH_FIELDS() \
- CV_SET_FIELDS() \
- CvSet* edges;
-
-typedef struct CvGraph
-{
- CV_GRAPH_FIELDS()
-}
-CvGraph;
-
-#define CV_TYPE_NAME_GRAPH "opencv-graph"
-
-/*********************************** Chain/Countour *************************************/
-
-typedef struct CvChain
-{
- CV_SEQUENCE_FIELDS()
- CvPoint origin;
-}
-CvChain;
-
-#define CV_CONTOUR_FIELDS() \
- CV_SEQUENCE_FIELDS() \
- CvRect rect; \
- int color; \
- int reserved[3];
-
-typedef struct CvContour
-{
- CV_CONTOUR_FIELDS()
-}
-CvContour;
-
-typedef CvContour CvPoint2DSeq;
-
-/****************************************************************************************\
-* Sequence types *
-\****************************************************************************************/
-
-#define CV_SEQ_MAGIC_VAL 0x42990000
-
-#define CV_IS_SEQ(seq) \
- ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL)
-
-#define CV_SET_MAGIC_VAL 0x42980000
-#define CV_IS_SET(set) \
- ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL)
-
-#define CV_SEQ_ELTYPE_BITS 12
-#define CV_SEQ_ELTYPE_MASK ((1 << CV_SEQ_ELTYPE_BITS) - 1)
-
-#define CV_SEQ_ELTYPE_POINT CV_32SC2 /* (x,y) */
-#define CV_SEQ_ELTYPE_CODE CV_8UC1 /* freeman code: 0..7 */
-#define CV_SEQ_ELTYPE_GENERIC 0
-#define CV_SEQ_ELTYPE_PTR CV_USRTYPE1
-#define CV_SEQ_ELTYPE_PPOINT CV_SEQ_ELTYPE_PTR /* &(x,y) */
-#define CV_SEQ_ELTYPE_INDEX CV_32SC1 /* #(x,y) */
-#define CV_SEQ_ELTYPE_GRAPH_EDGE 0 /* &next_o, &next_d, &vtx_o, &vtx_d */
-#define CV_SEQ_ELTYPE_GRAPH_VERTEX 0 /* first_edge, &(x,y) */
-#define CV_SEQ_ELTYPE_TRIAN_ATR 0 /* vertex of the binary tree */
-#define CV_SEQ_ELTYPE_CONNECTED_COMP 0 /* connected component */
-#define CV_SEQ_ELTYPE_POINT3D CV_32FC3 /* (x,y,z) */
-
-#define CV_SEQ_KIND_BITS 2
-#define CV_SEQ_KIND_MASK (((1 << CV_SEQ_KIND_BITS) - 1)<flags & CV_SEQ_ELTYPE_MASK)
-#define CV_SEQ_KIND( seq ) ((seq)->flags & CV_SEQ_KIND_MASK )
-
-/* flag checking */
-#define CV_IS_SEQ_INDEX( seq ) ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \
- (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC))
-
-#define CV_IS_SEQ_CURVE( seq ) (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE)
-#define CV_IS_SEQ_CLOSED( seq ) (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0)
-#define CV_IS_SEQ_CONVEX( seq ) 0
-#define CV_IS_SEQ_HOLE( seq ) (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0)
-#define CV_IS_SEQ_SIMPLE( seq ) 1
-
-/* type checking macros */
-#define CV_IS_SEQ_POINT_SET( seq ) \
- ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2))
-
-#define CV_IS_SEQ_POINT_SUBSET( seq ) \
- (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT)
-
-#define CV_IS_SEQ_POLYLINE( seq ) \
- (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq))
-
-#define CV_IS_SEQ_POLYGON( seq ) \
- (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq))
-
-#define CV_IS_SEQ_CHAIN( seq ) \
- (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1)
-
-#define CV_IS_SEQ_CONTOUR( seq ) \
- (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq)))
-
-#define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \
- (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq ))
-
-#define CV_IS_SEQ_POLYGON_TREE( seq ) \
- (CV_SEQ_ELTYPE (seq) == CV_SEQ_ELTYPE_TRIAN_ATR && \
- CV_SEQ_KIND( seq ) == CV_SEQ_KIND_BIN_TREE )
-
-#define CV_IS_GRAPH( seq ) \
- (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH)
-
-#define CV_IS_GRAPH_ORIENTED( seq ) \
- (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0)
-
-#define CV_IS_SUBDIV2D( seq ) \
- (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D)
-
-/****************************************************************************************/
-/* Sequence writer & reader */
-/****************************************************************************************/
-
-#define CV_SEQ_WRITER_FIELDS() \
- int header_size; \
- CvSeq* seq; /* the sequence written */ \
- CvSeqBlock* block; /* current block */ \
- schar* ptr; /* pointer to free space */ \
- schar* block_min; /* pointer to the beginning of block*/\
- schar* block_max; /* pointer to the end of block */
-
-typedef struct CvSeqWriter
-{
- CV_SEQ_WRITER_FIELDS()
-}
-CvSeqWriter;
-
-
-#define CV_SEQ_READER_FIELDS() \
- int header_size; \
- CvSeq* seq; /* sequence, beign read */ \
- CvSeqBlock* block; /* current block */ \
- schar* ptr; /* pointer to element be read next */ \
- schar* block_min; /* pointer to the beginning of block */\
- schar* block_max; /* pointer to the end of block */ \
- int delta_index;/* = seq->first->start_index */ \
- schar* prev_elem; /* pointer to previous element */
-
-
-typedef struct CvSeqReader
-{
- CV_SEQ_READER_FIELDS()
-}
-CvSeqReader;
-
-/****************************************************************************************/
-/* Operations on sequences */
-/****************************************************************************************/
-
-#define CV_SEQ_ELEM( seq, elem_type, index ) \
-/* assert gives some guarantee that parameter is valid */ \
-( assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && \
- (seq)->elem_size == sizeof(elem_type)), \
- (elem_type*)((seq)->first && (unsigned)index < \
- (unsigned)((seq)->first->count) ? \
- (seq)->first->data + (index) * sizeof(elem_type) : \
- cvGetSeqElem( (CvSeq*)(seq), (index) )))
-#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
-
-/* Add element to sequence: */
-#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer ) \
-{ \
- if( (writer).ptr >= (writer).block_max ) \
- { \
- cvCreateSeqBlock( &writer); \
- } \
- memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\
- (writer).ptr += (writer).seq->elem_size; \
-}
-
-#define CV_WRITE_SEQ_ELEM( elem, writer ) \
-{ \
- assert( (writer).seq->elem_size == sizeof(elem)); \
- if( (writer).ptr >= (writer).block_max ) \
- { \
- cvCreateSeqBlock( &writer); \
- } \
- assert( (writer).ptr <= (writer).block_max - sizeof(elem));\
- memcpy((writer).ptr, &(elem), sizeof(elem)); \
- (writer).ptr += sizeof(elem); \
-}
-
-
-/* Move reader position forward: */
-#define CV_NEXT_SEQ_ELEM( elem_size, reader ) \
-{ \
- if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
- { \
- cvChangeSeqBlock( &(reader), 1 ); \
- } \
-}
-
-
-/* Move reader position backward: */
-#define CV_PREV_SEQ_ELEM( elem_size, reader ) \
-{ \
- if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
- { \
- cvChangeSeqBlock( &(reader), -1 ); \
- } \
-}
-
-/* Read element and move read position forward: */
-#define CV_READ_SEQ_ELEM( elem, reader ) \
-{ \
- assert( (reader).seq->elem_size == sizeof(elem)); \
- memcpy( &(elem), (reader).ptr, sizeof((elem))); \
- CV_NEXT_SEQ_ELEM( sizeof(elem), reader ) \
-}
-
-/* Read element and move read position backward: */
-#define CV_REV_READ_SEQ_ELEM( elem, reader ) \
-{ \
- assert( (reader).seq->elem_size == sizeof(elem)); \
- memcpy(&(elem), (reader).ptr, sizeof((elem))); \
- CV_PREV_SEQ_ELEM( sizeof(elem), reader ) \
-}
-
-
-#define CV_READ_CHAIN_POINT( _pt, reader ) \
-{ \
- (_pt) = (reader).pt; \
- if( (reader).ptr ) \
- { \
- CV_READ_SEQ_ELEM( (reader).code, (reader)); \
- assert( ((reader).code & ~7) == 0 ); \
- (reader).pt.x += (reader).deltas[(int)(reader).code][0]; \
- (reader).pt.y += (reader).deltas[(int)(reader).code][1]; \
- } \
-}
-
-#define CV_CURRENT_POINT( reader ) (*((CvPoint*)((reader).ptr)))
-#define CV_PREV_POINT( reader ) (*((CvPoint*)((reader).prev_elem)))
-
-#define CV_READ_EDGE( pt1, pt2, reader ) \
-{ \
- assert( sizeof(pt1) == sizeof(CvPoint) && \
- sizeof(pt2) == sizeof(CvPoint) && \
- reader.seq->elem_size == sizeof(CvPoint)); \
- (pt1) = CV_PREV_POINT( reader ); \
- (pt2) = CV_CURRENT_POINT( reader ); \
- (reader).prev_elem = (reader).ptr; \
- CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader)); \
-}
-
-/************ Graph macros ************/
-
-/* Return next graph edge for given vertex: */
-#define CV_NEXT_GRAPH_EDGE( edge, vertex ) \
- (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)), \
- (edge)->next[(edge)->vtx[1] == (vertex)])
-
-
-
-/****************************************************************************************\
-* Data structures for persistence (a.k.a serialization) functionality *
-\****************************************************************************************/
-
-/* "black box" file storage */
-typedef struct CvFileStorage CvFileStorage;
-
-/* Storage flags: */
-#define CV_STORAGE_READ 0
-#define CV_STORAGE_WRITE 1
-#define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE
-#define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE
-#define CV_STORAGE_APPEND 2
-
-/* List of attributes: */
-typedef struct CvAttrList
-{
- const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs. */
- struct CvAttrList* next; /* Pointer to next chunk of the attributes list. */
-}
-CvAttrList;
-
-CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
- CvAttrList* next CV_DEFAULT(NULL) )
-{
- CvAttrList l;
- l.attr = attr;
- l.next = next;
-
- return l;
-}
-
-struct CvTypeInfo;
-
-#define CV_NODE_NONE 0
-#define CV_NODE_INT 1
-#define CV_NODE_INTEGER CV_NODE_INT
-#define CV_NODE_REAL 2
-#define CV_NODE_FLOAT CV_NODE_REAL
-#define CV_NODE_STR 3
-#define CV_NODE_STRING CV_NODE_STR
-#define CV_NODE_REF 4 /* not used */
-#define CV_NODE_SEQ 5
-#define CV_NODE_MAP 6
-#define CV_NODE_TYPE_MASK 7
-
-#define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK)
-
-/* file node flags */
-#define CV_NODE_FLOW 8 /* Used only for writing structures in YAML format. */
-#define CV_NODE_USER 16
-#define CV_NODE_EMPTY 32
-#define CV_NODE_NAMED 64
-
-#define CV_NODE_IS_INT(flags) (CV_NODE_TYPE(flags) == CV_NODE_INT)
-#define CV_NODE_IS_REAL(flags) (CV_NODE_TYPE(flags) == CV_NODE_REAL)
-#define CV_NODE_IS_STRING(flags) (CV_NODE_TYPE(flags) == CV_NODE_STRING)
-#define CV_NODE_IS_SEQ(flags) (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
-#define CV_NODE_IS_MAP(flags) (CV_NODE_TYPE(flags) == CV_NODE_MAP)
-#define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
-#define CV_NODE_IS_FLOW(flags) (((flags) & CV_NODE_FLOW) != 0)
-#define CV_NODE_IS_EMPTY(flags) (((flags) & CV_NODE_EMPTY) != 0)
-#define CV_NODE_IS_USER(flags) (((flags) & CV_NODE_USER) != 0)
-#define CV_NODE_HAS_NAME(flags) (((flags) & CV_NODE_NAMED) != 0)
-
-#define CV_NODE_SEQ_SIMPLE 256
-#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
-
-typedef struct CvString
-{
- int len;
- char* ptr;
-}
-CvString;
-
-/* All the keys (names) of elements in the readed file storage
- are stored in the hash to speed up the lookup operations: */
-typedef struct CvStringHashNode
-{
- unsigned hashval;
- CvString str;
- struct CvStringHashNode* next;
-}
-CvStringHashNode;
-
-typedef struct CvGenericHash CvFileNodeHash;
-
-/* Basic element of the file storage - scalar or collection: */
-typedef struct CvFileNode
-{
- int tag;
- struct CvTypeInfo* info; /* type information
- (only for user-defined object, for others it is 0) */
- union
- {
- double f; /* scalar floating-point number */
- int i; /* scalar integer number */
- CvString str; /* text string */
- CvSeq* seq; /* sequence (ordered collection of file nodes) */
- CvFileNodeHash* map; /* map (collection of named file nodes) */
- } data;
-}
-CvFileNode;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
-typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
-typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
-typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
- const void* struct_ptr, CvAttrList attributes );
-typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
-#ifdef __cplusplus
-}
-#endif
-
-typedef struct CvTypeInfo
-{
- int flags;
- int header_size;
- struct CvTypeInfo* prev;
- struct CvTypeInfo* next;
- const char* type_name;
- CvIsInstanceFunc is_instance;
- CvReleaseFunc release;
- CvReadFunc read;
- CvWriteFunc write;
- CvCloneFunc clone;
-}
-CvTypeInfo;
-
-
-/**** System data types ******/
-
-typedef struct CvPluginFuncInfo
-{
- void** func_addr;
- void* default_func_addr;
- const char* func_names;
- int search_modules;
- int loaded_from;
-}
-CvPluginFuncInfo;
-
-typedef struct CvModuleInfo
-{
- struct CvModuleInfo* next;
- const char* name;
- const char* version;
- CvPluginFuncInfo* func_tab;
-}
-CvModuleInfo;
-
-enum { CV_PARAM_TYPE_INT=0, CV_PARAM_TYPE_REAL=1, CV_PARAM_TYPE_STRING=2, CV_PARAM_TYPE_MAT=3 };
-
-#endif /*_CXCORE_TYPES_H_*/
-
-/* End of file. */
diff --git a/OpenCV-2.3.1/include/opencv2/features2d/features2d.hpp b/OpenCV-2.3.1/include/opencv2/features2d/features2d.hpp
deleted file mode 100644
index 6566472..0000000
--- a/OpenCV-2.3.1/include/opencv2/features2d/features2d.hpp
+++ /dev/null
@@ -1,3047 +0,0 @@
-/*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.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., 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 the copyright holders 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 __OPENCV_FEATURES_2D_HPP__
-#define __OPENCV_FEATURES_2D_HPP__
-
-#include "opencv2/core/core.hpp"
-#include "opencv2/flann/miniflann.hpp"
-
-#ifdef __cplusplus
-#include
-
-extern "C" {
-#endif
-
-typedef struct CvSURFPoint
-{
- CvPoint2D32f pt;
-
- int laplacian;
- int size;
- float dir;
- float hessian;
-
-} CvSURFPoint;
-
-CV_INLINE CvSURFPoint cvSURFPoint( CvPoint2D32f pt, int laplacian,
- int size, float dir CV_DEFAULT(0),
- float hessian CV_DEFAULT(0))
-{
- CvSURFPoint kp;
-
- kp.pt = pt;
- kp.laplacian = laplacian;
- kp.size = size;
- kp.dir = dir;
- kp.hessian = hessian;
-
- return kp;
-}
-
-typedef struct CvSURFParams
-{
- int extended;
- int upright;
- double hessianThreshold;
-
- int nOctaves;
- int nOctaveLayers;
-
-} CvSURFParams;
-
-CVAPI(CvSURFParams) cvSURFParams( double hessianThreshold, int extended CV_DEFAULT(0) );
-
-// If useProvidedKeyPts!=0, keypoints are not detected, but descriptors are computed
-// at the locations provided in keypoints (a CvSeq of CvSURFPoint).
-CVAPI(void) cvExtractSURF( const CvArr* img, const CvArr* mask,
- CvSeq** keypoints, CvSeq** descriptors,
- CvMemStorage* storage, CvSURFParams params, int useProvidedKeyPts CV_DEFAULT(0) );
-
-/*!
- Maximal Stable Regions Parameters
-*/
-typedef struct CvMSERParams
-{
- //! delta, in the code, it compares (size_{i}-size_{i-delta})/size_{i-delta}
- int delta;
- //! prune the area which bigger than maxArea
- int maxArea;
- //! prune the area which smaller than minArea
- int minArea;
- //! prune the area have simliar size to its children
- float maxVariation;
- //! trace back to cut off mser with diversity < min_diversity
- float minDiversity;
-
- /////// the next few params for MSER of color image
-
- //! for color image, the evolution steps
- int maxEvolution;
- //! the area threshold to cause re-initialize
- double areaThreshold;
- //! ignore too small margin
- double minMargin;
- //! the aperture size for edge blur
- int edgeBlurSize;
-} CvMSERParams;
-
-CVAPI(CvMSERParams) cvMSERParams( int delta CV_DEFAULT(5), int min_area CV_DEFAULT(60),
- int max_area CV_DEFAULT(14400), float max_variation CV_DEFAULT(.25f),
- float min_diversity CV_DEFAULT(.2f), int max_evolution CV_DEFAULT(200),
- double area_threshold CV_DEFAULT(1.01),
- double min_margin CV_DEFAULT(.003),
- int edge_blur_size CV_DEFAULT(5) );
-
-// Extracts the contours of Maximally Stable Extremal Regions
-CVAPI(void) cvExtractMSER( CvArr* _img, CvArr* _mask, CvSeq** contours, CvMemStorage* storage, CvMSERParams params );
-
-
-typedef struct CvStarKeypoint
-{
- CvPoint pt;
- int size;
- float response;
-} CvStarKeypoint;
-
-CV_INLINE CvStarKeypoint cvStarKeypoint(CvPoint pt, int size, float response)
-{
- CvStarKeypoint kpt;
- kpt.pt = pt;
- kpt.size = size;
- kpt.response = response;
- return kpt;
-}
-
-typedef struct CvStarDetectorParams
-{
- int maxSize;
- int responseThreshold;
- int lineThresholdProjected;
- int lineThresholdBinarized;
- int suppressNonmaxSize;
-} CvStarDetectorParams;
-
-CV_INLINE CvStarDetectorParams cvStarDetectorParams(
- int maxSize CV_DEFAULT(45),
- int responseThreshold CV_DEFAULT(30),
- int lineThresholdProjected CV_DEFAULT(10),
- int lineThresholdBinarized CV_DEFAULT(8),
- int suppressNonmaxSize CV_DEFAULT(5))
-{
- CvStarDetectorParams params;
- params.maxSize = maxSize;
- params.responseThreshold = responseThreshold;
- params.lineThresholdProjected = lineThresholdProjected;
- params.lineThresholdBinarized = lineThresholdBinarized;
- params.suppressNonmaxSize = suppressNonmaxSize;
-
- return params;
-}
-
-CVAPI(CvSeq*) cvGetStarKeypoints( const CvArr* img, CvMemStorage* storage,
- CvStarDetectorParams params CV_DEFAULT(cvStarDetectorParams()));
-
-#ifdef __cplusplus
-}
-
-namespace cv
-{
- struct CV_EXPORTS DefaultRngAuto
- {
- const uint64 old_state;
-
- DefaultRngAuto() : old_state(theRNG().state) { theRNG().state = (uint64)-1; }
- ~DefaultRngAuto() { theRNG().state = old_state; }
-
- DefaultRngAuto& operator=(const DefaultRngAuto&);
- };
-
-
-// CvAffinePose: defines a parameterized affine transformation of an image patch.
-// An image patch is rotated on angle phi (in degrees), then scaled lambda1 times
-// along horizontal and lambda2 times along vertical direction, and then rotated again
-// on angle (theta - phi).
-class CV_EXPORTS CvAffinePose
-{
-public:
- float phi;
- float theta;
- float lambda1;
- float lambda2;
-};
-
-/*!
- The Keypoint Class
-
- The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint detectors, such as
- Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT, cv::LDetector etc.
-
- The keypoint is characterized by the 2D position, scale
- (proportional to the diameter of the neighborhood that needs to be taken into account),
- orientation and some other parameters. The keypoint neighborhood is then analyzed by another algorithm that builds a descriptor
- (usually represented as a feature vector). The keypoints representing the same object in different images can then be matched using
- cv::KDTree or another method.
-*/
-class CV_EXPORTS_W_SIMPLE KeyPoint
-{
-public:
- //! the default constructor
- CV_WRAP KeyPoint() : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {}
- //! the full constructor
- KeyPoint(Point2f _pt, float _size, float _angle=-1,
- float _response=0, int _octave=0, int _class_id=-1)
- : pt(_pt), size(_size), angle(_angle),
- response(_response), octave(_octave), class_id(_class_id) {}
- //! another form of the full constructor
- CV_WRAP KeyPoint(float x, float y, float _size, float _angle=-1,
- float _response=0, int _octave=0, int _class_id=-1)
- : pt(x, y), size(_size), angle(_angle),
- response(_response), octave(_octave), class_id(_class_id) {}
-
- size_t hash() const;
-
- //! converts vector of keypoints to vector of points
- static void convert(const std::vector& keypoints,
- CV_OUT std::vector& points2f,
- const std::vector& keypointIndexes=std::vector());
- //! converts vector of points to the vector of keypoints, where each keypoint is assigned the same size and the same orientation
- static void convert(const std::vector& points2f,
- CV_OUT std::vector& keypoints,
- float size=1, float response=1, int octave=0, int class_id=-1);
-
- //! computes overlap for pair of keypoints;
- //! overlap is a ratio between area of keypoint regions intersection and
- //! area of keypoint regions union (now keypoint region is circle)
- static float overlap(const KeyPoint& kp1, const KeyPoint& kp2);
-
- CV_PROP_RW Point2f pt; //!< coordinates of the keypoints
- CV_PROP_RW float size; //!< diameter of the meaningful keypoint neighborhood
- CV_PROP_RW float angle; //!< computed orientation of the keypoint (-1 if not applicable)
- CV_PROP_RW float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
- CV_PROP_RW int octave; //!< octave (pyramid layer) from which the keypoint has been extracted
- CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
-};
-
-//! writes vector of keypoints to the file storage
-CV_EXPORTS void write(FileStorage& fs, const string& name, const vector& keypoints);
-//! reads vector of keypoints from the specified file storage node
-CV_EXPORTS void read(const FileNode& node, CV_OUT vector& keypoints);
-
-/*
- * A class filters a vector of keypoints.
- * Because now it is difficult to provide a convenient interface for all usage scenarios of the keypoints filter class,
- * it has only 4 needed by now static methods.
- */
-class CV_EXPORTS KeyPointsFilter
-{
-public:
- KeyPointsFilter(){}
-
- /*
- * Remove keypoints within borderPixels of an image edge.
- */
- static void runByImageBorder( vector& keypoints, Size imageSize, int borderSize );
- /*
- * Remove keypoints of sizes out of range.
- */
- static void runByKeypointSize( vector& keypoints, float minSize, float maxSize=std::numeric_limits::max() );
- /*
- * Remove keypoints from some image by mask for pixels of this image.
- */
- static void runByPixelsMask( vector& keypoints, const Mat& mask );
- /*
- * Remove duplicated keypoints.
- */
- static void removeDuplicated( vector& keypoints );
-};
-
-/*!
- SIFT implementation.
-
- The class implements SIFT algorithm by D. Lowe.
-*/
-
-class CV_EXPORTS SIFT
-{
-public:
- struct CV_EXPORTS CommonParams
- {
- static const int DEFAULT_NOCTAVES = 4;
- static const int DEFAULT_NOCTAVE_LAYERS = 3;
- static const int DEFAULT_FIRST_OCTAVE = -1;
- enum { FIRST_ANGLE = 0, AVERAGE_ANGLE = 1 };
-
- CommonParams();
- CommonParams( int _nOctaves, int _nOctaveLayers, int /*_firstOctave*/, int /*_angleMode*/ );
- CommonParams( int _nOctaves, int _nOctaveLayers );
- int nOctaves, nOctaveLayers;
- int firstOctave; // it is not used now (firstOctave == 0 always)
- int angleMode; // it is not used now
- };
-
- struct CV_EXPORTS DetectorParams
- {
- static double GET_DEFAULT_THRESHOLD() { return 0.04; }
- static double GET_DEFAULT_EDGE_THRESHOLD() { return 10.0; }
-
- DetectorParams();
- DetectorParams( double _threshold, double _edgeThreshold );
- double threshold, edgeThreshold;
- };
-
- struct CV_EXPORTS DescriptorParams
- {
- static double GET_DEFAULT_MAGNIFICATION() { return 3.0; }
- static const bool DEFAULT_IS_NORMALIZE = true;
- static const int DESCRIPTOR_SIZE = 128;
-
- DescriptorParams();
- DescriptorParams( double _magnification, bool /*_isNormalize*/, bool _recalculateAngles );
- DescriptorParams( bool _recalculateAngles );
- double magnification;
- bool isNormalize; // it is not used now (true always)
- bool recalculateAngles;
- };
-
- SIFT();
- //! sift-detector constructor
- SIFT( double _threshold, double _edgeThreshold,
- int _nOctaves=CommonParams::DEFAULT_NOCTAVES,
- int _nOctaveLayers=CommonParams::DEFAULT_NOCTAVE_LAYERS,
- int _firstOctave=CommonParams::DEFAULT_FIRST_OCTAVE,
- int _angleMode=CommonParams::FIRST_ANGLE );
- //! sift-descriptor constructor
- SIFT( double _magnification, bool _isNormalize=true,
- bool _recalculateAngles = true,
- int _nOctaves=CommonParams::DEFAULT_NOCTAVES,
- int _nOctaveLayers=CommonParams::DEFAULT_NOCTAVE_LAYERS,
- int _firstOctave=CommonParams::DEFAULT_FIRST_OCTAVE,
- int _angleMode=CommonParams::FIRST_ANGLE );
- SIFT( const CommonParams& _commParams,
- const DetectorParams& _detectorParams = DetectorParams(),
- const DescriptorParams& _descriptorParams = DescriptorParams() );
-
- //! returns the descriptor size in floats (128)
- int descriptorSize() const;
- //! finds the keypoints using SIFT algorithm
- void operator()(const Mat& img, const Mat& mask,
- vector& keypoints) const;
- //! finds the keypoints and computes descriptors for them using SIFT algorithm.
- //! Optionally it can compute descriptors for the user-provided keypoints
- void operator()(const Mat& img, const Mat& mask,
- vector& keypoints,
- Mat& descriptors,
- bool useProvidedKeypoints=false) const;
-
- CommonParams getCommonParams () const;
- DetectorParams getDetectorParams () const;
- DescriptorParams getDescriptorParams () const;
-
-protected:
- CommonParams commParams;
- DetectorParams detectorParams;
- DescriptorParams descriptorParams;
-};
-
-
-/*!
- SURF implementation.
-
- The class implements SURF algorithm by H. Bay et al.
- */
-class CV_EXPORTS_W SURF : public CvSURFParams
-{
-public:
- //! the default constructor
- CV_WRAP SURF();
- //! the full constructor taking all the necessary parameters
- CV_WRAP SURF(double _hessianThreshold, int _nOctaves=4,
- int _nOctaveLayers=2, bool _extended=false, bool _upright=false);
-
- //! returns the descriptor size in float's (64 or 128)
- CV_WRAP int descriptorSize() const;
- //! finds the keypoints using fast hessian detector used in SURF
- CV_WRAP_AS(detect) void operator()(const Mat& img, const Mat& mask,
- CV_OUT vector& keypoints) const;
- //! finds the keypoints and computes their descriptors. Optionally it can compute descriptors for the user-provided keypoints
- CV_WRAP_AS(detect) void operator()(const Mat& img, const Mat& mask,
- CV_OUT vector& keypoints,
- CV_OUT vector& descriptors,
- bool useProvidedKeypoints=false) const;
-};
-
-/*!
- ORB implementation.
-*/
-class CV_EXPORTS ORB
-{
-public:
-
- /** the size of the signature in bytes */
- enum { kBytes = 32 };
-
- struct CV_EXPORTS CommonParams
- {
- enum { DEFAULT_N_LEVELS = 3, DEFAULT_FIRST_LEVEL = 0};
-
- /** default constructor */
- CommonParams(float scale_factor = 1.2f, unsigned int n_levels = DEFAULT_N_LEVELS, int edge_threshold = 31,
- unsigned int first_level = DEFAULT_FIRST_LEVEL) :
- scale_factor_(scale_factor), n_levels_(n_levels), first_level_(first_level >= n_levels ? 0 : first_level),
- edge_threshold_(edge_threshold)
- {
- // No other patch size is supported right now
- patch_size_ = 31;
- }
- void read(const FileNode& fn);
- void write(FileStorage& fs) const;
-
- /** Coefficient by which we divide the dimensions from one scale pyramid level to the next */
- float scale_factor_;
- /** The number of levels in the scale pyramid */
- unsigned int n_levels_;
- /** The level at which the image is given
- * if 1, that means we will also look at the image scale_factor_ times bigger
- */
- unsigned int first_level_;
- /** How far from the boundary the points should be */
- int edge_threshold_;
-
- friend class ORB;
- protected:
- /** The size of the patch that will be used for orientation and comparisons */
- int patch_size_;
- };
-
- /** Constructor
- * @param n_features the number of desired features
- * @param detector_params parameters to use
- */
- ORB(size_t n_features = 500, const CommonParams & detector_params = CommonParams());
-
- /** destructor to empty the patterns */
- ~ORB();
-
- /** returns the descriptor size in bytes */
- int descriptorSize() const;
-
- /** Compute the ORB features and descriptors on an image
- * @param img the image to compute the features and descriptors on
- * @param mask the mask to apply
- * @param keypoints the resulting keypoints
- */
- void
- operator()(const cv::Mat &image, const cv::Mat &mask, std::vector & keypoints);
-
- /** Compute the ORB features and descriptors on an image
- * @param img the image to compute the features and descriptors on
- * @param mask the mask to apply
- * @param keypoints the resulting keypoints
- * @param descriptors the resulting descriptors
- * @param useProvidedKeypoints if true, the keypoints are used as an input
- */
- void
- operator()(const cv::Mat &image, const cv::Mat &mask, std::vector & keypoints, cv::Mat & descriptors,
- bool useProvidedKeypoints = false);
-
-private:
- /** The size of the patch used when comparing regions in the patterns */
- static const int kKernelWidth = 5;
-
- /** Compute the ORB features and descriptors on an image
- * @param image the image to compute the features and descriptors on
- * @param mask the mask to apply
- * @param keypoints the resulting keypoints
- * @param descriptors the resulting descriptors
- * @param do_keypoints if true, the keypoints are computed, otherwise used as an input
- * @param do_descriptors if true, also computes the descriptors
- */
- void
- operator()(const cv::Mat &image, const cv::Mat &mask, std::vector & keypoints, cv::Mat & descriptors,
- bool do_keypoints, bool do_descriptors);
-
- /** Compute the ORB keypoints on an image
- * @param image_pyramid the image pyramid to compute the features and descriptors on
- * @param mask_pyramid the masks to apply at every level
- * @param keypoints the resulting keypoints, clustered per level
- */
- void computeKeyPoints(const std::vector& image_pyramid, const std::vector& mask_pyramid,
- std::vector >& keypoints) const;
-
- /** Compute the ORB keypoint orientations
- * @param image the image to compute the features and descriptors on
- * @param integral_image the integral image of the image (can be empty, but the computation will be slower)
- * @param level the scale at which we compute the orientation
- * @param keypoints the resulting keypoints
- */
- void
- computeOrientation(const cv::Mat& image, const cv::Mat& integral_image, unsigned int level,
- std::vector& keypoints) const;
-
- /** Compute the ORB descriptors
- * @param image the image to compute the features and descriptors on
- * @param integral_image the integral image of the image (can be empty, but the computation will be slower)
- * @param level the scale at which we compute the orientation
- * @param keypoints the keypoints to use
- * @param descriptors the resulting descriptors
- */
- void
- computeDescriptors(const cv::Mat& image, const cv::Mat& integral_image, unsigned int level,
- std::vector& keypoints, cv::Mat & descriptors) const;
-
- /** Compute the integral image and upadte the cached values
- * @param image the image to compute the features and descriptors on
- * @param level the scale at which we compute the orientation
- * @param descriptors the resulting descriptors
- */
- void computeIntegralImage(const cv::Mat & image, unsigned int level, cv::Mat &integral_image);
-
- /** Parameters tuning ORB */
- CommonParams params_;
-
- /** size of the half patch used for orientation computation, see Rosin - 1999 - Measuring Corner Properties */
- int half_patch_size_;
-
- /** pre-computed offsets used for the Harris verification, one vector per scale */
- std::vector > orientation_horizontal_offsets_;
- std::vector > orientation_vertical_offsets_;
-
- /** The steps of the integral images for each scale */
- std::vector integral_image_steps_;
-
- /** The number of desired features per scale */
- std::vector n_features_per_level_;
-
- /** The overall number of desired features */
- size_t n_features_;
-
- /** the end of a row in a circular patch */
- std::vector u_max_;
-
- /** The patterns for each level (the patterns are the same, but not their offset */
- class OrbPatterns;
- std::vector patterns_;
-};
-
-/*!
- Maximal Stable Extremal Regions class.
-
- The class implements MSER algorithm introduced by J. Matas.
- Unlike SIFT, SURF and many other detectors in OpenCV, this is salient region detector,
- not the salient point detector.
-
- It returns the regions, each of those is encoded as a contour.
-*/
-class CV_EXPORTS_W MSER : public CvMSERParams
-{
-public:
- //! the default constructor
- CV_WRAP MSER();
- //! the full constructor
- CV_WRAP MSER( int _delta, int _min_area, int _max_area,
- double _max_variation, double _min_diversity,
- int _max_evolution, double _area_threshold,
- double _min_margin, int _edge_blur_size );
- //! the operator that extracts the MSERs from the image or the specific part of it
- CV_WRAP_AS(detect) void operator()( const Mat& image,
- CV_OUT vector >& msers, const Mat& mask ) const;
-};
-
-/*!
- The "Star" Detector.
-
- The class implements the keypoint detector introduced by K. Konolige.
-*/
-class CV_EXPORTS_W StarDetector : public CvStarDetectorParams
-{
-public:
- //! the default constructor
- CV_WRAP StarDetector();
- //! the full constructor
- CV_WRAP StarDetector(int _maxSize, int _responseThreshold,
- int _lineThresholdProjected,
- int _lineThresholdBinarized,
- int _suppressNonmaxSize);
- //! finds the keypoints in the image
- CV_WRAP_AS(detect) void operator()(const Mat& image,
- CV_OUT vector& keypoints) const;
-};
-
-//! detects corners using FAST algorithm by E. Rosten
-CV_EXPORTS void FAST( const Mat& image, CV_OUT vector& keypoints,
- int threshold, bool nonmaxSupression=true );
-
-/*!
- The Patch Generator class
-*/
-class CV_EXPORTS PatchGenerator
-{
-public:
- PatchGenerator();
- PatchGenerator(double _backgroundMin, double _backgroundMax,
- double _noiseRange, bool _randomBlur=true,
- double _lambdaMin=0.6, double _lambdaMax=1.5,
- double _thetaMin=-CV_PI, double _thetaMax=CV_PI,
- double _phiMin=-CV_PI, double _phiMax=CV_PI );
- void operator()(const Mat& image, Point2f pt, Mat& patch, Size patchSize, RNG& rng) const;
- void operator()(const Mat& image, const Mat& transform, Mat& patch,
- Size patchSize, RNG& rng) const;
- void warpWholeImage(const Mat& image, Mat& matT, Mat& buf,
- CV_OUT Mat& warped, int border, RNG& rng) const;
- void generateRandomTransform(Point2f srcCenter, Point2f dstCenter,
- CV_OUT Mat& transform, RNG& rng,
- bool inverse=false) const;
- void setAffineParam(double lambda, double theta, double phi);
-
- double backgroundMin, backgroundMax;
- double noiseRange;
- bool randomBlur;
- double lambdaMin, lambdaMax;
- double thetaMin, thetaMax;
- double phiMin, phiMax;
-};
-
-
-class CV_EXPORTS LDetector
-{
-public:
- LDetector();
- LDetector(int _radius, int _threshold, int _nOctaves,
- int _nViews, double _baseFeatureSize, double _clusteringDistance);
- void operator()(const Mat& image,
- CV_OUT vector& keypoints,
- int maxCount=0, bool scaleCoords=true) const;
- void operator()(const vector& pyr,
- CV_OUT vector& keypoints,
- int maxCount=0, bool scaleCoords=true) const;
- void getMostStable2D(const Mat& image, CV_OUT vector& keypoints,
- int maxCount, const PatchGenerator& patchGenerator) const;
- void setVerbose(bool verbose);
-
- void read(const FileNode& node);
- void write(FileStorage& fs, const String& name=String()) const;
-
- int radius;
- int threshold;
- int nOctaves;
- int nViews;
- bool verbose;
-
- double baseFeatureSize;
- double clusteringDistance;
-};
-
-typedef LDetector YAPE;
-
-class CV_EXPORTS FernClassifier
-{
-public:
- FernClassifier();
- FernClassifier(const FileNode& node);
- FernClassifier(const vector >& points,
- const vector& refimgs,
- const vector >& labels=vector >(),
- int _nclasses=0, int _patchSize=PATCH_SIZE,
- int _signatureSize=DEFAULT_SIGNATURE_SIZE,
- int _nstructs=DEFAULT_STRUCTS,
- int _structSize=DEFAULT_STRUCT_SIZE,
- int _nviews=DEFAULT_VIEWS,
- int _compressionMethod=COMPRESSION_NONE,
- const PatchGenerator& patchGenerator=PatchGenerator());
- virtual ~FernClassifier();
- virtual void read(const FileNode& n);
- virtual void write(FileStorage& fs, const String& name=String()) const;
- virtual void trainFromSingleView(const Mat& image,
- const vector& keypoints,
- int _patchSize=PATCH_SIZE,
- int _signatureSize=DEFAULT_SIGNATURE_SIZE,
- int _nstructs=DEFAULT_STRUCTS,
- int _structSize=DEFAULT_STRUCT_SIZE,
- int _nviews=DEFAULT_VIEWS,
- int _compressionMethod=COMPRESSION_NONE,
- const PatchGenerator& patchGenerator=PatchGenerator());
- virtual void train(const vector >& points,
- const vector& refimgs,
- const vector >& labels=vector >(),
- int _nclasses=0, int _patchSize=PATCH_SIZE,
- int _signatureSize=DEFAULT_SIGNATURE_SIZE,
- int _nstructs=DEFAULT_STRUCTS,
- int _structSize=DEFAULT_STRUCT_SIZE,
- int _nviews=DEFAULT_VIEWS,
- int _compressionMethod=COMPRESSION_NONE,
- const PatchGenerator& patchGenerator=PatchGenerator());
- virtual int operator()(const Mat& img, Point2f kpt, vector& signature) const;
- virtual int operator()(const Mat& patch, vector& signature) const;
- virtual void clear();
- virtual bool empty() const;
- void setVerbose(bool verbose);
-
- int getClassCount() const;
- int getStructCount() const;
- int getStructSize() const;
- int getSignatureSize() const;
- int getCompressionMethod() const;
- Size getPatchSize() const;
-
- struct Feature
- {
- uchar x1, y1, x2, y2;
- Feature() : x1(0), y1(0), x2(0), y2(0) {}
- Feature(int _x1, int _y1, int _x2, int _y2)
- : x1((uchar)_x1), y1((uchar)_y1), x2((uchar)_x2), y2((uchar)_y2)
- {}
- template bool operator ()(const Mat_<_Tp>& patch) const
- { return patch(y1,x1) > patch(y2, x2); }
- };
-
- enum
- {
- PATCH_SIZE = 31,
- DEFAULT_STRUCTS = 50,
- DEFAULT_STRUCT_SIZE = 9,
- DEFAULT_VIEWS = 5000,
- DEFAULT_SIGNATURE_SIZE = 176,
- COMPRESSION_NONE = 0,
- COMPRESSION_RANDOM_PROJ = 1,
- COMPRESSION_PCA = 2,
- DEFAULT_COMPRESSION_METHOD = COMPRESSION_NONE
- };
-
-protected:
- virtual void prepare(int _nclasses, int _patchSize, int _signatureSize,
- int _nstructs, int _structSize,
- int _nviews, int _compressionMethod);
- virtual void finalize(RNG& rng);
- virtual int getLeaf(int fidx, const Mat& patch) const;
-
- bool verbose;
- int nstructs;
- int structSize;
- int nclasses;
- int signatureSize;
- int compressionMethod;
- int leavesPerStruct;
- Size patchSize;
- vector features;
- vector classCounters;
- vector posteriors;
-};
-
-
-/****************************************************************************************\
-* Calonder Classifier *
-\****************************************************************************************/
-
-struct RTreeNode;
-
-struct CV_EXPORTS BaseKeypoint
-{
- int x;
- int y;
- IplImage* image;
-
- BaseKeypoint()
- : x(0), y(0), image(NULL)
- {}
-
- BaseKeypoint(int x, int y, IplImage* image)
- : x(x), y(y), image(image)
- {}
-};
-
-class CV_EXPORTS RandomizedTree
-{
-public:
- friend class RTreeClassifier;
-
- static const uchar PATCH_SIZE = 32;
- static const int DEFAULT_DEPTH = 9;
- static const int DEFAULT_VIEWS = 5000;
- static const size_t DEFAULT_REDUCED_NUM_DIM = 176;
- static float GET_LOWER_QUANT_PERC() { return .03f; }
- static float GET_UPPER_QUANT_PERC() { return .92f; }
-
- RandomizedTree();
- ~RandomizedTree();
-
- void train(std::vector const& base_set, RNG &rng,
- int depth, int views, size_t reduced_num_dim, int num_quant_bits);
- void train(std::vector const& base_set, RNG &rng,
- PatchGenerator &make_patch, int depth, int views, size_t reduced_num_dim,
- int num_quant_bits);
-
- // following two funcs are EXPERIMENTAL (do not use unless you know exactly what you do)
- static void quantizeVector(float *vec, int dim, int N, float bnds[2], int clamp_mode=0);
- static void quantizeVector(float *src, int dim, int N, float bnds[2], uchar *dst);
-
- // patch_data must be a 32x32 array (no row padding)
- float* getPosterior(uchar* patch_data);
- const float* getPosterior(uchar* patch_data) const;
- uchar* getPosterior2(uchar* patch_data);
- const uchar* getPosterior2(uchar* patch_data) const;
-
- void read(const char* file_name, int num_quant_bits);
- void read(std::istream &is, int num_quant_bits);
- void write(const char* file_name) const;
- void write(std::ostream &os) const;
-
- int classes() { return classes_; }
- int depth() { return depth_; }
-
- //void setKeepFloatPosteriors(bool b) { keep_float_posteriors_ = b; }
- void discardFloatPosteriors() { freePosteriors(1); }
-
- inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); }
-
- // debug
- void savePosteriors(std::string url, bool append=false);
- void savePosteriors2(std::string url, bool append=false);
-
-private:
- int classes_;
- int depth_;
- int num_leaves_;
- std::vector nodes_;
- float **posteriors_; // 16-bytes aligned posteriors
- uchar **posteriors2_; // 16-bytes aligned posteriors
- std::vector leaf_counts_;
-
- void createNodes(int num_nodes, RNG &rng);
- void allocPosteriorsAligned(int num_leaves, int num_classes);
- void freePosteriors(int which); // which: 1=posteriors_, 2=posteriors2_, 3=both
- void init(int classes, int depth, RNG &rng);
- void addExample(int class_id, uchar* patch_data);
- void finalize(size_t reduced_num_dim, int num_quant_bits);
- int getIndex(uchar* patch_data) const;
- inline float* getPosteriorByIndex(int index);
- inline const float* getPosteriorByIndex(int index) const;
- inline uchar* getPosteriorByIndex2(int index);
- inline const uchar* getPosteriorByIndex2(int index) const;
- //void makeRandomMeasMatrix(float *cs_phi, PHI_DISTR_TYPE dt, size_t reduced_num_dim);
- void convertPosteriorsToChar();
- void makePosteriors2(int num_quant_bits);
- void compressLeaves(size_t reduced_num_dim);
- void estimateQuantPercForPosteriors(float perc[2]);
-};
-
-
-inline uchar* getData(IplImage* image)
-{
- return reinterpret_cast(image->imageData);
-}
-
-inline float* RandomizedTree::getPosteriorByIndex(int index)
-{
- return const_cast(const_cast(this)->getPosteriorByIndex(index));
-}
-
-inline const float* RandomizedTree::getPosteriorByIndex(int index) const
-{
- return posteriors_[index];
-}
-
-inline uchar* RandomizedTree::getPosteriorByIndex2(int index)
-{
- return const_cast(const_cast(this)->getPosteriorByIndex2(index));
-}
-
-inline const uchar* RandomizedTree::getPosteriorByIndex2(int index) const
-{
- return posteriors2_[index];
-}
-
-struct CV_EXPORTS RTreeNode
-{
- short offset1, offset2;
-
- RTreeNode() {}
- RTreeNode(uchar x1, uchar y1, uchar x2, uchar y2)
- : offset1(y1*RandomizedTree::PATCH_SIZE + x1),
- offset2(y2*RandomizedTree::PATCH_SIZE + x2)
- {}
-
- //! Left child on 0, right child on 1
- inline bool operator() (uchar* patch_data) const
- {
- return patch_data[offset1] > patch_data[offset2];
- }
-};
-
-class CV_EXPORTS RTreeClassifier
-{
-public:
- static const int DEFAULT_TREES = 48;
- static const size_t DEFAULT_NUM_QUANT_BITS = 4;
-
- RTreeClassifier();
- void train(std::vector const& base_set,
- RNG &rng,
- int num_trees = RTreeClassifier::DEFAULT_TREES,
- int depth = RandomizedTree::DEFAULT_DEPTH,
- int views = RandomizedTree::DEFAULT_VIEWS,
- size_t reduced_num_dim = RandomizedTree::DEFAULT_REDUCED_NUM_DIM,
- int num_quant_bits = DEFAULT_NUM_QUANT_BITS);
- void train(std::vector const& base_set,
- RNG &rng,
- PatchGenerator &make_patch,
- int num_trees = RTreeClassifier::DEFAULT_TREES,
- int depth = RandomizedTree::DEFAULT_DEPTH,
- int views = RandomizedTree::DEFAULT_VIEWS,
- size_t reduced_num_dim = RandomizedTree::DEFAULT_REDUCED_NUM_DIM,
- int num_quant_bits = DEFAULT_NUM_QUANT_BITS);
-
- // sig must point to a memory block of at least classes()*sizeof(float|uchar) bytes
- void getSignature(IplImage *patch, uchar *sig) const;
- void getSignature(IplImage *patch, float *sig) const;
- void getSparseSignature(IplImage *patch, float *sig, float thresh) const;
- // TODO: deprecated in favor of getSignature overload, remove
- void getFloatSignature(IplImage *patch, float *sig) const { getSignature(patch, sig); }
-
- static int countNonZeroElements(float *vec, int n, double tol=1e-10);
- static inline void safeSignatureAlloc(uchar **sig, int num_sig=1, int sig_len=176);
- static inline uchar* safeSignatureAlloc(int num_sig=1, int sig_len=176);
-
- inline int classes() const { return classes_; }
- inline int original_num_classes() const { return original_num_classes_; }
-
- void setQuantization(int num_quant_bits);
- void discardFloatPosteriors();
-
- void read(const char* file_name);
- void read(std::istream &is);
- void write(const char* file_name) const;
- void write(std::ostream &os) const;
-
- // experimental and debug
- void saveAllFloatPosteriors(std::string file_url);
- void saveAllBytePosteriors(std::string file_url);
- void setFloatPosteriorsFromTextfile_176(std::string url);
- float countZeroElements();
-
- std::vector trees_;
-
-private:
- int classes_;
- int num_quant_bits_;
- mutable uchar **posteriors_;
- mutable unsigned short *ptemp_;
- int original_num_classes_;
- bool keep_floats_;
-};
-
-/****************************************************************************************\
-* One-Way Descriptor *
-\****************************************************************************************/
-
-class CV_EXPORTS OneWayDescriptor
-{
-public:
- OneWayDescriptor();
- ~OneWayDescriptor();
-
- // allocates memory for given descriptor parameters
- void Allocate(int pose_count, CvSize size, int nChannels);
-
- // GenerateSamples: generates affine transformed patches with averaging them over small transformation variations.
- // If external poses and transforms were specified, uses them instead of generating random ones
- // - pose_count: the number of poses to be generated
- // - frontal: the input patch (can be a roi in a larger image)
- // - norm: if nonzero, normalizes the output patch so that the sum of pixel intensities is 1
- void GenerateSamples(int pose_count, IplImage* frontal, int norm = 0);
-
- // GenerateSamplesFast: generates affine transformed patches with averaging them over small transformation variations.
- // Uses precalculated transformed pca components.
- // - frontal: the input patch (can be a roi in a larger image)
- // - pca_hr_avg: pca average vector
- // - pca_hr_eigenvectors: pca eigenvectors
- // - pca_descriptors: an array of precomputed descriptors of pca components containing their affine transformations
- // pca_descriptors[0] corresponds to the average, pca_descriptors[1]-pca_descriptors[pca_dim] correspond to eigenvectors
- void GenerateSamplesFast(IplImage* frontal, CvMat* pca_hr_avg,
- CvMat* pca_hr_eigenvectors, OneWayDescriptor* pca_descriptors);
-
- // sets the poses and corresponding transforms
- void SetTransforms(CvAffinePose* poses, CvMat** transforms);
-
- // Initialize: builds a descriptor.
- // - pose_count: the number of poses to build. If poses were set externally, uses them rather than generating random ones
- // - frontal: input patch. Can be a roi in a larger image
- // - feature_name: the feature name to be associated with the descriptor
- // - norm: if 1, the affine transformed patches are normalized so that their sum is 1
- void Initialize(int pose_count, IplImage* frontal, const char* feature_name = 0, int norm = 0);
-
- // InitializeFast: builds a descriptor using precomputed descriptors of pca components
- // - pose_count: the number of poses to build
- // - frontal: input patch. Can be a roi in a larger image
- // - feature_name: the feature name to be associated with the descriptor
- // - pca_hr_avg: average vector for PCA
- // - pca_hr_eigenvectors: PCA eigenvectors (one vector per row)
- // - pca_descriptors: precomputed descriptors of PCA components, the first descriptor for the average vector
- // followed by the descriptors for eigenvectors
- void InitializeFast(int pose_count, IplImage* frontal, const char* feature_name,
- CvMat* pca_hr_avg, CvMat* pca_hr_eigenvectors, OneWayDescriptor* pca_descriptors);
-
- // ProjectPCASample: unwarps an image patch into a vector and projects it into PCA space
- // - patch: input image patch
- // - avg: PCA average vector
- // - eigenvectors: PCA eigenvectors, one per row
- // - pca_coeffs: output PCA coefficients
- void ProjectPCASample(IplImage* patch, CvMat* avg, CvMat* eigenvectors, CvMat* pca_coeffs) const;
-
- // InitializePCACoeffs: projects all warped patches into PCA space
- // - avg: PCA average vector
- // - eigenvectors: PCA eigenvectors, one per row
- void InitializePCACoeffs(CvMat* avg, CvMat* eigenvectors);
-
- // EstimatePose: finds the closest match between an input patch and a set of patches with different poses
- // - patch: input image patch
- // - pose_idx: the output index of the closest pose
- // - distance: the distance to the closest pose (L2 distance)
- void EstimatePose(IplImage* patch, int& pose_idx, float& distance) const;
-
- // EstimatePosePCA: finds the closest match between an input patch and a set of patches with different poses.
- // The distance between patches is computed in PCA space
- // - patch: input image patch
- // - pose_idx: the output index of the closest pose
- // - distance: distance to the closest pose (L2 distance in PCA space)
- // - avg: PCA average vector. If 0, matching without PCA is used
- // - eigenvectors: PCA eigenvectors, one per row
- void EstimatePosePCA(CvArr* patch, int& pose_idx, float& distance, CvMat* avg, CvMat* eigenvalues) const;
-
- // GetPatchSize: returns the size of each image patch after warping (2 times smaller than the input patch)
- CvSize GetPatchSize() const
- {
- return m_patch_size;
- }
-
- // GetInputPatchSize: returns the required size of the patch that the descriptor is built from
- // (2 time larger than the patch after warping)
- CvSize GetInputPatchSize() const
- {
- return cvSize(m_patch_size.width*2, m_patch_size.height*2);
- }
-
- // GetPatch: returns a patch corresponding to specified pose index
- // - index: pose index
- // - return value: the patch corresponding to specified pose index
- IplImage* GetPatch(int index);
-
- // GetPose: returns a pose corresponding to specified pose index
- // - index: pose index
- // - return value: the pose corresponding to specified pose index
- CvAffinePose GetPose(int index) const;
-
- // Save: saves all patches with different poses to a specified path
- void Save(const char* path);
-
- // ReadByName: reads a descriptor from a file storage
- // - fs: file storage
- // - parent: parent node
- // - name: node name
- // - return value: 1 if succeeded, 0 otherwise
- int ReadByName(CvFileStorage* fs, CvFileNode* parent, const char* name);
-
- // ReadByName: reads a descriptor from a file node
- // - parent: parent node
- // - name: node name
- // - return value: 1 if succeeded, 0 otherwise
- int ReadByName(const FileNode &parent, const char* name);
-
- // Write: writes a descriptor into a file storage
- // - fs: file storage
- // - name: node name
- void Write(CvFileStorage* fs, const char* name);
-
- // GetFeatureName: returns a name corresponding to a feature
- const char* GetFeatureName() const;
-
- // GetCenter: returns the center of the feature
- CvPoint GetCenter() const;
-
- void SetPCADimHigh(int pca_dim_high) {m_pca_dim_high = pca_dim_high;};
- void SetPCADimLow(int pca_dim_low) {m_pca_dim_low = pca_dim_low;};
-
- int GetPCADimLow() const;
- int GetPCADimHigh() const;
-
- CvMat** GetPCACoeffs() const {return m_pca_coeffs;}
-
-protected:
- int m_pose_count; // the number of poses
- CvSize m_patch_size; // size of each image
- IplImage** m_samples; // an array of length m_pose_count containing the patch in different poses
- IplImage* m_input_patch;
- IplImage* m_train_patch;
- CvMat** m_pca_coeffs; // an array of length m_pose_count containing pca decomposition of the patch in different poses
- CvAffinePose* m_affine_poses; // an array of poses
- CvMat** m_transforms; // an array of affine transforms corresponding to poses
-
- string m_feature_name; // the name of the feature associated with the descriptor
- CvPoint m_center; // the coordinates of the feature (the center of the input image ROI)
-
- int m_pca_dim_high; // the number of descriptor pca components to use for generating affine poses
- int m_pca_dim_low; // the number of pca components to use for comparison
-};
-
-
-// OneWayDescriptorBase: encapsulates functionality for training/loading a set of one way descriptors
-// and finding the nearest closest descriptor to an input feature
-class CV_EXPORTS OneWayDescriptorBase
-{
-public:
-
- // creates an instance of OneWayDescriptor from a set of training files
- // - patch_size: size of the input (large) patch
- // - pose_count: the number of poses to generate for each descriptor
- // - train_path: path to training files
- // - pca_config: the name of the file that contains PCA for small patches (2 times smaller
- // than patch_size each dimension
- // - pca_hr_config: the name of the file that contains PCA for large patches (of patch_size size)
- // - pca_desc_config: the name of the file that contains descriptors of PCA components
- OneWayDescriptorBase(CvSize patch_size, int pose_count, const char* train_path = 0, const char* pca_config = 0,
- const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1,
- int pca_dim_high = 100, int pca_dim_low = 100);
-
- OneWayDescriptorBase(CvSize patch_size, int pose_count, const string &pca_filename, const string &train_path = string(), const string &images_list = string(),
- float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1,
- int pca_dim_high = 100, int pca_dim_low = 100);
-
-
- virtual ~OneWayDescriptorBase();
- void clear ();
-
-
- // Allocate: allocates memory for a given number of descriptors
- void Allocate(int train_feature_count);
-
- // AllocatePCADescriptors: allocates memory for pca descriptors
- void AllocatePCADescriptors();
-
- // returns patch size
- CvSize GetPatchSize() const {return m_patch_size;};
- // returns the number of poses for each descriptor
- int GetPoseCount() const {return m_pose_count;};
-
- // returns the number of pyramid levels
- int GetPyrLevels() const {return m_pyr_levels;};
-
- // returns the number of descriptors
- int GetDescriptorCount() const {return m_train_feature_count;};
-
- // CreateDescriptorsFromImage: creates descriptors for each of the input features
- // - src: input image
- // - features: input features
- // - pyr_levels: the number of pyramid levels
- void CreateDescriptorsFromImage(IplImage* src, const std::vector& features);
-
- // CreatePCADescriptors: generates descriptors for PCA components, needed for fast generation of feature descriptors
- void CreatePCADescriptors();
-
- // returns a feature descriptor by feature index
- const OneWayDescriptor* GetDescriptor(int desc_idx) const {return &m_descriptors[desc_idx];};
-
- // FindDescriptor: finds the closest descriptor
- // - patch: input image patch
- // - desc_idx: output index of the closest descriptor to the input patch
- // - pose_idx: output index of the closest pose of the closest descriptor to the input patch
- // - distance: distance from the input patch to the closest feature pose
- // - _scales: scales of the input patch for each descriptor
- // - scale_ranges: input scales variation (float[2])
- void FindDescriptor(IplImage* patch, int& desc_idx, int& pose_idx, float& distance, float* _scale = 0, float* scale_ranges = 0) const;
-
- // - patch: input image patch
- // - n: number of the closest indexes
- // - desc_idxs: output indexes of the closest descriptor to the input patch (n)
- // - pose_idx: output indexes of the closest pose of the closest descriptor to the input patch (n)
- // - distances: distance from the input patch to the closest feature pose (n)
- // - _scales: scales of the input patch
- // - scale_ranges: input scales variation (float[2])
- void FindDescriptor(IplImage* patch, int n, std::vector& desc_idxs, std::vector& pose_idxs,
- std::vector& distances, std::vector& _scales, float* scale_ranges = 0) const;
-
- // FindDescriptor: finds the closest descriptor
- // - src: input image
- // - pt: center of the feature
- // - desc_idx: output index of the closest descriptor to the input patch
- // - pose_idx: output index of the closest pose of the closest descriptor to the input patch
- // - distance: distance from the input patch to the closest feature pose
- void FindDescriptor(IplImage* src, cv::Point2f pt, int& desc_idx, int& pose_idx, float& distance) const;
-
- // InitializePoses: generates random poses
- void InitializePoses();
-
- // InitializeTransformsFromPoses: generates 2x3 affine matrices from poses (initializes m_transforms)
- void InitializeTransformsFromPoses();
-
- // InitializePoseTransforms: subsequently calls InitializePoses and InitializeTransformsFromPoses
- void InitializePoseTransforms();
-
- // InitializeDescriptor: initializes a descriptor
- // - desc_idx: descriptor index
- // - train_image: image patch (ROI is supported)
- // - feature_label: feature textual label
- void InitializeDescriptor(int desc_idx, IplImage* train_image, const char* feature_label);
-
- void InitializeDescriptor(int desc_idx, IplImage* train_image, const cv::KeyPoint& keypoint, const char* feature_label);
-
- // InitializeDescriptors: load features from an image and create descriptors for each of them
- void InitializeDescriptors(IplImage* train_image, const vector& features,
- const char* feature_label = "", int desc_start_idx = 0);
-
- // Write: writes this object to a file storage
- // - fs: output filestorage
- void Write (FileStorage &fs) const;
-
- // Read: reads OneWayDescriptorBase object from a file node
- // - fn: input file node
- void Read (const FileNode &fn);
-
- // LoadPCADescriptors: loads PCA descriptors from a file
- // - filename: input filename
- int LoadPCADescriptors(const char* filename);
-
- // LoadPCADescriptors: loads PCA descriptors from a file node
- // - fn: input file node
- int LoadPCADescriptors(const FileNode &fn);
-
- // SavePCADescriptors: saves PCA descriptors to a file
- // - filename: output filename
- void SavePCADescriptors(const char* filename);
-
- // SavePCADescriptors: saves PCA descriptors to a file storage
- // - fs: output file storage
- void SavePCADescriptors(CvFileStorage* fs) const;
-
- // GeneratePCA: calculate and save PCA components and descriptors
- // - img_path: path to training PCA images directory
- // - images_list: filename with filenames of training PCA images
- void GeneratePCA(const char* img_path, const char* images_list, int pose_count=500);
-
- // SetPCAHigh: sets the high resolution pca matrices (copied to internal structures)
- void SetPCAHigh(CvMat* avg, CvMat* eigenvectors);
-
- // SetPCALow: sets the low resolution pca matrices (copied to internal structures)
- void SetPCALow(CvMat* avg, CvMat* eigenvectors);
-
- int GetLowPCA(CvMat** avg, CvMat** eigenvectors)
- {
- *avg = m_pca_avg;
- *eigenvectors = m_pca_eigenvectors;
- return m_pca_dim_low;
- };
-
- int GetPCADimLow() const {return m_pca_dim_low;};
- int GetPCADimHigh() const {return m_pca_dim_high;};
-
- void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree
-
- // GetPCAFilename: get default PCA filename
- static string GetPCAFilename () { return "pca.yml"; }
-
- virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; }
-
-protected:
- CvSize m_patch_size; // patch size
- int m_pose_count; // the number of poses for each descriptor
- int m_train_feature_count; // the number of the training features
- OneWayDescriptor* m_descriptors; // array of train feature descriptors
- CvMat* m_pca_avg; // PCA average Vector for small patches
- CvMat* m_pca_eigenvectors; // PCA eigenvectors for small patches
- CvMat* m_pca_hr_avg; // PCA average Vector for large patches
- CvMat* m_pca_hr_eigenvectors; // PCA eigenvectors for large patches
- OneWayDescriptor* m_pca_descriptors; // an array of PCA descriptors
-
- cv::flann::Index* m_pca_descriptors_tree;
- CvMat* m_pca_descriptors_matrix;
-
- CvAffinePose* m_poses; // array of poses
- CvMat** m_transforms; // array of affine transformations corresponding to poses
-
- int m_pca_dim_high;
- int m_pca_dim_low;
-
- int m_pyr_levels;
- float scale_min;
- float scale_max;
- float scale_step;
-
- // SavePCAall: saves PCA components and descriptors to a file storage
- // - fs: output file storage
- void SavePCAall (FileStorage &fs) const;
-
- // LoadPCAall: loads PCA components and descriptors from a file node
- // - fn: input file node
- void LoadPCAall (const FileNode &fn);
-};
-
-class CV_EXPORTS OneWayDescriptorObject : public OneWayDescriptorBase
-{
-public:
- // creates an instance of OneWayDescriptorObject from a set of training files
- // - patch_size: size of the input (large) patch
- // - pose_count: the number of poses to generate for each descriptor
- // - train_path: path to training files
- // - pca_config: the name of the file that contains PCA for small patches (2 times smaller
- // than patch_size each dimension
- // - pca_hr_config: the name of the file that contains PCA for large patches (of patch_size size)
- // - pca_desc_config: the name of the file that contains descriptors of PCA components
- OneWayDescriptorObject(CvSize patch_size, int pose_count, const char* train_path, const char* pca_config,
- const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1);
-
- OneWayDescriptorObject(CvSize patch_size, int pose_count, const string &pca_filename,
- const string &train_path = string (), const string &images_list = string (),
- float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1);
-
-
- virtual ~OneWayDescriptorObject();
-
- // Allocate: allocates memory for a given number of features
- // - train_feature_count: the total number of features
- // - object_feature_count: the number of features extracted from the object
- void Allocate(int train_feature_count, int object_feature_count);
-
-
- void SetLabeledFeatures(const vector& features) {m_train_features = features;};
- vector& GetLabeledFeatures() {return m_train_features;};
- const vector& GetLabeledFeatures() const {return m_train_features;};
- vector _GetLabeledFeatures() const;
-
- // IsDescriptorObject: returns 1 if descriptor with specified index is positive, otherwise 0
- int IsDescriptorObject(int desc_idx) const;
-
- // MatchPointToPart: returns the part number of a feature if it matches one of the object parts, otherwise -1
- int MatchPointToPart(CvPoint pt) const;
-
- // GetDescriptorPart: returns the part number of the feature corresponding to a specified descriptor
- // - desc_idx: descriptor index
- int GetDescriptorPart(int desc_idx) const;
-
-
- void InitializeObjectDescriptors(IplImage* train_image, const vector& features,
- const char* feature_label, int desc_start_idx = 0, float scale = 1.0f,
- int is_background = 0);
-
- // GetObjectFeatureCount: returns the number of object features
- int GetObjectFeatureCount() const {return m_object_feature_count;};
-
-protected:
- int* m_part_id; // contains part id for each of object descriptors
- vector m_train_features; // train features
- int m_object_feature_count; // the number of the positive features
-
-};
-
-
-/****************************************************************************************\
-* FeatureDetector *
-\****************************************************************************************/
-
-/*
- * Abstract base class for 2D image feature detectors.
- */
-class CV_EXPORTS FeatureDetector
-{
-public:
- virtual ~FeatureDetector();
-
- /*
- * Detect keypoints in an image.
- * image The image.
- * keypoints The detected keypoints.
- * mask Mask specifying where to look for keypoints (optional). Must be a char
- * matrix with non-zero values in the region of interest.
- */
- void detect( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- /*
- * Detect keypoints in an image set.
- * images Image collection.
- * keypoints Collection of keypoints detected in an input images. keypoints[i] is a set of keypoints detected in an images[i].
- * masks Masks for image set. masks[i] is a mask for images[i].
- */
- void detect( const vector& images, vector >& keypoints, const vector& masks=vector() ) const;
-
- // Read detector object from a file node.
- virtual void read( const FileNode& );
- // Read detector object from a file node.
- virtual void write( FileStorage& ) const;
-
- // Return true if detector object is empty
- virtual bool empty() const;
-
- // Create feature detector by detector name.
- static Ptr create( const string& detectorType );
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const = 0;
-
- /*
- * Remove keypoints that are not in the mask.
- * Helper function, useful when wrapping a library call for keypoint detection that
- * does not support a mask argument.
- */
- static void removeInvalidPoints( const Mat& mask, vector& keypoints );
-};
-
-class CV_EXPORTS FastFeatureDetector : public FeatureDetector
-{
-public:
- FastFeatureDetector( int threshold=10, bool nonmaxSuppression=true );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- int threshold;
- bool nonmaxSuppression;
-};
-
-
-class CV_EXPORTS GoodFeaturesToTrackDetector : public FeatureDetector
-{
-public:
- class CV_EXPORTS Params
- {
- public:
- Params( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1.,
- int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
- void read( const FileNode& fn );
- void write( FileStorage& fs ) const;
-
- int maxCorners;
- double qualityLevel;
- double minDistance;
- int blockSize;
- bool useHarrisDetector;
- double k;
- };
-
- GoodFeaturesToTrackDetector( const GoodFeaturesToTrackDetector::Params& params=GoodFeaturesToTrackDetector::Params() );
- GoodFeaturesToTrackDetector( int maxCorners, double qualityLevel, double minDistance,
- int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- Params params;
-};
-
-class CV_EXPORTS MserFeatureDetector : public FeatureDetector
-{
-public:
- MserFeatureDetector( CvMSERParams params=cvMSERParams() );
- MserFeatureDetector( int delta, int minArea, int maxArea, double maxVariation, double minDiversity,
- int maxEvolution, double areaThreshold, double minMargin, int edgeBlurSize );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- MSER mser;
-};
-
-class CV_EXPORTS StarFeatureDetector : public FeatureDetector
-{
-public:
- StarFeatureDetector( const CvStarDetectorParams& params=cvStarDetectorParams() );
- StarFeatureDetector( int maxSize, int responseThreshold=30, int lineThresholdProjected = 10,
- int lineThresholdBinarized=8, int suppressNonmaxSize=5 );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- StarDetector star;
-};
-
-class CV_EXPORTS SiftFeatureDetector : public FeatureDetector
-{
-public:
- SiftFeatureDetector( const SIFT::DetectorParams& detectorParams=SIFT::DetectorParams(),
- const SIFT::CommonParams& commonParams=SIFT::CommonParams() );
- SiftFeatureDetector( double threshold, double edgeThreshold,
- int nOctaves=SIFT::CommonParams::DEFAULT_NOCTAVES,
- int nOctaveLayers=SIFT::CommonParams::DEFAULT_NOCTAVE_LAYERS,
- int firstOctave=SIFT::CommonParams::DEFAULT_FIRST_OCTAVE,
- int angleMode=SIFT::CommonParams::FIRST_ANGLE );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- SIFT sift;
-};
-
-class CV_EXPORTS SurfFeatureDetector : public FeatureDetector
-{
-public:
- SurfFeatureDetector( double hessianThreshold=400., int octaves=3, int octaveLayers=4, bool upright=false );
- virtual void read( const FileNode& fn );
- virtual void write( FileStorage& fs ) const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- SURF surf;
-};
-
-/** Feature detector for the ORB feature
- * Basically fast followed by a Harris check
- */
-class CV_EXPORTS OrbFeatureDetector : public cv::FeatureDetector
-{
-public:
- /** Default constructor
- * @param n_features the number of desired features
- * @param params parameters to use
- */
- OrbFeatureDetector(size_t n_features = 700, ORB::CommonParams params = ORB::CommonParams());
-
- virtual void read(const cv::FileNode&);
- virtual void write(cv::FileStorage&) const;
-
-protected:
- virtual void
- detectImpl(const cv::Mat& image, std::vector& keypoints, const cv::Mat& mask = cv::Mat()) const;
-private:
- /** the ORB object we use for the computations */
- mutable ORB orb_;
- /** The parameters used */
- ORB::CommonParams params_;
- /** the number of features that need to be retrieved */
- unsigned int n_features_;
-};
-
-class CV_EXPORTS SimpleBlobDetector : public cv::FeatureDetector
-{
-public:
- struct CV_EXPORTS Params
- {
- Params();
- float thresholdStep;
- float minThreshold;
- float maxThreshold;
- size_t minRepeatability;
- float minDistBetweenBlobs;
-
- bool filterByColor;
- uchar blobColor;
-
- bool filterByArea;
- float minArea, maxArea;
-
- bool filterByCircularity;
- float minCircularity, maxCircularity;
-
- bool filterByInertia;
- float minInertiaRatio, maxInertiaRatio;
-
- bool filterByConvexity;
- float minConvexity, maxConvexity;
- };
-
- SimpleBlobDetector(const SimpleBlobDetector::Params ¶meters = SimpleBlobDetector::Params());
-
-protected:
- struct CV_EXPORTS Center
- {
- Point2d location;
- double radius;
- double confidence;
- };
-
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
- virtual void findBlobs(const cv::Mat &image, const cv::Mat &binaryImage, std::vector
¢ers) const;
-
- Params params;
-};
-
-class CV_EXPORTS DenseFeatureDetector : public FeatureDetector
-{
-public:
- class CV_EXPORTS Params
- {
- public:
- Params( float initFeatureScale=1.f, int featureScaleLevels=1, float featureScaleMul=0.1f,
- int initXyStep=6, int initImgBound=0, bool varyXyStepWithScale=true, bool varyImgBoundWithScale=false );
- float initFeatureScale;
- int featureScaleLevels;
- float featureScaleMul;
-
- int initXyStep;
- int initImgBound;
-
- bool varyXyStepWithScale;
- bool varyImgBoundWithScale;
- };
-
- DenseFeatureDetector( const DenseFeatureDetector::Params& params=DenseFeatureDetector::Params() );
-
- // TODO implement read/write
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- Params params;
-};
-
-/*
- * Adapts a detector to partition the source image into a grid and detect
- * points in each cell.
- */
-class CV_EXPORTS GridAdaptedFeatureDetector : public FeatureDetector
-{
-public:
- /*
- * detector Detector that will be adapted.
- * maxTotalKeypoints Maximum count of keypoints detected on the image. Only the strongest keypoints
- * will be keeped.
- * gridRows Grid rows count.
- * gridCols Grid column count.
- */
- GridAdaptedFeatureDetector( const Ptr& detector, int maxTotalKeypoints=1000,
- int gridRows=4, int gridCols=4 );
-
- // TODO implement read/write
- virtual bool empty() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- Ptr detector;
- int maxTotalKeypoints;
- int gridRows;
- int gridCols;
-};
-
-/*
- * Adapts a detector to detect points over multiple levels of a Gaussian
- * pyramid. Useful for detectors that are not inherently scaled.
- */
-class CV_EXPORTS PyramidAdaptedFeatureDetector : public FeatureDetector
-{
-public:
- // maxLevel - The 0-based index of the last pyramid layer
- PyramidAdaptedFeatureDetector( const Ptr& detector, int maxLevel=2 );
-
- // TODO implement read/write
- virtual bool empty() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- Ptr detector;
- int maxLevel;
-};
-
-/** \brief A feature detector parameter adjuster, this is used by the DynamicAdaptedFeatureDetector
- * and is a wrapper for FeatureDetector that allow them to be adjusted after a detection
- */
-class CV_EXPORTS AdjusterAdapter: public FeatureDetector
-{
-public:
- /** pure virtual interface
- */
- virtual ~AdjusterAdapter() {}
- /** too few features were detected so, adjust the detector params accordingly
- * \param min the minimum number of desired features
- * \param n_detected the number previously detected
- */
- virtual void tooFew(int min, int n_detected) = 0;
- /** too many features were detected so, adjust the detector params accordingly
- * \param max the maximum number of desired features
- * \param n_detected the number previously detected
- */
- virtual void tooMany(int max, int n_detected) = 0;
- /** are params maxed out or still valid?
- * \return false if the parameters can't be adjusted any more
- */
- virtual bool good() const = 0;
-
- virtual Ptr clone() const = 0;
-
- static Ptr create( const string& detectorType );
-};
-/** \brief an adaptively adjusting detector that iteratively detects until the desired number
- * of features are detected.
- * Beware that this is not thread safe - as the adjustment of parameters breaks the const
- * of the detection routine...
- * /TODO Make this const correct and thread safe
- *
- * sample usage:
- //will create a detector that attempts to find 100 - 110 FAST Keypoints, and will at most run
- //FAST feature detection 10 times until that number of keypoints are found
- Ptr detector(new DynamicAdaptedFeatureDetector(new FastAdjuster(20,true),100, 110, 10));
-
- */
-class CV_EXPORTS DynamicAdaptedFeatureDetector: public FeatureDetector
-{
-public:
-
- /** \param adjaster an AdjusterAdapter that will do the detection and parameter adjustment
- * \param max_features the maximum desired number of features
- * \param max_iters the maximum number of times to try to adjust the feature detector params
- * for the FastAdjuster this can be high, but with Star or Surf this can get time consuming
- * \param min_features the minimum desired features
- */
- DynamicAdaptedFeatureDetector( const Ptr& adjaster, int min_features=400, int max_features=500, int max_iters=5 );
-
- virtual bool empty() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
-private:
- DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&);
- DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&);
-
- int escape_iters_;
- int min_features_, max_features_;
- const Ptr adjuster_;
-};
-
-/**\brief an adjust for the FAST detector. This will basically decrement or increment the
- * threshold by 1
- */
-class CV_EXPORTS FastAdjuster: public AdjusterAdapter
-{
-public:
- /**\param init_thresh the initial threshold to start with, default = 20
- * \param nonmax whether to use non max or not for fast feature detection
- */
- FastAdjuster(int init_thresh=20, bool nonmax=true, int min_thresh=1, int max_thresh=200);
-
- virtual void tooFew(int min, int n_detected);
- virtual void tooMany(int max, int n_detected);
- virtual bool good() const;
-
- virtual Ptr clone() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- int thresh_;
- bool nonmax_;
- int init_thresh_, min_thresh_, max_thresh_;
-};
-
-
-/** An adjuster for StarFeatureDetector, this one adjusts the responseThreshold for now
- * TODO find a faster way to converge the parameters for Star - use CvStarDetectorParams
- */
-class CV_EXPORTS StarAdjuster: public AdjusterAdapter
-{
-public:
- StarAdjuster(double initial_thresh=30.0, double min_thresh=2., double max_thresh=200.);
-
- virtual void tooFew(int min, int n_detected);
- virtual void tooMany(int max, int n_detected);
- virtual bool good() const;
-
- virtual Ptr clone() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- double thresh_, init_thresh_, min_thresh_, max_thresh_;
- CvStarDetectorParams params_; //todo use these instead of thresh_
-};
-
-class CV_EXPORTS SurfAdjuster: public AdjusterAdapter
-{
-public:
- SurfAdjuster( double initial_thresh=400.f, double min_thresh=2, double max_thresh=1000 );
-
- virtual void tooFew(int min, int n_detected);
- virtual void tooMany(int max, int n_detected);
- virtual bool good() const;
-
- virtual Ptr clone() const;
-
-protected:
- virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const;
-
- double thresh_, init_thresh_, min_thresh_, max_thresh_;
-};
-
-CV_EXPORTS Mat windowedMatchingMask( const vector& keypoints1, const vector& keypoints2,
- float maxDeltaX, float maxDeltaY );
-
-/****************************************************************************************\
-* DescriptorExtractor *
-\****************************************************************************************/
-
-/*
- * Abstract base class for computing descriptors for image keypoints.
- *
- * In this interface we assume a keypoint descriptor can be represented as a
- * dense, fixed-dimensional vector of some basic type. Most descriptors used
- * in practice follow this pattern, as it makes it very easy to compute
- * distances between descriptors. Therefore we represent a collection of
- * descriptors as a cv::Mat, where each row is one keypoint descriptor.
- */
-class CV_EXPORTS DescriptorExtractor
-{
-public:
- virtual ~DescriptorExtractor();
-
- /*
- * Compute the descriptors for a set of keypoints in an image.
- * image The image.
- * keypoints The input keypoints. Keypoints for which a descriptor cannot be computed are removed.
- * descriptors Copmputed descriptors. Row i is the descriptor for keypoint i.
- */
- void compute( const Mat& image, vector& keypoints, Mat& descriptors ) const;
-
- /*
- * Compute the descriptors for a keypoints collection detected in image collection.
- * images Image collection.
- * keypoints Input keypoints collection. keypoints[i] is keypoints detected in images[i].
- * Keypoints for which a descriptor cannot be computed are removed.
- * descriptors Descriptor collection. descriptors[i] are descriptors computed for set keypoints[i].
- */
- void compute( const vector& images, vector >& keypoints, vector& descriptors ) const;
-
- virtual void read( const FileNode& );
- virtual void write( FileStorage& ) const;
-
- virtual int descriptorSize() const = 0;
- virtual int descriptorType() const = 0;
-
- virtual bool empty() const;
-
- static Ptr create( const string& descriptorExtractorType );
-
-protected:
- virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const = 0;
-
- /*
- * Remove keypoints within borderPixels of an image edge.
- */
- static void removeBorderKeypoints( vector& keypoints,
- Size imageSize, int borderSize );
-};
-
-/*
- * SiftDescriptorExtractor
- */
-class CV_EXPORTS SiftDescriptorExtractor : public DescriptorExtractor
-{
-public:
- SiftDescriptorExtractor( const SIFT::DescriptorParams& descriptorParams=SIFT::DescriptorParams(),
- const SIFT::CommonParams& commonParams=SIFT::CommonParams() );
- SiftDescriptorExtractor( double magnification, bool isNormalize=true, bool recalculateAngles=true,
- int nOctaves=SIFT::CommonParams::DEFAULT_NOCTAVES,
- int nOctaveLayers=SIFT::CommonParams::DEFAULT_NOCTAVE_LAYERS,
- int firstOctave=SIFT::CommonParams::DEFAULT_FIRST_OCTAVE,
- int angleMode=SIFT::CommonParams::FIRST_ANGLE );
-
- virtual void read( const FileNode &fn );
- virtual void write( FileStorage &fs ) const;
-
- virtual int descriptorSize() const;
- virtual int descriptorType() const;
-
-protected:
- virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
-
- SIFT sift;
-};
-
-/*
- * SurfDescriptorExtractor
- */
-class CV_EXPORTS SurfDescriptorExtractor : public DescriptorExtractor
-{
-public:
- SurfDescriptorExtractor( int nOctaves=4, int nOctaveLayers=2, bool extended=false, bool upright=false );
-
- virtual void read( const FileNode &fn );
- virtual void write( FileStorage &fs ) const;
-
- virtual int descriptorSize() const;
- virtual int descriptorType() const;
-
-protected:
- virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
-
- SURF surf;
-};
-
-/** The descriptor extractor for the ORB descriptor
- * There are two ways to speed up its computation:
- * - if you know the step size of the integral image, use setStepSize so that offsets are precomputed and cached
- * - if you know the integral image, use setIntegralImage so that it is not recomputed. This calls
- * setStepSize automatically
- */
-class OrbDescriptorExtractor : public cv::DescriptorExtractor
-{
-public:
- /** default constructor
- * @param params parameters to use
- */
- OrbDescriptorExtractor(ORB::CommonParams params = ORB::CommonParams());
-
- /** destructor */
- ~OrbDescriptorExtractor()
- {
- }
-
- virtual int descriptorSize() const;
- virtual int descriptorType() const;
-
- virtual void read(const cv::FileNode&);
- virtual void write(cv::FileStorage&) const;
-
-protected:
- void computeImpl(const cv::Mat& image, std::vector& keypoints, cv::Mat& descriptors) const;
-private:
- /** the ORB object we use for the computations */
- mutable ORB orb_;
- /** The parameters used */
- ORB::CommonParams params_;
-};
-
-/*
- * CalonderDescriptorExtractor
- */
-template
-class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor
-{
-public:
- CalonderDescriptorExtractor( const string& classifierFile );
-
- virtual void read( const FileNode &fn );
- virtual void write( FileStorage &fs ) const;
-
- virtual int descriptorSize() const { return classifier_.classes(); }
- virtual int descriptorType() const { return DataType::type; }
-
- virtual bool empty() const;
-
-protected:
- virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
-
- RTreeClassifier classifier_;
- static const int BORDER_SIZE = 16;
-};
-
-template
-CalonderDescriptorExtractor::CalonderDescriptorExtractor(const std::string& classifier_file)
-{
- classifier_.read( classifier_file.c_str() );
-}
-
-template
-void CalonderDescriptorExtractor::computeImpl( const cv::Mat& image,
- std::vector& keypoints,
- cv::Mat& descriptors) const
-{
- // Cannot compute descriptors for keypoints on the image border.
- KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);
-
- /// @todo Check 16-byte aligned
- descriptors.create(keypoints.size(), classifier_.classes(), cv::DataType::type);
-
- int patchSize = RandomizedTree::PATCH_SIZE;
- int offset = patchSize / 2;
- for (size_t i = 0; i < keypoints.size(); ++i)
- {
- cv::Point2f pt = keypoints[i].pt;
- IplImage ipl = image( Rect((int)(pt.x - offset), (int)(pt.y - offset), patchSize, patchSize) );
- classifier_.getSignature( &ipl, descriptors.ptr(i));
- }
-}
-
-template
-void CalonderDescriptorExtractor::read( const FileNode& )
-{}
-
-template
-void CalonderDescriptorExtractor::write( FileStorage& ) const
-{}
-
-template
-bool CalonderDescriptorExtractor::empty() const
-{
- return classifier_.trees_.empty();
-}
-
-/*
- * OpponentColorDescriptorExtractor
- *
- * Adapts a descriptor extractor to compute descripors in Opponent Color Space
- * (refer to van de Sande et al., CGIV 2008 "Color Descriptors for Object Category Recognition").
- * Input RGB image is transformed in Opponent Color Space. Then unadapted descriptor extractor
- * (set in constructor) computes descriptors on each of the three channel and concatenate
- * them into a single color descriptor.
- */
-class CV_EXPORTS OpponentColorDescriptorExtractor : public DescriptorExtractor
-{
-public:
- OpponentColorDescriptorExtractor( const Ptr& descriptorExtractor );
-
- virtual void read( const FileNode& );
- virtual void write( FileStorage& ) const;
-
- virtual int descriptorSize() const;
- virtual int descriptorType() const;
-
- virtual bool empty() const;
-
-protected:
- virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const;
-
- Ptr descriptorExtractor;
-};
-
-/*
- * BRIEF Descriptor
- */
-class CV_EXPORTS BriefDescriptorExtractor : public DescriptorExtractor
-{
-public:
- static const int PATCH_SIZE = 48;
- static const int KERNEL_SIZE = 9;
-
- // bytes is a length of descriptor in bytes. It can be equal 16, 32 or 64 bytes.
- BriefDescriptorExtractor( int bytes = 32 );
-
- virtual int descriptorSize() const;
- virtual int descriptorType() const;
-
- /// @todo read and write for brief
-
-protected:
- virtual void computeImpl(const Mat& image, std::vector& keypoints, Mat& descriptors) const;
-
- typedef void(*PixelTestFn)(const Mat&, const std::vector&, Mat&);
-
- int bytes_;
- PixelTestFn test_fn_;
-};
-
-/****************************************************************************************\
-* Distance *
-\****************************************************************************************/
-template
-struct CV_EXPORTS Accumulator
-{
- typedef T Type;
-};
-
-template<> struct Accumulator { typedef float Type; };
-template<> struct Accumulator { typedef float Type; };
-template<> struct Accumulator { typedef float Type; };
-template<> struct Accumulator { typedef float Type; };
-
-/*
- * Squared Euclidean distance functor
- */
-template
-struct CV_EXPORTS L2
-{
- typedef T ValueType;
- typedef typename Accumulator::Type ResultType;
-
- ResultType operator()( const T* a, const T* b, int size ) const
- {
- ResultType result = ResultType();
- for( int i = 0; i < size; i++ )
- {
- ResultType diff = (ResultType)(a[i] - b[i]);
- result += diff*diff;
- }
- return (ResultType)sqrt((double)result);
- }
-};
-
-/*
- * Manhattan distance (city block distance) functor
- */
-template
-struct CV_EXPORTS L1
-{
- typedef T ValueType;
- typedef typename Accumulator::Type ResultType;
-
- ResultType operator()( const T* a, const T* b, int size ) const
- {
- ResultType result = ResultType();
- for( int i = 0; i < size; i++ )
- {
- ResultType diff = a[i] - b[i];
- result += (ResultType)fabs( diff );
- }
- return result;
- }
-};
-
-/*
- * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor
- * bit count of A exclusive XOR'ed with B
- */
-struct CV_EXPORTS HammingLUT
-{
- typedef unsigned char ValueType;
- typedef int ResultType;
-
- /** this will count the bits in a ^ b
- */
- ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const;
-
- /** \brief given a byte, count the bits using a compile time generated look up table
- * \param b the byte to count bits. The look up table has an entry for all
- * values of b, where that entry is the number of bits.
- * \return the number of bits in byte b
- */
- static unsigned char byteBitsLookUp(unsigned char b);
-};
-
-
-/// Hamming distance functor, this one will try to use gcc's __builtin_popcountl
-/// but will fall back on HammingLUT if not available
-/// bit count of A exclusive XOR'ed with B
-struct CV_EXPORTS Hamming
-{
- typedef unsigned char ValueType;
-
- //! important that this is signed as weird behavior happens
- // in BruteForce if not
- typedef int ResultType;
-
- /** this will count the bits in a ^ b, using __builtin_popcountl try compiling with sse4
- */
- ResultType operator()(const unsigned char* a, const unsigned char* b, int size) const;
-};
-
-
-/****************************************************************************************\
-* DMatch *
-\****************************************************************************************/
-/*
- * Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors.
- */
-struct CV_EXPORTS DMatch
-{
- DMatch() : queryIdx(-1), trainIdx(-1), imgIdx(-1), distance(std::numeric_limits::max()) {}
- DMatch( int _queryIdx, int _trainIdx, float _distance ) :
- queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1), distance(_distance) {}
- DMatch( int _queryIdx, int _trainIdx, int _imgIdx, float _distance ) :
- queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx), distance(_distance) {}
-
- int queryIdx; // query descriptor index
- int trainIdx; // train descriptor index
- int imgIdx; // train image index
-
- float distance;
-
- // less is better
- bool operator<( const DMatch &m ) const
- {
- return distance < m.distance;
- }
-};
-
-/****************************************************************************************\
-* DescriptorMatcher *
-\****************************************************************************************/
-/*
- * Abstract base class for matching two sets of descriptors.
- */
-class CV_EXPORTS DescriptorMatcher
-{
-public:
- virtual ~DescriptorMatcher();
-
- /*
- * Add descriptors to train descriptor collection.
- * descriptors Descriptors to add. Each descriptors[i] is a descriptors set from one image.
- */
- virtual void add( const vector& descriptors );
- /*
- * Get train descriptors collection.
- */
- const vector& getTrainDescriptors() const;
- /*
- * Clear train descriptors collection.
- */
- virtual void clear();
-
- /*
- * Return true if there are not train descriptors in collection.
- */
- virtual bool empty() const;
- /*
- * Return true if the matcher supports mask in match methods.
- */
- virtual bool isMaskSupported() const = 0;
-
- /*
- * Train matcher (e.g. train flann index).
- * In all methods to match the method train() is run every time before matching.
- * Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation
- * of this method, other matchers really train their inner structures
- * (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation
- * of train() should check the class object state and do traing/retraining
- * only if the state requires that (e.g. FlannBasedMatcher trains flann::Index
- * if it has not trained yet or if new descriptors have been added to the train
- * collection).
- */
- virtual void train();
- /*
- * Group of methods to match descriptors from image pair.
- * Method train() is run in this methods.
- */
- // Find one best match for each query descriptor (if mask is empty).
- void match( const Mat& queryDescriptors, const Mat& trainDescriptors,
- vector& matches, const Mat& mask=Mat() ) const;
- // Find k best matches for each query descriptor (in increasing order of distances).
- // compactResult is used when mask is not empty. If compactResult is false matches
- // vector will have the same size as queryDescriptors rows. If compactResult is true
- // matches vector will not contain matches for fully masked out query descriptors.
- void knnMatch( const Mat& queryDescriptors, const Mat& trainDescriptors,
- vector >& matches, int k,
- const Mat& mask=Mat(), bool compactResult=false ) const;
- // Find best matches for each query descriptor which have distance less than
- // maxDistance (in increasing order of distances).
- void radiusMatch( const Mat& queryDescriptors, const Mat& trainDescriptors,
- vector >& matches, float maxDistance,
- const Mat& mask=Mat(), bool compactResult=false ) const;
- /*
- * Group of methods to match descriptors from one image to image set.
- * See description of similar methods for matching image pair above.
- */
- void match( const Mat& queryDescriptors, vector& matches,
- const vector& masks=vector() );
- void knnMatch( const Mat& queryDescriptors, vector >& matches, int k,
- const vector& masks=vector(), bool compactResult=false );
- void radiusMatch( const Mat& queryDescriptors, vector >& matches, float maxDistance,
- const vector& masks=vector(), bool compactResult=false );
-
- // Reads matcher object from a file node
- virtual void read( const FileNode& );
- // Writes matcher object to a file storage
- virtual void write( FileStorage& ) const;
-
- // Clone the matcher. If emptyTrainData is false the method create deep copy of the object, i.e. copies
- // both parameters and train data. If emptyTrainData is true the method create object copy with current parameters
- // but with empty train data.
- virtual Ptr clone( bool emptyTrainData=false ) const = 0;
-
- static Ptr create( const string& descriptorMatcherType );
-protected:
- /*
- * Class to work with descriptors from several images as with one merged matrix.
- * It is used e.g. in FlannBasedMatcher.
- */
- class CV_EXPORTS DescriptorCollection
- {
- public:
- DescriptorCollection();
- DescriptorCollection( const DescriptorCollection& collection );
- virtual ~DescriptorCollection();
-
- // Vector of matrices "descriptors" will be merged to one matrix "mergedDescriptors" here.
- void set( const vector& descriptors );
- virtual void clear();
-
- const Mat& getDescriptors() const;
- const Mat getDescriptor( int imgIdx, int localDescIdx ) const;
- const Mat getDescriptor( int globalDescIdx ) const;
- void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const;
-
- int size() const;
-
- protected:
- Mat mergedDescriptors;
- vector startIdxs;
- };
-
- // In fact the matching is implemented only by the following two methods. These methods suppose
- // that the class object has been trained already. Public match methods call these methods
- // after calling train().
- virtual void knnMatchImpl( const Mat& queryDescriptors, vector >& matches, int k,
- const vector& masks=vector(), bool compactResult=false ) = 0;
- virtual void radiusMatchImpl( const Mat& queryDescriptors, vector >& matches, float maxDistance,
- const vector& masks=vector(), bool compactResult=false ) = 0;
-
- static bool isPossibleMatch( const Mat& mask, int queryIdx, int trainIdx );
- static bool isMaskedOut( const vector& masks, int queryIdx );
-
- static Mat clone_op( Mat m ) { return m.clone(); }
- void checkMasks( const vector& masks, int queryDescriptorsCount ) const;
-
- // Collection of descriptors from train images.
- vector trainDescCollection;
-};
-
-/*
- * Brute-force descriptor matcher.
- *
- * For each descriptor in the first set, this matcher finds the closest
- * descriptor in the second set by trying each one.
- *
- * For efficiency, BruteForceMatcher is templated on the distance metric.
- * For float descriptors, a common choice would be cv::L2.
- */
-template
-class CV_EXPORTS BruteForceMatcher : public DescriptorMatcher
-{
-public:
- BruteForceMatcher( Distance d = Distance() ) : distance(d) {}
- virtual ~BruteForceMatcher() {}
-
- virtual bool isMaskSupported() const { return true; }
-
- virtual Ptr clone( bool emptyTrainData=false ) const;
-
-protected:
- virtual void knnMatchImpl( const Mat& queryDescriptors, vector >& matches, int k,
- const vector& masks=vector(), bool compactResult=false );
- virtual void radiusMatchImpl( const Mat& queryDescriptors, vector >& matches, float maxDistance,
- const vector& masks=vector(), bool compactResult=false );
-
- Distance distance;
-
-private:
- /*
- * Next two methods are used to implement specialization.
- */
- static void commonKnnMatchImpl( BruteForceMatcher& matcher,
- const Mat& queryDescriptors, vector >& matches, int k,
- const vector& masks, bool compactResult );
- static void commonRadiusMatchImpl( BruteForceMatcher& matcher,
- const Mat& queryDescriptors, vector >& matches, float maxDistance,
- const vector& masks, bool compactResult );
-};
-
-template
-Ptr BruteForceMatcher::clone( bool emptyTrainData ) const
-{
- BruteForceMatcher* matcher = new BruteForceMatcher(distance);
- if( !emptyTrainData )
- {
- std::transform( trainDescCollection.begin(), trainDescCollection.end(),
- matcher->trainDescCollection.begin(), clone_op );
- }
- return matcher;
-}
-
-template
-void BruteForceMatcher