1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-22 03:43:03 +04:00

Compare commits

...

412 Commits

Author SHA1 Message Date
Alexander Smorkalov e6f3f3c029 OpenCV version++. 2015-09-17 14:02:36 +03:00
Ilya Lavrenov 7746d9b7cc fix for corrent modules dependencies
(cherry picked from commit 1c3d83df54)
2015-09-17 13:45:08 +03:00
Vladislav Vinogradov 3494d640df add extra checks to data_step_down to prevent out-of-border access
(cherry picked from commit 3ef067cc65)
2015-09-17 13:44:56 +03:00
Vladislav Vinogradov c22cc67ba8 revert previous change in gpu::StereoBeliefPropogation
(cherry picked from commit f903192c17)
2015-09-17 13:44:33 +03:00
Vladislav Vinogradov 558054a53d fix for gpu::StereoBeliefPropogation:
use continuous memory for internal buffers

(cherry picked from commit e2a9df408f)
2015-09-17 13:44:17 +03:00
Elena Shipunova c7b471f10f do not proceed with removing zero-length slice
(cherry picked from commit 036c3b4e6d)
2015-09-17 13:43:54 +03:00
Ilya Lavrenov f4ffcae8d9 initialize padding of CvString with zeros
(cherry picked from commit 7b1eb3af7b)
2015-09-17 13:43:37 +03:00
Ilya Lavrenov 0422054aa1 fixed warnings in gpu module
(cherry picked from commit 6a05939e1c)
2015-09-17 13:41:51 +03:00
Ilya Lavrenov a81f0a5123 fixed uninitialized memory writing/reading in flann
(cherry picked from commit 3934d61de7)
2015-09-17 13:41:31 +03:00
Ilya Lavrenov c36582d2df fixed memory leak in flann index
(cherry picked from commit 32d7c1950a)
2015-09-17 13:41:16 +03:00
Ilya Lavrenov d50c07e303 fixed "Conditional jump or move depends on uninitialised value(s)" in GBD
(cherry picked from commit 887736bcd4)
2015-09-17 13:41:03 +03:00
Ilya Lavrenov 54693b3fa7 fixed memory leak in GBTrees
(cherry picked from commit 1b8c2589c0)
2015-09-17 13:40:50 +03:00
Ilya Lavrenov 3c3bc123fc release filestorage before exception
(cherry picked from commit 3a1bb93340)
2015-09-17 13:40:36 +03:00
Ilya Lavrenov ac33cd688c fixed memory leak in ANN
(cherry picked from commit dfb49097e3)
2015-09-17 13:40:14 +03:00
Ilya Lavrenov b5e42d8cc1 fixed memory leak in ml module
(cherry picked from commit d7bb1025f3)
2015-09-17 13:40:02 +03:00
Ilya Lavrenov 7e4e8921bc fixed memory leak in descriptor regression tests 2015-09-17 13:39:44 +03:00
Ilya Lavrenov 6dcd455ac4 fixed memory leaks in modules/features2d/test/test_nearestneighbors.cpp 2015-09-17 13:39:34 +03:00
Vladislav Vinogradov 1d58e1a14a fix potential out-of-border access in gpu StereoBeliefPropagation 2015-09-17 13:39:17 +03:00
Roman Donchenko d122510c4f Only conflict with packages corresponding to modules that are built 2015-09-17 13:39:03 +03:00
Roman Donchenko 6613d14261 Add missing packages to the Debian conflict list
And refactor the code to make sure that the dev and runtime package lists are
in sync.
2015-09-17 13:38:52 +03:00
a-andre a14e524b32 fix documentation builder warnings 2015-09-17 13:38:25 +03:00
a-andre 226ff93917 install new headers like "opencv2/core.hpp" 2015-09-17 13:38:11 +03:00
Ilya Lavrenov d28e6c9b36 fixed memory leak caused by illegal memory access
(cherry picked from commit 4722b2d0e5)
2015-09-17 13:37:52 +03:00
Ilya Lavrenov c16f465ff5 fixed "Conditional jump or move depends on uninitialised value" warning
(cherry picked from commit f100cdb6d4)
2015-09-17 13:37:38 +03:00
Roman Donchenko 3231c2f995 NearestNeighborTest: use ts->get_rng() instead of (implicit) theRNG()
This ensures that test data is not dependent on the order the tests are
executed in.

(cherry picked from commit 1245cd1752)
2015-09-17 13:37:26 +03:00
Ilya Lavrenov 16bcc30e42 typo
(cherry picked from commit 793bdaada7)
2015-09-17 13:37:12 +03:00
Ilya Lavrenov 69c50e0181 fixed typo
(cherry picked from commit 370d1ff21a)
2015-09-17 13:37:02 +03:00
Ilya Lavrenov 486c40f578 fixed uninitialized values warning in bad arg test class
(cherry picked from commit 47cee8715b)
2015-09-17 13:36:51 +03:00
Ilya Lavrenov 08e38e9ff9 fixed memory leaks in warpAffine tests
(cherry picked from commit b70e27e076)
2015-09-17 13:36:35 +03:00
Ilya Lavrenov ba3b902da7 fixed memory leaks in floodfill tests
(cherry picked from commit d1b882ddcf)
2015-09-17 13:36:24 +03:00
Ilya Lavrenov bf94e6a91c fixed memory leaks in cvtyuv tests
(cherry picked from commit b2489d31d6)
2015-09-17 13:36:14 +03:00
Ilya Lavrenov ecc53dd7a4 fixed memory leak in core ds tests
(cherry picked from commit 7719da9552)
2015-09-17 13:35:51 +03:00
Ilya Lavrenov fc0e0239b8 fixed valgrind warning in polylines
(cherry picked from commit 855765986e)
2015-09-17 13:35:25 +03:00
Alexander Smorkalov d0210f510e OpenCV version++. 2015-08-14 16:43:10 +03:00
Maksim Shabunin 34aa4e4578 Merge pull request #5151 from mshabunin:fix-training-data-corruption 2015-08-12 14:40:51 +00:00
Maksim Shabunin 447b8bf58a Fixing possible corruption for big training data sizes 2015-08-10 12:36:27 +03:00
Alexander Alekhin e9539061db Merge pull request #5124 from StevenPuttemans:fix_annotation_tool_2.4 2015-08-08 16:51:51 +00:00
StevenPuttemans ba7bf1ef68 add checks on input parameters for valid path and folder
opening a folder is system specific - made system specific code
added license
2015-08-06 10:23:41 +02:00
Alexander Alekhin 5a53f41622 Merge branch '2.4.10.x-prep' into 2.4 2015-08-05 16:20:12 +03:00
Alexander Alekhin 80844fd554 Merge pull request #5096 from terfendail:2.4 2015-08-03 12:46:45 +00:00
Vitaly Tuzov a96a6bf149 Resize area result verification moved to the separate function 2015-07-31 15:01:33 +03:00
Vitaly Tuzov b7c9aaa471 Added more resize_area tests to ensure right rounding behavior for half and quarter downscaling 2015-07-30 18:48:06 +03:00
Alexander Smorkalov 1f5fd865aa Merge pull request #5092 from etalanin:update-branch-to-2-4-12 2015-07-29 18:57:02 +00:00
Evgeny Talanin 9a3dccab20 Increase Android Manager version 2015-07-29 21:16:21 +03:00
Evgeny Talanin ac6ca660f4 Increase version to 2.4.12 2015-07-29 20:34:47 +03:00
Alexander Alekhin 6f47c26acf Merge pull request #5091 from jet47:gpu-sanity-epsilon 2015-07-29 16:29:37 +00:00
Vladislav Vinogradov 945663bc9b increase epsilon for some GPU sanity tests 2015-07-29 18:57:14 +03:00
Alexander Alekhin 0263b49298 Merge pull request #5090 from SpecLad:autotune-crash 2015-07-29 15:47:20 +00:00
Roman Donchenko c2f59a0f73 flann: fix AutotunedIndex crashing if a KDTree index is selected
Backport of mariusmuja/flann@f8ca6df3.
2015-07-29 18:03:48 +03:00
Maksim Shabunin 9eda260495 Merge pull request #4211 from alalek:fix_python_2_4 2015-07-24 13:33:51 +00:00
Maksim Shabunin 3ed54b9008 Merge pull request #4220 from alalek:fix_gcc_warnings_2_4 2015-07-24 13:09:44 +00:00
Alexander Alekhin 6b954cd24e Merge pull request #4219 from SpecLad:freak-missing-init 2015-07-22 12:52:36 +00:00
Alexander Alekhin 42ba5c7d16 fix GCC 4.9 warnings 2015-07-22 14:17:54 +03:00
Roman Donchenko 72ddeea479 FREAK: add missing field initialization 2015-07-22 14:06:39 +03:00
Vadim Pisarevsky 869dda4117 Merge pull request #4204 from gladilov-gleb:minMaxLocBugFix 2015-07-22 10:52:16 +00:00
Gleb Gladilov 07de67c32f Added test of minMaxLoc on filling with maximums of int 2015-07-22 11:43:35 +03:00
Gleb Gladilov c467d0d553 Fixed minMaxLoc and test functions 2015-07-21 17:17:23 +03:00
Alexander Alekhin 0906744788 fix python cross-compilation 2015-07-21 12:41:57 +03:00
Alexander Smorkalov 67158b12cd Merge pull request #4191 from SpecLad:irc-workaround 2015-07-16 08:17:45 +00:00
Roman Donchenko 9e50cf5375 Refactor a section of icvRotatingCalipers to work around a GCC bug
https://bugs.launchpad.net/ubuntu/+source/gcc-4.9/+bug/1474304
2015-07-14 13:26:47 +03:00
Alexander Alekhin 4bf82e50d0 Merge pull request #4187 from SpecLad:chessboard-png 2015-07-13 15:52:46 +00:00
Roman Donchenko 2e86d46cf2 CV_ChessboardDetectorTimingTest: don't ignore missing test data 2015-07-09 17:32:08 +03:00
Vadim Pisarevsky 707d10f115 Merge pull request #4137 from asmorkalov:as/ros_conflict 2015-06-22 11:52:05 +00:00
Alexander Alekhin 83a4ad5f51 Merge branch '2.4.9.x-prep' into 2.4 2015-06-19 14:55:38 +03:00
Alexander Alekhin e7b82a8561 Merge branch '2.4.8.x-prep' into 2.4 2015-06-19 14:54:18 +03:00
Alexander Smorkalov 546e68dc65 Merge pull request #4034 from jet47:opencv_run_all_tests_unix 2015-06-17 08:19:47 +00:00
Vadim Pisarevsky b7c2a46830 Merge pull request #4107 from SpecLad:libav-compat 2015-06-16 13:22:40 +00:00
Vadim Pisarevsky 719099ad6d Merge pull request #4104 from SpecLad:arm64-packaging 2015-06-16 13:19:11 +00:00
Vadim Pisarevsky 2e9004813e Merge pull request #4088 from howtobeahacker:2.4 2015-06-16 12:31:13 +00:00
Vincent Rabaud 50842b9036 get code to compile on Ubuntu Saucy
A define was forgotten for the codecs and there was a typo for
another.

(cherry picked from commit f052b0bc4d)

Conflicts:
	modules/videoio/src/ffmpeg_codecs.hpp
2015-06-09 15:53:08 +03:00
Vadim Pisarevsky 3d6413cfc6 fixed compile warnings; hopefully fixed test failures
(cherry picked from commit 30912b49f3)

Conflicts:
	modules/videoio/src/cap_ffmpeg_impl.hpp
	modules/videoio/src/ffmpeg_codecs.hpp
2015-06-09 15:53:08 +03:00
Vadim Pisarevsky 799622affd make sure opencv builds fine with the recent versions of libav (e.g. from Ubuntu 14.10)
(cherry picked from commit 2b2e3ee93c)

Conflicts:
	cmake/OpenCVFindLibsVideo.cmake
	modules/videoio/src/cap.cpp
	modules/videoio/src/cap_ffmpeg_impl.hpp
	modules/videoio/src/ffmpeg_codecs.hpp
	modules/videoio/test/test_ffmpeg.cpp
2015-06-09 15:53:08 +03:00
Alexander Smorkalov 57ab0d4d17 Debian packages header update to fix conflict with OpenCV from deb repo. 2015-06-09 14:59:12 +03:00
Roman Donchenko 02f8b85dd9 Add ARM64 packaging support 2015-06-08 18:03:08 +03:00
Roman Donchenko 1fbdca0c9b Set CPACK_DEBIAN_PACKAGE_ARCHITECTURE instead of CPACK_DEBIAN_ARCHITECTURE
Because that's the variable actually used by CPack.
2015-06-08 18:03:07 +03:00
howtobeahacker 9eaac6105f correct covariation matrix formula in Harris corner detector 2015-06-03 17:33:40 +08:00
Vadim Pisarevsky 83ace8d580 Merge pull request #4085 from berak:patch-3 2015-06-03 07:25:17 +00:00
berak 851ce27240 http://code.opencv.org/issues/4359 2.4 branch 2015-06-03 07:48:29 +02:00
Vadim Pisarevsky 70f8d807c8 Merge pull request #4003 from uwinsoftware:2.4 2015-05-29 18:55:55 +00:00
Vadim Pisarevsky daa21a4385 Merge pull request #4057 from apavlenko:24_java_memory_release 2015-05-28 14:59:46 +00:00
Vadim Pisarevsky 13cef0cdfc Merge pull request #4061 from ilya-lavrenov:android 2015-05-26 17:24:05 +00:00
Ilya Lavrenov 083aced3b4 fixed OS names 2015-05-26 17:41:23 +03:00
Andrey Pavlenko 72ec9c159e releasing native memory of temp Mat objects in generated Java code 2015-05-26 13:58:54 +03:00
Andrey Pavlenko 5b00d9da49 releasing native memory in Java converters 2015-05-26 13:58:35 +03:00
Vadim Pisarevsky 74bb0beeb0 Merge pull request #4008 from cr333:triangulation_fix_2.4 2015-05-23 10:18:08 +00:00
Vadim Pisarevsky 08714c510f Merge pull request #4042 from ilya-lavrenov:android_mk 2015-05-21 13:17:46 +00:00
Vadim Pisarevsky acfbed8654 Merge pull request #4037 from Lectem:patch-1 2015-05-21 12:33:42 +00:00
Vadim Pisarevsky 6212084046 Merge pull request #4041 from ilya-lavrenov:warning_fix 2015-05-21 12:24:46 +00:00
Ilya Lavrenov d89b6226a3 fixed Android mk generation for arm64-v8a 2015-05-21 15:00:46 +03:00
Ilya Lavrenov 11d1909e6b fixed warning 2015-05-21 11:49:06 +03:00
Lectem 3c6fe75149 fix mutex for uclibc
The uClibc doesn't have pthread_spin_* implemented on their 'old' linux threads.
Since it is on linux, we have to check if uclibc is using this implementation or not.
2015-05-20 12:18:28 +02:00
Alexander Smorkalov 00d9f690f6 Version++. 2015-05-20 11:21:28 +03:00
Vladislav Vinogradov ae79fe10dc do not loose logs from nvidia tests
(cherry picked from commit d58d277707)
2015-05-20 08:16:44 +03:00
Vladislav Vinogradov 62fc342d35 use fixed seed for RNG in gpu SolvePnPRansac test
(cherry picked from commit 95eed59f2d)
2015-05-20 08:16:22 +03:00
Vladislav Vinogradov 36924d6dbb use cv::theRNG() instead of ::rand() in gpu::solvePnPRansac
(cherry picked from commit 62bc647731)
2015-05-20 08:16:05 +03:00
Alexander Smorkalov ede4943d7e Merge pull request #4030 from asmorkalov:as/accurate_cuda_arch_aarch64 2015-05-20 05:12:43 +00:00
Alexander Smorkalov 9d148c76ca Merge pull request #4033 from jet47:gpu-tests-fix 2015-05-20 05:12:24 +00:00
Vladislav Vinogradov 21d8b588a2 exclude dates from report names 2015-05-19 18:26:13 +03:00
Vladislav Vinogradov 5d66b1130b save tests console output to separate log files 2015-05-19 18:26:13 +03:00
Vladislav Vinogradov 0550b2c1fe check that current directory has write access 2015-05-19 18:26:04 +03:00
Vladislav Vinogradov d58d277707 do not loose logs from nvidia tests 2015-05-19 17:28:43 +03:00
Vladislav Vinogradov 95eed59f2d use fixed seed for RNG in gpu SolvePnPRansac test 2015-05-19 17:27:50 +03:00
Vladislav Vinogradov 62bc647731 use cv::theRNG() instead of ::rand() in gpu::solvePnPRansac 2015-05-19 17:27:23 +03:00
Alexander Smorkalov 7f63776395 Precise default CUDA version for Tegra X1 chips. 2015-05-19 13:24:17 +03:00
Vadim Pisarevsky b9792fdc14 Merge pull request #3829 from ippei-i:2.4-flann-lsh-addable-index 2015-05-18 15:38:21 +00:00
Alexander Smorkalov 0410fe6978 Merge pull request #3785 from jet47:tiny-gpu-module 2015-05-18 08:00:12 +00:00
Christian Richardt 242e64c08d Fixed triangulation bug http://code.opencv.org/issues/4334. 2015-05-13 15:47:00 +02:00
Vadim Pisarevsky cc94b393c5 Merge pull request #3975 from StevenPuttemans:RGB_doc_fixing_2.4 2015-05-12 15:12:04 +00:00
Nguyen Nguyen 58dd70e8dc Revert support for audio 2015-05-08 12:06:03 -04:00
Nguyen Nguyen 53ff537f1c temporary fixes 2015-05-08 11:33:11 -04:00
Nguyen Nguyen a5814871d9 Adding audio to opencv 2015-05-06 17:01:38 -04:00
Vadim Pisarevsky 1aa03cecf1 Merge pull request #3981 from patrikhuber:vs2015-support 2015-05-06 15:35:36 +00:00
Vladislav Vinogradov f10537cdd6 fix tests compilation issue on Windows 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov 9d294cbcf5 fix performance tests in tiny mode 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov f1bec940b1 fix accuracy tests in tiny mode 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov dd93d48be4 turn on stereob instantiates that required for tests 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov ad3123adfd turn on some instantiates that required for other primitives 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov f939d80f4c fixed seg faults 2015-05-06 17:15:25 +03:00
Vladislav Vinogradov ee316758ca reduce color instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 6d7a61cbdc reduce copy_make_border instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov b44b1ab47b reduce matrix_reductions instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 2e47a1a61b reduce pyramids instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 72685cf01c reduce resize instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 612888c066 reduce remap instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov e7b55f4982 reduce warp instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 3004f5fa30 reduce stereobm instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 9682d2afff reduce element_operations instantiates for tiny build 2015-05-06 17:15:24 +03:00
Vladislav Vinogradov 87d655325c reduce add_weighted instantiates for tiny build 2015-05-06 17:13:59 +03:00
Vladislav Vinogradov db25e44a17 reduce brute_force_matcher instantiates for tiny build 2015-05-06 17:13:59 +03:00
Vladislav Vinogradov b7a9e672c5 reduce bilateral filter instantiates for tiny build 2015-05-06 17:13:59 +03:00
Vladislav Vinogradov 8e49ab1d3b reduce filter2d instantiates for tiny build 2015-05-06 17:13:59 +03:00
Vladislav Vinogradov 00c36e88ef reduce separable filter instantiates for tiny build 2015-05-06 17:13:59 +03:00
Vladislav Vinogradov cde697dd14 introduce BUILD_TINY_GPU_MODULE CMake option
it adds OPENCV_TINY_GPU_MODULE definition, that will allow
to build tiny version of gpu module (with limited image format support)
2015-05-06 17:13:59 +03:00
Alexander Smorkalov e49e75da06 OpenCV patch verison++. 2015-05-06 16:29:51 +03:00
Vladislav Vinogradov 1d40946959 Bug #4315 : fix CUDA bitwise operations with mask
(cherry picked from commit d87c30dc84)
2015-05-06 16:27:12 +03:00
Alexander Smorkalov 2598392295 Added explicit deb package dependency from libtbb-dev if TBB is enabled.
(cherry picked from commit 63d6cc5ca6)
2015-05-06 16:26:50 +03:00
lujia 17cc5e2c40 bugfix_for_hog_detectMultiScale_with_weights
(cherry picked from commit 7ce116695d)
2015-05-06 16:24:39 +03:00
Vladislav Vinogradov 4b14400976 disable several heavy performance tests
(cherry picked from commit cbdddb473c)
2015-05-06 16:24:07 +03:00
Vladislav Vinogradov 4704a254f7 disable Video_PyrLKOpticalFlowDense performance test
sanity fails on Maxwell and CUDA 7.0 due to unknow reason
(cherry picked from commit b4c2891ef3)
2015-05-06 16:23:41 +03:00
Vladislav Vinogradov 7708e9882e use border extrapolation for central pixel in pyrDown
in case if image has odd dimension

(cherry picked from commit 1325213303)
2015-05-06 16:23:28 +03:00
Vladislav Vinogradov fe1bd0cc2f fix racecheck warning in scanRows kernel
(cherry picked from commit fb15bdfb21)
2015-05-06 16:23:09 +03:00
Vladislav Vinogradov a752f25944 increase epsilon for solvePnPRansac function
(cherry picked from commit 9d2d173485)
2015-05-06 16:22:57 +03:00
Alexander Smorkalov bb44316028 Merge pull request #3990 from jet47:cuda-bitwise-mask 2015-05-06 12:50:08 +00:00
Alexander Smorkalov 0b2cfcfda2 Merge pull request #3976 from SpecLad:rm-insertIframe 2015-05-06 12:47:59 +00:00
Alexander Smorkalov 9c02caf392 Merge pull request #3989 from asmorkalov:as/tbb_dep 2015-05-06 12:47:41 +00:00
Vladislav Vinogradov d87c30dc84 Bug #4315 : fix CUDA bitwise operations with mask 2015-05-06 13:28:08 +03:00
Alexander Smorkalov 63d6cc5ca6 Added explicit deb package dependency from libtbb-dev if TBB is enabled. 2015-05-06 13:10:39 +03:00
Nguyen Nguyen 9682430a69 Adding code to deal with audio output 2015-05-05 13:14:26 -04:00
Nguyen Nguyen b69ffe6376 Fixed memory leak when recording video in iOS 2015-05-04 16:21:25 -04:00
Nguyen Nguyen 1f72815637 Exporting videoFileString to outside world 2015-05-04 12:38:55 -04:00
Maksim Shabunin 90c3d7d361 Merge pull request #3969 from Dikay900:master_to_2_4 2015-05-04 10:13:45 +00:00
StevenPuttemans f4eebc46b2 Fixing all wrong uses of RGB channels instead of the OpenCV BGR standard 2015-05-04 09:23:15 +02:00
Patrik Huber 2b1103c1d3 Add support for VS2015
Without the fix, OpenCV will compile and silently copy the compiled libs/executables to a location not prefixed with arch/vc14, and OpenCV won't be picked up by find_package and OpenCVConfig.cmake.
2015-05-02 13:31:43 +01:00
Roman Donchenko 007a3ef8b6 Remove insertIframe.js
It hasn't been used since f82c04f. Also, the line adding the script had
an unneeded pathto call, so the script was being loaded from the wrong path
anyway.
2015-04-30 15:42:15 +03:00
Belev 83eb1d3608 Fix typo
Fixed difference in the given arguments to the ellipse function and the description after that

Fixed two more typos

Replaced unnecessary the with to

Conflicts:
	doc/tutorials/core/adding_images/adding_images.markdown
	doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.markdown
	doc/tutorials/core/random_generator_and_text/random_generator_and_text.markdown
	modules/imgproc/include/opencv2/imgproc.hpp
