diff --git a/android/scripts/ABI_compat_generator.py b/android/scripts/ABI_compat_generator.py
index 462ac1bca..7e884dbaf 100755
--- a/android/scripts/ABI_compat_generator.py
+++ b/android/scripts/ABI_compat_generator.py
@@ -57,13 +57,12 @@ PROJECT_NAME = sys.argv[2]
CLASS_PATH = os.path.join(INSTALL_DIRECTORY, "sdk/java/bin/classes")
if (not os.path.exists(CLASS_PATH)):
- print("Error: no java classes found in \"%s\"", CLASS_PATH)
+ print("Error: no java classes found in \"%s\"" % CLASS_PATH)
exit(-2)
if (os.environ.has_key("NDK_ROOT")):
ANDROID_NDK_PATH = os.environ["NDK_ROOT"];
print("Using Android NDK from NDK_ROOT (\"%s\")" % ANDROID_NDK_PATH)
-
if (not ANDROID_NDK_PATH):
pipe = os.popen("which ndk-build")
@@ -112,13 +111,14 @@ outputFile.write("\n\t" + "\n\t".join(cppHeaders))
outputFile.write("\n\t" + "\n\t".join(jniHeaders))
outputFile.write("\n\n\n")
-includes = []
+includes = [os.path.join(INSTALL_DIRECTORY, "sdk", "native", "jni", "include"),
+ os.path.join(INSTALL_DIRECTORY, "sdk", "native", "jni", "include", "opencv"),
+ os.path.join(INSTALL_DIRECTORY, "sdk", "native", "jni", "include", "opencv2")]
+
for inc in SYS_INCLUDES:
includes.append(os.path.join(ANDROID_NDK_PATH, inc))
-outputFile.write("\n\tOpenCV-2.4.2-branch/sdk/native/jni/include\n\tOpenCV-2.4.2-branch/sdk/native/jni/include/opencv\n\tOpenCV-2.4.2-branch/sdk/native/jni/include/opencv2\n")
-
-outputFile.write("\t%s\n\n\n" % "\n\t".join(includes))
+outputFile.write("\n\t%s\n\n\n" % "\n\t".join(includes))
libraries = []
for lib in TARGET_LIBS:
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 72c7fc830..91b65f59a 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -581,7 +581,7 @@ function(ocv_add_perf_tests)
__ocv_parse_test_sources(PERF ${ARGN})
# opencv_highgui is required for imread/imwrite
- set(perf_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_PERF_${the_module}_DEPS})
+ set(perf_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_PERF_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
ocv_check_dependencies(${perf_deps})
if(OCV_DEPENDENCIES_FOUND)
@@ -632,7 +632,7 @@ function(ocv_add_accuracy_tests)
__ocv_parse_test_sources(TEST ${ARGN})
# opencv_highgui is required for imread/imwrite
- set(test_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_TEST_${the_module}_DEPS})
+ set(test_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_TEST_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
ocv_check_dependencies(${test_deps})
if(OCV_DEPENDENCIES_FOUND)
diff --git a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
index db109adae..5dd1c40f6 100644
--- a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
+++ b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
@@ -323,7 +323,7 @@ We recommend the approach based on Eclipse :abbr:`CDT(C/C++ Development Tooling)
:alt: Eclipse About
:align: center
-.. important:: OpenCV for Android 2.4.2 package contains sample projects pre-configured CDT Builders. For your own projects follow the steps below.
+.. important:: OpenCV for Android package since version 2.4.2 contains sample projects pre-configured CDT Builders. For your own projects follow the steps below.
#. Define the ``NDKROOT`` environment variable containing the path to Android NDK in your system (e.g. ``"X:\\Apps\\android-ndk-r8"`` or ``"/opt/android-ndk-r8"``).
**On Windows** an environment variable can be set via :guilabel:`My Computer -> Properties -> Advanced -> Environment variables` and restarting Eclipse.
diff --git a/doc/tutorials/introduction/windows_install/windows_install.rst b/doc/tutorials/introduction/windows_install/windows_install.rst
index bf48f89cb..f6397ae78 100644
--- a/doc/tutorials/introduction/windows_install/windows_install.rst
+++ b/doc/tutorials/introduction/windows_install/windows_install.rst
@@ -16,7 +16,7 @@ Installation by using the pre-built libraries
1. Open up a web browser and go to: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/
-#. Open the folder for the latest version (currently this is 2.4.2).
+#. Open the folder for the latest version (currently this is |release|).
#. Choose a build you want to use and download it. The naming conventions used will show what kind of support they offer. For example:
diff --git a/modules/calib3d/perf/perf_pnp.cpp b/modules/calib3d/perf/perf_pnp.cpp
index 746f548e8..b32b96cae 100644
--- a/modules/calib3d/perf/perf_pnp.cpp
+++ b/modules/calib3d/perf/perf_pnp.cpp
@@ -1,4 +1,5 @@
#include "perf_precomp.hpp"
+#include "opencv2/core/internal.hpp"
using namespace std;
using namespace cv;
@@ -48,7 +49,10 @@ PERF_TEST_P(PointsNum_Algo, solvePnP,
declare.in(points3d, points2d);
- TEST_CYCLE_N(1000) solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, algo);
+ TEST_CYCLE_N(1000)
+ {
+ solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, algo);
+ }
SANITY_CHECK(rvec, 1e-6);
SANITY_CHECK(tvec, 1e-6);
@@ -83,7 +87,10 @@ PERF_TEST(PointsNum_Algo, solveP3P)
declare.in(points3d, points2d);
- TEST_CYCLE_N(1000) solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, CV_P3P);
+ TEST_CYCLE_N(1000)
+ {
+ solvePnP(points3d, points2d, intrinsics, distortion, rvec, tvec, false, CV_P3P);
+ }
SANITY_CHECK(rvec, 1e-6);
SANITY_CHECK(tvec, 1e-6);
@@ -117,9 +124,10 @@ PERF_TEST_P(PointsNum, SolvePnPRansac, testing::Values(4, 3*9, 7*13))
Mat rvec;
Mat tvec;
- solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
-
- declare.time(3.0);
+#ifdef HAVE_TBB
+ // limit concurrency to get determenistic result
+ cv::Ptr one_thread = new tbb::task_scheduler_init(1);
+#endif
TEST_CYCLE()
{
diff --git a/modules/calib3d/src/solvepnp.cpp b/modules/calib3d/src/solvepnp.cpp
index 125d7a9fa..25988be48 100644
--- a/modules/calib3d/src/solvepnp.cpp
+++ b/modules/calib3d/src/solvepnp.cpp
@@ -260,6 +260,8 @@ namespace cv
{
rvec.copyTo(initRvec);
tvec.copyTo(initTvec);
+
+ generator.state = theRNG().state; //to control it somehow...
}
private:
PnPSolver& operator=(const PnPSolver&);
diff --git a/modules/contrib/include/opencv2/contrib/detection_based_tracker.hpp b/modules/contrib/include/opencv2/contrib/detection_based_tracker.hpp
index c29031803..dc157b17a 100644
--- a/modules/contrib/include/opencv2/contrib/detection_based_tracker.hpp
+++ b/modules/contrib/include/opencv2/contrib/detection_based_tracker.hpp
@@ -27,6 +27,7 @@ class DetectionBasedTracker
minNeighbours(2),
scaleFactor(1.1f)
{}
+ virtual ~IDetector() {}
virtual void detect(const cv::Mat& image, std::vector& objects) = 0;
@@ -62,7 +63,6 @@ class DetectionBasedTracker
{
minNeighbours = value;
}
- virtual ~IDetector() {}
protected:
cv::Size minObjSize;
@@ -107,7 +107,6 @@ class DetectionBasedTracker
};
virtual void getObjects(std::vector& result) const;
-
virtual int addObject(const cv::Rect& location); //returns id of the new object
protected:
@@ -170,7 +169,7 @@ class DetectionBasedTracker
namespace cv
{
- typedef ::DetectionBasedTracker DetectionBasedTracker;
-
+ using ::DetectionBasedTracker;
} //end of cv namespace
+
#endif
diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp
index d2f281914..b90f59f6b 100644
--- a/modules/core/src/arithm.cpp
+++ b/modules/core/src/arithm.cpp
@@ -1278,7 +1278,11 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
"nor 'array op scalar', nor 'scalar op array'" );
haveScalar = true;
CV_Assert(src2.type() == CV_64F && (src2.rows == 4 || src2.rows == 1));
- depth2 = MAX(src1.depth(), actualScalarDepth(src2.ptr(), src1.channels()));
+
+ if (usrdata == 0) // hack to filter out multiply and divide
+ depth2 = actualScalarDepth(src2.ptr(), src1.channels());
+ else
+ depth2 = CV_64F;
}
int cn = src1.channels(), depth1 = src1.depth(), wtype;
diff --git a/modules/features2d/perf/perf_batchDistance.cpp b/modules/features2d/perf/perf_batchDistance.cpp
index e95a41c1d..aa57d88d0 100644
--- a/modules/features2d/perf/perf_batchDistance.cpp
+++ b/modules/features2d/perf/perf_batchDistance.cpp
@@ -6,17 +6,15 @@ using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;
-CV_FLAGS(NormType, NORM_L1, NORM_L2, NORM_L2SQR, NORM_HAMMING, NORM_HAMMING2)
-CV_ENUM(SourceType, CV_32F, CV_8U)
-CV_ENUM(DestinationType, CV_32F, CV_32S)
+CV_ENUM(NormType, NORM_L1, NORM_L2, NORM_L2SQR, NORM_HAMMING, NORM_HAMMING2)
-typedef std::tr1::tuple Norm_Destination_CrossCheck_t;
+typedef std::tr1::tuple Norm_Destination_CrossCheck_t;
typedef perf::TestBaseWithParam Norm_Destination_CrossCheck;
typedef std::tr1::tuple Norm_CrossCheck_t;
typedef perf::TestBaseWithParam Norm_CrossCheck;
-typedef std::tr1::tuple Source_CrossCheck_t;
+typedef std::tr1::tuple Source_CrossCheck_t;
typedef perf::TestBaseWithParam Source_CrossCheck;
void generateData( Mat& query, Mat& train, const int sourceType );
@@ -29,27 +27,25 @@ PERF_TEST_P(Norm_Destination_CrossCheck, batchDistance_8U,
)
{
NormType normType = get<0>(GetParam());
- DestinationType destinationType = get<1>(GetParam());
+ int destinationType = get<1>(GetParam());
bool isCrossCheck = get<2>(GetParam());
+ int knn = isCrossCheck ? 1 : 0;
Mat queryDescriptors;
Mat trainDescriptors;
Mat dist;
Mat ndix;
- int knn = 1;
generateData(queryDescriptors, trainDescriptors, CV_8U);
- if(!isCrossCheck)
- {
- knn = 0;
- }
- declare.time(30);
TEST_CYCLE()
{
batchDistance(queryDescriptors, trainDescriptors, dist, destinationType, (isCrossCheck) ? ndix : noArray(),
normType, knn, Mat(), 0, isCrossCheck);
}
+
+ SANITY_CHECK(dist);
+ if (isCrossCheck) SANITY_CHECK(ndix);
}
PERF_TEST_P(Norm_CrossCheck, batchDistance_Dest_32S,
@@ -60,25 +56,23 @@ PERF_TEST_P(Norm_CrossCheck, batchDistance_Dest_32S,
{
NormType normType = get<0>(GetParam());
bool isCrossCheck = get<1>(GetParam());
+ int knn = isCrossCheck ? 1 : 0;
Mat queryDescriptors;
Mat trainDescriptors;
Mat dist;
Mat ndix;
- int knn = 1;
generateData(queryDescriptors, trainDescriptors, CV_8U);
- if(!isCrossCheck)
- {
- knn = 0;
- }
- declare.time(30);
TEST_CYCLE()
{
batchDistance(queryDescriptors, trainDescriptors, dist, CV_32S, (isCrossCheck) ? ndix : noArray(),
normType, knn, Mat(), 0, isCrossCheck);
}
+
+ SANITY_CHECK(dist);
+ if (isCrossCheck) SANITY_CHECK(ndix);
}
PERF_TEST_P(Source_CrossCheck, batchDistance_L2,
@@ -87,27 +81,25 @@ PERF_TEST_P(Source_CrossCheck, batchDistance_L2,
)
)
{
- SourceType sourceType = get<0>(GetParam());
+ int sourceType = get<0>(GetParam());
bool isCrossCheck = get<1>(GetParam());
+ int knn = isCrossCheck ? 1 : 0;
Mat queryDescriptors;
Mat trainDescriptors;
Mat dist;
Mat ndix;
- int knn = 1;
generateData(queryDescriptors, trainDescriptors, sourceType);
- if(!isCrossCheck)
- {
- knn = 0;
- }
- declare.time(30);
TEST_CYCLE()
{
batchDistance(queryDescriptors, trainDescriptors, dist, CV_32F, (isCrossCheck) ? ndix : noArray(),
NORM_L2, knn, Mat(), 0, isCrossCheck);
}
+
+ SANITY_CHECK(dist);
+ if (isCrossCheck) SANITY_CHECK(ndix);
}
PERF_TEST_P(Norm_CrossCheck, batchDistance_32F,
@@ -118,25 +110,23 @@ PERF_TEST_P(Norm_CrossCheck, batchDistance_32F,
{
NormType normType = get<0>(GetParam());
bool isCrossCheck = get<1>(GetParam());
+ int knn = isCrossCheck ? 1 : 0;
Mat queryDescriptors;
Mat trainDescriptors;
Mat dist;
Mat ndix;
- int knn = 1;
generateData(queryDescriptors, trainDescriptors, CV_32F);
- if(!isCrossCheck)
- {
- knn = 0;
- }
- declare.time(30);
TEST_CYCLE()
{
batchDistance(queryDescriptors, trainDescriptors, dist, CV_32F, (isCrossCheck) ? ndix : noArray(),
normType, knn, Mat(), 0, isCrossCheck);
}
+
+ SANITY_CHECK(dist);
+ if (isCrossCheck) SANITY_CHECK(ndix);
}
void generateData( Mat& query, Mat& train, const int sourceType )
diff --git a/modules/features2d/perf/perf_fast.cpp b/modules/features2d/perf/perf_fast.cpp
index 0abf56b56..f550f7b33 100644
--- a/modules/features2d/perf/perf_fast.cpp
+++ b/modules/features2d/perf/perf_fast.cpp
@@ -6,15 +6,23 @@ using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;
-typedef perf::TestBaseWithParam fast;
+enum { TYPE_5_8 =FastFeatureDetector::TYPE_5_8, TYPE_7_12 = FastFeatureDetector::TYPE_7_12, TYPE_9_16 = FastFeatureDetector::TYPE_9_16 };
+CV_ENUM(FastType, TYPE_5_8, TYPE_7_12, TYPE_9_16)
+
+typedef std::tr1::tuple File_Type_t;
+typedef perf::TestBaseWithParam fast;
#define FAST_IMAGES \
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
"stitching/a3.png"
-PERF_TEST_P(fast, detectForORB, testing::Values(FAST_IMAGES))
+PERF_TEST_P(fast, detect, testing::Combine(
+ testing::Values(FAST_IMAGES),
+ testing::ValuesIn(FastType::all())
+ ))
{
- String filename = getDataPath(GetParam());
+ String filename = getDataPath(get<0>(GetParam()));
+ int type = get<1>(GetParam());
Mat frame = imread(filename, IMREAD_GRAYSCALE);
if (frame.empty())
@@ -22,13 +30,11 @@ PERF_TEST_P(fast, detectForORB, testing::Values(FAST_IMAGES))
declare.in(frame);
- FastFeatureDetector fd(20, true, FastFeatureDetector::TYPE_5_8);
+ FastFeatureDetector fd(20, true, type);
vector points;
TEST_CYCLE() fd.detect(frame, points);
- fd = FastFeatureDetector(20, true, FastFeatureDetector::TYPE_7_12);
- TEST_CYCLE() fd.detect(frame, points);
- fd = FastFeatureDetector(20, true, FastFeatureDetector::TYPE_9_16);
- TEST_CYCLE() fd.detect(frame, points);
+
+ SANITY_CHECK_KEYPOINTS(points);
}
diff --git a/modules/features2d/perf/perf_orb.cpp b/modules/features2d/perf/perf_orb.cpp
index d318533ec..cf7b46b64 100644
--- a/modules/features2d/perf/perf_orb.cpp
+++ b/modules/features2d/perf/perf_orb.cpp
@@ -26,6 +26,8 @@ PERF_TEST_P(orb, detect, testing::Values(ORB_IMAGES))
vector points;
TEST_CYCLE() detector(frame, mask, points);
+
+ SANITY_CHECK_KEYPOINTS(points);
}
PERF_TEST_P(orb, extract, testing::Values(ORB_IMAGES))
@@ -46,6 +48,8 @@ PERF_TEST_P(orb, extract, testing::Values(ORB_IMAGES))
Mat descriptors;
TEST_CYCLE() detector(frame, mask, points, descriptors, true);
+
+ SANITY_CHECK(descriptors);
}
PERF_TEST_P(orb, full, testing::Values(ORB_IMAGES))
@@ -64,4 +68,7 @@ PERF_TEST_P(orb, full, testing::Values(ORB_IMAGES))
Mat descriptors;
TEST_CYCLE() detector(frame, mask, points, descriptors, false);
+
+ SANITY_CHECK_KEYPOINTS(points);
+ SANITY_CHECK(descriptors);
}
diff --git a/modules/highgui/perf/perf_input.cpp b/modules/highgui/perf/perf_input.cpp
index 421589529..79f864c8e 100644
--- a/modules/highgui/perf/perf_input.cpp
+++ b/modules/highgui/perf/perf_input.cpp
@@ -23,5 +23,6 @@ PERF_TEST_P(VideoCapture_Reading, ReadFile,
TEST_CYCLE() cap.open(filename);
- SANITY_CHECK(cap.isOpened());
+ bool dummy = cap.isOpened();
+ SANITY_CHECK(dummy);
}
diff --git a/modules/highgui/perf/perf_output.cpp b/modules/highgui/perf/perf_output.cpp
index e7ddaa607..851a2a6a0 100644
--- a/modules/highgui/perf/perf_output.cpp
+++ b/modules/highgui/perf/perf_output.cpp
@@ -25,5 +25,6 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
TEST_CYCLE() { Mat image = imread(filename, 1); writer << image; }
- SANITY_CHECK(writer.isOpened());
+ bool dummy = writer.isOpened();
+ SANITY_CHECK(dummy);
}
diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt
index 4b23effbc..7b8d0c17f 100644
--- a/modules/java/CMakeLists.txt
+++ b/modules/java/CMakeLists.txt
@@ -210,13 +210,7 @@ if(ANDROID)
list(REMOVE_ITEM android_lib_project_files "${ANDROID_MANIFEST_FILE}")
foreach(f ${android_lib_project_files})
if(NOT f MATCHES "\\.svn")
- add_custom_command(
- OUTPUT "${OpenCV_BINARY_DIR}/${f}"
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${f}" "${OpenCV_BINARY_DIR}/${f}"
- MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${f}"
- COMMENT "Generating ${f}"
- )
-
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${f}" "${OpenCV_BINARY_DIR}/${f}")
list(APPEND lib_proj_files "${OpenCV_BINARY_DIR}/${f}")
if(NOT f MATCHES "jni/.+")
@@ -250,11 +244,13 @@ if(ANDROID)
COMMAND ${CMAKE_COMMAND} -E remove ${lib_target_files}
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}"
COMMAND ${ANDROID_EXECUTABLE} --silent create lib-project --path \"${OpenCV_BINARY_DIR}\" --target \"${lib_target_sdk_target}\" --name OpenCV --package org.opencv 2>\"${CMAKE_CURRENT_BINARY_DIR}/create_lib_project.log\"
- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}"
DEPENDS ${lib_proj_files}
COMMENT "Generating OpenCV Android library project. SDK target: ${lib_target_sdk_target}"
)
+
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/android_lib/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}")
+
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_PROJECT_PROPERTIES_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main)
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main)
# creating empty 'gen' and 'res' folders
diff --git a/modules/java/android_lib/.classpath b/modules/java/android_lib/.classpath
index dd19757ca..98845764e 100644
--- a/modules/java/android_lib/.classpath
+++ b/modules/java/android_lib/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/modules/java/android_lib/.project b/modules/java/android_lib/.project
index 11eed7375..174e529f5 100644
--- a/modules/java/android_lib/.project
+++ b/modules/java/android_lib/.project
@@ -1,6 +1,6 @@
- OpenCV Library - 2.4.2
+ OpenCV Library - @OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@.@OPENCV_VERSION_PATCH@
diff --git a/modules/java/android_lib/AndroidManifest.xml b/modules/java/android_lib/AndroidManifest.xml
index 86008bf39..355971856 100644
--- a/modules/java/android_lib/AndroidManifest.xml
+++ b/modules/java/android_lib/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@"
+ android:versionName="@OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@.@OPENCV_VERSION_PATCH@"
diff --git a/modules/nonfree/perf/perf_surf.cpp b/modules/nonfree/perf/perf_surf.cpp
index 11227799b..8b14356b5 100644
--- a/modules/nonfree/perf/perf_surf.cpp
+++ b/modules/nonfree/perf/perf_surf.cpp
@@ -26,6 +26,8 @@ PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES))
vector points;
TEST_CYCLE() detector(frame, mask, points);
+
+ SANITY_CHECK_KEYPOINTS(points);
}
PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
@@ -45,6 +47,8 @@ PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
detector(frame, mask, points);
TEST_CYCLE() detector(frame, mask, points, descriptors, true);
+
+ SANITY_CHECK(descriptors, 1e-4);
}
PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
@@ -62,4 +66,7 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
vector descriptors;
TEST_CYCLE() detector(frame, mask, points, descriptors, false);
+
+ SANITY_CHECK_KEYPOINTS(points);
+ SANITY_CHECK(descriptors, 1e-4);
}
diff --git a/modules/stitching/include/opencv2/stitching/detail/util.hpp b/modules/stitching/include/opencv2/stitching/detail/util.hpp
index bce390b1a..15cecc749 100644
--- a/modules/stitching/include/opencv2/stitching/detail/util.hpp
+++ b/modules/stitching/include/opencv2/stitching/detail/util.hpp
@@ -46,7 +46,7 @@
#include
#include "opencv2/core/core.hpp"
-#define ENABLE_LOG 1
+#define ENABLE_LOG 0
// TODO remove LOG macros, add logging class
#if ENABLE_LOG
diff --git a/modules/stitching/perf/perf_stich.cpp b/modules/stitching/perf/perf_stich.cpp
index 946a5342a..3ee47a9f8 100644
--- a/modules/stitching/perf/perf_stich.cpp
+++ b/modules/stitching/perf/perf_stich.cpp
@@ -56,6 +56,8 @@ PERF_TEST_P(stitch, a123, TEST_DETECTORS)
stitcher.stitch(imgs, pano);
stopTimer();
}
+
+ SANITY_CHECK(pano, 2);
}
PERF_TEST_P(stitch, b12, TEST_DETECTORS)
@@ -88,6 +90,8 @@ PERF_TEST_P(stitch, b12, TEST_DETECTORS)
stitcher.stitch(imgs, pano);
stopTimer();
}
+
+ SANITY_CHECK(pano, 2);
}
PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
@@ -122,8 +126,7 @@ PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
detail::MatchesInfo pairwise_matches;
- declare.in(features1.descriptors, features2.descriptors)
- .iterations(100);
+ declare.in(features1.descriptors, features2.descriptors);
while(next())
{
@@ -133,6 +136,8 @@ PERF_TEST_P( match, bestOf2Nearest, TEST_DETECTORS)
stopTimer();
matcher->collectGarbage();
}
+
+ SANITY_CHECK_MATCHES(pairwise_matches.matches);
}
PERF_TEST_P( matchVector, bestOf2NearestVectorFeatures, testing::Combine(
@@ -186,4 +191,8 @@ PERF_TEST_P( matchVector, bestOf2NearestVectorFeatures, testing::Combine(
stopTimer();
matcher->collectGarbage();
}
+
+
+ std::vector& matches = pairwise_matches[0].matches;
+ SANITY_CHECK_MATCHES(matches);
}
diff --git a/modules/stitching/src/exposure_compensate.cpp b/modules/stitching/src/exposure_compensate.cpp
index 23bc16140..39aa316e0 100644
--- a/modules/stitching/src/exposure_compensate.cpp
+++ b/modules/stitching/src/exposure_compensate.cpp
@@ -74,7 +74,9 @@ void GainCompensator::feed(const vector &corners, const vector &imag
const vector > &masks)
{
LOGLN("Exposure compensation...");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
CV_Assert(corners.size() == images.size() && images.size() == masks.size());
diff --git a/modules/stitching/src/motion_estimators.cpp b/modules/stitching/src/motion_estimators.cpp
index bbbc9698c..9fb33b98d 100644
--- a/modules/stitching/src/motion_estimators.cpp
+++ b/modules/stitching/src/motion_estimators.cpp
@@ -105,7 +105,9 @@ void HomographyBasedEstimator::estimate(const vector &features, c
vector &cameras)
{
LOGLN("Estimating rotations...");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
const int num_images = static_cast(features.size());
@@ -172,7 +174,9 @@ void BundleAdjusterBase::estimate(const vector &features,
vector &cameras)
{
LOG_CHAT("Bundle adjustment");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
num_images_ = static_cast(features.size());
features_ = &features[0];
@@ -582,7 +586,9 @@ void BundleAdjusterRay::calcJacobian(Mat &jac)
void waveCorrect(vector &rmats, WaveCorrectKind kind)
{
LOGLN("Wave correcting...");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
Mat moment = Mat::zeros(3, 3, CV_32F);
for (size_t i = 0; i < rmats.size(); ++i)
diff --git a/modules/stitching/src/seam_finders.cpp b/modules/stitching/src/seam_finders.cpp
index 83f053c3b..44e3a916c 100644
--- a/modules/stitching/src/seam_finders.cpp
+++ b/modules/stitching/src/seam_finders.cpp
@@ -52,10 +52,12 @@ void PairwiseSeamFinder::find(const vector &src, const vector &corne
vector &masks)
{
LOGLN("Finding seams...");
- if (src.size() == 0)
+ if (src.size() == 0)
return;
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
images_ = src;
sizes_.resize(src.size());
@@ -87,10 +89,12 @@ void VoronoiSeamFinder::find(const vector &sizes, const vector &cor
vector &masks)
{
LOGLN("Finding seams...");
- if (sizes.size() == 0)
+ if (sizes.size() == 0)
return;
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
sizes_ = sizes;
corners_ = corners;
@@ -161,7 +165,9 @@ DpSeamFinder::DpSeamFinder(CostFunction costFunc) : costFunc_(costFunc) {}
void DpSeamFinder::find(const vector &src, const vector &corners, vector &masks)
{
LOGLN("Finding seams...");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
if (src.size() == 0)
return;
@@ -700,7 +706,7 @@ void DpSeamFinder::computeCosts(
{
CV_Assert(states_[comp] & INTERS);
- // compute costs
+ // compute costs
float (*diff)(const Mat&, int, int, const Mat&, int, int) = 0;
if (image1.type() == CV_32FC3 && image2.type() == CV_32FC3)
@@ -1055,10 +1061,10 @@ public:
void findInPair(size_t first, size_t second, Rect roi);
private:
- void setGraphWeightsColor(const Mat &img1, const Mat &img2,
+ void setGraphWeightsColor(const Mat &img1, const Mat &img2,
const Mat &mask1, const Mat &mask2, GCGraph &graph);
- void setGraphWeightsColorGrad(const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
- const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
+ void setGraphWeightsColorGrad(const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
+ const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
GCGraph &graph);
vector dx_, dy_;
@@ -1148,8 +1154,8 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColor(const Mat &img1, const Mat &
void GraphCutSeamFinder::Impl::setGraphWeightsColorGrad(
- const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
- const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
+ const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
+ const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
GCGraph &graph)
{
const Size img_size = img1.size();
@@ -1177,7 +1183,7 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColorGrad(
float grad = dx1.at(y, x) + dx1.at(y, x + 1) +
dx2.at(y, x) + dx2.at(y, x + 1) + weight_eps;
float weight = (normL2(img1.at(y, x), img2.at(y, x)) +
- normL2(img1.at(y, x + 1), img2.at(y, x + 1))) / grad +
+ normL2(img1.at(y, x + 1), img2.at(y, x + 1))) / grad +
weight_eps;
if (!mask1.at(y, x) || !mask1.at(y, x + 1) ||
!mask2.at(y, x) || !mask2.at(y, x + 1))
@@ -1186,10 +1192,10 @@ void GraphCutSeamFinder::Impl::setGraphWeightsColorGrad(
}
if (y < img_size.height - 1)
{
- float grad = dy1.at(y, x) + dy1.at(y + 1, x) +
+ float grad = dy1.at(y, x) + dy1.at(y + 1, x) +
dy2.at(y, x) + dy2.at(y + 1, x) + weight_eps;
- float weight = (normL2(img1.at(y, x), img2.at(y, x)) +
- normL2(img1.at(y + 1, x), img2.at(y + 1, x))) / grad +
+ float weight = (normL2(img1.at(y, x), img2.at(y, x)) +
+ normL2(img1.at(y + 1, x), img2.at(y + 1, x))) / grad +
weight_eps;
if (!mask1.at(y, x) || !mask1.at(y + 1, x) ||
!mask2.at(y, x) || !mask2.at(y + 1, x))
@@ -1271,7 +1277,7 @@ void GraphCutSeamFinder::Impl::findInPair(size_t first, size_t second, Rect roi)
setGraphWeightsColor(subimg1, subimg2, submask1, submask2, graph);
break;
case GraphCutSeamFinder::COST_COLOR_GRAD:
- setGraphWeightsColorGrad(subimg1, subimg2, subdx1, subdx2, subdy1, subdy2,
+ setGraphWeightsColorGrad(subimg1, subimg2, subdx1, subdx2, subdy1, subdy2,
submask1, submask2, graph);
break;
default:
@@ -1402,17 +1408,17 @@ void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
}
}
}
-
+
Mat terminals, leftT, rightT, top, bottom;
switch (cost_type_)
{
case GraphCutSeamFinder::COST_COLOR:
- setGraphWeightsColor(subimg1, subimg2, submask1, submask2,
+ setGraphWeightsColor(subimg1, subimg2, submask1, submask2,
terminals, leftT, rightT, top, bottom);
break;
case GraphCutSeamFinder::COST_COLOR_GRAD:
- setGraphWeightsColorGrad(subimg1, subimg2, subdx1, subdx2, subdy1, subdy2,
+ setGraphWeightsColorGrad(subimg1, subimg2, subdx1, subdx2, subdy1, subdy2,
submask1, submask2, terminals, leftT, rightT, top, bottom);
break;
default:
@@ -1448,7 +1454,7 @@ void GraphCutSeamFinderGpu::findInPair(size_t first, size_t second, Rect roi)
}
-void GraphCutSeamFinderGpu::setGraphWeightsColor(const Mat &img1, const Mat &img2, const Mat &mask1, const Mat &mask2,
+void GraphCutSeamFinderGpu::setGraphWeightsColor(const Mat &img1, const Mat &img2, const Mat &mask1, const Mat &mask2,
Mat &terminals, Mat &leftT, Mat &rightT, Mat &top, Mat &bottom)
{
const Size img_size = img1.size();
@@ -1540,7 +1546,7 @@ void GraphCutSeamFinderGpu::setGraphWeightsColor(const Mat &img1, const Mat &img
void GraphCutSeamFinderGpu::setGraphWeightsColorGrad(
const Mat &img1, const Mat &img2, const Mat &dx1, const Mat &dx2,
- const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
+ const Mat &dy1, const Mat &dy2, const Mat &mask1, const Mat &mask2,
Mat &terminals, Mat &leftT, Mat &rightT, Mat &top, Mat &bottom)
{
const Size img_size = img1.size();
diff --git a/modules/stitching/src/stitcher.cpp b/modules/stitching/src/stitcher.cpp
index f8b58d3e0..99bacf237 100644
--- a/modules/stitching/src/stitcher.cpp
+++ b/modules/stitching/src/stitcher.cpp
@@ -152,7 +152,9 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
Mat &pano_ = pano.getMatRef();
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
vector corners(imgs_.size());
vector masks_warped(imgs_.size());
@@ -201,7 +203,9 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
masks.clear();
LOGLN("Compositing...");
+#if ENABLE_LOG
t = getTickCount();
+#endif
Mat img_warped, img_warped_s;
Mat dilated_mask, seam_mask, mask, mask_warped;
@@ -349,7 +353,9 @@ Stitcher::Status Stitcher::matchImages()
full_img_sizes_.resize(imgs_.size());
LOGLN("Finding features...");
+#if ENABLE_LOG
int64 t = getTickCount();
+#endif
for (size_t i = 0; i < imgs_.size(); ++i)
{
@@ -406,7 +412,9 @@ Stitcher::Status Stitcher::matchImages()
LOGLN("Finding features, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
LOG("Pairwise matching");
+#if ENABLE_LOG
t = getTickCount();
+#endif
(*features_matcher_)(features_, pairwise_matches_, matching_mask_);
features_matcher_->collectGarbage();
LOGLN("Pairwise matching, time: " << ((getTickCount() - t) / getTickFrequency()) << " sec");
diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt
index c50b396fa..455ef876b 100644
--- a/modules/ts/CMakeLists.txt
+++ b/modules/ts/CMakeLists.txt
@@ -10,7 +10,8 @@ endif()
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
-ocv_add_module(ts opencv_core)
+ocv_add_module(ts opencv_core opencv_features2d)
+
ocv_glob_module_sources()
ocv_module_include_directories()
ocv_create_module()
diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp
index 449b43450..909a34625 100644
--- a/modules/ts/include/opencv2/ts/ts_perf.hpp
+++ b/modules/ts/include/opencv2/ts/ts_perf.hpp
@@ -2,6 +2,7 @@
#define __OPENCV_TS_PERF_HPP__
#include "opencv2/core/core.hpp"
+#include "opencv2/features2d/features2d.hpp"
#include "ts_gtest.h"
#ifdef HAVE_TBB
@@ -165,6 +166,8 @@ class CV_EXPORTS Regression
{
public:
static Regression& add(TestBase* test, const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
+ static Regression& addKeypoints(TestBase* test, const std::string& name, const std::vector& array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
+ static Regression& addMatches(TestBase* test, const std::string& name, const std::vector& array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
static void Init(const std::string& testSuitName, const std::string& ext = ".xml");
Regression& operator() (const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
@@ -199,6 +202,8 @@ private:
};
#define SANITY_CHECK(array, ...) ::perf::Regression::add(this, #array, array , ## __VA_ARGS__)
+#define SANITY_CHECK_KEYPOINTS(array, ...) ::perf::Regression::addKeypoints(this, #array, array , ## __VA_ARGS__)
+#define SANITY_CHECK_MATCHES(array, ...) ::perf::Regression::addMatches(this, #array, array , ## __VA_ARGS__)
/*****************************************************************************************\
diff --git a/modules/ts/src/ts_perf.cpp b/modules/ts/src/ts_perf.cpp
index 5467d618d..626459b84 100644
--- a/modules/ts/src/ts_perf.cpp
+++ b/modules/ts/src/ts_perf.cpp
@@ -103,6 +103,38 @@ Regression& Regression::add(TestBase* test, const std::string& name, cv::InputAr
return instance()(name, array, eps, err);
}
+Regression& Regression::addKeypoints(TestBase* test, const std::string& name, const std::vector& array, double eps, ERROR_TYPE err)
+{
+ int len = (int)array.size();
+ cv::Mat pt (len, 1, CV_32FC2, (void*)&array[0].pt, sizeof(cv::KeyPoint));
+ cv::Mat size (len, 1, CV_32FC1, (void*)&array[0].size, sizeof(cv::KeyPoint));
+ cv::Mat angle (len, 1, CV_32FC1, (void*)&array[0].angle, sizeof(cv::KeyPoint));
+ cv::Mat response(len, 1, CV_32FC1, (void*)&array[0].response, sizeof(cv::KeyPoint));
+ cv::Mat octave (len, 1, CV_32SC1, (void*)&array[0].octave, sizeof(cv::KeyPoint));
+ cv::Mat class_id(len, 1, CV_32SC1, (void*)&array[0].class_id, sizeof(cv::KeyPoint));
+
+ return Regression::add(test, name + "-pt", pt, eps, ERROR_ABSOLUTE)
+ (name + "-size", size, eps, ERROR_ABSOLUTE)
+ (name + "-angle", angle, eps, ERROR_ABSOLUTE)
+ (name + "-response", response, eps, err)
+ (name + "-octave", octave, eps, ERROR_ABSOLUTE)
+ (name + "-class_id", class_id, eps, ERROR_ABSOLUTE);
+}
+
+Regression& Regression::addMatches(TestBase* test, const std::string& name, const std::vector& array, double eps, ERROR_TYPE err)
+{
+ int len = (int)array.size();
+ cv::Mat queryIdx(len, 1, CV_32SC1, (void*)&array[0].queryIdx, sizeof(cv::DMatch));
+ cv::Mat trainIdx(len, 1, CV_32SC1, (void*)&array[0].trainIdx, sizeof(cv::DMatch));
+ cv::Mat imgIdx (len, 1, CV_32SC1, (void*)&array[0].imgIdx, sizeof(cv::DMatch));
+ cv::Mat distance(len, 1, CV_32FC1, (void*)&array[0].distance, sizeof(cv::DMatch));
+
+ return Regression::add(test, name + "-queryIdx", queryIdx, DBL_EPSILON, ERROR_ABSOLUTE)
+ (name + "-trainIdx", trainIdx, DBL_EPSILON, ERROR_ABSOLUTE)
+ (name + "-imgIdx", imgIdx, DBL_EPSILON, ERROR_ABSOLUTE)
+ (name + "-distance", distance, eps, err);
+}
+
void Regression::Init(const std::string& testSuitName, const std::string& ext)
{
instance().init(testSuitName, ext);
@@ -490,6 +522,12 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
Regression& Regression::operator() (const std::string& name, cv::InputArray array, double eps, ERROR_TYPE err)
{
+ if(!array.empty() && array.depth() == CV_USRTYPE1)
+ {
+ ADD_FAILURE() << " Can not check regression for CV_USRTYPE1 data type for " << name;
+ return *this;
+ }
+
std::string nodename = getCurrentTestNodeName();
cv::FileNode n = rootIn[nodename];
@@ -674,6 +712,8 @@ cv::Size TestBase::getSize(cv::InputArray a)
bool TestBase::next()
{
bool has_next = ++currentIter < nIters && totalTime < timeLimit;
+ cv::theRNG().state = param_seed; //this rng should generate same numbers for each run
+
#ifdef ANDROID
if (log_power_checkpoints)
{
@@ -948,7 +988,6 @@ void TestBase::SetUp()
currentIter = (unsigned int)-1;
timeLimit = timeLimitDefault;
times.clear();
- cv::theRNG().state = param_seed;//this rng should generate same numbers for each run
}
void TestBase::TearDown()
diff --git a/modules/video/perf/perf_optflowpyrlk.cpp b/modules/video/perf/perf_optflowpyrlk.cpp
index b5445330d..07d896cf0 100644
--- a/modules/video/perf/perf_optflowpyrlk.cpp
+++ b/modules/video/perf/perf_optflowpyrlk.cpp
@@ -91,6 +91,10 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK_full, testing::Combine(
Size(winSize, winSize), maxLevel, criteria,
flags, minEigThreshold);
}
+
+ SANITY_CHECK(outPoints);
+ SANITY_CHECK(status);
+ SANITY_CHECK(err, 1e-5);
}
typedef tr1::tuple, int, bool> Path_Idx_Cn_NPoints_WSize_Deriv_t;
@@ -166,6 +170,10 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize_Deriv, OpticalFlowPyrLK_self, testing::Com
Size(winSize, winSize), maxLevel, criteria,
flags, minEigThreshold);
}
+
+ SANITY_CHECK(outPoints);
+ SANITY_CHECK(status);
+ SANITY_CHECK(err, 1e-5);
}
CV_ENUM(PyrBorderMode, BORDER_DEFAULT, BORDER_TRANSPARENT);