2015-04-30 09:14:36 +02:00
Andrey Pavlenko 5c12c92243 Merge pull request #3961 from apavlenko:2.4_fix_polylines_empty 2015-04-28 16:22:31 +00:00
Martin Ueding 9e29762838 Add example data types for calibrateCamera call
It took me a while to figure out what was meant with

    OpenCV Error: Assertion failed (i < 0) in getMat

While searching for this error message I found [a list of error
messages](https://adventuresandwhathaveyou.wordpress.com/2014/03/14/opencv-error-messages-suck/)
which also explained what the problem was: The data type for `rvecs` was
not a simple `cv::Mat` but a `std::vector<cv::Mat>`.

After I fixed that, I got the next error message:

    OpenCV Error: Assertion failed (ni > 0 && ni == ni1) in
    collectCalibrationData, file
    /build/buildd/opencv-2.4.9+dfsg/modules/calib3d/src/calibration.cpp,
    line 3193

The problem here was that my data type for the `objectPoints` was just
`vector<Vec3f>` and not `vector<vector<Vec3f>>`.

In order to save other people the time looking for this, I added
explicit examples of the needed data types into the documentation of the
function. I had to re-read the current version a couple of times until I
can read the needed levels of `vector<>`. Having this example would have
really helped me there.

Conflicts:
	modules/calib3d/include/opencv2/calib3d.hpp
2015-04-28 17:24:37 +02:00
Vadim Pisarevsky da229cce9a Merge pull request #3946 from zjulujia:bugfix_for_hog_detectMultiScale_with_weights 2015-04-28 10:54:45 +00:00
Vadim Pisarevsky 36af97d00c Merge pull request #3959 from jet47:gpu-fixes 2015-04-28 10:49:06 +00:00
Vadim Pisarevsky d705c651f2 Merge pull request #3960 from ilya-lavrenov:aarch64_test_fixes 2015-04-28 10:48:33 +00:00
Vadim Pisarevsky 08848c56b7 Merge pull request #3965 from Dikay900:2_4_diff_to_master_2 2015-04-28 10:47:05 +00:00
Vadim Pisarevsky ebe979090e Merge pull request #3963 from Dikay900:2_4_diff_to_master 2015-04-28 10:41:42 +00:00
Pierre Moulon 901d4995e3 Fix a typo error
Fix a typo error
Conflicts:
	modules/features2d/include/opencv2/features2d.hpp
2015-04-25 15:07:17 +02:00
Adi Shavit aad95c7d8c Added call to clone() to avoid unexpected change to external data.
- Fix both stitching_detailed.cpp sample and cv::Stitcher.
2015-04-25 14:54:35 +02:00
Dikay900 d9b7b300b4 fix qt example on 2.4 with vs2010 and higher 2015-04-25 14:46:17 +02:00
Brian Park 044de4105e add input paramter checking that verifies the existance of the input files to stero_match example
remove the unnecessary header file

check input paramter by checking the image size
2015-04-25 14:46:17 +02:00
Chris Mayo 7a5aa06b9e Act on INSTALL_PYTHON_EXAMPLES
Conflicts:
	samples/CMakeLists.txt
2015-04-25 14:46:16 +02:00
Ben Hagen a21fb63c28 store user-provided data in PlaneTracker class 2015-04-25 11:22:18 +02:00
Yang Fan eaa9b78121 ENH: explicitly declared outputFilename to surpress error C2668
Conflicts:
	samples/gpu/video_writer.cpp
2015-04-25 10:58:01 +02:00
Abhijit Kundu fd4df0f67d Added suuport for finding Intel TBB for Visual Studio 2013 2015-04-25 10:23:34 +02:00
Simon Heinen 6decc2596d squashed #3729
Update android+AsyncServiceHelper.java

Update android+AsyncServiceHelper.java

changed tabs in last commit to spaces

Update android+AsyncServiceHelper.java

small formatting fixes
2015-04-24 23:02:10 +02:00
Eric Sommerlade 41b920344d added support for uncompressed parameters to tiff image format as described here: expertland.net/question/b6o3n6p9a72341db823b48nl98m91dx8n1/detail.html
Conflicts:
	modules/imgcodecs/src/grfmt_tiff.cpp
2015-04-24 22:59:08 +02:00
Ying Xiong 82668e06d4 Silence cmake 3.0+ warnings about MACOSX_RPATH 2015-04-24 22:39:49 +02:00
ttagu99 a81374c1d7 findcontour_example check image empty 2015-04-24 21:58:31 +02:00
侯骥 66fc6126d2 Update MatchTemplate_Demo.cpp 2015-04-24 21:58:31 +02:00
Jay Bosamiya 8b58b59df4 Fix typo 2015-04-24 21:58:30 +02:00
RafaRuiz f0595b8254 Update lkdemo.cpp because of memory leak
In MacOSx x64 it was getting a memory leak even without initializing points:
http://code.opencv.org/issues/4250
2015-04-24 21:58:29 +02:00
Pastafarianist 1e01441767 Fixed typo 2015-04-24 21:58:29 +02:00
Dikay900 c797746b6e use constant instead of value backported from #785 2015-04-24 21:58:28 +02:00
Dikay900 1bf4427a5c filename correction from #3217 2015-04-24 21:58:28 +02:00
Kevin Hughes ac3ec0d96d squashed #823
removed separate example for reading image sequences and modified starter_video.cpp to better explain the functionality of VideoCapture. I also added a bit more explanation in the documentation of the VideoCapture interface

Conflicts:
	modules/highgui/doc/reading_and_writing_images_and_video.rst
	samples/cpp/starter_video.cpp

starter_video.cpp changed CV WINDOW KEEPRATIO to just WINDOW KEEPTATIO to fix build error

starter_video.cpp hid local functions
2015-04-24 21:58:14 +02:00
Maximilien Cuony 5c6c537044 Fix typo in error for extrinsic parameters 2015-04-24 18:39:34 +02:00
Dikay900 f8c82fc214 update openni sample comments referring #81 2015-04-24 18:25:23 +02:00
Andrey Pavlenko 40b762bceb adding test for polylines() call with empty Point-s vector and fix for crash in this case 2015-04-24 16:40:14 +03:00
Ilya Lavrenov 89e3c508d8 fixed tests for aarch64 2015-04-24 13:56:20 +03:00
Vladislav Vinogradov cbdddb473c disable several heavy performance tests 2015-04-23 19:09:03 +03:00
Vladislav Vinogradov b4c2891ef3 disable Video_PyrLKOpticalFlowDense performance test
sanity fails on Maxwell and CUDA 7.0 due to unknow reason
2015-04-23 19:08:40 +03:00
Vladislav Vinogradov 1325213303 use border extrapolation for central pixel in pyrDown
in case if image has odd dimension
2015-04-23 17:21:42 +03:00
Vladislav Vinogradov fb15bdfb21 fix racecheck warning in scanRows kernel 2015-04-23 17:21:42 +03:00
Vladislav Vinogradov 9d2d173485 increase epsilon for solvePnPRansac function 2015-04-23 17:21:42 +03:00
Vadim Pisarevsky 26e3bcb9de Merge pull request #3956 from ilya-lavrenov:cuda_aarch64 2015-04-23 13:49:33 +00:00
Vadim Pisarevsky 960dee8ab8 Merge pull request #3953 from ilya-lavrenov:cuda_unused 2015-04-23 12:26:07 +00:00
Ilya Lavrenov 847976de4e fixed find cuda for aarch64 2015-04-23 14:49:12 +03:00
Ilya Lavrenov ceec0eb33a rmeoved unused functions 2015-04-23 12:48:50 +03:00
Vadim Pisarevsky 4840c4ae6f Merge pull request #3949 from ilya-lavrenov:clobbered_warning 2015-04-22 19:07:46 +00:00
Ilya Lavrenov 02e29fc99c suppress -Wclobbered warning 2015-04-22 16:42:03 +03:00
lujia 7ce116695d bugfix_for_hog_detectMultiScale_with_weights 2015-04-21 02:32:27 -04:00
Vadim Pisarevsky c879b1ab09 Merge pull request #3940 from sergarrido:fix-gen_pattern.py-2.4 2015-04-20 19:47:55 +00:00
Vladislav Vinogradov a984da911b increase epsilons for some sanity tests
(cherry picked from commit 6a6619ec1e)
2015-04-19 14:06:47 +03:00
Vladislav Vinogradov df55be3c3d fix BruteForceMatcher resource distribution
added launch bounds attributes for all CUDA kernels
(cherry picked from commit d22516872c)
2015-04-19 14:06:36 +03:00
Vladislav Vinogradov 55339de684 make NVIDIA tests verbose by default
(cherry picked from commit 17608f7ade)
2015-04-19 14:06:25 +03:00
Vladislav Vinogradov f08dd510fa fixed a bug in scanRows CUDA kernel (part of nppStIntegral)
uninitialized value
(cherry picked from commit 81ebe28c24)
2015-04-19 14:06:11 +03:00
Alexander Smorkalov de8d8720a2 Merge pull request #3924 from jet47:gpu-fixes 2015-04-19 11:04:55 +00:00
Vladislav Vinogradov d308ed3712 fix GPU WARP border mode in CUDA 7.0 and Maxwell architecture
(cherry picked from commit 27302c367c)
2015-04-19 14:02:54 +03:00
Vladislav Vinogradov 6d0f8aa893 fix tests for gpu HOG
initialize HOG after CUDA device switch
(cherry picked from commit c849492dfa)
2015-04-19 14:01:16 +03:00
Vladimir Kolesnikov bea98bd22a Not block PDB file in multithreaded build on Windows.
If used cl compiler, but generator is not Visual Studio e.g. Ninja,
enable FS option to prevent blocking PDB file in multithreaded build.

(cherry picked from commit 58c9135626)
2015-04-19 14:00:24 +03:00
Vladislav Vinogradov 4539607ab1 fix gpu HOG implementation:
move hog::set_up_constants from constructor to compute method

if user changed CUDA device between constructor and computation,
some variables were uninitialized
(cherry picked from commit 21bbed7baf)
2015-04-19 13:57:37 +03:00
Vladislav Vinogradov b320138dba fix GpuMat::setTo implementation
previous implementation was not thread/stream safe, since it used constant
memory

new implementation doesn't use any global objects, so it is thread/stream safe
(cherry picked from commit 4f5d30a865)
2015-04-19 13:57:23 +03:00
Vladislav Vinogradov 95ea12588e set epsilon for gpu OpticalFlowBM to 1e-6, since it uses floating point arithmetic
(cherry picked from commit c147ab1e85)
2015-04-19 13:57:03 +03:00
Roman Donchenko bcd08b5d18 Mark the libs component required
Everything else depends on it, after all.

(cherry picked from commit cf54e3b97e)
2015-04-19 13:55:35 +03:00
Roman Donchenko 19298ae3cb Add component display names
(cherry picked from commit 6d52ea8984)
2015-04-19 13:55:22 +03:00
Roman Donchenko 5e06da3050 Update the CPack variables to match the changes in asmorkalov/CMake#1
Which also happens to align the non-Debian specific variables
with the ones used by upstream CMake.

(cherry picked from commit b8c60234c3)

Conflicts:
	cmake/OpenCVPackaging.cmake
2015-04-19 13:54:32 +03:00
Roman Donchenko 17ac18a7b9 Remove useless CPACK_*_COMPONENT_INSTALL variables
They don't actually do anything. And even if they did, all components are
enabled by default, anyway.

(cherry picked from commit 49fe496914)
2015-04-19 13:42:14 +03:00
Roman Donchenko c259590b26 Fix a memory leak in CvCapture_FFMPEG::close
FFmpeg now requires that frames allocated with avcodec_alloc_frame are
freed with avcodec_free_frame.

(cherry picked from commit 77578d415f)
2015-04-19 13:41:22 +03:00
Roman Donchenko 3f3ca85103 Don't use ${CMAKE_INSTALL_PREFIX} as an install destination
Absolute destinations are not necessary, and prevent CPack from working.

(cherry picked from commit 0387f8ad56)
2015-04-19 13:39:55 +03:00
Alexander Smorkalov 05ddc16eaa Added Debian changelog to -tests package.
(cherry picked from commit a87ccb9ac0)
2015-04-19 13:39:01 +03:00
Alexander Smorkalov 2ba77614aa Debian package names replaced by lower case version to satisfy lintian.
(cherry picked from commit e6ac64008b)
2015-04-19 13:38:46 +03:00
Vladislav Vinogradov ef347aa6a4 disable gpu::matchTemplate tests
(cherry picked from commit 7bb8c50080)
2015-04-19 13:38:20 +03:00
Alexander Smorkalov b1cdb91139 Fixed samples install permissions for Debian packaging.
(cherry picked from commit cf852972d1)
2015-04-19 13:37:50 +03:00
Alexander Smorkalov a09ad35d98 opencv_testing.sh script installation is removed as run tests script does the same thing.
(cherry picked from commit 9206ec30a2)
2015-04-19 13:37:29 +03:00
Alexander Smorkalov 1b5835cd35 Added dependency from numpy to debian package with python bindings.
(cherry picked from commit be6b847675)
2015-04-19 13:37:04 +03:00
Alexander Smorkalov 9932bbad3a Added Debian changelog installation step for Debian package generation.
(cherry picked from commit ddc1b965b6)
2015-04-19 13:36:47 +03:00
Vijay Pradeep 39ac84ff04 Fixing race condition by expanding resultsMutex lock section
(cherry picked from commit 042ff210d5)
2015-04-19 13:36:17 +03:00
Vladislav Vinogradov fcbefaff86 fix tests for gpu::matchTemplate:
use ASSERT_FLOAT_EQ to compare float values, it is more robust for
large values
(cherry picked from commit d00f36ec75)
2015-04-19 13:32:24 +03:00
Roman Donchenko bf2256fb89 cvOpenFileStorage: reduce the scope of xml_buf and make sure it's freed...
... before any exceptions occur.

(cherry picked from commit 08da247a87)
2015-04-19 13:31:52 +03:00
Vladislav Vinogradov b0b2fc9e3f get rid of cuda.h usage
(cherry picked from commit eeb997261d)
2015-04-19 13:29:45 +03:00
Roman Donchenko 1ccd64e102 Fix uninitialized memory reads and memory leaks in StereoGC
(cherry picked from commit 7d8e5f623a)
2015-04-19 13:27:55 +03:00
Vicente Olivert Riera 23bf3e337a superres: Fix return value VideoFrameSource_GPU
superres module fails to compile with the following error messages:

[100%] Building CXX object modules/superres/CMakeFiles/opencv_superres.dir/src/super_resolution.cpp.o
/opencv-2.4.10/modules/superres/src/frame_source.cpp: In function 'cv::Ptr<cv::superres::FrameSource> cv::superres::createFrameSource_Video_GPU(const string&)':
/opencv-2.4.10/modules/superres/src/frame_source.cpp:263:16: error: expected type-specifier before 'VideoFrameSource'
/opencv-2.4.10/modules/superres/src/frame_source.cpp:263:16: error: could not convert '(int*)operator new(4ul)' from 'int*' to 'cv::Ptr<cv::superres::FrameSource>'
/opencv-2.4.10/modules/superres/src/frame_source.cpp:263:16: error: expected ';' before 'VideoFrameSource'
/opencv-2.4.10/modules/superres/src/frame_source.cpp:263:41: error: 'VideoFrameSource' was not declared in this scope
/opencv-2.4.10/modules/superres/src/frame_source.cpp:264:1: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: some warnings being treated as errors
make[3]: *** [modules/superres/CMakeFiles/opencv_superres.dir/src/frame_source.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....

This is caused because the return value of the createFrameSource_Video_GPU function should be a VideoFrameSource_GPU object.
(cherry picked from commit 2e393ab833)
2015-04-19 13:25:16 +03:00
Vladislav Vinogradov 3cf265992f fix installation layout for debian packages:
Install symlinks to shared libraries as a part of development package,
not runtime package.

It is default behavior for debian packages.
(cherry picked from commit f55c1cc0fb)
2015-04-19 13:23:47 +03:00
S. Garrido a855d230ec completing and fixing gen_pattern.py for 2.4 branch 2015-04-18 22:13:22 +02:00
Vladislav Vinogradov 6a6619ec1e increase epsilons for some sanity tests 2015-04-14 10:12:56 +03:00
Alexander Alekhin 8c2bde2af4 Merge pull request #3923 from ilya-lavrenov:typo 2015-04-13 16:57:13 +00:00
Vladislav Vinogradov d22516872c fix BruteForceMatcher resource distribution
added launch bounds attributes for all CUDA kernels
2015-04-13 17:12:04 +03:00
Vladislav Vinogradov 17608f7ade make NVIDIA tests verbose by default 2015-04-13 17:11:19 +03:00
Vladislav Vinogradov 81ebe28c24 fixed a bug in scanRows CUDA kernel (part of nppStIntegral)
uninitialized value
2015-04-13 17:09:59 +03:00
Vadim Pisarevsky f7792f0be2 Merge pull request #3908 from jet47:gpu-wrap-border-mode 2015-04-07 11:44:51 +00:00
Vladislav Vinogradov 27302c367c fix GPU WARP border mode in CUDA 7.0 and Maxwell architecture 2015-04-07 13:04:31 +03:00
Vadim Pisarevsky a153948a19 Merge pull request #3898 from greensea:2.4 2015-04-07 09:31:36 +00:00
Ilya Lavrenov 4273534c92 typo 2015-04-07 11:08:21 +03:00
greensea 7274e2ff1a Fix a segment fault issue in cascade classfier 2015-04-07 10:38:58 +08:00
Vadim Pisarevsky 0e8bfff386 Merge pull request #3904 from SeninAndrew:2.4 2015-04-05 18:00:30 +00:00
Andrew Senin 8c55d7be5e Ximea camera fix (see issue #4235) 2015-04-03 22:50:05 +03:00
Vadim Pisarevsky f6de017171 Merge pull request #3900 from apavlenko:doc_fix_imwrite 2015-04-03 13:26:00 +00:00
Vadim Pisarevsky cc63452f65 Merge pull request #3899 from StevenPuttemans:add_breakrule_traincascade_2.4 2015-04-03 11:44:55 +00:00
Andrey Pavlenko eeae81e903 fixing confusing variable naming in a sample code 2015-04-03 13:54:49 +03:00
StevenPuttemans e30139edc3 add the possibility to add traincascade accuracy 2015-04-03 12:47:09 +02:00
Vadim Pisarevsky f01b2413c3 Merge pull request #3770 from jet47:gpu-hog-tests 2015-04-03 10:32:59 +00:00
Alexander Smorkalov 772fcf4088 Merge pull request #3893 from SpecLad:cuda-imported-targets 2015-04-02 13:56:31 +00:00
ippei ito b8c00854fe instead of "using namespace cv" put all the tests into cv:: namespace. 2015-04-02 19:58:19 +09:00
Vadim Pisarevsky ba0a8dc723 Merge pull request #3783 from StevenPuttemans:fix_traincascade_getNegatives 2015-04-01 13:56:29 +00:00
Vadim Pisarevsky 100c2dd91c Merge pull request #3852 from renko:multithread_cl_not_studio_generator 2015-04-01 13:25:39 +00:00
Vladimir Kolesnikov 58c9135626 Not block PDB file in multithreaded build on Windows.
If used cl compiler, but generator is not Visual Studio e.g. Ninja,
enable FS option to prevent blocking PDB file in multithreaded build.
2015-04-01 13:52:07 +03:00
Roman Donchenko 6e121b2e29 Use imported targets for linking to CUDA
This retains the desirable quality of not including paths to CUDA libraries
from the build system into the config files, and has two major advantages:

* It removes the need to use link_directories, which doesn't guarantee that
  the libraries from the supplied directory will be used (there may be
  libraries with the same names earlier in the search path).

* It removes the need to put -L entries into OPENCV_LINKER_LIBS. This variable
  is used with target_link_libraries, where such entries are treated as linker
  flags, so doing this is unportable. I remove the support for -L entries
  from OpenCVGenPkgconfig.cmake, as well, to discourage adding them in the
  future.
2015-03-31 13:46:28 +03:00
Roman Donchenko e6619cf580 Move the CUDA searching code in OpenCVConfig.cmake.in out of the foreach loop
There's no reason to do it twice.
2015-03-30 15:04:27 +03:00
Roman Donchenko 122b9f8e17 Turn ocv_convert_to_lib_name into a function 2015-03-30 14:58:37 +03:00
Vadim Pisarevsky d948b2a235 Merge pull request #3886 from beahacker:2.4 2015-03-30 09:09:31 +00:00
howtobeahacker ebd7d08408 fix bug 4269 2015-03-30 00:01:20 +08:00
ippei ito 140051b18c Merge remote-tracking branch 'origin/2.4-flann-lsh-addable-index' into 2.4-flann-lsh-addable-index 2015-03-27 20:55:59 +09:00
ippei ito b7276359e9 Test accuracy for PR#3829 2015-03-27 20:54:05 +09:00
Vadim Pisarevsky 83d6d70a56 Merge pull request #3855 from polarfuchs99:2.4 2015-03-26 16:55:30 +00:00
Prof. Dr. Rudolf Haussmann a9d4e05346 Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

	modified:   highgui/include/opencv2/highgui/highgui_c.h
	modified:   highgui/src/cap_dshow.cpp
	modified:   java/generator/gen_java.py

The correction of the orthographic error in the enumeration constant
CAP_PROP_MONOCROME has been undone.
2015-03-25 15:45:20 +01:00
Prof. Dr. Rudolf Haussmann e5e6367223 Merge remote-tracking branch 'upstream/2.4' into 2.4 2015-03-25 13:38:49 +01:00
Vadim Pisarevsky 5678ba1227 Merge pull request #3805 from nitsch:fix-mingw-cmake-config 2015-03-25 09:53:35 +00:00
Vadim Pisarevsky b01f067614 Merge pull request #3865 from tdsmith:2.4-python-linkage 2015-03-25 09:52:52 +00:00
ippei ito 65b0ecfec5 Test accuracy for PR#3829.Fix WOrder warning on gcc 2015-03-25 18:24:52 +09:00
ippei ito d1902a1276 Test accuracy for PR#3829.Fix warning on gcc, comment out INIT_RANDOM_SEED for same result each ran. 2015-03-25 05:28:29 +09:00
ippei ito 56cae1b293 Test accuracy for PR#3829.Fix Some Error, Modify SLA. 2015-03-25 03:11:44 +09:00
ippei ito 7c740b6a31 Test accuracy for Pull Request # 3829 2015-03-25 02:38:01 +09:00
Alexander Nitsch d430664791 Remove local variables from CMAKE namespace 2015-03-24 14:42:55 +01:00
Tim D. Smith d057828ee3 Don't explicitly link Python on OS X
Explicitly linking to a Python framework on OS X prevents modules from
being built against one python (i.e. system python) and imported from
another (i.e. Homebrew python); the interpreter segfaults if there's a
linkage to a foreign python. Building the module with `-undefined
dynamic_lookup` instead of an explicit link allows the symbols to be
resolved at load time from a compatible python.
2015-03-23 23:13:48 -07:00
Vadim Pisarevsky c9bb18b9f7 Merge pull request #3850 from piponazo:2.4 2015-03-23 08:03:49 +00:00
Vadim Pisarevsky 297e2b6f1a Merge pull request #3834 from asmorkalov:retina_docs_fix 2015-03-20 10:14:29 +00:00
Vadim Pisarevsky 3853a18e0e Merge pull request #3792 from laomaiweng:cuda-pkg-config-Ldir 2015-03-20 10:13:46 +00:00
Vadim Pisarevsky 226b4e3ed5 Merge pull request #3839 from hyperscience:fix-free-space-check-in-grow-seq 2015-03-20 09:37:49 +00:00
Prof. Dr. Rudolf Haussmann 756c1a22d9 Merge remote-tracking branch 'upstream/2.4' into 2.4 2015-03-20 01:44:29 +01:00
Prof. Dr. Rudolf Haussmann a7bf1d53d8 Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

	modified:   modules/highgui/include/opencv2/highgui/highgui_c.h
	modified:   modules/highgui/src/cap_dshow.cpp
	modified:   modules/highgui/src/cap_pvapi.cpp
	modified:   modules/java/generator/gen_java.py

Änderungen in der PvAPI hinzugefügt.
2015-03-20 01:42:16 +01:00
Luis Díaz Más 7711cd284b Fix a bug that impede to set the trackbar pos using the Qt control panel 2015-03-19 21:25:10 +01:00
Boris Daskalov 8755ffbf31 Fix a bad free space check in icvGrowSeq.
A difference of two pointers was casted to unsigned which can lead to
overflow on 64-bit systems.
2015-03-19 17:32:32 +02:00
Vadim Pisarevsky 69344f175b Merge pull request #3843 from piponazo:BugFix4244 2015-03-19 12:15:41 +00:00
Luis Díaz Más d14a1de947 Fixing the bug #4244 that I just reported in code.opencv.org 2015-03-18 20:07:08 +01:00
Alexander Smorkalov 514b3b520c Documentation update after iOS warnings fix in contrib/retina header. 2015-03-17 19:25:05 +03:00
Vadim Pisarevsky 4a6b1805e0 Merge pull request #3824 from Milania1:tutorial_hough_lines_fix 2015-03-17 11:14:13 +00:00
Vadim Pisarevsky 4ab525c880 Merge pull request #3810 from StevenPuttemans:upgrade_traincascade_default_memory 2015-03-16 10:02:07 +00:00
ippei ito 7d665a4754 Fix warn conversion from 'size_t' to 'int'. add comment for doxygen 2015-03-14 09:35:53 +09:00
ippei ito f7d52c774e Fix compile error on linux change cv::InputArray& to cv::InputArray 2015-03-14 06:58:34 +09:00
ippei ito 8efdfd9dfc Fix unused-parameter Warning 2015-03-14 06:07:55 +09:00
ippei ito cd42e38013 FlannBasedMatcher(LshIndex) in the feature2d optimization for continuance additional train()
Current implementation of miniflann is releasing the trained index, and
rebuilding the index from the beginning.
But, some indexing algorithms like the LSH are able to add the indexing
data after that.
This branch is implementation of that optimization for LshIndex
FlannBasedMatcher in the feature2d.
2015-03-14 04:38:07 +09:00
Milania1 339e6aa782 fixed error in hough lines tutorial (the point (9,4) is not on the lines, but the point (4,9) is) 2015-03-12 16:46:25 +01:00
Vadim Pisarevsky 309eb3c122 Merge pull request #3815 from StevenPuttemans:add_camera_IP_regulations 2015-03-12 14:39:48 +00:00
Vadim Pisarevsky 2594e5e384 Merge pull request #3800 from StevenPuttemans:add_parameter_info_annotation 2015-03-12 14:29:04 +00:00
StevenPuttemans 3a7ea37090 extra camera specific information for IP settings 2015-03-10 10:16:13 +01:00
StevenPuttemans 9f0cd9ee10 upgrade traincascade default memory 2015-03-09 10:43:14 +01:00
Alexander Nitsch 13694c8ae8 Fix MinGW detection on x86
Make detection of x64 using the gcc's target triplet identical
to the one used in cmake/OpenCVDetectCXXCompiler.cmake.
Otherwise, MinGW-w64 setups will always be treated as x64 since
they contain "w64" as vendor key.
2015-03-07 15:49:48 +01:00
Alexander Nitsch dde7c22fad Fix MinGW architecture detection
Fix typo that would always lead to detection of x86 for MinGW
builds in the OpenCVConfig.cmake file.
2015-03-07 15:37:21 +01:00
Alexander Alekhin 29e7eb7719 Merge pull request #3789 from StevenPuttemans:fix_cmakelist_annotation 2015-03-06 14:53:43 +00:00
StevenPuttemans 3419c704a9 adding usage information 2015-03-06 13:52:52 +01:00
StevenPuttemans cdbb661eab update cmakelists of annotation tool 2015-03-06 12:51:28 +01:00
quentin afdf319f36 Add -L for CUDA libs path to pkg-config
Add all dirs from CUDA_LIBS_PATH as -L linker options to
OPENCV_LINKER_LIBS. These will end up in opencv.pc.
2015-03-05 14:37:21 +01:00
StevenPuttemans 488babf3b3 fixing undesired behaviour 2015-03-04 12:03:33 +01:00
Vadim Pisarevsky 2c57717ca2 Merge pull request #3774 from JoeHowse:2.4 2015-03-03 12:31:29 +00:00
Joe Howse e9b4813bb2 Cat face detection cascades 2015-03-02 11:58:08 -04:00
Vadim Pisarevsky 9185b62a1d Merge pull request #3761 from StevenPuttemans:fix_smile_model 2015-03-02 11:49:41 +00:00
Vadim Pisarevsky ac8045b9c6 Merge pull request #3754 from eliteraspberries:unsigned-mask 2015-03-02 11:34:43 +00:00
Vadim Pisarevsky 417f1e51a4 Merge pull request #3755 from eliteraspberries:mat-size-sign 2015-03-02 11:34:09 +00:00
Vadim Pisarevsky b595812bd0 Merge pull request #3745 from nitsch:fix-mingw-detection 2015-03-02 10:55:00 +00:00
Vadim Pisarevsky 0172bd6beb Merge pull request #3756 from eliteraspberries:cast-double 2015-03-02 10:52:28 +00:00
Vadim Pisarevsky e02d6e2c8f Merge pull request #3766 from StevenPuttemans:add_GPU_old_models 2015-03-02 10:49:38 +00:00
Vadim Pisarevsky 7458dfc082 Merge pull request #3765 from jet47:gpu-hog-fix 2015-03-02 10:34:51 +00:00
Vadim Pisarevsky bed8cb42be Merge pull request #3768 from jet47:gpumat-set-to 2015-03-02 10:33:45 +00:00
Vladislav Vinogradov c849492dfa fix tests for gpu HOG
initialize HOG after CUDA device switch
2015-03-02 11:02:47 +03:00
Vladislav Vinogradov 4f5d30a865 fix GpuMat::setTo implementation
previous implementation was not thread/stream safe, since it used constant
memory

new implementation doesn't use any global objects, so it is thread/stream safe
2015-02-27 16:28:06 +03:00
StevenPuttemans 2c0ef660bf Add GPU models in seperate folder, only old models are supported and they were replaced to make the CPU interface work.
This solves the undesired consequence of breaking the GPU interface.
2015-02-27 14:15:30 +01:00
Vladislav Vinogradov 21bbed7baf fix gpu HOG implementation:
move hog::set_up_constants from constructor to compute method

if user changed CUDA device between constructor and computation,
some variables were uninitialized
2015-02-27 14:28:12 +03:00
StevenPuttemans 1e95c964f3 fixing model size, typo in previous PR 2015-02-26 15:53:00 +01:00
Alexander Nitsch a5b293b412 Fix setting of architecture for MinGW builds
The architecture has been correctly determined earlier in this
file. No need to do it again.
2015-02-24 23:13:27 +01:00
Mansour Moufid 7d4cbbd7aa Cast a long integer to double explicitly. 2015-02-24 17:04:28 -05:00
Mansour Moufid b7be49426d Cast some image coordinates and sizes to double. 2015-02-24 12:21:34 -05:00
Mansour Moufid 42b1c6440c Cast some matrix sizes to type int. 2015-02-23 23:19:33 -05:00
Mansour Moufid 35a89b1541 Change some vector mask types to unsigned. 2015-02-23 23:10:57 -05:00
Alexander Nitsch 8ae6402799 Fix MinGW detection on x86
MinGW-w64 always uses "w64" as vendor key which the previously
used check for "64" anywhere in the target triplet matched. This
would lead to MinGW-w64 setups always being treated as x64.

Since we are actually interested in finding the "64" in the
triplet's operating system key, this fix makes sure to look for
"mingw64" and thus avoids the false match.

Fixes issue #3835. Credits to Lode Leroy for the original patch.
2015-02-23 15:03:28 +01:00
Alexander Smorkalov 67635c6d65 Version++. 2014-11-05 08:46:55 +03:00
Vladislav Vinogradov a26e496d00 minor fix for StereoCSBP data cost compute kernel and test
(cherry picked from commit 84f33d0578)
2014-11-04 10:19:38 +03:00
Vladislav Vinogradov d579d3e596 increase epsilons for some tests, which functions use floating point arithm
(cherry picked from commit 5c07e0b6d3)
2014-11-04 10:19:18 +03:00
Vladislav Vinogradov 5a77176654 avoid pointer arithmetic on register memory in color conversion
(cherry picked from commit e0827069c1)
2014-11-04 10:18:58 +03:00
Alexander Smorkalov e929dd4d98 GPU MatchTemplate32F test epsilon increased. 2014-09-02 20:24:49 +04:00
Vladislav Vinogradov 10a2c51c52 fix OpenCVConfig.cmake template - missing parentheses
(cherry picked from commit 67b562d543)
2014-09-02 19:30:35 +04:00
Alexander Smorkalov 4664a339ae Fix non-Android cross compilation with OpenCVConfig.cmake
(cherry picked from commit e8376c789d)
2014-09-02 19:29:59 +04:00
Vladislav Vinogradov fb81e4df1c fix CUDA cvtColor after corresponding change in CPU version
see https://github.com/Itseez/opencv/pull/3137
(cherry picked from commit ebe36d6e7c)
2014-09-02 16:48:20 +04:00
Alexander Karsakov cb1e9adc63 Fixed getConversionInfo() for YUV2RGBA_* conversions
(cherry picked from commit 023a42ba55)
2014-09-02 15:05:13 +04:00
Vladislav Vinogradov 562796e41b fix cv::gpu::resize for INTER_LINEAR, now it produces the same result as CPU version
(cherry picked from commit da9be8231f)
2014-09-02 13:17:47 +04:00
Alexander Smorkalov bb93c53948 OpenCV version++. 2014-09-02 11:54:54 +04:00
Alexander Karsakov 00575b346d Fixed range for 'v' channel for 8U images.
(cherry picked from commit b027eac173)
2014-09-02 11:41:08 +04:00
Vladislav Vinogradov 7316676c41 fix CUDA LUT implementation
In CUDA 6.0 there was a bug in NPP LUT implementation (invalid results when
src == 255). In CUDA 6.5 the bug was fixed.

Replaced NPP LUT call with own implementation (ported from master branch)
to be independant from CUDA Toolkit version.
(cherry picked from commit eaaa2d27d5)
2014-09-02 08:34:42 +04:00
Alexander Smorkalov 77585bf8af Several fixes for lintian varnings
(cherry picked from commit 634ffed488)
2014-08-27 16:44:18 +04:00
Vladislav Vinogradov c821cb1489 fix BGR->BGR5x5 color convertion
(cherry picked from commit 62f27b28ed)
2014-08-27 16:44:18 +04:00
Vladislav Vinogradov 86c1babd03 use downscaled frames in FGDStatModel test
(cherry picked from commit 599f5ef51b)
2014-08-27 16:44:18 +04:00
Vladislav Vinogradov 2205b2f5bc increase epsilon for ResizeSameAsHost test
(cherry picked from commit 86e12b6074)
2014-08-27 16:44:18 +04:00
Vladislav Vinogradov 975e40f1c0 increase epsilon for TVL1 sanity test
(cherry picked from commit 5dff283b39)
2014-08-27 16:44:18 +04:00
Alexander Smorkalov 628b23acc8 GCC 4.8 warning array subscript is above array bounds fixed.
(cherry picked from commit e11333dd83)
2014-08-15 10:20:31 +04:00
Alexander Smorkalov f8758da289 More accurate deb package build fix for CUDA 6.5 and newer.
(cherry picked from commit b2790973a3)
2014-07-24 15:06:38 +04:00
Alexander Smorkalov ca9c52ac97 Deb package build fix for CUDA 6.5 and newer.
(cherry picked from commit e650d87e47)
2014-07-24 15:06:35 +04:00
Alexander Smorkalov b2790973a3 More accurate deb package build fix for CUDA 6.5 and newer. 2014-07-14 23:58:05 +04:00
Alexander Smorkalov e650d87e47 Deb package build fix for CUDA 6.5 and newer. 2014-07-14 21:27:23 +04:00
Alexander Smorkalov feb74b125d Build fixes for CUDA 6.5
(cherry picked from commit 60a5ada454)
2014-07-14 16:39:23 +04:00
Alexander Smorkalov 3c0b0b0f94 Build fixes for CUDA 6.5
(cherry picked from commit 60a5ada454)
2014-07-14 16:37:50 +04:00
Vladislav Vinogradov 942401de16 fix output matrix allocation in cv::subtract(cherry picked from commit 629461c836) 2014-05-07 20:16:27 +04:00
Vladislav Vinogradov f9ff9c5618 fix cv::subtract function:
call dst.create(...) before using it(cherry picked from commit 4c66614e07)
2014-05-07 16:54:20 +04:00
Vladislav Vinogradov b4845d8c9f temporary disable performance test for alphaComp function(cherry picked from commit 1ce5165cb7) 2014-02-14 17:12:31 +04:00
Alexander Smorkalov ea51396731 Dead code removed as this cannot be null in Java.
(cherry picked from commit dbe7634286)
2014-02-13 20:13:47 +04:00
Vladislav Vinogradov aa82f921cc temporary disable perf test for StereoBeliefPropagation(cherry picked from commit eb247d826f) 2014-02-13 20:13:38 +04:00
Vladislav Vinogradov 2da7eae2c4 increase epsilon for AlphaComp sanity test for integer input(cherry picked from commit 9e69e2a07a) 2014-02-13 20:13:27 +04:00
Alexander Smorkalov 25159d8e81 Application pause/resume fix for Android sample NativeActivity.
(cherry picked from commit 7da3e98dfd)
2014-02-13 17:59:23 +04:00
Alexander Smorkalov f40ffe4763 LICENSE and README files installation rules added.
(cherry picked from commit e55f2b2602)
2014-02-12 19:36:52 +04:00
Alexander Smorkalov 116311b7b4 opencv_run_all_tests.sh implemented for Android SDK.
(cherry picked from commit d02c291160)
2014-02-12 19:36:43 +04:00
Alexander Smorkalov f1ef3a4865 OpenCV version++. 2014-02-11 10:15:02 +04:00
Vladislav Vinogradov 9997aa8187 decrease input size for several gpu tests to fix "timed out" error:
* BruteForceNonLocalMeans
* OpticalFlowBM(cherry picked from commit 8b44a42a40)
2014-02-10 15:48:52 +04:00
Vladislav Vinogradov f15b42018c fix nonfree module compilation without CUDA(cherry picked from commit 3e1f74f2ca) 2014-02-10 15:48:52 +04:00
Alexander Smorkalov f9e9ae85bd dynamicuda module disabled in OpenCv.mk for all arches except armeabi-v7a.
(cherry picked from commit b10d4b05ed)
2014-02-10 15:48:52 +04:00
Alexander Smorkalov a49beb7c73 Multiple improvements in OpenCV examples build.
EMBED_CUDA and FORCE_EMBED_OPENCV flags added to cmake macro add_android_project;
INSTALL_CUDA_LIBRARIES option added to OpenCV.mk
opencv_dynamicuda library installation with enabled OPENCV_INSTALL_MODULES flag fixed;
CUDA initialization apportunity added to OpenCVLoader.initDebug();
Tutorial-4-CUDA sample reimplemented with static OpenCV and CUDA initialization.
(cherry picked from commit 6ae4a9b09b)
2014-02-10 15:48:52 +04:00
Alexander Smorkalov 51dff5b9e8 project.properties file generation fixed for per-component installation.
(cherry picked from commit 65b4d77959)
2014-02-10 15:48:52 +04:00
Alexander Smorkalov 826fc00374 Tests install path fix for Android SDK.
(cherry picked from commit 0cd0e4749b)
2014-02-10 15:48:52 +04:00
Vladislav Vinogradov c10692deff save previous values of LOCAL_* variables and restore them at the end(cherry picked from commit 286fe261d0) 2014-02-10 15:48:52 +04:00
Vladislav Vinogradov daa7b9ce5f fix path to CUDA libraries (use targets/armv7-linux-androideabi/lib)(cherry picked from commit a098fb1803) 2014-02-10 15:48:52 +04:00
Vladislav Vinogradov 1ab02631b0 update stitching sample
(cherry picked from commit 214cbabc40)
2014-02-10 15:48:52 +04:00
Vladislav Vinogradov 3e755b2290 turn on CUDA part of stitching module on Android for non-dynamic build(cherry picked from commit a138e5a6a5) 2014-02-10 15:48:51 +04:00
Vladislav Vinogradov f15a167df4 turn on CUDA part of nonfree module on Android for non-dynamic build(cherry picked from commit d8f7377122) 2014-02-10 15:48:51 +04:00
Ilya Lavrenov f6367a2ea5 eliminated possible memory leak
(cherry picked from commit e7e63fac6c)
2014-02-10 15:48:51 +04:00
Vladislav Vinogradov 5f88e2b496 fix #3477:
CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING property is not supported
by all VideoCapture backends. Some backends can return 0.0 or -1.0.(cherry picked from commit c41e8006c7)
2014-02-10 15:48:51 +04:00
Seunghoon Park 2c7cf52e3b fixing bug #3345. use norm to make sure two matrices are the same.
(cherry picked from commit eb9d7c4dd5)
2014-02-10 15:48:51 +04:00
Andrey Pavlenko b7c5083a87 removing duplicated legacy license, the actual instance is in 'opencv/LICENSE'
(cherry picked from commit dca5684145)
2014-02-10 15:48:51 +04:00
Vladislav Vinogradov d5d88efd5d fix GpuMat::copyTo method with mask:
fill destination matrix with zeros if it was reallocated(cherry picked from commit dda999545c)
2014-02-10 15:48:51 +04:00
Drew Jetter 6cb7a7be18 Fixed bug #3489: The code assumed that two global variables would be constructed in a particular order, but global variable initialization order is compiler-dependent.
(cherry picked from commit 6bf599b1bc)
2014-02-10 15:48:51 +04:00
Pierre-Emmanuel Viel cdea6b532f Fix: freeing previous elements has to be done before loading new parameters to avoid trying to delete unexisting objects if arrays size was modified
(cherry picked from commit 3f458c6eb1)
2014-02-10 15:48:51 +04:00
ComFreek d01e3529a6 Corrected package name in tutorial
See also #2101(cherry picked from commit ae795e5797)
2014-02-10 15:48:51 +04:00
Nghia Ho 7c13d3277c Fixed a valgrind 'Conditional jump or move depends on uninitialised value(s)' on cv::kmeans(...). The original code used points(sampleCount, 1, CV_32FC2), which confused generateCentersPP into thinking it is a 1 dimensional center, instead of 2. As a result it would set only the x variable and leave y unitialised.
(cherry picked from commit 601b7d1dd3)
2014-02-10 15:48:51 +04:00
Robbert Klarenbeek 345b3b0bdd Fix algorithm setter argument validation for uchar(cherry picked from commit e21c6e19db) 2014-02-10 15:48:51 +04:00
Kazuki Matsuda a65d7d4dd3 Fix typo of SparseMat_<_Tp>::SparseMat_(const SparseMat& m)
Fix compilation erros when compiling this constructor.
First argument type of "convertTo" should be instance, not a pointer of instance.

First pull request was created for master branch.
But it should be marged for 2.4.
https://github.com/Itseez/opencv/pull/2113
(cherry picked from commit 2ae20c74a2)
2014-02-10 15:48:51 +04:00
Ilya Lavrenov 5e986f3347 fixed bug #3319
(cherry picked from commit 4f9c081dc3)
2014-02-10 15:48:50 +04:00
Seunghoon Park 27a8bb471b fixing bug #3345. don't use BORDER_ISOLATED alone. it should be combined with some border type
(cherry picked from commit 2272a58769)
2014-02-10 15:48:50 +04:00
Seunghoon Park 7868733002 fixing bug #3345
(cherry picked from commit b036fc756a)
2014-02-10 15:48:50 +04:00
Ilya Lavrenov 469aef2e5e fixed bug #3341
(cherry picked from commit 09d25e11c6)
2014-02-10 15:48:50 +04:00
Roman Donchenko 5e00fc6afe Fixed MinGW build by declaring the minimal required Windows version.
Also deleted miscellaneous remaining multimon cruft.
Deleted #include <winuser.h>, because <windows.h> includes it
already.

This should have a nice side effect of preventing us from
accidentally using any Windows API that's too new.
(cherry picked from commit 795c108f2b)
2014-02-10 15:48:50 +04:00
Vladislav Vinogradov 5170f0b5da fixed several bugs in CUDA Canny implementation:
* out of border access in edgesHysteresisLocalKernel
* incorrect usage of atomicAdd(cherry picked from commit 5dbdadb769)
2014-02-07 20:59:13 +04:00
Vladislav Vinogradov dc2dbb4173 Revert "disable gpu Canny and HoughCircles perf tests:"
This reverts commit dbce90692a.
(cherry picked from commit bfc27271e2)
2014-02-07 20:58:49 +04:00
Vladislav Vinogradov 79e4f7eb78 Revert "disable CUDA generalized Hough Transform"
This reverts commit 33d42b740c.
(cherry picked from commit 5d099df578)
2014-02-07 18:24:57 +04:00
Vladislav Vinogradov cc73c7000f fix epsilons for several gpu tests
(cherry picked from commit 3e4bb371c8)
2014-02-07 18:24:44 +04:00
Vladislav Vinogradov 8bb26fa5de Revert "disable gpu CvtColor.*2HSV tests:"
This reverts commit 952027a853.
(cherry picked from commit b6ba1f226c)
2014-02-07 18:24:35 +04:00
Vladislav Vinogradov 48612d7c58 Revert "disable gpu Subtract_Array test:"
This reverts commit e91bf95d58.
(cherry picked from commit da44a2fac1)
2014-02-07 18:24:23 +04:00
Alexander Smorkalov 8ba84f4b47 Implicit testdata directory permissions setup added.
(cherry picked from commit b86088b89c)
2014-02-07 18:24:11 +04:00
Alexander Smorkalov bc653add74 Absolute path to tests in opencv_run_app_tests.sh fixed.
(cherry picked from commit 530702c5f2)
2014-02-06 17:16:21 +04:00
Alexander Smorkalov 215f78eee2 Merge branch 'android_manager_version_inc4' into 2.4.8.1-prep 2014-01-31 22:25:36 +04:00
Vladislav Vinogradov 4425dac7f4 disable gpu CvtColor.*2HSV tests:
possible bug in CPU version(cherry picked from commit 3cb8b352e52f85847d98d2b0ece32ba5bdb5c31b)
2014-01-31 22:24:20 +04:00
Vladislav Vinogradov 4f79b9de48 disable gpu Subtract_Array test:
possible bug in CPU version(cherry picked from commit 59155c1eefb6f22e362e34a8d73b31841eb3413a)
2014-01-31 22:23:55 +04:00
Vladislav Vinogradov 397ac5e68f disable gpu Canny and HoughCircles perf tests:
it fails because driver terminates CUDA kernels after time out
(cherry picked from commit fa5bbb5f8dc1a86cfe004fb258d66e56c90560d6)
2014-01-31 22:23:39 +04:00
Vladislav Vinogradov 43c75c64b5 disable NPP for GpuMat methods and for copyMakeBorder(cherry picked from commit 316d49fc0fb7a609ebb0a65efc207faea6b978a4) 2014-01-31 22:23:22 +04:00
Vladislav Vinogradov c319625a07 disable some gpu tests if library was built without CUFFT(cherry picked from commit b4b929d27cc25822dd15b5b96b8d335c59d4408c) 2014-01-31 22:23:05 +04:00
Vladislav Vinogradov a7d0448faa gpu test output files moved from cwd to temp folder(cherry picked from commit 49731ad530) 2014-01-31 22:22:49 +04:00
Alexander Smorkalov ca10e5e8ae Highgui test output fixes.
Useless output to console fixed;
Test output files moved from cwd to temp folder.
(cherry picked from commit 87935f3560)
2014-01-31 22:22:33 +04:00
Vladislav Vinogradov 32414afe72 disable performance test for gpu generalized hough(cherry picked from commit 063d8b4211) 2014-01-31 22:22:14 +04:00
Alexander Smorkalov ed10f50d25 Reports path fix for opencv_run_all_tests.sh.in script.
(cherry picked from commit 3d261e8a01)
2014-01-31 22:21:57 +04:00
Alexander Smorkalov 48d9be70d5 Android toolchain file sync with original project.
Original project: https://github.com/taka-no-me/android-cmake/
Revision: 5db45cfb87fec180b74963d3680dd60d4d8d8c3a
(cherry picked from commit c815043607)
2014-01-31 22:21:34 +04:00
Alexander Smorkalov c6b31481b6 OpenCV Manager version++. 2014-01-31 12:15:22 +04:00
Alexander Smorkalov 514b714cc2 opencv_run_all_tests.sh script added to -tests package.
(cherry picked from commit d45350a06a)
2014-01-29 17:41:59 +04:00
Alexander Smorkalov 7fec87d3f6 Multiple fixes for tests deb package build.
Added opencv_testing.sh.in file;
opencv_testing.sh installation guarded by OS check.
(cherry picked from commit d9dc5ffa91)
2014-01-28 17:56:22 +04:00
Alexander Smorkalov 00d555f051 Code review notes fixed.
Env setup for testing package implemented using /etc/profile.d;
Variable with path for all native samples added;
Path for test binaries and test data updated.
(cherry picked from commit 39201e68e2)
2014-01-27 21:37:01 +04:00
Alexander Smorkalov 6cf7d6ef4e OpenCV C/C++/OCL/CUDA samples install path fixed. Install rools for tests added.
(cherry picked from commit f332cba14b)
2014-01-27 21:36:43 +04:00
Alexander Smorkalov 3ebdcafdd3 All installed files marked with component names for install customization.
(cherry picked from commit b75cbfde45)

Conflicts:

	cmake/OpenCVModule.cmake
2014-01-24 17:13:22 +04:00
Alexander Smorkalov a348f3eeaa OpenCV version++ 2014-01-24 14:49:56 +04:00
Alexander Smorkalov 33f423de04 Improvements in package build.
(cherry picked from commit 086792ec06)
2014-01-24 14:48:51 +04:00
Alexander Smorkalov d6ba52c3f9 Initial Linux packages build rools for CPack.
(cherry picked from commit 7821fe2bde)

Conflicts:

	cmake/OpenCVModule.cmake
2014-01-24 14:48:19 +04:00
Vladislav Vinogradov e9638d0997 disable CUDA generalized Hough Transform
(cherry picked from commit 33d42b740c)
2014-01-24 14:46:36 +04:00
Vladislav Vinogradov 5cb0084547 split CUDA Hough sources
(cherry picked from commit d847387694)
2014-01-24 14:46:16 +04:00
254 changed files with 396527 additions and 1491 deletions
+2
View File
@@ -3,9 +3,11 @@ set(HAVE_FFMPEG_CODEC 1)
set(HAVE_FFMPEG_FORMAT 1)
set(HAVE_FFMPEG_UTIL 1)
set(HAVE_FFMPEG_SWSCALE 1)
set(HAVE_FFMPEG_RESAMPLE 0)
set(HAVE_GENTOO_FFMPEG 1)
set(ALIASOF_libavcodec_VERSION 55.18.102)
set(ALIASOF_libavformat_VERSION 55.12.100)
set(ALIASOF_libavutil_VERSION 52.38.100)
set(ALIASOF_libswscale_VERSION 2.3.100)
set(ALIASOF_libavresample_VERSION 1.0.1)
+8
View File
@@ -52,6 +52,11 @@ if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
if (POLICY CMP0042)
# silence cmake 3.0+ warnings about MACOSX_RPATH
cmake_policy(SET CMP0042 OLD)
endif()
# must go before the project command
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
@@ -189,6 +194,7 @@ OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for sta
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
OCV_OPTION(BUILD_TINY_GPU_MODULE "Build tiny gpu module with limited image format support" OFF )
# 3rd party libs
OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE )
@@ -883,6 +889,7 @@ if(DEFINED WITH_FFMPEG)
status(" format:" HAVE_FFMPEG_FORMAT THEN "YES (ver ${ALIASOF_libavformat_VERSION})" ELSE NO)
status(" util:" HAVE_FFMPEG_UTIL THEN "YES (ver ${ALIASOF_libavutil_VERSION})" ELSE NO)
status(" swscale:" HAVE_FFMPEG_SWSCALE THEN "YES (ver ${ALIASOF_libswscale_VERSION})" ELSE NO)
status(" resample:" HAVE_FFMPEG_RESAMPLE THEN "YES (ver ${ALIASOF_libavresample_VERSION})" ELSE NO)
status(" gentoo-style:" HAVE_GENTOO_FFMPEG THEN YES ELSE NO)
endif(DEFINED WITH_FFMPEG)
@@ -991,6 +998,7 @@ if(HAVE_CUDA)
status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN})
status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX})
status(" Use fast math:" CUDA_FAST_MATH THEN YES ELSE NO)
status(" Tiny gpu module:" BUILD_TINY_GPU_MODULE THEN YES ELSE NO)
endif()
if(HAVE_OPENCL)
+6 -5
View File
@@ -1,5 +1,5 @@
SET(deps opencv_core opencv_highgui opencv_imgproc)
ocv_check_dependencies(${deps})
SET(OPENCV_ANNOTATION_DEPS opencv_core opencv_highgui opencv_imgproc)
ocv_check_dependencies(${OPENCV_ANNOTATION_DEPS})
if(NOT OCV_DEPENDENCIES_FOUND)
return()
@@ -8,12 +8,13 @@ endif()
project(annotation)
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
ocv_include_modules(${deps})
ocv_include_modules(${OPENCV_ANNOTATION_DEPS})
set(annotation_files opencv_annotation.cpp)
set(the_target opencv_annotation)
add_executable(${the_target} opencv_annotation.cpp)
target_link_libraries(${the_target} ${deps})
add_executable(${the_target} ${annotation_files})
target_link_libraries(${the_target} ${OPENCV_ANNOTATION_DEPS})
set_target_properties(${the_target} PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
+90 -1
View File
@@ -1,8 +1,51 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// 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.
// Copyright (C) 2013, OpenCV Foundation, 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.
//
////////////////////////////////////////////////////////////////////////////////////////
/*****************************************************************************************************
USAGE:
./opencv_annotation -images <folder location> -annotations <ouput file>
Created by: Puttemans Steven
Created by: Puttemans Steven - February 2015
*****************************************************************************************************/
#include <opencv2/core/core.hpp>
@@ -12,6 +55,12 @@ Created by: Puttemans Steven
#include <fstream>
#include <iostream>
#if defined(_WIN32)
#include <direct.h>
#else
#include <sys/stat.h>
#endif
using namespace std;
using namespace cv;
@@ -152,6 +201,15 @@ void get_annotations(Mat input_image, stringstream* output_stream)
int main( int argc, const char** argv )
{
// If no arguments are given, then supply some information on how this tool works
if( argc == 1 ){
cout << "Usage: " << argv[0] << endl;
cout << " -images <folder_location> [example - /data/testimages/]" << endl;
cout << " -annotations <ouput_file> [example - /data/annotations.txt]" << endl;
return -1;
}
// Read in the input arguments
string image_folder;
string annotations;
@@ -167,8 +225,33 @@ int main( int argc, const char** argv )
}
}
// Check if the folder actually exists
// If -1 is returned then the folder actually exists, and thus you can continue
// In all other cases there was a folder creation and thus the folder did not exist
#if defined(_WIN32)
if(_mkdir(image_folder.c_str()) != -1){
// Generate an error message
cerr << "The image folder given does not exist. Please check again!" << endl;
// Remove the created folder again, to ensure a second run with same code fails again
_rmdir(image_folder.c_str());
return 0;
}
#else
if(mkdir(image_folder.c_str(), 0777) != -1){
// Generate an error message
cerr << "The image folder given does not exist. Please check again!" << endl;
// Remove the created folder again, to ensure a second run with same code fails again
remove(image_folder.c_str());
return 0;
}
#endif
// Create the outputfilestream
ofstream output(annotations.c_str());
if ( !output.is_open() ){
cerr << "The path for the output file contains an error and could not be opened. Please check again!" << endl;
return 0;
}
// Return the image filenames inside the image folder
vector<String> filenames;
@@ -182,6 +265,12 @@ int main( int argc, const char** argv )
// Read in an image
Mat current_image = imread(filenames[i]);
// Check if the image is actually read - avoid other files in the folder, because glob() takes them all
// If not then simply skip this iteration
if(current_image.empty()){
continue;
}
// Perform annotations & generate corresponding output
stringstream output_stream;
get_annotations(current_image, &output_stream);
+28 -28
View File
@@ -374,7 +374,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
if (is_buf_16u)
{
unsigned short* udst_idx = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
vi*sample_count + data_root->offset);
(size_t)vi*sample_count + data_root->offset);
for( int i = 0; i < num_valid; i++ )
{
idx = src_idx[i];
@@ -387,7 +387,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
else
{
int* idst_idx = buf->data.i + root->buf_idx*get_length_subbuf() +
vi*sample_count + root->offset;
(size_t)vi*sample_count + root->offset;
for( int i = 0; i < num_valid; i++ )
{
idx = src_idx[i];
@@ -404,14 +404,14 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
if (is_buf_16u)
{
unsigned short* udst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
(workVarCount-1)*sample_count + root->offset);
(size_t)(workVarCount-1)*sample_count + root->offset);
for( int i = 0; i < count; i++ )
udst[i] = (unsigned short)src_lbls[sidx[i]];
}
else
{
int* idst = buf->data.i + root->buf_idx*get_length_subbuf() +
(workVarCount-1)*sample_count + root->offset;
(size_t)(workVarCount-1)*sample_count + root->offset;
for( int i = 0; i < count; i++ )
idst[i] = src_lbls[sidx[i]];
}
@@ -421,14 +421,14 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
if (is_buf_16u)
{
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
workVarCount*sample_count + root->offset);
(size_t)workVarCount*sample_count + root->offset);
for( int i = 0; i < count; i++ )
sample_idx_dst[i] = (unsigned short)sample_idx_src[sidx[i]];
}
else
{
int* sample_idx_dst = buf->data.i + root->buf_idx*get_length_subbuf() +
workVarCount*sample_count + root->offset;
(size_t)workVarCount*sample_count + root->offset;
for( int i = 0; i < count; i++ )
sample_idx_dst[i] = sample_idx_src[sidx[i]];
}
@@ -614,9 +614,9 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
// set sample labels
if (is_buf_16u)
udst = (unsigned short*)(buf->data.s + work_var_count*sample_count);
udst = (unsigned short*)(buf->data.s + (size_t)work_var_count*sample_count);
else
idst = buf->data.i + work_var_count*sample_count;
idst = buf->data.i + (size_t)work_var_count*sample_count;
for (int si = 0; si < sample_count; si++)
{
@@ -684,11 +684,11 @@ void CvCascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* o
if ( vi < numPrecalcIdx )
{
if( !is_buf_16u )
*sortedIndices = buf->data.i + n->buf_idx*get_length_subbuf() + vi*sample_count + n->offset;
*sortedIndices = buf->data.i + n->buf_idx*get_length_subbuf() + (size_t)vi*sample_count + n->offset;
else
{
const unsigned short* shortIndices = (const unsigned short*)(buf->data.s + n->buf_idx*get_length_subbuf() +
vi*sample_count + n->offset );
(size_t)vi*sample_count + n->offset );
for( int i = 0; i < nodeSampleCount; i++ )
sortedIndicesBuf[i] = shortIndices[i];
@@ -799,14 +799,14 @@ struct FeatureIdxOnlyPrecalc : ParallelLoopBody
{
valCachePtr[si] = (*featureEvaluator)( fi, si );
if ( is_buf_16u )
*(udst + fi*sample_count + si) = (unsigned short)si;
*(udst + (size_t)fi*sample_count + si) = (unsigned short)si;
else
*(idst + fi*sample_count + si) = si;
*(idst + (size_t)fi*sample_count + si) = si;
}
if ( is_buf_16u )
icvSortUShAux( udst + fi*sample_count, sample_count, valCachePtr );
icvSortUShAux( udst + (size_t)fi*sample_count, sample_count, valCachePtr );
else
icvSortIntAux( idst + fi*sample_count, sample_count, valCachePtr );
icvSortIntAux( idst + (size_t)fi*sample_count, sample_count, valCachePtr );
}
}
const CvFeatureEvaluator* featureEvaluator;
@@ -835,14 +835,14 @@ struct FeatureValAndIdxPrecalc : ParallelLoopBody
{
valCache->at<float>(fi,si) = (*featureEvaluator)( fi, si );
if ( is_buf_16u )
*(udst + fi*sample_count + si) = (unsigned short)si;
*(udst + (size_t)fi*sample_count + si) = (unsigned short)si;
else
*(idst + fi*sample_count + si) = si;
*(idst + (size_t)fi*sample_count + si) = si;
}
if ( is_buf_16u )
icvSortUShAux( udst + fi*sample_count, sample_count, valCache->ptr<float>(fi) );
icvSortUShAux( udst + (size_t)fi*sample_count, sample_count, valCache->ptr<float>(fi) );
else
icvSortIntAux( idst + fi*sample_count, sample_count, valCache->ptr<float>(fi) );
icvSortIntAux( idst + (size_t)fi*sample_count, sample_count, valCache->ptr<float>(fi) );
}
}
const CvFeatureEvaluator* featureEvaluator;
@@ -1165,9 +1165,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
if (data->is_buf_16u)
{
unsigned short *ldst = (unsigned short *)(buf->data.s + left->buf_idx*length_buf_row +
(workVarCount-1)*scount + left->offset);
(size_t)(workVarCount-1)*scount + left->offset);
unsigned short *rdst = (unsigned short *)(buf->data.s + right->buf_idx*length_buf_row +
(workVarCount-1)*scount + right->offset);
(size_t)(workVarCount-1)*scount + right->offset);
for( int i = 0; i < n; i++ )
{
@@ -1188,9 +1188,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
else
{
int *ldst = buf->data.i + left->buf_idx*length_buf_row +
(workVarCount-1)*scount + left->offset;
(size_t)(workVarCount-1)*scount + left->offset;
int *rdst = buf->data.i + right->buf_idx*length_buf_row +
(workVarCount-1)*scount + right->offset;
(size_t)(workVarCount-1)*scount + right->offset;
for( int i = 0; i < n; i++ )
{
@@ -1218,9 +1218,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
if (data->is_buf_16u)
{
unsigned short* ldst = (unsigned short*)(buf->data.s + left->buf_idx*length_buf_row +
workVarCount*scount + left->offset);
(size_t)workVarCount*scount + left->offset);
unsigned short* rdst = (unsigned short*)(buf->data.s + right->buf_idx*length_buf_row +
workVarCount*scount + right->offset);
(size_t)workVarCount*scount + right->offset);
for (int i = 0; i < n; i++)
{
unsigned short idx = (unsigned short)tempBuf[i];
@@ -1239,9 +1239,9 @@ void CvCascadeBoostTree::split_node_data( CvDTreeNode* node )
else
{
int* ldst = buf->data.i + left->buf_idx*length_buf_row +
workVarCount*scount + left->offset;
(size_t)workVarCount*scount + left->offset;
int* rdst = buf->data.i + right->buf_idx*length_buf_row +
workVarCount*scount + right->offset;
(size_t)workVarCount*scount + right->offset;
for (int i = 0; i < n; i++)
{
int idx = tempBuf[i];
@@ -1410,7 +1410,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
if (data->is_buf_16u)
{
unsigned short* labels = (unsigned short*)(buf->data.s + data->data_root->buf_idx*length_buf_row +
data->data_root->offset + (data->work_var_count-1)*data->sample_count);
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count);
for( int i = 0; i < n; i++ )
{
// save original categorical responses {0,1}, convert them to {-1,1}
@@ -1428,7 +1428,7 @@ void CvCascadeBoost::update_weights( CvBoostTree* tree )
else
{
int* labels = buf->data.i + data->data_root->buf_idx*length_buf_row +
data->data_root->offset + (data->work_var_count-1)*data->sample_count;
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count;
for( int i = 0; i < n; i++ )
{
+10 -3
View File
@@ -136,7 +136,8 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
const CvCascadeParams& _cascadeParams,
const CvFeatureParams& _featureParams,
const CvCascadeBoostParams& _stageParams,
bool baseFormatSave )
bool baseFormatSave,
double acceptanceRatioBreakValue)
{
// Start recording clock ticks for training time output
const clock_t begin_time = clock();
@@ -186,6 +187,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
cout << "numStages: " << numStages << endl;
cout << "precalcValBufSize[Mb] : " << _precalcValBufSize << endl;
cout << "precalcIdxBufSize[Mb] : " << _precalcIdxBufSize << endl;
cout << "acceptanceRatioBreakValue : " << acceptanceRatioBreakValue << endl;
cascadeParams.printAttrs();
stageParams->printAttrs();
featureParams->printAttrs();
@@ -208,15 +210,20 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
if ( !updateTrainingSet( requiredLeafFARate, tempLeafFARate ) )
{
cout << "Train dataset for temp stage can not be filled. "
"Branch training terminated." << endl;
"Branch training terminated." << endl;
break;
}
if( tempLeafFARate <= requiredLeafFARate )
{
cout << "Required leaf false alarm rate achieved. "
"Branch training terminated." << endl;
"Branch training terminated." << endl;
break;
}
if( (tempLeafFARate <= acceptanceRatioBreakValue) && (acceptanceRatioBreakValue >= 0) ){
cout << "The required acceptanceRatio for the model has been reached to avoid overfitting of trainingdata. "
"Branch training terminated." << endl;
break;
}
CvCascadeBoost* tempStage = new CvCascadeBoost;
bool isStageTrained = tempStage->train( (CvFeatureEvaluator*)featureEvaluator,
+2 -1
View File
@@ -96,7 +96,8 @@ public:
const CvCascadeParams& _cascadeParams,
const CvFeatureParams& _featureParams,
const CvCascadeBoostParams& _stageParams,
bool baseFormatSave = false );
bool baseFormatSave = false,
double acceptanceRatioBreakValue = -1.0 );
private:
int predict( int sampleIdx );
void save( const std::string cascadeDirName, bool baseFormat = false );
+1 -9
View File
@@ -32,20 +32,12 @@ bool CvCascadeImageReader::NegReader::create( const string _filename, Size _winS
if ( !file.is_open() )
return false;
size_t pos = _filename.rfind('\\');
char dlmrt = '\\';
if (pos == string::npos)
{
pos = _filename.rfind('/');
dlmrt = '/';
}
dirname = pos == string::npos ? "" : _filename.substr(0, pos) + dlmrt;
while( !file.eof() )
{
std::getline(file, str);
if (str.empty()) break;
if (str.at(0) == '#' ) continue; /* comment */
imgFilenames.push_back(dirname + str);
imgFilenames.push_back(str);
}
file.close();
+10 -3
View File
@@ -14,9 +14,10 @@ int main( int argc, char* argv[] )
int numPos = 2000;
int numNeg = 1000;
int numStages = 20;
int precalcValBufSize = 256,
precalcIdxBufSize = 256;
int precalcValBufSize = 1024,
precalcIdxBufSize = 1024;
bool baseFormatSave = false;
double acceptanceRatioBreakValue = -1.0;
CvCascadeParams cascadeParams;
CvCascadeBoostParams stageParams;
@@ -37,6 +38,7 @@ int main( int argc, char* argv[] )
cout << " [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = " << precalcValBufSize << ">]" << endl;
cout << " [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = " << precalcIdxBufSize << ">]" << endl;
cout << " [-baseFormatSave]" << endl;
cout << " [-acceptanceRatioBreakValue <value> = " << acceptanceRatioBreakValue << ">]" << endl;
cascadeParams.printDefaults();
stageParams.printDefaults();
for( int fi = 0; fi < fc; fi++ )
@@ -83,6 +85,10 @@ int main( int argc, char* argv[] )
{
baseFormatSave = true;
}
else if( !strcmp( argv[i], "-acceptanceRatioBreakValue" ) )
{
acceptanceRatioBreakValue = atof(argv[++i]);
}
else if ( cascadeParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
else if ( stageParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
else if ( !set )
@@ -108,6 +114,7 @@ int main( int argc, char* argv[] )
cascadeParams,
*featureParams[cascadeParams.featureType],
stageParams,
baseFormatSave );
baseFormatSave,
acceptanceRatioBreakValue );
return 0;
}
+12 -2
View File
@@ -619,6 +619,8 @@ if(DEFINED CUDA_TARGET_CPU_ARCH)
set(_cuda_target_cpu_arch_initial "${CUDA_TARGET_CPU_ARCH}")
elseif(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM)")
set(_cuda_target_cpu_arch_initial "ARM")
elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|AARCH64)")
set(_cuda_target_cpu_arch_initial "AARCH64")
else()
set(_cuda_target_cpu_arch_initial "")
endif()
@@ -643,6 +645,12 @@ elseif(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND "${CUDA_T
elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf")
set(_cuda_target_triplet_initial "armv7-linux-gnueabihf")
endif()
elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND "${CUDA_TARGET_CPU_ARCH}" STREQUAL "AARCH64")
if("${CUDA_TARGET_OS_VARIANT}" STREQUAL "Android" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux-androideabi")
set(_cuda_target_triplet_initial "aarch64-linux-androideabi")
elseif(EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux-gnueabihf")
set(_cuda_target_triplet_initial "aarch64-linux-gnueabihf")
endif()
endif()
set(CUDA_TARGET_TRIPLET "${_cuda_target_triplet_initial}" CACHE STRING "Specify the target triplet for which the input files must be compiled.")
file(GLOB __cuda_available_target_tiplets RELATIVE "${CUDA_TOOLKIT_ROOT_DIR}/targets" "${CUDA_TOOLKIT_ROOT_DIR}/targets/*" )
@@ -1094,8 +1102,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set(nvcc_flags ${nvcc_flags} -m32)
endif()
if(CUDA_TARGET_CPU_ARCH)
set(nvcc_flags ${nvcc_flags} "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH}")
if(CUDA_TARGET_CPU_ARCH AND CUDA_VERSION VERSION_LESS "7.0")
# CPU architecture is either ARM or X86. Patch AARCH64 to be ARM
string(REPLACE "AARCH64" "ARM" CUDA_TARGET_CPU_ARCH_patched ${CUDA_TARGET_CPU_ARCH})
set(nvcc_flags ${nvcc_flags} "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH_patched}")
endif()
if(CUDA_TARGET_OS_VARIANT AND CUDA_VERSION VERSION_LESS "7.0")
+11
View File
@@ -63,6 +63,10 @@ if(OPENCV_CAN_BREAK_BINARY_COMPATIBILITY)
add_definitions(-DOPENCV_CAN_BREAK_BINARY_COMPATIBILITY)
endif()
if(BUILD_TINY_GPU_MODULE)
add_definitions(-DOPENCV_TINY_GPU_MODULE)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# High level of warnings.
add_extra_compiler_option(-W)
@@ -91,6 +95,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wno-narrowing)
add_extra_compiler_option(-Wno-delete-non-virtual-dtor)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-array-bounds)
add_extra_compiler_option(-Wno-aggressive-loop-optimizations)
endif()
add_extra_compiler_option(-fdiagnostics-show-option)
@@ -257,6 +263,11 @@ if(MSVC)
endif()
endif()
if(MSVC12 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
endif()
# Extra link libs if the user selects building static libs:
if(NOT BUILD_SHARED_LIBS AND ((CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID) OR QNX))
# Android does not need these settings because they are already set by toolchain file
+3 -1
View File
@@ -79,6 +79,8 @@ if(MSVC)
set(OpenCV_RUNTIME vc11)
elseif(MSVC_VERSION EQUAL 1800)
set(OpenCV_RUNTIME vc12)
elseif(MSVC_VERSION EQUAL 1900)
set(OpenCV_RUNTIME vc14)
endif()
elseif(MINGW)
set(OpenCV_RUNTIME mingw)
@@ -86,7 +88,7 @@ elseif(MINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
set(MINGW64 1)
set(OpenCV_ARCH x64)
else()
+8 -28
View File
@@ -86,12 +86,14 @@ if(CUDA_FOUND)
set(__cuda_arch_bin "3.2")
set(__cuda_arch_ptx "")
elseif(AARCH64)
set(__cuda_arch_bin "5.2")
set(__cuda_arch_bin "5.3")
set(__cuda_arch_ptx "")
endif()
else()
if(${CUDA_VERSION} VERSION_LESS "5.0")
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
elseif(${CUDA_VERSION} VERSION_GREATER "6.5")
set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5")
else()
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
endif()
@@ -216,40 +218,18 @@ else()
endif()
if(HAVE_CUDA)
set(CUDA_LIBS_PATH "")
foreach(p ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
if(HAVE_CUBLAS)
foreach(p ${CUDA_cublas_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
endif()
if(HAVE_CUFFT)
foreach(p ${CUDA_cufft_LIBRARY})
get_filename_component(_tmp ${p} PATH)
list(APPEND CUDA_LIBS_PATH ${_tmp})
endforeach()
endif()
list(REMOVE_DUPLICATES CUDA_LIBS_PATH)
link_directories(${CUDA_LIBS_PATH})
set(CUDA_LIBRARIES_ABS ${CUDA_LIBRARIES})
ocv_convert_to_lib_name(CUDA_LIBRARIES ${CUDA_LIBRARIES})
ocv_create_imported_targets(CUDA_LIBRARIES ${CUDA_LIBRARIES})
set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY})
ocv_convert_to_lib_name(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
ocv_create_imported_targets(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY})
if(HAVE_CUBLAS)
set(CUDA_cublas_LIBRARY_ABS ${CUDA_cublas_LIBRARY})
ocv_convert_to_lib_name(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
ocv_create_imported_targets(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY})
endif()
if(HAVE_CUFFT)
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
ocv_create_imported_targets(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
endif()
endif()
+6 -8
View File
@@ -91,9 +91,9 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
if(OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
set(MINGW64 1)
endif()
endif()
@@ -114,7 +114,7 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64.*|AARCH64.*")
endif()
# Similar code is existed in OpenCVConfig.cmake
# Similar code exists in OpenCVConfig.cmake
if(NOT DEFINED OpenCV_STATIC)
# look for global setting
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
@@ -140,15 +140,13 @@ if(MSVC)
set(OpenCV_RUNTIME vc11)
elseif(MSVC_VERSION EQUAL 1800)
set(OpenCV_RUNTIME vc12)
elseif(MSVC_VERSION EQUAL 1900)
set(OpenCV_RUNTIME vc14)
endif()
elseif(MINGW)
set(OpenCV_RUNTIME mingw)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
if(MINGW64)
set(OpenCV_ARCH x64)
else()
set(OpenCV_ARCH x86)
+3 -3
View File
@@ -39,11 +39,11 @@ if(PYTHON_EXECUTABLE)
if(NOT ANDROID AND NOT IOS)
ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
if(CMAKE_CROSSCOMPILING)
find_host_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR})
find_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR})
elseif(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
find_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
else()
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
find_package(PythonLibs ${PYTHON_VERSION_FULL})
endif()
# cmake 2.4 (at least on Ubuntu 8.04 (hardy)) don't define PYTHONLIBS_FOUND
if(NOT PYTHONLIBS_FOUND AND PYTHON_INCLUDE_PATH)
+2
View File
@@ -63,6 +63,8 @@ if(NOT HAVE_TBB)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
elseif(MSVC11)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
elseif(MSVC12)
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc12")
endif()
set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
link_directories("${TBB_LIB_DIR}")
+2 -1
View File
@@ -190,7 +190,7 @@ if(WITH_XIMEA)
endif(WITH_XIMEA)
# --- FFMPEG ---
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_FFMPEG_RESAMPLE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
if(WITH_FFMPEG)
if(WIN32 AND NOT ARM)
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
@@ -199,6 +199,7 @@ if(WITH_FFMPEG)
CHECK_MODULE(libavformat HAVE_FFMPEG_FORMAT)
CHECK_MODULE(libavutil HAVE_FFMPEG_UTIL)
CHECK_MODULE(libswscale HAVE_FFMPEG_SWSCALE)
CHECK_MODULE(libavresample HAVE_FFMPEG_RESAMPLE)
CHECK_INCLUDE_FILE(libavformat/avformat.h HAVE_GENTOO_FFMPEG)
CHECK_INCLUDE_FILE(ffmpeg/avformat.h HAVE_FFMPEG_FFMPEG)
+4 -1
View File
@@ -25,6 +25,8 @@ if(ANDROID)
set( ${VAR} "armeabi" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARMEABI_V7A" )
set( ${VAR} "armeabi-v7a" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARM64_V8A" )
set( ${VAR} "arm64-v8a" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " X86" )
set( ${VAR} "x86" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " MIPS" )
@@ -36,7 +38,7 @@ if(ANDROID)
endif()
# setup lists of camera libs
foreach(abi ARMEABI ARMEABI_V7A X86 MIPS)
foreach(abi ARMEABI ARMEABI_V7A ARM64_V8A X86 MIPS)
ANDROID_GET_ABI_RAWNAME(${abi} ndkabi)
if(BUILD_ANDROID_CAMERA_WRAPPER)
if(ndkabi STREQUAL ANDROID_NDK_ABI_NAME)
@@ -46,6 +48,7 @@ if(ANDROID)
endif()
elseif(HAVE_opencv_androidcamera)
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "")
# TODO: add prebuild camera libs for arm64-v8a
file(GLOB OPENCV_CAMERA_LIBS "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ndkabi}/libnative_camera_r*.so")
if(OPENCV_CAMERA_LIBS)
list(SORT OPENCV_CAMERA_LIBS)
+10 -9
View File
@@ -63,22 +63,23 @@ endforeach()
# add extra dependencies required for OpenCV
if(OpenCV_EXTRA_COMPONENTS)
foreach(extra_component ${OpenCV_EXTRA_COMPONENTS})
if(TARGET "${extra_component}")
get_target_property(extra_component_is_imported "${extra_component}" IMPORTED)
if(extra_component_is_imported)
get_target_property(extra_component "${extra_component}" LOCATION)
endif()
endif()
if(extra_component MATCHES "^-[lL]")
set(libprefix "")
set(libname "${extra_component}")
if(extra_component MATCHES "^-l")
list(APPEND OpenCV_LIB_COMPONENTS_ "${extra_component}")
elseif(extra_component MATCHES "[\\/]")
get_filename_component(libdir "${extra_component}" PATH)
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}")
get_filename_component(libname "${extra_component}" NAME_WE)
string(REGEX REPLACE "^lib" "" libname "${libname}")
set(libprefix "-l")
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}" "-l${libname}")
else()
set(libprefix "-l")
set(libname "${extra_component}")
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${extra_component}")
endif()
list(APPEND OpenCV_LIB_COMPONENTS_ "${libprefix}${libname}")
endforeach()
endif()
+17 -12
View File
@@ -49,6 +49,8 @@ foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MOD
if(HAVE_${mod})
unset(HAVE_${mod} CACHE)
endif()
unset(OPENCV_MODULE_${mod}_DEPS CACHE)
unset(OPENCV_MODULE_${mod}_DEPS_EXT CACHE)
unset(OPENCV_MODULE_${mod}_REQ_DEPS CACHE)
unset(OPENCV_MODULE_${mod}_OPT_DEPS CACHE)
unset(OPENCV_MODULE_${mod}_PRIVATE_REQ_DEPS CACHE)
@@ -488,7 +490,7 @@ macro(ocv_glob_module_sources)
file(GLOB_RECURSE lib_srcs "src/*.cpp")
file(GLOB_RECURSE lib_int_hdrs "src/*.hpp" "src/*.h")
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
file(GLOB lib_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
file(GLOB_RECURSE lib_srcs_apple "src/*.mm")
if (APPLE)
@@ -629,7 +631,7 @@ macro(ocv_create_module)
if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
if(hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$")
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT dev)
endif()
endforeach()
@@ -919,25 +921,28 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
list(REMOVE_AT __mod_depends 0)
if(__dep STREQUAL the_module)
set(__has_cycle TRUE)
else()#if("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
else()
ocv_regex_escape(__rdep "${__dep}")
if(__resolved_deps MATCHES "(^|;)${__rdep}(;|$)")
#all dependencies of this module are already resolved
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${__dep}")
elseif(TARGET ${__dep})
get_target_property(__module_type ${__dep} TYPE)
if(__module_type STREQUAL "STATIC_LIBRARY")
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind})
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT)
get_target_property(__dep_imported ${__dep} IMPORTED)
if(__dep_imported)
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}")
else()
get_target_property(__module_type ${__dep} TYPE)
if(__module_type STREQUAL "STATIC_LIBRARY")
if(NOT DEFINED ${__dep}_LIB_DEPENDS_${optkind})
ocv_split_libs_list(${__dep}_LIB_DEPENDS ${__dep}_LIB_DEPENDS_DBG ${__dep}_LIB_DEPENDS_OPT)
endif()
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep})
list(APPEND __resolved_deps "${__dep}")
endif()
list(INSERT __mod_depends 0 ${${__dep}_LIB_DEPENDS_${optkind}} ${__dep})
list(APPEND __resolved_deps "${__dep}")
endif()
else()
list(APPEND ${the_module}_EXTRA_DEPS_${optkind} "${__dep}")
endif()
#else()
# get_target_property(__dep_location "${__dep}" LOCATION)
endif()
endwhile()
@@ -951,7 +956,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
list(APPEND ${the_module}_MODULE_DEPS_${optkind} "${the_module}")
endif()
unset(__dep_location)
unset(__dep_imported)
unset(__mod_depends)
unset(__resolved_deps)
unset(__has_cycle)
+46 -5
View File
@@ -25,21 +25,24 @@ set(CPACK_STRIP_FILES 1)
#arch
if(X86)
set(CPACK_DEBIAN_ARCHITECTURE "i386")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
elseif(X86_64)
set(CPACK_DEBIAN_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
elseif(ARM)
set(CPACK_DEBIAN_ARCHITECTURE "armhf")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
elseif(AARCH64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "aarch64")
else()
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(CPACK_GENERATOR STREQUAL "DEB")
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE})
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
elseif(CPACK_GENERATOR STREQUAL "RPM")
set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
else()
@@ -104,6 +107,44 @@ if(HAVE_CUDA)
endif()
endif()
if(HAVE_TBB AND NOT BUILD_TBB)
if(CPACK_DEB_DEV_PACKAGE_DEPENDS)
set(CPACK_DEB_DEV_PACKAGE_DEPENDS "${CPACK_DEB_DEV_PACKAGE_DEPENDS}, libtbb-dev")
else()
set(CPACK_DEB_DEV_PACKAGE_DEPENDS "libtbb-dev")
endif()
endif()
set(STD_OPENCV_LIBS opencv-data)
set(STD_OPENCV_DEV libopencv-dev)
foreach(module calib3d contrib core features2d flann gpu highgui imgproc legacy
ml objdetect ocl photo stitching superres ts video videostab)
if(HAVE_opencv_${module})
list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
endif()
endforeach()
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_REPLACES "${STD_OPENCV_LIBS}")
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_CONFLICTS "${STD_OPENCV_DEV}")
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_PROVIDES "${STD_OPENCV_DEV}")
string(REPLACE ";" ", " CPACK_COMPONENT_DEV_REPLACES "${STD_OPENCV_DEV}")
set(CPACK_COMPONENT_PYTHON_CONFLICTS python-opencv)
set(CPACK_COMPONENT_PYTHON_PROVIDES python-opencv)
set(CPACK_COMPONENT_PYTHON_REPLACES python-opencv)
set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv2.4-java, libopencv2.4-jni")
set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv2.4-java, libopencv2.4-jni")
set(CPACK_COMPONENT_JAVA_REPLACES "libopencv2.4-java, libopencv2.4-jni")
set(CPACK_COMPONENT_DOCS_CONFLICTS opencv-doc)
set(CPACK_COMPONENT_SAMPLES_CONFLICTS opencv-doc)
if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "libopencv")
+20 -9
View File
@@ -449,18 +449,29 @@ endmacro()
# convert list of paths to libraries names without lib prefix
macro(ocv_convert_to_lib_name var)
set(__tmp "")
function(ocv_convert_to_lib_name var)
set(tmp "")
foreach(path ${ARGN})
get_filename_component(__tmp_name "${path}" NAME_WE)
string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
list(APPEND __tmp "${__tmp_name}")
get_filename_component(tmp_name "${path}" NAME_WE)
string(REGEX REPLACE "^lib" "" tmp_name "${tmp_name}")
list(APPEND tmp "${tmp_name}")
endforeach()
set(${var} ${__tmp})
unset(__tmp)
unset(__tmp_name)
endmacro()
set(${var} ${tmp} PARENT_SCOPE)
endfunction()
# create imported targets for a list of external libraries
function(ocv_create_imported_targets var)
set(target_list "")
foreach(library ${ARGN})
ocv_convert_to_lib_name(libname "${library}")
add_library("opencv_dep_${libname}" UNKNOWN IMPORTED)
set_target_properties("opencv_dep_${libname}" PROPERTIES IMPORTED_LOCATION "${library}")
list(APPEND target_list "opencv_dep_${libname}")
endforeach()
set("${var}" "${target_list}" PARENT_SCOPE)
endfunction()
# add install command
function(ocv_install_target)
+28 -3
View File
@@ -31,7 +31,16 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
endif
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
else
OPENCV_DYNAMICUDA_MODULE:=
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
ifeq ($(OPENCV_HAVE_GPU_MODULE),on)
ifneq ($(CUDA_TOOLKIT_DIR),)
OPENCV_USE_GPU_MODULE:=on
endif
endif
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
else
OPENCV_DYNAMICUDA_MODULE:=
endif
endif
CUDA_RUNTIME_LIBS:=@CUDA_RUNTIME_LIBS_CONFIGMAKE@
@@ -56,6 +65,10 @@ else
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),x86)
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
@@ -77,6 +90,9 @@ ifeq ($(OPENCV_CAMERA_MODULES),on)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_V7A_CONFIGCMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARM64_V8A_CONFIGCMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),x86)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_X86_CONFIGCMAKE@
endif
@@ -101,10 +117,18 @@ define add_opencv_module
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
endef
ifndef CUDA_LIBS_DIR
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/aarch64-linux-androideabi/lib
else
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib
endif
endif
define add_cuda_module
include $(CLEAR_VARS)
LOCAL_MODULE:=$1
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$1.so
LOCAL_SRC_FILES:=$(CUDA_LIBS_DIR)/lib$(1:opencv_dep_%=%).so
include $(PREBUILT_SHARED_LIBRARY)
endef
@@ -202,7 +226,8 @@ ifeq ($(OPENCV_USE_GPU_MODULE),on)
ifeq ($(INSTALL_CUDA_LIBRARIES),on)
LOCAL_SHARED_LIBRARIES += $(foreach mod, $(CUDA_RUNTIME_LIBS), $(mod))
else
LOCAL_LDLIBS += -L$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib $(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib))
LOCAL_LDLIBS += -L$(CUDA_LIBS_DIR) \
$(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib:opencv_dep_%=%))
endif
LOCAL_STATIC_LIBRARIES+=libopencv_gpu
endif
+47 -47
View File
@@ -234,55 +234,55 @@ endif()
foreach(__opttype OPT DBG)
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
# CUDA
if(OpenCV_CUDA_VERSION)
if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
if(${CUDA_VERSION} VERSION_LESS "5.5")
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
else()
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
find_cuda_helper_libs(npps)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
endif()
if(OpenCV_USE_CUBLAS)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
endif()
if(OpenCV_USE_CUFFT)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
endif()
if(OpenCV_USE_NVCUVID)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
endif()
if(WIN32)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
endif()
set(OpenCV_CUDA_LIBS_RELPATH "")
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
get_filename_component(_tmp ${l} PATH)
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
endforeach()
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
link_directories(${OpenCV_CUDA_LIBS_RELPATH})
endif()
endforeach()
# Configure CUDA targets
if(OpenCV_CUDA_VERSION)
if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
if(${CUDA_VERSION} VERSION_LESS "5.5")
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
else()
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
find_cuda_helper_libs(npps)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
endif()
if(OpenCV_USE_CUBLAS)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
endif()
if(OpenCV_USE_CUFFT)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
endif()
if(OpenCV_USE_NVCUVID)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
endif()
if(WIN32)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
endif()
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
get_filename_component(_tmp "${l}" NAME_WE)
string(REGEX REPLACE "^lib" "" _tmp "${_tmp}")
if(NOT TARGET "opencv_dep_${_tmp}") # protect against repeated inclusions
add_library("opencv_dep_${_tmp}" UNKNOWN IMPORTED)
set_target_properties("opencv_dep_${_tmp}" PROPERTIES IMPORTED_LOCATION "${l}")
endif()
endforeach()
endif()
# ==============================================================
# Android camera helper macro
# ==============================================================
@@ -55,6 +55,15 @@ OPENCV_TEST_PATH=@CMAKE_INSTALL_PREFIX@/@OPENCV_TEST_INSTALL_PATH@
OPENCV_PYTHON_TESTS=@OPENCV_PYTHON_TESTS_LIST@
export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata
CUR_DIR=`pwd`
if [ -d "$CUR_DIR" -a -w "$CUR_DIR" ]; then
echo "${TEXT_CYAN}CUR_DIR : $CUR_DIR${TEXT_RESET}"
else
echo "${TEXT_RED}Error: Do not have permissions to write to $CUR_DIR${TEXT_RESET}"
echo "${TEXT_RED}Please run the script from directory with write access${TEXT_RESET}"
exit 1
fi
# Run tests
SUMMARY_STATUS=0
@@ -64,9 +73,8 @@ PASSED_TESTS=""
for t in "$OPENCV_TEST_PATH/"opencv_test_* "$OPENCV_TEST_PATH/"opencv_perf_*;
do
test_name=`basename "$t"`
report="$test_name-`date --rfc-3339=date`.xml"
cmd="$t --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:\"$report\""
cmd="$t --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:$test_name.xml"
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
if [ $COLOR_OUTPUT -eq 1 ]; then
@@ -79,7 +87,7 @@ do
fi
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
$cmd | sed -r "$seg_reg"
eval "$cmd" | tee "$test_name.log" | sed -r "$seg_reg"
ret=${PIPESTATUS[0]}
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
@@ -98,14 +106,13 @@ done
for t in $OPENCV_PYTHON_TESTS;
do
test_name=`basename "$t"`
report="$test_name-`date --rfc-3339=date`.xml"
cmd="py.test --junitxml $report \"$OPENCV_TEST_PATH\"/$t"
cmd="py.test --junitxml $test_name.xml \"$OPENCV_TEST_PATH\"/$t"
seg_reg="s/^/${TEXT_CYAN}[$test_name]${TEXT_RESET} /" # append test name
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RUN : $cmd"
eval "$cmd" | sed -r "$seg_reg"
eval "$cmd" | tee "$test_name.log" | sed -r "$seg_reg"
ret=${PIPESTATUS[0]}
echo "${TEXT_CYAN}[$test_name]${TEXT_RESET} RETURN_CODE : $ret"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -47,7 +47,7 @@
<opencv_storage>
<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
<featureType>HAAR</featureType>
<height>19</height>
<height>18</height>
<width>36</width>
<stageParams>
<maxWeakCount>53</maxWeakCount></stageParams>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
function insertIframe (elementId, iframeSrc)
{
var iframe;
if (document.createElement && (iframe = document.createElement('iframe')))
{
iframe.src = unescape(iframeSrc);
iframe.width = "100%";
iframe.height = "511px";
var element = document.getElementById(elementId);
element.parentNode.replaceChild(iframe, element);
}
}
-1
View File
@@ -11,7 +11,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{%- endblock %}
{% set script_files = script_files + [pathto("_static/insertIframe.js", 1)] %}
{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
+1 -1
View File
@@ -132,7 +132,7 @@ html_logo = 'opencv-logo-white.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
+30 -33
View File
@@ -1,13 +1,19 @@
#!/usr/bin/env python
"""gen_pattern.py
To run:
-c 10 -r 12 -o out.svg
-T type of pattern, circles, acircles, checkerboard
-s --square_size size of squares in pattern
-u --units mm, inches, px, m
-w page width in units
-h page height in units
Usage example:
python gen_pattern.py -o out.svg -r 11 -c 8 -T circles -s 20.0 -R 5.0 -u mm -w 216 -h 279
-o, --output - output file (default out.svg)
-r, --rows - pattern rows (default 11)
-c, --columns - pattern columns (default 8)
-T, --type - type of pattern, circles, acircles, checkerboard (default circles)
-s, --square_size - size of squares in pattern (default 20.0)
-R, --radius_rate - circles_radius = square_size/radius_rate (default 5.0)
-u, --units - mm, inches, px, m (default mm)
-w, --page_width - page width in units (default 216)
-h, --page_height - page height in units (default 279)
-H, --help - show help
"""
from svgfig import *
@@ -16,18 +22,20 @@ import sys
import getopt
class PatternMaker:
def __init__(self, cols,rows,output,units,square_size,page_width,page_height):
def __init__(self, cols,rows,output,units,square_size,radius_rate,page_width,page_height):
self.cols = cols
self.rows = rows
self.output = output
self.units = units
self.square_size = square_size
self.radius_rate = radius_rate
self.width = page_width
self.height = page_height
self.g = SVG("g") # the svg group container
def makeCirclesPattern(self):
spacing = self.square_size
r = spacing / 5.0 #radius is a 5th of the spacing TODO parameterize
r = spacing / self.radius_rate
for x in range(1,self.cols+1):
for y in range(1,self.rows+1):
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
@@ -35,7 +43,7 @@ class PatternMaker:
def makeACirclesPattern(self):
spacing = self.square_size
r = spacing / 5.0
r = spacing / self.radius_rate
for i in range(0,self.rows):
for j in range(0,self.cols):
dot = SVG("circle", cx= ((j*2 + i%2)*spacing) + spacing, cy=self.height - (i * spacing + spacing), r=r, fill="black")
@@ -43,37 +51,23 @@ class PatternMaker:
def makeCheckerboardPattern(self):
spacing = self.square_size
r = spacing / 5.0
for x in range(1,self.cols+1):
for y in range(1,self.rows+1):
#TODO make a checkerboard pattern
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
self.g.append(dot)
if x%2 == y%2:
dot = SVG("rect", x=x * spacing, y=y * spacing, width=spacing, height=spacing, stroke_width="0", fill="black")
self.g.append(dot)
def save(self):
c = canvas(self.g,width="%d%s"%(self.width,self.units),height="%d%s"%(self.height,self.units),viewBox="0 0 %d %d"%(self.width,self.height))
c.inkview(self.output)
def makePattern(cols,rows,output,p_type,units,square_size,page_width,page_height):
width = page_width
spacing = square_size
height = page_height
r = spacing / 5.0
g = SVG("g") # the svg group container
for x in range(1,cols+1):
for y in range(1,rows+1):
if "circle" in p_type:
dot = SVG("circle", cx=x * spacing, cy=y * spacing, r=r, fill="black")
g.append(dot)
c = canvas(g,width="%d%s"%(width,units),height="%d%s"%(height,units),viewBox="0 0 %d %d"%(width,height))
c.inkview(output)
def main():
# parse command line options, TODO use argparse for better doc
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:c:r:T:u:s:w:h:", ["help","output","columns","rows",
"type","units","square_size","page_width",
"page_height"])
opts, args = getopt.getopt(sys.argv[1:], "Ho:c:r:T:u:s:R:w:h:", ["help","output=","columns=","rows=",
"type=","units=","square_size=","radius_rate=",
"page_width=","page_height="])
except getopt.error, msg:
print msg
print "for help use --help"
@@ -84,11 +78,12 @@ def main():
p_type = "circles"
units = "mm"
square_size = 20.0
radius_rate = 5.0
page_width = 216 #8.5 inches
page_height = 279 #11 inches
# process options
for o, a in opts:
if o in ("-h", "--help"):
if o in ("-H", "--help"):
print __doc__
sys.exit(0)
elif o in ("-r", "--rows"):
@@ -103,11 +98,13 @@ def main():
units = a
elif o in ("-s", "--square_size"):
square_size = float(a)
elif o in ("-R", "--radius_rate"):
radius_rate = float(a)
elif o in ("-w", "--page_width"):
page_width = float(a)
elif o in ("-h", "--page_height"):
page_height = float(a)
pm = PatternMaker(columns,rows,output,units,square_size,page_width,page_height)
pm = PatternMaker(columns,rows,output,units,square_size,radius_rate,page_width,page_height)
#dict for easy lookup of pattern type
mp = {"circles":pm.makeCirclesPattern,"acircles":pm.makeACirclesPattern,"checkerboard":pm.makeCheckerboardPattern}
mp[p_type]()
@@ -193,7 +193,7 @@ In the main program, before processing, first check input command parameters. He
{
std::cout<<"RetinaDemo: processing image "<<argv[2]<<std::endl;
// image processing case
inputFrame = cv::imread(std::string(argv[2]), 1); // load image in RGB mode
inputFrame = cv::imread(std::string(argv[2]), 1); // load image in BGR color mode
}else
if (!strcmp(inputMediaType.c_str(), "-video"))
{
@@ -26,7 +26,7 @@ From our previous tutorial, we know already a bit of *Pixel operators*. An inter
g(x) = (1 - \alpha)f_{0}(x) + \alpha f_{1}(x)
By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-disolve* between two images or videos, as seen in slide shows and film productions (cool, eh?)
By varying :math:`\alpha` from :math:`0 \rightarrow 1` this operator can be used to perform a temporal *cross-dissolve* between two images or videos, as seen in slide shows and film productions (cool, eh?)
Code
=====
@@ -44,14 +44,14 @@ or
Scalar
-------
* Represents a 4-element vector. The type Scalar is widely used in OpenCV for passing pixel values.
* In this tutorial, we will use it extensively to represent RGB color values (3 parameters). It is not necessary to define the last argument if it is not going to be used.
* In this tutorial, we will use it extensively to represent BGR color values (3 parameters). It is not necessary to define the last argument if it is not going to be used.
* Let's see an example, if we are asked for a color argument and we give:
.. code-block:: cpp
Scalar( a, b, c )
We would be defining a RGB color such as: *Red = c*, *Green = b* and *Blue = a*
We would be defining a BGR color such as: *Blue = a*, *Green = b* and *Red = c*
Code
@@ -135,7 +135,7 @@ Explanation
* Draw a line from Point **start** to Point **end**
* The line is displayed in the image **img**
* The line color is defined by **Scalar( 0, 0, 0)** which is the RGB value correspondent to **Black**
* The line color is defined by **Scalar( 0, 0, 0)** which is the BGR value correspondent to **Black**
* The line thickness is set to **thickness** (in this case 2)
* The line is a 8-connected one (**lineType** = 8)
@@ -167,7 +167,7 @@ Explanation
* The ellipse center is located in the point **(w/2.0, w/2.0)** and is enclosed in a box of size **(w/4.0, w/16.0)**
* The ellipse is rotated **angle** degrees
* The ellipse extends an arc between **0** and **360** degrees
* The color of the figure will be **Scalar( 255, 255, 0)** which means blue in RGB value.
* The color of the figure will be **Scalar( 255, 0, 0)** which means blue in BGR value.
* The ellipse's **thickness** is 2.
@@ -151,7 +151,7 @@ Explanation
We observe that :mat_zeros:`Mat::zeros <>` returns a Matlab-style zero initializer based on *image.size()* and *image.type()*
#. Now, to perform the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` we will access to each pixel in image. Since we are operating with RGB images, we will have three values per pixel (R, G and B), so we will also access them separately. Here is the piece of code:
#. Now, to perform the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` we will access to each pixel in image. Since we are operating with BGR images, we will have three values per pixel (B, G and R), so we will also access them separately. Here is the piece of code:
.. code-block:: cpp
@@ -40,7 +40,7 @@ You can download the full source code :download:`here <../../../../samples/cpp/t
how_to_scan_images imageName.jpg intValueToReduce [G]
The final argument is optional. If given the image will be loaded in gray scale format, otherwise the RGB color way is used. The first thing is to calculate the lookup table.
The final argument is optional. If given the image will be loaded in gray scale format, otherwise the BGR color way is used. The first thing is to calculate the lookup table.
.. literalinclude:: ../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
:language: cpp
@@ -76,7 +76,7 @@ As you could already read in my :ref:`matTheBasicImageContainer` tutorial the si
Row n & \tabItG{n,0} & \tabItG{n,1} & \tabItG{n,...} & \tabItG{n, m} \\
\end{tabular}
For multichannel images the columns contain as many sub columns as the number of channels. For example in case of an RGB color system:
For multichannel images the columns contain as many sub columns as the number of channels. For example in case of an BGR color system:
.. math::
@@ -89,7 +89,7 @@ For multichannel images the columns contain as many sub columns as the number of
Row n & \tabIt{n,0} & \tabIt{n,1} & \tabIt{n,...} & \tabIt{n, m} \\
\end{tabular}
Note that the order of the channels is inverse: BGR instead of RGB. Because in many cases the memory is large enough to store the rows in a successive fashion the rows may follow one after another, creating a single long row. Because everything is in a single place following one after another this may help to speed up the scanning process. We can use the :basicstructures:`isContinuous() <mat-iscontinuous>` function to *ask* the matrix if this is the case. Continue on to the next section to find an example.
Because in many cases the memory is large enough to store the rows in a successive fashion the rows may follow one after another, creating a single long row. Because everything is in a single place following one after another this may help to speed up the scanning process. We can use the :basicstructures:`isContinuous() <mat-iscontinuous>` function to *ask* the matrix if this is the case. Continue on to the next section to find an example.
The efficient way
=================
@@ -87,7 +87,7 @@ Here you can observe that with the new structure we have no pointer problems, al
:tab-width: 4
:lines: 46-51
Because, we want to mess around with the images luma component we first convert from the default RGB to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula.
Because, we want to mess around with the images luma component we first convert from the default BGR to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula.
The scanning version looks like:
@@ -76,12 +76,12 @@ There are, however, many other color systems each with their own advantages:
.. container:: enumeratevisibleitemswithsquare
* RGB is the most common as our eyes use something similar, our display systems also compose colors using these.
* RGB is the most common as our eyes use something similar, but keep in mind that the OpenCV display system uses BGR colors.
* The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors. You might, for example, dismiss the value component, making your algorithm less sensitive to the light conditions of the input image.
* YCrCb is used by the popular JPEG image format.
* CIE L*a*b* is a perceptually uniform color space, which comes handy if you need to measure the *distance* of a given color to another color.
Each of the color components has its own valid domains. This brings us to the data type used: how we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in the case of three components (such as RGB) this already gives 16 million representable colors. We may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
Each of the color components has its own valid domains. This brings us to the data type used: how we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in the case of three components (such as BGR) this already gives 16 million representable colors. We may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
Creating a *Mat* object explicitly
==================================
@@ -116,7 +116,7 @@ Explanation
pt1.x = rng.uniform( x_1, x_2 );
pt1.y = rng.uniform( y_1, y_2 );
* We know that **rng** is a *Random number generator* object. In the code above we are calling **rng.uniform(a,b)**. This generates a radombly uniformed distribution between the values **a** and **b** (inclusive in **a**, exclusive in **b**).
* We know that **rng** is a *Random number generator* object. In the code above we are calling **rng.uniform(a,b)**. This generates a randomly uniformed distribution between the values **a** and **b** (inclusive in **a**, exclusive in **b**).
* From the explanation above, we deduce that the extremes *pt1* and *pt2* will be random values, so the lines positions will be quite impredictable, giving a nice visual effect (check out the Result section below).
@@ -138,7 +138,7 @@ Explanation
As we can see, the return value is an *Scalar* with 3 randomly initialized values, which are used as the *R*, *G* and *B* parameters for the line color. Hence, the color of the lines will be random too!
#. The explanation above applies for the other functions generating circles, ellipses, polygones, etc. The parameters such as *center* and *vertices* are also generated randomly.
#. The explanation above applies for the other functions generating circles, ellipses, polygons, etc. The parameters such as *center* and *vertices* are also generated randomly.
#. Before finishing, we also should take a look at the functions *Display_Random_Text* and *Displaying_Big_End*, since they both have a few interesting features:
@@ -14,7 +14,7 @@ Whenever you work with video feeds you may eventually want to save your image pr
+ What type of video files you can create with OpenCV
+ How to extract a given color channel from a video
As a simple demonstration I'll just extract one of the RGB color channels of an input video file into a new video. You can control the flow of the application from its console line arguments:
As a simple demonstration I'll just extract one of the BGR color channels of an input video file into a new video. You can control the flow of the application from its console line arguments:
.. container:: enumeratevisibleitemswithsquare
@@ -111,7 +111,7 @@ Afterwards, you use the :hgvideo:`isOpened() <videowriter-isopened>` function to
outputVideo.write(res); //or
outputVideo << res;
Extracting a color channel from an RGB image means to set to zero the RGB values of the other channels. You can either do this with image scanning operations or by using the split and merge operations. You first split the channels up into different images, set the other channels to zero images of the same size and type and finally merge them back:
Extracting a color channel from an BGR image means to set to zero the BGR values of the other channels. You can either do this with image scanning operations or by using the split and merge operations. You first split the channels up into different images, set the other channels to zero images of the same size and type and finally merge them back:
.. code-block:: cpp
@@ -177,7 +177,7 @@ Explanation
.. container:: enumeratevisibleitemswithsquare
* Load an image (can be RGB or grayscale)
* Load an image (can be BGR or grayscale)
* Create two windows (one for dilation output, the other for erosion)
* Create a set of 02 Trackbars for each operation:
@@ -93,7 +93,7 @@ Code
Explanation
===========
#. Declare variables such as the matrices to store the base image and the two other images to compare ( RGB and HSV )
#. Declare variables such as the matrices to store the base image and the two other images to compare ( BGR and HSV )
.. code-block:: cpp
@@ -57,7 +57,7 @@ How does it work?
We consider only points such that :math:`r > 0` and :math:`0< \theta < 2 \pi`.
#. We can do the same operation above for all the points in an image. If the curves of two different points intersect in the plane :math:`\theta` - :math:`r`, that means that both points belong to a same line. For instance, following with the example above and drawing the plot for two more points: :math:`x_{1} = 9`, :math:`y_{1} = 4` and :math:`x_{2} = 12`, :math:`y_{2} = 3`, we get:
#. We can do the same operation above for all the points in an image. If the curves of two different points intersect in the plane :math:`\theta` - :math:`r`, that means that both points belong to a same line. For instance, following with the example above and drawing the plot for two more points: :math:`x_{1} = 4`, :math:`y_{1} = 9` and :math:`x_{2} = 12`, :math:`y_{2} = 3`, we get:
.. image:: images/Hough_Lines_Tutorial_Theory_2.jpg
:alt: Polar plot of the family of lines for three points
@@ -88,7 +88,7 @@ Code
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
/// Convert the image to grayscale
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
@@ -141,7 +141,7 @@ Explanation
.. code-block:: cpp
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
#. Apply the Laplacian operator to the grayscale image:
@@ -154,7 +154,7 @@ Code
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
/// Convert it to gray
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
@@ -217,7 +217,7 @@ Explanation
.. code-block:: cpp
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
#. Second, we calculate the "*derivatives*" in *x* and *y* directions. For this, we use the function :sobel:`Sobel <>` as shown below:
@@ -167,7 +167,7 @@ The tutorial code's is shown lines below. You can also download it from `here <h
src = imread( argv[1], 1 );
/// Convert the image to Gray
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
/// Create a window to display results
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
@@ -221,14 +221,14 @@ Explanation
#. Let's check the general structure of the program:
* Load an image. If it is RGB we convert it to Grayscale. For this, remember that we can use the function :cvt_color:`cvtColor <>`:
* Load an image. If it is BGR we convert it to Grayscale. For this, remember that we can use the function :cvt_color:`cvtColor <>`:
.. code-block:: cpp
src = imread( argv[1], 1 );
/// Convert the image to Gray
cvtColor( src, src_gray, CV_RGB2GRAY );
cvtColor( src, src_gray, CV_BGR2GRAY );
* Create a window to display the result
@@ -68,7 +68,7 @@ Now we call the :imread:`imread <>` function which loads the image name specifie
+ CV_LOAD_IMAGE_UNCHANGED (<0) loads the image as is (including the alpha channel if present)
+ CV_LOAD_IMAGE_GRAYSCALE ( 0) loads the image as an intensity one
+ CV_LOAD_IMAGE_COLOR (>0) loads the image in the RGB format
+ CV_LOAD_IMAGE_COLOR (>0) loads the image in the BGR format
.. literalinclude:: ../../../../samples/cpp/tutorial_code/introduction/display_image/display_image.cpp
:language: cpp
@@ -63,7 +63,7 @@ Here it is:
Explanation
============
#. We begin by loading an image using :readwriteimagevideo:`imread <imread>`, located in the path given by *imageName*. For this example, assume you are loading a RGB image.
#. We begin by loading an image using :readwriteimagevideo:`imread <imread>`, located in the path given by *imageName*. For this example, assume you are loading a BGR image.
#. Now we are going to convert our image from BGR to Grayscale format. OpenCV has a really nice function to do this kind of transformations:
+3 -3
View File
@@ -7,7 +7,7 @@ Senz3D and Intel Perceptual Computing SDK
Using Creative Senz3D and other Intel Perceptual Computing SDK compatible depth sensors
=======================================================================================
Depth sensors compatible with Intel Perceptual Computing SDK are supported through ``VideoCapture`` class. Depth map, RGB image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
Depth sensors compatible with Intel Perceptual Computing SDK are supported through ``VideoCapture`` class. Depth map, BGR image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
In order to use depth sensor with OpenCV you should do the following preliminary steps:
@@ -28,7 +28,7 @@ VideoCapture can retrieve the following data:
* ``CV_CAP_INTELPERC_UVDEPTH_MAP`` - each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates. (CV_32FC2)
* ``CV_CAP_INTELPERC_IR_MAP`` - each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam. (CV_16UC1)
#.
data given from RGB image generator:
data given from BGR image generator:
* ``CV_CAP_INTELPERC_IMAGE`` - color image. (CV_8UC3)
In order to get depth map from depth sensor use ``VideoCapture::operator >>``, e. g. ::
@@ -76,4 +76,4 @@ Since two types of sensor's data generators are supported (image generator and d
For more information please refer to the example of usage intelperc_capture.cpp_ in ``opencv/samples/cpp`` folder.
.. _intelperc_capture.cpp: https://github.com/Itseez/opencv/tree/master/samples/cpp/intelperc_capture.cpp
.. _intelperc_capture.cpp: https://github.com/Itseez/opencv/tree/master/samples/cpp/intelperc_capture.cpp
+3 -3
View File
@@ -7,7 +7,7 @@ Kinect and OpenNI
Using Kinect and other OpenNI compatible depth sensors
======================================================
Depth sensors compatible with OpenNI (Kinect, XtionPRO, ...) are supported through ``VideoCapture`` class. Depth map, RGB image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
Depth sensors compatible with OpenNI (Kinect, XtionPRO, ...) are supported through ``VideoCapture`` class. Depth map, BGR image and some other formats of output can be retrieved by using familiar interface of ``VideoCapture``.
In order to use depth sensor with OpenCV you should do the following preliminary steps:
@@ -47,7 +47,7 @@ VideoCapture can retrieve the following data:
* ``CV_CAP_OPENNI_DISPARITY_MAP_32F`` - disparity in pixels (CV_32FC1)
* ``CV_CAP_OPENNI_VALID_DEPTH_MASK`` - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)
#.
data given from RGB image generator:
data given from BGR image generator:
* ``CV_CAP_OPENNI_BGR_IMAGE`` - color image (CV_8UC3)
* ``CV_CAP_OPENNI_GRAY_IMAGE`` - gray image (CV_8UC1)
@@ -69,7 +69,7 @@ For getting several data maps use ``VideoCapture::grab`` and ``VideoCapture::ret
for(;;)
{
Mat depthMap;
Mat rgbImage
Mat bgrImage;
capture.grab();
+4
View File
@@ -294,6 +294,10 @@ Command line arguments of ``opencv_traincascade`` application grouped by purpose
This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format.
* ``-acceptanceRatioBreakValue``
This argument is used to determine how precise your model should keep learning and when to stop. A good guideline is to train not further than 10e-5, to ensure the model does not overtrain on your training data. By default this value is set to -1 to disable this feature.
#.
Cascade parameters:
@@ -128,11 +128,11 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
.. ocv:pyoldfunction:: cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags=0)-> None
:param objectPoints: In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space. The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0.
:param objectPoints: In the new interface it is a vector of vectors of calibration pattern points in the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer vector contains as many elements as the number of the pattern views. If the same calibration pattern is shown in each view and it is fully visible, all the vectors will be the same. Although, it is possible to use partially occluded patterns, or even different patterns in different views. Then, the vectors will be different. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0.
In the old interface all the vectors of object points from different views are concatenated together.
:param imagePoints: In the new interface it is a vector of vectors of the projections of calibration pattern points. ``imagePoints.size()`` and ``objectPoints.size()`` and ``imagePoints[i].size()`` must be equal to ``objectPoints[i].size()`` for each ``i``.
:param imagePoints: In the new interface it is a vector of vectors of the projections of calibration pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). ``imagePoints.size()`` and ``objectPoints.size()`` and ``imagePoints[i].size()`` must be equal to ``objectPoints[i].size()`` for each ``i``.
In the old interface all the vectors of object points from different views are concatenated together.
@@ -144,7 +144,7 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
:param distCoeffs: Output vector of distortion coefficients :math:`(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]])` of 4, 5, or 8 elements.
:param rvecs: Output vector of rotation vectors (see :ocv:func:`Rodrigues` ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
:param rvecs: Output vector of rotation vectors (see :ocv:func:`Rodrigues` ) estimated for each pattern view (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
:param tvecs: Output vector of translation vectors estimated for each pattern view.
+6 -7
View File
@@ -82,18 +82,18 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa
CV_Error( CV_StsUnmatchedSizes, "Size of projection matrices must be 3x4" );
CvMat matrA;
double matrA_dat[24];
matrA = cvMat(6,4,CV_64F,matrA_dat);
double matrA_dat[16];
matrA = cvMat(4,4,CV_64F,matrA_dat);
//CvMat matrU;
CvMat matrW;
CvMat matrV;
//double matrU_dat[9*9];
double matrW_dat[6*4];
double matrW_dat[4*4];
double matrV_dat[4*4];
//matrU = cvMat(6,6,CV_64F,matrU_dat);
matrW = cvMat(6,4,CV_64F,matrW_dat);
matrW = cvMat(4,4,CV_64F,matrW_dat);
matrV = cvMat(4,4,CV_64F,matrV_dat);
CvMat* projPoints[2];
@@ -117,9 +117,8 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa
y = cvmGet(projPoints[j],1,i);
for( int k = 0; k < 4; k++ )
{
cvmSet(&matrA, j*3+0, k, x * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],0,k) );
cvmSet(&matrA, j*3+1, k, y * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],1,k) );
cvmSet(&matrA, j*3+2, k, x * cvmGet(projMatrs[j],1,k) - y * cvmGet(projMatrs[j],0,k) );
cvmSet(&matrA, j*2+0, k, x * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],0,k) );
cvmSet(&matrA, j*2+1, k, y * cvmGet(projMatrs[j],2,k) - cvmGet(projMatrs[j],1,k) );
}
}
/* Solve system for current point */
@@ -1870,5 +1870,12 @@ TEST(Calib3d_CalibrationMatrixValues_C, accuracy) { CV_CalibrationMatrixValuesTe
TEST(Calib3d_CalibrationMatrixValues_CPP, accuracy) { CV_CalibrationMatrixValuesTest_CPP test; test.safe_run(); }
TEST(Calib3d_ProjectPoints_C, accuracy) { CV_ProjectPointsTest_C test; test.safe_run(); }
TEST(Calib3d_ProjectPoints_CPP, regression) { CV_ProjectPointsTest_CPP test; test.safe_run(); }
#ifdef __aarch64__
// Tests fail by accuracy (0.019145 vs 0.001000)
TEST(Calib3d_StereoCalibrate_C, DISABLED_regression) { CV_StereoCalibrationTest_C test; test.safe_run(); }
TEST(Calib3d_StereoCalibrate_CPP, DISABLED_regression) { CV_StereoCalibrationTest_CPP test; test.safe_run(); }
#else
TEST(Calib3d_StereoCalibrate_C, regression) { CV_StereoCalibrationTest_C test; test.safe_run(); }
TEST(Calib3d_StereoCalibrate_CPP, regression) { CV_StereoCalibrationTest_CPP test; test.safe_run(); }
#endif
@@ -110,11 +110,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
if( !img )
{
ts->printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", filename );
if( max_idx == 1 )
{
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
goto _exit_;
}
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
continue;
}
@@ -137,7 +137,12 @@ protected:
{
InT d = disp(y, x);
double from[4] = { x, y, d, 1 };
double from[4] = {
static_cast<double>(x),
static_cast<double>(y),
static_cast<double>(d),
1.0,
};
Mat_<double> res = Q * Mat_<double>(4, 1, from);
res /= res(3, 0);
@@ -101,7 +101,10 @@ void CV_UndistortPointsBadArgTest::run(int)
img_size.height = 600;
double cam[9] = {150.f, 0.f, img_size.width/2.f, 0, 300.f, img_size.height/2.f, 0.f, 0.f, 1.f};
double dist[4] = {0.01,0.02,0.001,0.0005};
double s_points[N_POINTS2] = {img_size.width/4,img_size.height/4};
double s_points[N_POINTS2] = {
static_cast<double>(img_size.width) / 4.0,
static_cast<double>(img_size.height) / 4.0,
};
double d_points[N_POINTS2];
double p[9] = {155.f, 0.f, img_size.width/2.f+img_size.width/50.f, 0, 310.f, img_size.height/2.f+img_size.height/50.f, 0.f, 0.f, 1.f};
double r[9] = {1,0,0,0,1,0,0,0,1};
+2 -2
View File
@@ -293,7 +293,7 @@ Retina::write
Retina::setupIPLMagnoChannel
++++++++++++++++++++++++++++
.. ocv:function:: void Retina::setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta = 0, const float parasolCells_tau = 0, const float parasolCells_k = 7, const float amacrinCellsTemporalCutFrequency = 1.2, const float V0CompressionParameter = 0.95, const float localAdaptintegration_tau = 0, const float localAdaptintegration_k = 7 )
.. ocv:function:: void Retina::setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta = 0, const float parasolCells_tau = 0, const float parasolCells_k = 7, const float amacrinCellsTemporalCutFrequency = 1.2f, const float V0CompressionParameter = 0.95f, const float localAdaptintegration_tau = 0, const float localAdaptintegration_k = 7 )
Set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel this channel processes signals output from OPL processing stage in peripheral vision, it allows motion information enhancement. It is decorrelated from the details channel. See reference papers for more details.
@@ -309,7 +309,7 @@ Retina::setupIPLMagnoChannel
Retina::setupOPLandIPLParvoChannel
++++++++++++++++++++++++++++++++++
.. ocv:function:: void Retina::setupOPLandIPLParvoChannel(const bool colorMode = true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity = 0.7, const float photoreceptorsTemporalConstant = 0.5, const float photoreceptorsSpatialConstant = 0.53, const float horizontalCellsGain = 0, const float HcellsTemporalConstant = 1, const float HcellsSpatialConstant = 7, const float ganglionCellsSensitivity = 0.7 )
.. ocv:function:: void Retina::setupOPLandIPLParvoChannel(const bool colorMode = true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity = 0.7f, const float photoreceptorsTemporalConstant = 0.5f, const float photoreceptorsSpatialConstant = 0.53f, const float horizontalCellsGain = 0, const float HcellsTemporalConstant = 1, const float HcellsSpatialConstant = 7, const float ganglionCellsSensitivity = 0.7f )
Setup the OPL and IPL parvo channels (see biologocal model) OPL is referred as Outer Plexiform Layer of the retina, it allows the spatio-temporal filtering which withens the spectrum and reduces spatio-temporal noise while attenuating global luminance (low frequency energy) IPL parvo is the OPL next processing stage, it refers to a part of the Inner Plexiform layer of the retina, it allows high contours sensitivity in foveal vision. See reference papers for more informations.
-3
View File
@@ -1,6 +1,3 @@
/*! \file core.hpp
\brief The Core Functionality
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
@@ -1,6 +1,3 @@
/*! \file core.hpp
\brief The Core Functionality
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
@@ -49,8 +49,8 @@
#define CV_VERSION_EPOCH 2
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 11
#define CV_VERSION_REVISION 0
#define CV_VERSION_MINOR 12
#define CV_VERSION_REVISION 2
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
+4 -1
View File
@@ -33,5 +33,8 @@ PERF_TEST_P( Size_DepthSrc_DepthDst_Channels_alpha, convertTo,
int runs = (sz.width <= 640) ? 8 : 1;
TEST_CYCLE_MULTIRUN(runs) src.convertTo(dst, depthDst, alpha);
SANITY_CHECK(dst, alpha == 1.0 ? 1e-12 : 1e-7);
if (depthDst >= CV_32F)
SANITY_CHECK(dst, 1e-7, ERROR_RELATIVE);
else
SANITY_CHECK(dst, 1e-12);
}
+1 -1
View File
@@ -22,5 +22,5 @@ PERF_TEST_P(Size_MatType, dft, TEST_MATS_DFT)
TEST_CYCLE() dft(src, dst);
SANITY_CHECK(dst, 1e-5);
SANITY_CHECK(dst, 4e-7, ERROR_RELATIVE);
}
+7
View File
@@ -33,5 +33,12 @@ PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
int runs = (sz.width <= 640) ? 8 : 1;
TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst );
#ifdef __aarch64__
// looks like random generator produces a little bit
// different source data on aarch64 platform and
// eps should be increased to allow the tests pass
SANITY_CHECK(dst, (srcDepth == CV_32F ? 1.55e-5 : 1e-12));
#else
SANITY_CHECK(dst, 1e-12);
#endif
}
+7
View File
@@ -29,5 +29,12 @@ PERF_TEST_P( Size_Depth_Channels, split,
int runs = (sz.width <= 640) ? 8 : 1;
TEST_CYCLE_MULTIRUN(runs) split(m, (vector<Mat>&)mv);
#ifdef __aarch64__
// looks like random generator produces a little bit
// different source data on aarch64 platform and
// eps should be increased to allow the tests pass
SANITY_CHECK(mv, (depth == CV_32F ? 1.55e-5 : 1e-12));
#else
SANITY_CHECK(mv, 1e-12);
#endif
}
+2 -2
View File
@@ -427,7 +427,7 @@ struct _VAdd32f { __m128 operator()(const __m128& a, const __m128& b) const { re
struct _VSub32f { __m128 operator()(const __m128& a, const __m128& b) const { return _mm_sub_ps(a,b); }};
struct _VMin32f { __m128 operator()(const __m128& a, const __m128& b) const { return _mm_min_ps(a,b); }};
struct _VMax32f { __m128 operator()(const __m128& a, const __m128& b) const { return _mm_max_ps(a,b); }};
static int CV_DECL_ALIGNED(16) v32f_absmask[] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff };
static unsigned int CV_DECL_ALIGNED(16) v32f_absmask[] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff };
struct _VAbsDiff32f
{
__m128 operator()(const __m128& a, const __m128& b) const
@@ -441,7 +441,7 @@ struct _VSub64f { __m128d operator()(const __m128d& a, const __m128d& b) const {
struct _VMin64f { __m128d operator()(const __m128d& a, const __m128d& b) const { return _mm_min_pd(a,b); }};
struct _VMax64f { __m128d operator()(const __m128d& a, const __m128d& b) const { return _mm_max_pd(a,b); }};
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
static unsigned int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
struct _VAbsDiff64f
{
__m128d operator()(const __m128d& a, const __m128d& b) const
+5 -1
View File
@@ -346,6 +346,7 @@ CV_IMPL CvString
cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len )
{
CvString str;
memset(&str, 0, sizeof(CvString));
str.len = len >= 0 ? len : (int)strlen(ptr);
str.ptr = (char*)cvMemStorageAlloc( storage, str.len + 1 );
@@ -645,7 +646,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
/* If there is a free space just after last allocated block
and it is big enough then enlarge the last block.
This can happen only if the new block is added to the end of sequence: */
if( (unsigned)(ICV_FREE_PTR(storage) - seq->block_max) < CV_STRUCT_ALIGN &&
if( (size_t)(ICV_FREE_PTR(storage) - seq->block_max) < CV_STRUCT_ALIGN &&
storage->free_space >= seq->elem_size && !in_front_of )
{
int delta = storage->free_space / elem_size;
@@ -1688,6 +1689,9 @@ cvSeqRemoveSlice( CvSeq* seq, CvSlice slice )
slice.end_index = slice.start_index + length;
if ( slice.start_index == slice.end_index )
return;
if( slice.end_index < total )
{
CvSeqReader reader_to, reader_from;
+4
View File
@@ -2215,7 +2215,11 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
{
Mat p = pts.getMat(manyContours ? i : -1);
if( p.total() == 0 )
{
ptsptr[i] = NULL;
npts[i] = 0;
continue;
}
CV_Assert(p.checkVector(2, CV_32S) >= 0);
ptsptr[i] = (Point*)p.data;
npts[i] = p.rows*p.cols*p.channels()/2;
+10 -2
View File
@@ -1097,8 +1097,8 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
size_t minidx = 0, maxidx = 0;
int iminval = INT_MAX, imaxval = INT_MIN;
float fminval = FLT_MAX, fmaxval = -FLT_MAX;
double dminval = DBL_MAX, dmaxval = -DBL_MAX;
float fminval = std::numeric_limits<float>::infinity(), fmaxval = -fminval;
double dminval = std::numeric_limits<double>::infinity(), dmaxval = -dminval;
size_t startidx = 1;
int *minval = &iminval, *maxval = &imaxval;
int planeSize = (int)it.size*cn;
@@ -1111,6 +1111,14 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
for( size_t i = 0; i < it.nplanes; i++, ++it, startidx += planeSize )
func( ptrs[0], ptrs[1], minval, maxval, &minidx, &maxidx, planeSize, startidx );
if (!src.empty() && mask.empty())
{
if( minidx == 0 )
minidx = 1;
if( maxidx == 0 )
maxidx = 1;
}
if( minidx == 0 )
dminval = dmaxval = 0;
else if( depth == CV_32F )
+1 -1
View File
@@ -923,7 +923,7 @@ struct Mutex::Impl
int refcount;
};
#elif defined __linux__ && !defined ANDROID
#elif defined __linux__ && !defined ANDROID && !defined __LINUXTHREADS_OLD__
struct Mutex::Impl
{
+18
View File
@@ -1792,3 +1792,21 @@ INSTANTIATE_TEST_CASE_P(Arithm, SubtractOutputMatNotEmpty, testing::Combine(
testing::Values(perf::MatType(CV_8UC1), CV_8UC3, CV_8UC4, CV_16SC1, CV_16SC3),
testing::Values(-1, CV_16S, CV_32S, CV_32F),
testing::Bool()));
TEST(MinMaxLoc, Mat_IntMax_Without_Mask)
{
Mat_<int> mat(50, 50);
int iMaxVal = numeric_limits<int>::max();
mat.setTo(iMaxVal);
double min, max;
Point minLoc, maxLoc;
minMaxLoc(mat, &min, &max, &minLoc, &maxLoc, Mat());
ASSERT_EQ(iMaxVal, min);
ASSERT_EQ(iMaxVal, max);
ASSERT_EQ(Point(0, 0), minLoc);
ASSERT_EQ(Point(0, 0), maxLoc);
}
+17 -3
View File
@@ -493,6 +493,7 @@ class Core_SeqBaseTest : public Core_DynStructBaseTest
{
public:
Core_SeqBaseTest();
virtual ~Core_SeqBaseTest();
void clear();
void run( int );
@@ -503,11 +504,14 @@ protected:
int test_seq_ops( int iters );
};
Core_SeqBaseTest::Core_SeqBaseTest()
{
}
Core_SeqBaseTest::~Core_SeqBaseTest()
{
clear();
}
void Core_SeqBaseTest::clear()
{
@@ -1208,6 +1212,7 @@ class Core_SetTest : public Core_DynStructBaseTest
{
public:
Core_SetTest();
virtual ~Core_SetTest();
void clear();
void run( int );
@@ -1221,6 +1226,10 @@ Core_SetTest::Core_SetTest()
{
}
Core_SetTest::~Core_SetTest()
{
clear();
}
void Core_SetTest::clear()
{
@@ -1419,6 +1428,7 @@ class Core_GraphTest : public Core_DynStructBaseTest
{
public:
Core_GraphTest();
virtual ~Core_GraphTest();
void clear();
void run( int );
@@ -1432,6 +1442,10 @@ Core_GraphTest::Core_GraphTest()
{
}
Core_GraphTest::~Core_GraphTest()
{
clear();
}
void Core_GraphTest::clear()
{
@@ -2044,6 +2058,8 @@ void Core_GraphScanTest::run( int )
CV_TS_SEQ_CHECK_CONDITION( vtx_count == 0 && edge_count == 0,
"Not every vertex/edge has been visited" );
update_progressbar();
cvReleaseGraphScanner( &scanner );
}
// for a random graph the test just checks that every graph vertex and
@@ -2108,8 +2124,6 @@ void Core_GraphScanTest::run( int )
catch(int)
{
}
cvReleaseGraphScanner( &scanner );
}
+11 -3
View File
@@ -144,7 +144,11 @@ protected:
depth = cvtest::randInt(rng) % (CV_64F+1);
cn = cvtest::randInt(rng) % 4 + 1;
int sz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1};
int sz[] = {
static_cast<int>(cvtest::randInt(rng)%10+1),
static_cast<int>(cvtest::randInt(rng)%10+1),
static_cast<int>(cvtest::randInt(rng)%10+1),
};
MatND test_mat_nd(3, sz, CV_MAKETYPE(depth, cn));
rng0.fill(test_mat_nd, CV_RAND_UNI, Scalar::all(ranges[depth][0]), Scalar::all(ranges[depth][1]));
@@ -156,8 +160,12 @@ protected:
multiply(test_mat_nd, test_mat_scale, test_mat_nd);
}
int ssz[] = {cvtest::randInt(rng)%10+1, cvtest::randInt(rng)%10+1,
cvtest::randInt(rng)%10+1,cvtest::randInt(rng)%10+1};
int ssz[] = {
static_cast<int>(cvtest::randInt(rng)%10+1),
static_cast<int>(cvtest::randInt(rng)%10+1),
static_cast<int>(cvtest::randInt(rng)%10+1),
static_cast<int>(cvtest::randInt(rng)%10+1),
};
SparseMat test_sparse_mat = cvTsGetRandomSparseMat(4, ssz, cvtest::randInt(rng)%(CV_64F+1),
cvtest::randInt(rng) % 10000, 0, 100, rng);
+20
View File
@@ -48,3 +48,23 @@ TEST(Core_SaturateCast, NegativeNotClipped)
ASSERT_EQ(0xffffffff, val);
}
TEST(Core_Drawing, polylines_empty)
{
Mat img(100, 100, CV_8UC1, Scalar(0));
vector<Point> pts; // empty
polylines(img, pts, false, Scalar(255));
int cnt = countNonZero(img);
ASSERT_EQ(cnt, 0);
}
TEST(Core_Drawing, polylines)
{
Mat img(100, 100, CV_8UC1, Scalar(0));
vector<Point> pts;
pts.push_back(Point(0, 0));
pts.push_back(Point(20, 0));
polylines(img, pts, false, Scalar(255));
int cnt = countNonZero(img);
ASSERT_EQ(cnt, 21);
}
@@ -44,6 +44,7 @@
#include "opencv2/gpu/device/transform.hpp"
#include "opencv2/gpu/device/functional.hpp"
#include "opencv2/gpu/device/type_traits.hpp"
#include "opencv2/gpu/device/vec_traits.hpp"
namespace cv { namespace gpu { namespace device
{
@@ -105,87 +106,59 @@ namespace cv { namespace gpu { namespace device
////////////////////////////////// SetTo //////////////////////////////////
///////////////////////////////////////////////////////////////////////////
__constant__ uchar scalar_8u[4];
__constant__ schar scalar_8s[4];
__constant__ ushort scalar_16u[4];
__constant__ short scalar_16s[4];
__constant__ int scalar_32s[4];
__constant__ float scalar_32f[4];
__constant__ double scalar_64f[4];
template <typename T> __device__ __forceinline__ T readScalar(int i);
template <> __device__ __forceinline__ uchar readScalar<uchar>(int i) {return scalar_8u[i];}
template <> __device__ __forceinline__ schar readScalar<schar>(int i) {return scalar_8s[i];}
template <> __device__ __forceinline__ ushort readScalar<ushort>(int i) {return scalar_16u[i];}
template <> __device__ __forceinline__ short readScalar<short>(int i) {return scalar_16s[i];}
template <> __device__ __forceinline__ int readScalar<int>(int i) {return scalar_32s[i];}
template <> __device__ __forceinline__ float readScalar<float>(int i) {return scalar_32f[i];}
template <> __device__ __forceinline__ double readScalar<double>(int i) {return scalar_64f[i];}
void writeScalar(const uchar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8u, vals, sizeof(uchar) * 4) );
}
void writeScalar(const schar* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_8s, vals, sizeof(schar) * 4) );
}
void writeScalar(const ushort* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16u, vals, sizeof(ushort) * 4) );
}
void writeScalar(const short* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_16s, vals, sizeof(short) * 4) );
}
void writeScalar(const int* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32s, vals, sizeof(int) * 4) );
}
void writeScalar(const float* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_32f, vals, sizeof(float) * 4) );
}
void writeScalar(const double* vals)
{
cudaSafeCall( cudaMemcpyToSymbol(scalar_64f, vals, sizeof(double) * 4) );
}
template<typename T>
__global__ void set_to_without_mask(T* mat, int cols, int rows, size_t step, int channels)
__global__ void set_to_without_mask(PtrStepSz<T> mat, typename TypeVec<T, 4>::vec_type val, int channels)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
const int y = blockIdx.x * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
if (y < mat.rows)
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
const T vals[] = {
val.x, val.y, val.z, val.w
};
T* row = mat.ptr(y);
for (int x = threadIdx.x; x < mat.cols * channels; x += 32)
{
row[x] = vals[x % channels];
}
}
}
template<typename T>
__global__ void set_to_with_mask(T* mat, const uchar* mask, int cols, int rows, size_t step, int channels, size_t step_mask)
__global__ void set_to_with_mask(PtrStepSz<T> mat, const PtrStepb mask, typename TypeVec<T, 4>::vec_type val, int channels)
{
size_t x = blockIdx.x * blockDim.x + threadIdx.x;
size_t y = blockIdx.y * blockDim.y + threadIdx.y;
const int y = blockIdx.x * blockDim.y + threadIdx.y;
if ((x < cols * channels ) && (y < rows))
if (mask[y * step_mask + x / channels] != 0)
if (y < mat.rows)
{
const T vals[] = {
val.x, val.y, val.z, val.w
};
T* row = mat.ptr(y);
const uchar* mask_row = mask.ptr(y);
for (int x = threadIdx.x; x < mat.cols * channels; x += 32)
{
size_t idx = y * ( step >> shift_and_sizeof<T>::shift ) + x;
mat[idx] = readScalar<T>(x % channels);
if (mask_row[x / channels])
{
row[x] = vals[x % channels];
}
}
}
}
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, PtrStepSzb mask, int channels, cudaStream_t stream)
{
writeScalar(scalar);
typedef typename TypeVec<T, 4>::vec_type vec_type;
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
dim3 block(32, 8);
dim3 grid(divUp(mat.rows, block.y));
set_to_with_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, (uchar*)mask.data, mat.cols, mat.rows, mat.step, channels, mask.step);
set_to_with_mask<T><<<grid, block, 0, stream>>>(PtrStepSz<T>(mat), mask, VecTraits<vec_type>::make(scalar), channels);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
@@ -203,12 +176,12 @@ namespace cv { namespace gpu { namespace device
template <typename T>
void set_to_gpu(PtrStepSzb mat, const T* scalar, int channels, cudaStream_t stream)
{
writeScalar(scalar);
typedef typename TypeVec<T, 4>::vec_type vec_type;
dim3 threadsPerBlock(32, 8, 1);
dim3 numBlocks (mat.cols * channels / threadsPerBlock.x + 1, mat.rows / threadsPerBlock.y + 1, 1);
dim3 block(32, 8);
dim3 grid(divUp(mat.rows, block.y));
set_to_without_mask<T><<<numBlocks, threadsPerBlock, 0, stream>>>((T*)mat.data, mat.cols, mat.rows, mat.step, channels);
set_to_without_mask<T><<<grid, block, 0, stream>>>(PtrStepSz<T>(mat), VecTraits<vec_type>::make(scalar), channels);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
@@ -879,7 +879,7 @@ CV_EXPORTS Mat windowedMatchingMask( const vector<KeyPoint>& keypoints1, const v
/*
* OpponentColorDescriptorExtractor
*
* Adapts a descriptor extractor to compute descripors in Opponent Color Space
* Adapts a descriptor extractor to compute descriptors 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
+2 -2
View File
@@ -28,7 +28,7 @@ PERF_TEST_P(orb, detect, testing::Values(ORB_IMAGES))
TEST_CYCLE() detector(frame, mask, points);
sort(points.begin(), points.end(), comparators::KeypointGreater());
SANITY_CHECK_KEYPOINTS(points);
SANITY_CHECK_KEYPOINTS(points, 1e-7, ERROR_RELATIVE);
}
PERF_TEST_P(orb, extract, testing::Values(ORB_IMAGES))
@@ -72,6 +72,6 @@ PERF_TEST_P(orb, full, testing::Values(ORB_IMAGES))
TEST_CYCLE() detector(frame, mask, points, descriptors, false);
perf::sort(points, descriptors);
SANITY_CHECK_KEYPOINTS(points);
SANITY_CHECK_KEYPOINTS(points, 1e-8, ERROR_RELATIVE);
SANITY_CHECK(descriptors);
}
+2 -1
View File
@@ -656,7 +656,8 @@ void FREAKImpl::drawPattern()
FREAK::FREAK( bool _orientationNormalized, bool _scaleNormalized
, float _patternScale, int _nOctaves, const std::vector<int>& _selectedPairs )
: orientationNormalized(_orientationNormalized), scaleNormalized(_scaleNormalized),
patternScale(_patternScale), nOctaves(_nOctaves), extAll(false), nOctaves0(0), selectedPairs0(_selectedPairs)
patternScale(_patternScale), nOctaves(_nOctaves), extAll(false),
patternScale0(0.0), nOctaves0(0), selectedPairs0(_selectedPairs)
{
}
+12 -2
View File
@@ -531,10 +531,20 @@ void FlannBasedMatcher::clear()
void FlannBasedMatcher::train()
{
if( flannIndex.empty() || mergedDescriptors.size() < addedDescCount )
int trained = mergedDescriptors.size();
if (flannIndex.empty() || trained < addedDescCount)
{
mergedDescriptors.set( trainDescCollection );
flannIndex = new flann::Index( mergedDescriptors.getDescriptors(), *indexParams );
// construct flannIndex class, if empty or Algorithm not equal FLANN_INDEX_LSH
if (flannIndex.empty() || flannIndex->getAlgorithm() != cvflann::FLANN_INDEX_LSH)
{
flannIndex = new flann::Index(mergedDescriptors.getDescriptors(), *indexParams);
}
else
{
flannIndex->build(mergedDescriptors.getDescriptors(), mergedDescriptors.getDescriptors().rowRange(trained, mergedDescriptors.size()), *indexParams, cvflann::FLANN_DIST_HAMMING);
}
}
}
@@ -61,7 +61,7 @@ static void writeMatInBin( const Mat& mat, const string& filename )
fwrite( (void*)&mat.rows, sizeof(int), 1, f );
fwrite( (void*)&mat.cols, sizeof(int), 1, f );
fwrite( (void*)&type, sizeof(int), 1, f );
int dataSize = (int)(mat.step * mat.rows * mat.channels());
int dataSize = (int)(mat.step * mat.rows);
fwrite( (void*)&dataSize, sizeof(int), 1, f );
fwrite( (void*)mat.data, 1, dataSize, f );
fclose(f);
@@ -80,12 +80,15 @@ static Mat readMatFromBin( const string& filename )
size_t elements_read4 = fread( (void*)&dataSize, sizeof(int), 1, f );
CV_Assert(elements_read1 == 1 && elements_read2 == 1 && elements_read3 == 1 && elements_read4 == 1);
uchar* data = (uchar*)cvAlloc(dataSize);
size_t elements_read = fread( (void*)data, 1, dataSize, f );
Mat returnMat(rows, cols, type);
CV_Assert(returnMat.step * returnMat.rows == (size_t)(dataSize));
size_t elements_read = fread( (void*)returnMat.data, 1, dataSize, f );
CV_Assert(elements_read == (size_t)(dataSize));
fclose(f);
return Mat( rows, cols, type, data );
return returnMat;
}
return Mat();
}
@@ -0,0 +1,543 @@
/***********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2015 Ippei Ito. All rights reserved.
*
* THE BSD LICENSE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*************************************************************************/
/*
For OpenCV2.4/OpenCV3.0
Test for Pull Request # 3829
https://github.com/Itseez/opencv/pull/3829
This test code creates brute force matcher for accuracy of reference, and the test target matcher.
Then, add() and train() transformed query image descriptors, and some outlier images descriptors to both matchers.
Then, compared with the query image by match() and findHomography() to detect outlier and calculate accuracy.
And each drawMatches() images are saved, if SAVE_DRAW_MATCHES_IMAGES is true.
Finally, compare accuracies between the brute force matcher and the test target matcher.
The lsh algorithm uses std::random_shuffle in lsh_index.h to make the random indexes table.
So, in relation to default random seed value of the execution environment or by using "srand(time(0)) function",
the match time and accuracy of the match results are different, each time the code ran.
And the match time becomes late in relation to the number of the hash collision times.
*/
#include "test_precomp.hpp"
#include "opencv2/ts.hpp" // for FilePath::CreateFolder()
#include <time.h> // for time()
// If defined, the match time and accuracy of the match results are a little different, each time the code ran.
//#define INIT_RANDOM_SEED
// If defined, some outlier images descriptors add() the matcher.
#define TRAIN_WITH_OUTLIER_IMAGES
// If true, save drawMatches() images.
#define SAVE_DRAW_MATCHES_IMAGES false
// if true, verbose output
#define SHOW_DEBUG_LOG true
#if CV_MAJOR_VERSION==2
#define OrbCreate new cv::ORB(4000)
#elif CV_MAJOR_VERSION==3
#define OrbCreate cv::ORB::create(4000)
#define AKazeCreate cv::AKAZE::create()
#endif
using namespace std;
int testno_for_make_filename = 0;
// --------------------------------------------------------------------------------------
// Parameter class to transform query image
// --------------------------------------------------------------------------------------
class testparam
{
public:
string transname;
void(*transfunc)(float, const cv::Mat&, cv::Mat&);
float from, to, step;
testparam(string _transname, void(*_transfunc)(float, const cv::Mat&, cv::Mat&), float _from, float _to, float _step) :
transname(_transname),
transfunc(_transfunc),
from(_from),
to(_to),
step(_step)
{}
};
// --------------------------------------------------------------------------------------
// from matching_to_many_images.cpp
// --------------------------------------------------------------------------------------
int maskMatchesByTrainImgIdx(const vector<cv::DMatch>& matches, int trainImgIdx, vector<char>& mask)
{
int matchcnt = 0;
mask.resize(matches.size());
fill(mask.begin(), mask.end(), 0);
for (size_t i = 0; i < matches.size(); i++)
{
if (matches[i].imgIdx == trainImgIdx)
{
mask[i] = 1;
matchcnt++;
}
}
return matchcnt;
}
int calcHomographyAndInlierCount(const vector<cv::KeyPoint>& query_kp, const vector<cv::KeyPoint>& train_kp, const vector<cv::DMatch>& match, vector<char> &mask, cv::Mat &homography)
{
// make query and current train image keypoint pairs
std::vector<cv::Point2f> srcPoints, dstPoints;
for (unsigned int i = 0; i < match.size(); ++i)
{
if (mask[i] != 0) // is current train image ?
{
srcPoints.push_back(query_kp[match[i].queryIdx].pt);
dstPoints.push_back(train_kp[match[i].trainIdx].pt);
}
}
// calc homography
vector<uchar> inlierMask;
homography = findHomography(srcPoints, dstPoints, cv::RANSAC, 3.0, inlierMask);
// update outlier mask
int j = 0;
for (unsigned int i = 0; i < match.size(); ++i)
{
if (mask[i] != 0) // is current train image ?
{
if (inlierMask.size() == 0 || inlierMask[j] == 0) // is outlier ?
{
mask[i] = 0;
}
j++;
}
}
// count inlier
int inlierCnt = 0;
for (unsigned int i = 0; i < mask.size(); ++i)
{
if (mask[i] != 0)
{
inlierCnt++;
}
}
return inlierCnt;
}
void drawDetectedRectangle(cv::Mat& imgResult, const cv::Mat& homography, const cv::Mat& imgQuery)
{
std::vector<cv::Point2f> query_corners(4);
query_corners[0] = cv::Point(0, 0);
query_corners[1] = cv::Point(imgQuery.cols, 0);
query_corners[2] = cv::Point(imgQuery.cols, imgQuery.rows);
query_corners[3] = cv::Point(0, imgQuery.rows);
std::vector<cv::Point2f> train_corners(4);
perspectiveTransform(query_corners, train_corners, homography);
line(imgResult, train_corners[0] + query_corners[1], train_corners[1] + query_corners[1], cv::Scalar(0, 255, 0), 4);
line(imgResult, train_corners[1] + query_corners[1], train_corners[2] + query_corners[1], cv::Scalar(0, 255, 0), 4);
line(imgResult, train_corners[2] + query_corners[1], train_corners[3] + query_corners[1], cv::Scalar(0, 255, 0), 4);
line(imgResult, train_corners[3] + query_corners[1], train_corners[0] + query_corners[1], cv::Scalar(0, 255, 0), 4);
}
// --------------------------------------------------------------------------------------
// transform query image, extract&compute, train, matching and save result image function
// --------------------------------------------------------------------------------------
typedef struct tagTrainInfo
{
int traindesccnt;
double traintime;
double matchtime;
double accuracy;
}TrainInfo;
TrainInfo transImgAndTrain(
cv::Feature2D *fe,
cv::DescriptorMatcher *matcher,
const string &matchername,
const cv::Mat& imgQuery, const vector<cv::KeyPoint>& query_kp, const cv::Mat& query_desc,
const vector<cv::Mat>& imgOutliers, const vector<vector<cv::KeyPoint> >& outliers_kp, const vector<cv::Mat>& outliers_desc, const int totalOutlierDescCnt,
const float t, const testparam *tp,
const int testno, const bool bVerboseOutput, const bool bSaveDrawMatches)
{
TrainInfo ti;
// transform query image
cv::Mat imgTransform;
(tp->transfunc)(t, imgQuery, imgTransform);
// extract kp and compute desc from transformed query image
vector<cv::KeyPoint> trans_query_kp;
cv::Mat trans_query_desc;
#if CV_MAJOR_VERSION==2
(*fe)(imgTransform, cv::Mat(), trans_query_kp, trans_query_desc);
#elif CV_MAJOR_VERSION==3
fe->detectAndCompute(imgTransform, Mat(), trans_query_kp, trans_query_desc);
#endif
// add&train transformed query desc and outlier desc
matcher->clear();
matcher->add(vector<cv::Mat>(1, trans_query_desc));
double s = (double)cv::getTickCount();
matcher->train();
ti.traintime = 1000.0*((double)cv::getTickCount() - s) / cv::getTickFrequency();
ti.traindesccnt = trans_query_desc.rows;
#if defined(TRAIN_WITH_OUTLIER_IMAGES)
// same as matcher->add(outliers_desc); matcher->train();
for (unsigned int i = 0; i < outliers_desc.size(); ++i)
{
matcher->add(vector<cv::Mat>(1, outliers_desc[i]));
s = (double)cv::getTickCount();
matcher->train();
ti.traintime += 1000.0*((double)cv::getTickCount() - s) / cv::getTickFrequency();
}
ti.traindesccnt += totalOutlierDescCnt;
#endif
// matching
vector<cv::DMatch> match;
s = (double)cv::getTickCount();
matcher->match(query_desc, match);
ti.matchtime = 1000.0*((double)cv::getTickCount() - s) / cv::getTickFrequency();
// prepare a directory and variables for save matching images
vector<char> mask;
cv::Mat imgResult;
const char resultDir[] = "result";
if (bSaveDrawMatches)
{
testing::internal::FilePath fp = testing::internal::FilePath(resultDir);
fp.CreateFolder();
}
char buff[2048];
int matchcnt;
// save query vs transformed query matching image with detected rectangle
matchcnt = maskMatchesByTrainImgIdx(match, (int)0, mask);
// calc homography and inlier
cv::Mat homography;
int inlierCnt = calcHomographyAndInlierCount(query_kp, trans_query_kp, match, mask, homography);
ti.accuracy = (double)inlierCnt / (double)mask.size()*100.0;
drawMatches(imgQuery, query_kp, imgTransform, trans_query_kp, match, imgResult, cv::Scalar::all(-1), cv::Scalar::all(128), mask, cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
if (inlierCnt)
{
// draw detected rectangle
drawDetectedRectangle(imgResult, homography, imgQuery);
}
// draw status
sprintf(buff, "%s accuracy:%-3.2f%% %d descriptors training time:%-3.2fms matching :%-3.2fms", matchername.c_str(), ti.accuracy, ti.traindesccnt, ti.traintime, ti.matchtime);
putText(imgResult, buff, cv::Point(0, 12), cv::FONT_HERSHEY_PLAIN, 0.8, cv::Scalar(0., 0., 255.));
sprintf(buff, "%s/res%03d_%s_%s%.1f_inlier.png", resultDir, testno, matchername.c_str(), tp->transname.c_str(), t);
if (bSaveDrawMatches && !imwrite(buff, imgResult)) cout << "Image " << buff << " can not be saved (may be because directory " << resultDir << " does not exist)." << endl;
#if defined(TRAIN_WITH_OUTLIER_IMAGES)
// save query vs outlier matching image(s)
for (unsigned int i = 0; i <imgOutliers.size(); ++i)
{
matchcnt = maskMatchesByTrainImgIdx(match, (int)i + 1, mask);
drawMatches(imgQuery, query_kp, imgOutliers[i], outliers_kp[i], match, imgResult, cv::Scalar::all(-1), cv::Scalar::all(128), mask);// , DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
sprintf(buff, "query_num:%d train_num:%d matched:%d %d descriptors training time:%-3.2fms matching :%-3.2fms", (int)query_kp.size(), (int)outliers_kp[i].size(), matchcnt, ti.traindesccnt, ti.traintime, ti.matchtime);
putText(imgResult, buff, cv::Point(0, 12), cv::FONT_HERSHEY_PLAIN, 0.8, cv::Scalar(0., 0., 255.));
sprintf(buff, "%s/res%03d_%s_%s%.1f_outlier%02d.png", resultDir, testno, matchername.c_str(), tp->transname.c_str(), t, i);
if (bSaveDrawMatches && !imwrite(buff, imgResult)) cout << "Image " << buff << " can not be saved (may be because directory " << resultDir << " does not exist)." << endl;
}
#endif
if (bVerboseOutput)
{
cout << tp->transname <<" image matching accuracy:" << ti.accuracy << "% " << ti.traindesccnt << " train:" << ti.traintime << "ms match:" << ti.matchtime << "ms" << endl;
}
return ti;
}
// --------------------------------------------------------------------------------------
// Main Test Class
// --------------------------------------------------------------------------------------
class CV_FeatureDetectorMatcherBaseTest : public cvtest::BaseTest
{
private:
testparam *tp;
double target_accuracy_margin_from_bfmatcher;
cv::Feature2D* fe; // feature detector extractor
cv::DescriptorMatcher* bfmatcher; // brute force matcher for accuracy of reference
cv::DescriptorMatcher* flmatcher; // flann matcher to test
cv::Mat imgQuery; // query image
vector<cv::Mat> imgOutliers; // outlier image
vector<cv::KeyPoint> query_kp; // query key points detect from imgQuery
cv::Mat query_desc; // query descriptors extract from imgQuery
vector<vector<cv::KeyPoint> > outliers_kp;
vector<cv::Mat> outliers_desc;
int totalOutlierDescCnt;
string flmatchername;
public:
//
// constructor
//
CV_FeatureDetectorMatcherBaseTest(testparam* _tp, double _accuracy_margin, cv::Feature2D* _fe,
cv::DescriptorMatcher *_flmatcher, string _flmatchername, int norm_type_for_bfmatcher) :
tp(_tp),
target_accuracy_margin_from_bfmatcher(_accuracy_margin),
fe(_fe),
flmatcher(_flmatcher),
flmatchername(_flmatchername)
{
#if defined(INIT_RANDOM_SEED)
// from test/test_eigen.cpp
srand((unsigned int)time(0));
#endif
// create brute force matcher for accuracy of reference
bfmatcher = new cv::BFMatcher(norm_type_for_bfmatcher);
}
virtual ~CV_FeatureDetectorMatcherBaseTest()
{
if (bfmatcher)
{
delete bfmatcher;
bfmatcher = NULL;
}
}
//
// Main Test method
//
virtual void run(int)
{
// load query image
string strQueryFile = string(cvtest::TS::ptr()->get_data_path()) + "shared/lena.png";
imgQuery = cv::imread(strQueryFile, 0);
if (imgQuery.empty())
{
ts->printf(cvtest::TS::LOG, "Image %s can not be read.\n", strQueryFile.c_str());
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return;
}
// load outlier images
char* outliers[] = { (char*)"baboon.png", (char*)"fruits.png", (char*)"airplane.png" };
for (unsigned int i = 0; i < sizeof(outliers) / sizeof(char*); i++)
{
string strOutlierFile = string(cvtest::TS::ptr()->get_data_path()) + "shared/" + outliers[i];
cv::Mat imgOutlier = cv::imread(strOutlierFile, 0);
if (imgQuery.empty())
{
ts->printf(cvtest::TS::LOG, "Image %s can not be read.\n", strOutlierFile.c_str());
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return;
}
imgOutliers.push_back(imgOutlier);
}
// extract and compute keypoints and descriptors from query image
#if CV_MAJOR_VERSION==2
(*fe)(imgQuery, cv::Mat(), query_kp, query_desc);
#elif CV_MAJOR_VERSION==3
fe->detectAndCompute(imgQuery, Mat(), query_kp, query_desc);
#endif
// extract and compute keypoints and descriptors from outlier images
fe->detect(imgOutliers, outliers_kp);
((cv::DescriptorExtractor*)fe)->compute(imgOutliers, outliers_kp, outliers_desc);
totalOutlierDescCnt = 0;
for (unsigned int i = 0; i < outliers_desc.size(); ++i) totalOutlierDescCnt += outliers_desc[i].rows;
if (SHOW_DEBUG_LOG)
{
cout << query_kp.size() << " keypoints extracted from query image." << endl;
#if defined(TRAIN_WITH_OUTLIER_IMAGES)
cout << totalOutlierDescCnt << " keypoints extracted from outlier image(s)." << endl;
#endif
}
// compute brute force matcher accuracy for reference
double totalTrainTime = 0.;
double totalMatchTime = 0.;
double totalAccuracy = 0.;
int cnt = 0;
for (float t = tp->from; t <= tp->to; t += tp->step, ++testno_for_make_filename, ++cnt)
{
if (SHOW_DEBUG_LOG) cout << "Test No." << testno_for_make_filename << " BFMatcher " << t;
TrainInfo ti = transImgAndTrain(fe, bfmatcher, "BFMatcher",
imgQuery, query_kp, query_desc,
imgOutliers, outliers_kp, outliers_desc,
totalOutlierDescCnt,
t, tp, testno_for_make_filename, SHOW_DEBUG_LOG, SAVE_DRAW_MATCHES_IMAGES);
totalTrainTime += ti.traintime;
totalMatchTime += ti.matchtime;
totalAccuracy += ti.accuracy;
}
double bf_average_accuracy = totalAccuracy / cnt;
if (SHOW_DEBUG_LOG)
{
cout << "total training time: " << totalTrainTime << "ms" << endl;
cout << "total matching time: " << totalMatchTime << "ms" << endl;
cout << "average accuracy:" << bf_average_accuracy << "%" << endl;
}
// test the target matcher
totalTrainTime = 0.;
totalMatchTime = 0.;
totalAccuracy = 0.;
cnt = 0;
for (float t = tp->from; t <= tp->to; t += tp->step, ++testno_for_make_filename, ++cnt)
{
if (SHOW_DEBUG_LOG) cout << "Test No." << testno_for_make_filename << " " << flmatchername << " " << t;
TrainInfo ti = transImgAndTrain(fe, flmatcher, flmatchername,
imgQuery, query_kp, query_desc,
imgOutliers, outliers_kp, outliers_desc,
totalOutlierDescCnt,
t, tp, testno_for_make_filename, SHOW_DEBUG_LOG, SAVE_DRAW_MATCHES_IMAGES);
totalTrainTime += ti.traintime;
totalMatchTime += ti.matchtime;
totalAccuracy += ti.accuracy;
}
double average_accuracy = totalAccuracy / cnt;
double target_average_accuracy = bf_average_accuracy * target_accuracy_margin_from_bfmatcher;
if (SHOW_DEBUG_LOG)
{
cout << "total training time: " << totalTrainTime << "ms" << endl;
cout << "total matching time: " << totalMatchTime << "ms" << endl;
cout << "average accuracy:" << average_accuracy << "%" << endl;
cout << "threshold of the target matcher average accuracy as error :" << target_average_accuracy << "%" << endl;
cout << "accuracy degraded " << (100.0 - (average_accuracy / bf_average_accuracy *100.0)) << "% from BFMatcher.(lower percentage is better)" << endl;
}
// compare accuracies between the brute force matcher and the test target matcher
if (average_accuracy < target_average_accuracy)
{
ts->printf(cvtest::TS::LOG, "Bad average accuracy %f < %f while test %s %s query\n", average_accuracy, target_average_accuracy, flmatchername.c_str(), tp->transname.c_str());
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
}
return;
}
};
// --------------------------------------------------------------------------------------
// Transform Functions
// --------------------------------------------------------------------------------------
static void rotate(float deg, const cv::Mat& src, cv::Mat& dst)
{
cv::warpAffine(src, dst, getRotationMatrix2D(cv::Point2f(src.cols / 2.0f, src.rows / 2.0f), deg, 1), src.size(), cv::INTER_CUBIC);
}
static void scale(float scale, const cv::Mat& src, cv::Mat& dst)
{
cv::resize(src, dst, cv::Size((int)(src.cols*scale), (int)(src.rows*scale)), cv::INTER_CUBIC);
}
static void blur(float k, const cv::Mat& src, cv::Mat& dst)
{
GaussianBlur(src, dst, cv::Size((int)k, (int)k), 0);
}
// --------------------------------------------------------------------------------------
// Tests Registrations
// --------------------------------------------------------------------------------------
#define SHORT_LSH_KEY_ACCURACY_MARGIN 0.72 // The margin for FlannBasedMatcher. 28% degraded from BFMatcher(Actually, about 10..24% measured.lower percentage is better.) for lsh key size=16.
#define MIDDLE_LSH_KEY_ACCURACY_MARGIN 0.72 // The margin for FlannBasedMatcher. 28% degraded from BFMatcher(Actually, about 7..24% measured.lower percentage is better.) for lsh key size=24.
#define LONG_LSH_KEY_ACCURACY_MARGIN 0.90 // The margin for FlannBasedMatcher. 10% degraded from BFMatcher(Actually, about -29...7% measured.lower percentage is better.) for lsh key size=31.
TEST(BlurredQueryFlannBasedLshShortKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 16, 2));
testparam tp("blurred", blur, 1.0f, 11.0f, 2.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, SHORT_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 16, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(BlurredQueryFlannBasedLshMiddleKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 24, 2));
testparam tp("blurred", blur, 1.0f, 11.0f, 2.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, MIDDLE_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 24, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(BlurredQueryFlannBasedLshLongKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 31, 2));
testparam tp("blurred", blur, 1.0f, 11.0f, 2.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, LONG_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 31, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(ScaledQueryFlannBasedLshShortKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 16, 2));
testparam tp("scaled", scale, 0.5f, 1.5f, 0.1f);
CV_FeatureDetectorMatcherBaseTest test(&tp, SHORT_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 16, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(ScaledQueryFlannBasedLshMiddleKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 24, 2));
testparam tp("scaled", scale, 0.5f, 1.5f, 0.1f);
CV_FeatureDetectorMatcherBaseTest test(&tp, MIDDLE_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 24, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(ScaledQueryFlannBasedLshLongKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 31, 2));
testparam tp("scaled", scale, 0.5f, 1.5f, 0.1f);
CV_FeatureDetectorMatcherBaseTest test(&tp, LONG_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 31, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(RotatedQueryFlannBasedLshShortKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 16, 2));
testparam tp("rotated", rotate, 0.0f, 359.0f, 30.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, SHORT_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 16, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(RotatedQueryFlannBasedLshMiddleKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 24, 2));
testparam tp("rotated", rotate, 0.0f, 359.0f, 30.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, MIDDLE_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 24, 2)", cv::NORM_HAMMING);
test.safe_run();
}
TEST(RotatedQueryFlannBasedLshLongKeyMatcherAdditionalTrainTest, accuracy)
{
cv::Ptr<cv::Feature2D> fe = OrbCreate;
cv::Ptr<cv::FlannBasedMatcher> fl = cv::makePtr<cv::FlannBasedMatcher>(cv::makePtr<cv::flann::LshIndexParams>(1, 31, 2));
testparam tp("rotated", rotate, 0.0f, 359.0f, 30.0f);
CV_FeatureDetectorMatcherBaseTest test(&tp, LONG_LSH_KEY_ACCURACY_MARGIN, fe, fl, "FlannLsh(1, 31, 2)", cv::NORM_HAMMING);
test.safe_run();
}
@@ -65,13 +65,13 @@ protected:
virtual void run( int start_from );
virtual void createModel( const Mat& data ) = 0;
virtual int findNeighbors( Mat& points, Mat& neighbors ) = 0;
virtual int checkGetPoins( const Mat& data );
virtual int checkGetPoints( const Mat& data );
virtual int checkFindBoxed();
virtual int checkFind( const Mat& data );
virtual void releaseModel() = 0;
};
int NearestNeighborTest::checkGetPoins( const Mat& )
int NearestNeighborTest::checkGetPoints( const Mat& )
{
return cvtest::TS::OK;
}
@@ -125,11 +125,11 @@ int NearestNeighborTest::checkFind( const Mat& data )
void NearestNeighborTest::run( int /*start_from*/ ) {
int code = cvtest::TS::OK, tempCode;
Mat desc( featuresCount, dims, CV_32FC1 );
randu( desc, Scalar(minValue), Scalar(maxValue) );
ts->get_rng().fill( desc, RNG::UNIFORM, minValue, maxValue );
createModel( desc );
tempCode = checkGetPoins( desc );
tempCode = checkGetPoints( desc );
if( tempCode != cvtest::TS::OK )
{
ts->printf( cvtest::TS::LOG, "bad accuracy of GetPoints \n" );
@@ -159,10 +159,10 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
class CV_KDTreeTest_CPP : public NearestNeighborTest
{
public:
CV_KDTreeTest_CPP() {}
CV_KDTreeTest_CPP() : NearestNeighborTest(), tr(NULL) {}
protected:
virtual void createModel( const Mat& data );
virtual int checkGetPoins( const Mat& data );
virtual int checkGetPoints( const Mat& data );
virtual int findNeighbors( Mat& points, Mat& neighbors );
virtual int checkFindBoxed();
virtual void releaseModel();
@@ -175,7 +175,7 @@ void CV_KDTreeTest_CPP::createModel( const Mat& data )
tr = new KDTree( data, false );
}
int CV_KDTreeTest_CPP::checkGetPoins( const Mat& data )
int CV_KDTreeTest_CPP::checkGetPoints( const Mat& data )
{
Mat res1( data.size(), data.type() ),
res3( data.size(), data.type() );
@@ -244,7 +244,7 @@ void CV_KDTreeTest_CPP::releaseModel()
class CV_FlannTest : public NearestNeighborTest
{
public:
CV_FlannTest() {}
CV_FlannTest() : NearestNeighborTest(), index(NULL) { }
protected:
void createIndex( const Mat& data, const IndexParams& params );
int knnSearch( Mat& points, Mat& neighbors );
@@ -255,6 +255,9 @@ protected:
void CV_FlannTest::createIndex( const Mat& data, const IndexParams& params )
{
// release previously allocated index
releaseModel();
index = new Index( data, params );
}
@@ -321,7 +324,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
void CV_FlannTest::releaseModel()
{
delete index;
if (index)
{
delete index;
index = NULL;
}
}
//---------------------------------------
+1
View File
@@ -14,6 +14,7 @@
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include <iostream>
#endif
@@ -94,6 +94,13 @@ public:
}
}
/**
* Dummy implementation for other algorithms of addable indexes after that.
*/
void addIndex(const Matrix<ElementType>& /*wholeData*/, const Matrix<ElementType>& /*additionalData*/)
{
}
/**
* Method responsible with building the index.
*/
@@ -377,6 +384,7 @@ private:
// evaluate kdtree for all parameter combinations
for (size_t i = 0; i < FLANN_ARRAY_LEN(testTrees); ++i) {
CostData cost;
cost.params["algorithm"] = FLANN_INDEX_KDTREE;
cost.params["trees"] = testTrees[i];
evaluate_kdtree(cost);
@@ -130,6 +130,13 @@ public:
return kmeans_index_->usedMemory() + kdtree_index_->usedMemory();
}
/**
* Dummy implementation for other algorithms of addable indexes after that.
*/
void addIndex(const Matrix<ElementType>& /*wholeData*/, const Matrix<ElementType>& /*additionalData*/)
{
}
/**
* \brief Builds the index
*/

Some files were not shown because too many files have changed in this diff Show More