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

Compare commits

...

108 Commits

Author SHA1 Message Date
Alexander Smorkalov 8e40becab1 Debian packages with legacy C headers added to list of conflicts, relpaces, etc.
(cherry picked from commit e245aed6bb)
2015-10-26 10:56:34 +03:00
Alexander Alekhin 60eda6f25c export simple libs from OPENCV_LINKER_LIBS (fix #5541)
(cherry picked from commit 937a096bf1)
2015-10-26 10:55:38 +03:00
Alexander Smorkalov 2e78a3e5e9 Fixed samples build with nonfree.
(cherry picked from commit 341e7b3be2)
2015-10-26 10:55:24 +03:00
Alexander Smorkalov 966d35a9fb Made samples build independent from nonfree module.
(cherry picked from commit bba8c0beac)
2015-10-26 10:55:14 +03:00
Alexander Smorkalov 42447a7610 Set of lintain warning fixes for -samples debian package.
(cherry picked from commit ff00220302)
2015-10-26 10:55:00 +03:00
Aaron Simmons ca50969c2b brining over fix in master (#4140) for libz import on 64-bit android
(cherry picked from commit 55a9fdf051)
2015-10-26 10:54:44 +03:00
a-andre 2d3e170370 install opencv2/highgui.hpp header
(cherry picked from commit d16fb30512)
2015-10-26 10:54:29 +03:00
Alexander Smorkalov 8a37fc8223 Added missing copyright headers.
(cherry picked from commit 408107ce6d)
2015-10-26 10:53:52 +03:00
Alexander Smorkalov a5c20f8592 Debian formatted copyright file added to all debian packages.
(cherry picked from commit 9d24b3c3b0)
2015-10-26 10:53:38 +03:00
Ilya Lavrenov 96a2edb375 delete video readers
(cherry picked from commit 0d5b739d35)
2015-10-26 10:53:23 +03:00
Ilya Lavrenov 15b313ce4b fixed memory leak in findHomography tests
(cherry picked from commit ec5244a73a)
2015-10-26 10:52:57 +03:00
Alexander Smorkalov 1ea6568951 Fixed wrong-name-for-changelog-of-native-package warning for deb packages.
(cherry picked from commit cb1dc7cb6e)
2015-10-26 10:51:22 +03:00
Ilya Lavrenov 56654ae360 added some property setting and getting
(cherry picked from commit 75fcedf0ed)
2015-10-26 10:50:00 +03:00
Ilya Lavrenov 9a3e53e738 repaired GStreamer 0.10 version
(cherry picked from commit c19ed39a78)
2015-10-26 10:49:43 +03:00
Ilya Lavrenov 2243bfa181 repaired gstreamer camera capture:
1. Enabled property retrieval: height, width, FPS
2. Fixed issue when isOpened returns always true even for non-existing devices
3. Ability to work with non-0 device. Camera capture index is taken into account

(cherry picked from commit dbd7912b88)
2015-10-26 10:49:32 +03:00
robertxwu 33cd7f38a8 re-submit
(cherry picked from commit 4a68cc1675)
2015-10-26 10:49:02 +03:00
Hajo Nils Krabbenhöft 2fc0ce5c24 buffer_size should be in bytes, not bits
(cherry picked from commit 7825cbeb7d)
2015-10-26 10:46:33 +03:00
Hajo Nils Krabbenhöft c5d009d6c4 fix crash for large BW tif images
(cherry picked from commit d38fee7599)
2015-10-26 10:46:23 +03:00
Roman Donchenko 7d28541bbe test2.py: fail if a downloaded image can't be decoded
(cherry picked from commit 56f17e4921)
2015-10-26 10:45:22 +03:00
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 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 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
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
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
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
65 changed files with 981 additions and 349 deletions
+81 -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;
@@ -176,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;
@@ -191,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);
+2 -1
View File
@@ -8,7 +8,8 @@ if(BUILD_ZLIB)
else()
include(FindZLIB)
if(ZLIB_FOUND AND ANDROID)
if(ZLIB_LIBRARY STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
if(ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so" OR
ZLIB_LIBRARIES STREQUAL "${ANDROID_SYSROOT}/usr/lib64/libz.so")
set(ZLIB_LIBRARY z)
set(ZLIB_LIBRARIES z)
endif()
+3 -3
View File
@@ -12,8 +12,8 @@ endif(WITH_VFW)
# --- GStreamer ---
ocv_clear_vars(HAVE_GSTREAMER)
# try to find gstreamer 1.x first
if(WITH_GSTREAMER)
# try to find gstreamer 1.x first if 0.10 was not requested
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
@@ -29,7 +29,7 @@ if(WITH_GSTREAMER)
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
endif()
endif(WITH_GSTREAMER)
endif()
# gstreamer support was requested but could not find gstreamer 1.x,
# so fallback/try to find gstreamer 0.10
+8 -3
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)
@@ -574,7 +576,10 @@ macro(ocv_create_module)
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS})
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${OPENCV_MODULE_${the_module}_DEPS})
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
ocv_extract_simple_libs(extra_deps _simple_deps _other_deps)
target_link_libraries(${the_module} LINK_INTERFACE_LIBRARIES ${_simple_deps}) # this list goes to "export"
target_link_libraries(${the_module} ${extra_deps})
endif()
add_dependencies(opencv_modules ${the_module})
@@ -629,7 +634,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()
+32 -9
View File
@@ -19,6 +19,7 @@ OpenCV makes it easy for businesses to utilize and modify the code.")
set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
set(OPENCV_DEBIAN_COPYRIGHT_FILE "")
endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
set(CPACK_STRIP_FILES 1)
@@ -115,15 +116,18 @@ if(HAVE_TBB AND NOT BUILD_TBB)
endif()
endif()
set(STD_OPENCV_LIBS opencv-data libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4
libopencv-features2d2.4 libopencv-flann2.4 libopencv-gpu2.4 libopencv-imgproc2.4
libopencv-ml2.4 libopencv-ocl2.4 libopencv-stitching2.4 libopencv-ts2.4 libopencv-videostab2.4)
set(STD_OPENCV_LIBS opencv-data)
set(STD_OPENCV_DEV libopencv-dev)
set(STD_OPENCV_DEV libopencv-calib3d-dev libopencv-contrib-dev libopencv-core-dev
libopencv-dev libopencv-features2d-dev libopencv-flann-dev libopencv-gpu-dev
libopencv-highgui-dev libopencv-imgproc-dev libopencv-legacy-dev libopencv-ml-dev
libopencv-objdetect-dev libopencv-ocl-dev libopencv-photo-dev libopencv-stitching-dev
libopencv-superres-dev libopencv-ts-dev libopencv-video-dev libopencv-videostab-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()
list(APPEND STD_OPENCV_DEV "libhighgui-dev" "libcv-dev" "libcvaux-dev")
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
@@ -191,7 +195,7 @@ if(CPACK_GENERATOR STREQUAL "DEB")
set(DEBIAN_CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian")
set(DEBIAN_CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.Debian.gz")
set(CHANGELOG_PACKAGE_NAME "${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/changelog.Debian.in" "${DEBIAN_CHANGELOG_OUT_FILE}" @ONLY)
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${DEBIAN_CHANGELOG_OUT_FILE}"
OUTPUT_FILE "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
@@ -200,6 +204,25 @@ if(CPACK_GENERATOR STREQUAL "DEB")
install(FILES "${DEBIAN_CHANGELOG_OUT_FILE_GZ}"
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
COMPONENT "${comp}")
set(CHANGELOG_OUT_FILE "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog")
set(CHANGELOG_OUT_FILE_GZ "${CMAKE_BINARY_DIR}/deb-packages-gen/${comp}/changelog.gz")
file(WRITE ${CHANGELOG_OUT_FILE} "Upstream changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog")
execute_process(COMMAND "${GZIP_TOOL}" "-cf9" "${CHANGELOG_OUT_FILE}"
OUTPUT_FILE "${CHANGELOG_OUT_FILE_GZ}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
install(FILES "${CHANGELOG_OUT_FILE_GZ}"
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
COMPONENT "${comp}")
if(OPENCV_DEBIAN_COPYRIGHT_FILE)
install(FILES "${OPENCV_DEBIAN_COPYRIGHT_FILE}"
DESTINATION "share/doc/${CPACK_DEBIAN_COMPONENT_${comp_upcase}_NAME}"
COMPONENT "${comp}")
endif()
endforeach()
endif()
+18
View File
@@ -630,3 +630,21 @@ function(ocv_source_group group)
file(GLOB srcs ${OCV_SOURCE_GROUP_GLOB})
source_group(${group} FILES ${srcs})
endfunction()
# build the list of simple dependencies, that links via "-l"
# _all_libs - name of variable with input list
# _simple - name of variable with output list of simple libs
# _other - name of variable with _all_libs - _simple
macro(ocv_extract_simple_libs _all_libs _simple _other)
set(${_simple} "")
set(${_other} "")
foreach(_l ${${_all_libs}})
if(TARGET ${_l})
list(APPEND ${_other} ${_l})
elseif(EXISTS "${_l}")
list(APPEND ${_other} ${_l})
else()
list(APPEND ${_simple} ${_l})
endif()
endforeach()
endmacro()
+2 -1
View File
@@ -1,4 +1,5 @@
@CHANGELOG_PACKAGE_NAME@ (@CPACK_PACKAGE_VERSION@) unstable; urgency=low
* Debian changelog stub. See upstream changelog or release notes in user
* Debian changelog stub. See https://github.com/Itseez/opencv/wiki/ChangeLog
or release notes in user
documentation for more details.
-- @CPACK_PACKAGE_CONTACT@ @CHANGELOG_PACKAGE_DATE@
+43
View File
@@ -0,0 +1,43 @@
Format: http://dep.debian.net/deps/dep5
Files: *
Copyright: 2000-2015, Intel Corporation
2009-2011, Willow Garage Inc.
2009-2015, NVIDIA Corporation
2010-2013, Advanced Micro Devices, Inc.
2015, OpenCV Foundation
2015, Itseez Inc.
License: BSD-3-clause
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
(3-clause BSD License)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
\* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
\* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
\* Neither the names of the copyright holders nor the names of the
contributors may 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 copyright holders 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.
+42
View File
@@ -1,3 +1,45 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
* //
* // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
* //
* // By downloading, copying, installing or using the software you agree to this license.
* // If you do not agree to this license, do not download, install,
* // copy or use the software.
* //
* //
* // License Agreement
* // For Open Source Computer Vision Library
* //
* // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
* // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
* // Third party copyrights are property of their respective owners.
* //
* // Redistribution and use in source and binary forms, with or without modification,
* // are permitted provided that the following conditions are met:
* //
* // * Redistribution's of source code must retain the above copyright notice,
* // this list of conditions and the following disclaimer.
* //
* // * Redistribution's in binary form must reproduce the above copyright notice,
* // this list of conditions and the following disclaimer in the documentation
* // and/or other materials provided with the distribution.
* //
* // * The name of the copyright holders may not be used to endorse or promote products
* // derived from this software without specific prior written permission.
* //
* // This software is provided by the copyright holders and contributors "as is" and
* // any express or implied warranties, including, but not limited to, the implied
* // warranties of merchantability and fitness for a particular purpose are disclaimed.
* // In no event shall the Intel Corporation or contributors be liable for any direct,
* // indirect, incidental, special, exemplary, or consequential damages
* // (including, but not limited to, procurement of substitute goods or services;
* // loss of use, data, or profits; or business interruption) however caused
* // and on any theory of liability, whether in contract, strict liability,
* // or tort (including negligence or otherwise) arising in any way out of
* // the use of this software, even if advised of the possibility of such damage.
* //
* //M*/
#ifndef __OPENCV_OLD_CXMISC_H__
#define __OPENCV_OLD_CXMISC_H__
+20 -15
View File
@@ -152,7 +152,7 @@ struct CvCBQuad
//static CvMat* debug_img = 0;
static int icvGenerateQuads( CvCBQuad **quads, CvCBCorner **corners,
CvMemStorage *storage, CvMat *image, int flags );
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size);
/*static int
icvGenerateQuadsEx( CvCBQuad **out_quads, CvCBCorner **out_corners,
@@ -172,7 +172,7 @@ static int icvCleanFoundConnectedQuads( int quad_count,
static int icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
CvSize pattern_size, CvMemStorage* storage );
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage );
static void icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common);
@@ -183,7 +183,7 @@ static int icvTrimRow(CvCBQuad **quads, int count, int row, int dir);
#endif
static int icvAddOuterQuad(CvCBQuad *quad, CvCBQuad **quads, int quad_count,
CvCBQuad **all_quads, int all_count, CvCBCorner **corners);
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size);
static void icvRemoveQuadFromGroup(CvCBQuad **quads, int count, CvCBQuad *q0);
@@ -313,6 +313,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
// making it difficult to detect smaller squares.
for( k = 0; k < 6; k++ )
{
int max_quad_buf_size = 0;
for( dilations = min_dilations; dilations <= max_dilations; dilations++ )
{
if (found)
@@ -368,7 +369,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
cvRectangle( thresh_img, cvPoint(0,0), cvPoint(thresh_img->cols-1,
thresh_img->rows-1), CV_RGB(255,255,255), 3, 8);
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags );
quad_count = icvGenerateQuads( &quads, &corners, storage, thresh_img, flags, &max_quad_buf_size);
PRINTF("Quad count: %d/%d\n", quad_count, expected_corners_num);
}
@@ -408,8 +409,8 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
// allocate extra for adding in icvOrderFoundQuads
cvFree(&quad_group);
cvFree(&corner_group);
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * (quad_count+quad_count / 2));
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * (quad_count+quad_count / 2)*4 );
quad_group = (CvCBQuad**)cvAlloc( sizeof(quad_group[0]) * max_quad_buf_size);
corner_group = (CvCBCorner**)cvAlloc( sizeof(corner_group[0]) * max_quad_buf_size * 4 );
for( group_idx = 0; ; group_idx++ )
{
@@ -424,7 +425,7 @@ int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
// maybe delete or add some
PRINTF("Starting ordering of inner quads\n");
count = icvOrderFoundConnectedQuads(count, quad_group, &quad_count, &quads, &corners,
pattern_size, storage );
pattern_size, max_quad_buf_size, storage );
PRINTF("Orig count: %d After ordering: %d\n", icount, count);
@@ -623,7 +624,7 @@ icvCheckBoardMonotony( CvPoint2D32f* corners, CvSize pattern_size )
static int
icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
int *all_count, CvCBQuad **all_quads, CvCBCorner **corners,
CvSize pattern_size, CvMemStorage* storage )
CvSize pattern_size, int max_quad_buf_size, CvMemStorage* storage )
{
cv::Ptr<CvMemStorage> temp_storage = cvCreateChildMemStorage( storage );
CvSeq* stack = cvCreateSeq( 0, sizeof(*stack), sizeof(void*), temp_storage );
@@ -803,15 +804,18 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
if (found > 0)
{
PRINTF("Found %d inner quads not connected to outer quads, repairing\n", found);
for (int i=0; i<quad_count; i++)
for (int i=0; i<quad_count && *all_count < max_quad_buf_size; i++)
{
if (quads[i]->count < 4 && quads[i]->ordered)
{
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners);
int added = icvAddOuterQuad(quads[i],quads,quad_count,all_quads,*all_count,corners, max_quad_buf_size);
*all_count += added;
quad_count += added;
}
}
if (*all_count >= max_quad_buf_size)
return 0;
}
@@ -854,11 +858,11 @@ icvOrderFoundConnectedQuads( int quad_count, CvCBQuad **quads,
static int
icvAddOuterQuad( CvCBQuad *quad, CvCBQuad **quads, int quad_count,
CvCBQuad **all_quads, int all_count, CvCBCorner **corners )
CvCBQuad **all_quads, int all_count, CvCBCorner **corners, int max_quad_buf_size )
{
int added = 0;
for (int i=0; i<4; i++) // find no-neighbor corners
for (int i=0; i<4 && all_count < max_quad_buf_size; i++) // find no-neighbor corners
{
if (!quad->neighbors[i]) // ok, create and add neighbor
{
@@ -1649,7 +1653,7 @@ static void icvFindQuadNeighbors( CvCBQuad *quads, int quad_count )
static int
icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
CvMemStorage *storage, CvMat *image, int flags )
CvMemStorage *storage, CvMat *image, int flags, int *max_quad_buf_size )
{
int quad_count = 0;
cv::Ptr<CvMemStorage> temp_storage;
@@ -1754,8 +1758,9 @@ icvGenerateQuads( CvCBQuad **out_quads, CvCBCorner **out_corners,
cvEndFindContours( &scanner );
// allocate quad & corner buffers
*out_quads = (CvCBQuad*)cvAlloc((root->total+root->total / 2) * sizeof((*out_quads)[0]));
*out_corners = (CvCBCorner*)cvAlloc((root->total+root->total / 2) * 4 * sizeof((*out_corners)[0]));
*max_quad_buf_size = MAX(1, (root->total+root->total / 2)) * 2;
*out_quads = (CvCBQuad*)cvAlloc(*max_quad_buf_size * sizeof((*out_quads)[0]));
*out_corners = (CvCBCorner*)cvAlloc(*max_quad_buf_size * 4 * sizeof((*out_corners)[0]));
// Create array of quads structures
for( idx = 0; idx < root->total; idx++ )
+4
View File
@@ -12,6 +12,7 @@
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2015, Itseez Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
@@ -562,6 +563,9 @@ void CV_HomographyTest::run(int)
default: continue;
}
}
delete[]src_data;
src_data = NULL;
}
}
-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.
@@ -50,7 +50,7 @@
#define CV_VERSION_EPOCH 2
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 12
#define CV_VERSION_REVISION 0
#define CV_VERSION_REVISION 2
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
+4
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 );
@@ -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;
+1
View File
@@ -2216,6 +2216,7 @@ 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;
}
+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 );
}
@@ -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();
}
@@ -303,7 +303,8 @@ public:
//
// constructor
//
CV_FeatureDetectorMatcherBaseTest(testparam* _tp, double _accuracy_margin, cv::Feature2D* _fe, cv::DescriptorMatcher *_flmatcher, string _flmatchername, int norm_type_for_bfmatcher) :
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),
@@ -318,6 +319,15 @@ public:
bfmatcher = new cv::BFMatcher(norm_type_for_bfmatcher);
}
virtual ~CV_FeatureDetectorMatcherBaseTest()
{
if (bfmatcher)
{
delete bfmatcher;
bfmatcher = NULL;
}
}
//
// Main Test method
//
@@ -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,3 +1,32 @@
/***********************************************************************
* Software License Agreement (BSD License)
*
* Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
* Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). 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.
*************************************************************************/
#ifndef OPENCV_FLANN_DUMMY_H_
#define OPENCV_FLANN_DUMMY_H_
@@ -384,6 +384,8 @@ public:
}
root_ = pool_.allocate<KMeansNode>();
std::memset(root_, 0, sizeof(KMeansNode));
computeNodeStatistics(root_, indices_, (int)size_);
computeClustering(root_, indices_, (int)size_, branching_,0);
}
@@ -823,11 +825,11 @@ private:
variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
node->childs[c] = pool_.allocate<KMeansNode>();
std::memset(node->childs[c], 0, sizeof(KMeansNode));
node->childs[c]->radius = radiuses[c];
node->childs[c]->pivot = centers[c];
node->childs[c]->variance = variance;
node->childs[c]->mean_radius = mean_radius;
node->childs[c]->indices = NULL;
computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
start=end;
}
+5 -3
View File
@@ -318,12 +318,14 @@ buildIndex_(void*& index, const Mat& wholedata, const Mat& data, const IndexPara
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
IndexType* _index = NULL;
if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH) // currently, additional index support is the lsh algorithm only.
// currently, additional index support is the lsh algorithm only.
if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH)
{
_index = new IndexType(dataset, get_params(params), dist);
Ptr<IndexType> _index = makePtr<IndexType>(dataset, get_params(params), dist);
_index->buildIndex();
index = _index;
// HACK to prevent object destruction
_index.obj = NULL;
}
else // build additional lsh index
{
+9 -9
View File
@@ -255,7 +255,7 @@ namespace cv { namespace gpu { namespace device
///////////////////////////////////////////////////////////////
template <typename T>
__global__ void data_step_down(int dst_cols, int dst_rows, int src_rows, const PtrStep<T> src, PtrStep<T> dst)
__global__ void data_step_down(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStep<T> src, PtrStep<T> dst)
{
const int x = blockIdx.x * blockDim.x + threadIdx.x;
const int y = blockIdx.y * blockDim.y + threadIdx.y;
@@ -264,10 +264,10 @@ namespace cv { namespace gpu { namespace device
{
for (int d = 0; d < cndisp; ++d)
{
float dst_reg = src.ptr(d * src_rows + (2*y+0))[(2*x+0)];
dst_reg += src.ptr(d * src_rows + (2*y+1))[(2*x+0)];
dst_reg += src.ptr(d * src_rows + (2*y+0))[(2*x+1)];
dst_reg += src.ptr(d * src_rows + (2*y+1))[(2*x+1)];
float dst_reg = src.ptr(d * src_rows + ::min(2*y+0, src_rows-1))[::min(2*x+0, src_cols-1)];
dst_reg += src.ptr(d * src_rows + ::min(2*y+1, src_rows-1))[::min(2*x+0, src_cols-1)];
dst_reg += src.ptr(d * src_rows + ::min(2*y+0, src_rows-1))[::min(2*x+1, src_cols-1)];
dst_reg += src.ptr(d * src_rows + ::min(2*y+1, src_rows-1))[::min(2*x+1, src_cols-1)];
dst.ptr(d * dst_rows + y)[x] = saturate_cast<T>(dst_reg);
}
@@ -275,7 +275,7 @@ namespace cv { namespace gpu { namespace device
}
template<typename T>
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream)
void data_step_down_gpu(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream)
{
dim3 threads(32, 8, 1);
dim3 grid(1, 1, 1);
@@ -283,15 +283,15 @@ namespace cv { namespace gpu { namespace device
grid.x = divUp(dst_cols, threads.x);
grid.y = divUp(dst_rows, threads.y);
data_step_down<T><<<grid, threads, 0, stream>>>(dst_cols, dst_rows, src_rows, (PtrStepSz<T>)src, (PtrStepSz<T>)dst);
data_step_down<T><<<grid, threads, 0, stream>>>(dst_cols, dst_rows, src_cols, src_rows, (PtrStepSz<T>)src, (PtrStepSz<T>)dst);
cudaSafeCall( cudaGetLastError() );
if (stream == 0)
cudaSafeCall( cudaDeviceSynchronize() );
}
template void data_step_down_gpu<short>(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
template void data_step_down_gpu<float>(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
template void data_step_down_gpu<short>(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
template void data_step_down_gpu<float>(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
///////////////////////////////////////////////////////////////
/////////////////// level up messages ////////////////////////
+4 -4
View File
@@ -2804,7 +2804,7 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, St
}
else
{
const int elem_size = src.elemSize1();
const int elem_size = static_cast<int>(src.elemSize1());
const int num_channels = src.channels();
const int bcols = src.cols * num_channels;
@@ -2895,7 +2895,7 @@ void cv::gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
}
else
{
const int elem_size = src1.elemSize1();
const int elem_size = static_cast<int>(src1.elemSize1());
const int num_channels = src1.channels();
const int bcols = src1.cols * num_channels;
@@ -2979,7 +2979,7 @@ void cv::gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, co
}
else
{
const int elem_size = src1.elemSize1();
const int elem_size = static_cast<int>(src1.elemSize1());
const int num_channels = src1.channels();
const int bcols = src1.cols * num_channels;
@@ -3063,7 +3063,7 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c
}
else
{
const int elem_size = src1.elemSize1();
const int elem_size = static_cast<int>(src1.elemSize1());
const int num_channels = src1.channels();
const int bcols = src1.cols * num_channels;
+13 -13
View File
@@ -67,7 +67,7 @@ namespace cv { namespace gpu { namespace device
template<typename T, typename D>
void comp_data_gpu(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& data, cudaStream_t stream);
template<typename T>
void data_step_down_gpu(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
void data_step_down_gpu(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
template <typename T>
void level_up_messages_gpu(int dst_idx, int dst_cols, int dst_rows, int src_rows, PtrStepSzb* mus, PtrStepSzb* mds, PtrStepSzb* mls, PtrStepSzb* mrs, cudaStream_t stream);
template <typename T>
@@ -158,7 +158,7 @@ namespace
init(stream);
datas[0].create(rows * rthis.ndisp, cols, rthis.msg_type);
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, datas[0]);
comp_data_callers[rthis.msg_type == CV_32F][left.channels()](left, right, datas[0], StreamAccessor::getStream(stream));
@@ -187,10 +187,10 @@ namespace
private:
void init(Stream& stream)
{
u.create(rows * rthis.ndisp, cols, rthis.msg_type);
d.create(rows * rthis.ndisp, cols, rthis.msg_type);
l.create(rows * rthis.ndisp, cols, rthis.msg_type);
r.create(rows * rthis.ndisp, cols, rthis.msg_type);
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, u);
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, d);
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, l);
createContinuous(rows * rthis.ndisp, cols, rthis.msg_type, r);
if (rthis.levels & 1)
{
@@ -216,10 +216,10 @@ namespace
int less_rows = (rows + 1) / 2;
int less_cols = (cols + 1) / 2;
u2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
d2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
l2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
r2.create(less_rows * rthis.ndisp, less_cols, rthis.msg_type);
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, u2);
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, d2);
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, l2);
createContinuous(less_rows * rthis.ndisp, less_cols, rthis.msg_type, r2);
if ((rthis.levels & 1) == 0)
{
@@ -253,7 +253,7 @@ namespace
void calcBP(GpuMat& disp, Stream& stream)
{
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
typedef void (*data_step_down_t)(int dst_cols, int dst_rows, int src_cols, int src_rows, const PtrStepSzb& src, const PtrStepSzb& dst, cudaStream_t stream);
static const data_step_down_t data_step_down_callers[2] =
{
data_step_down_gpu<short>, data_step_down_gpu<float>
@@ -286,9 +286,9 @@ namespace
cols_all[i] = (cols_all[i-1] + 1) / 2;
rows_all[i] = (rows_all[i-1] + 1) / 2;
datas[i].create(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type);
createContinuous(rows_all[i] * rthis.ndisp, cols_all[i], rthis.msg_type, datas[i]);
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], rows_all[i-1], datas[i-1], datas[i], cudaStream);
data_step_down_callers[funcIdx](cols_all[i], rows_all[i], cols_all[i-1], rows_all[i-1], datas[i-1], datas[i], cudaStream);
}
PtrStepSzb mus[] = {u, u2};
+3 -1
View File
@@ -114,7 +114,9 @@ GPU_TEST_P(StereoBeliefPropagation, Regression)
cv::Mat h_disp(disp);
h_disp.convertTo(h_disp, disp_gold.depth());
EXPECT_MAT_NEAR(disp_gold, h_disp, 0.0);
cv::Rect roi(0, 0, disp_gold.cols - 20, disp_gold.rows - 20);
EXPECT_MAT_NEAR(disp_gold(roi), h_disp(roi), 0.0);
}
INSTANTIATE_TEST_CASE_P(GPU_Calib3D, StereoBeliefPropagation, ALL_DEVICES);
+1 -1
View File
@@ -64,7 +64,7 @@ set(highgui_srcs
src/window.cpp
)
file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
file(GLOB highgui_ext_hdrs "include/opencv2/*.hpp" "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
if(HAVE_QT5)
set(CMAKE_AUTOMOC ON)
+4 -2
View File
@@ -238,10 +238,12 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
#endif
#ifdef HAVE_GSTREAMER
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, 0);
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2,
reinterpret_cast<char *>(index));
if (capture)
return capture;
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L, 0);
capture = cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L,
reinterpret_cast<char *>(index));
if (capture)
return capture;
#endif
+133 -65
View File
@@ -75,10 +75,13 @@
#if GST_VERSION_MAJOR == 0
#define COLOR_ELEM "ffmpegcolorspace"
#define COLOR_ELEM_NAME "ffmpegcsp"
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
#define COLOR_ELEM "videoconvert"
#define COLOR_ELEM_NAME COLOR_ELEM
#else
#define COLOR_ELEM "autovideoconvert"
#define COLOR_ELEM_NAME COLOR_ELEM
#endif
void toFraction(double decimal, double &numerator, double &denominator);
@@ -142,6 +145,7 @@ protected:
gpointer data);
GstElement* pipeline;
GstElement* uridecodebin;
GstElement* v4l2src;
GstElement* color;
GstElement* sink;
#if GST_VERSION_MAJOR > 0
@@ -165,6 +169,7 @@ void CvCapture_GStreamer::init()
{
pipeline = NULL;
uridecodebin = NULL;
v4l2src = NULL;
color = NULL;
sink = NULL;
#if GST_VERSION_MAJOR > 0
@@ -371,9 +376,7 @@ void CvCapture_GStreamer::startPipeline()
if (status == GST_STATE_CHANGE_ASYNC)
{
// wait for status update
GstState st1;
GstState st2;
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
}
if (status == GST_STATE_CHANGE_FAILURE)
{
@@ -568,21 +571,39 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
GstElementFactory * testfac;
GstStateChangeReturn status;
if (type == CV_CAP_GSTREAMER_V4L){
int cameraID = -1;
if (type == CV_CAP_GSTREAMER_V4L ||
type == CV_CAP_GSTREAMER_V4L2)
{
cameraID = static_cast<int>(reinterpret_cast<intptr_t>(filename));
}
std::stringstream stdstream;
std::string stdfilename;
if (type == CV_CAP_GSTREAMER_V4L)
{
testfac = gst_element_factory_find("v4lsrc");
if (!testfac){
return false;
}
g_object_unref(G_OBJECT(testfac));
filename = "v4lsrc ! "COLOR_ELEM" ! appsink";
stdstream << "v4lsrc device=/dev/video" << cameraID << " ! " << COLOR_ELEM << " ! appsink";
stdfilename = stdstream.str();
filename = stdfilename.c_str();
}
if (type == CV_CAP_GSTREAMER_V4L2){
else if (type == CV_CAP_GSTREAMER_V4L2)
{
testfac = gst_element_factory_find("v4l2src");
if (!testfac){
return false;
}
g_object_unref(G_OBJECT(testfac));
filename = "v4l2src ! "COLOR_ELEM" ! appsink";
stdstream << "v4l2src device=/dev/video" << cameraID << " ! " << COLOR_ELEM << " ! appsink";
stdfilename = stdstream.str();
filename = stdfilename.c_str();
}
@@ -620,7 +641,9 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
stream = true;
manualpipeline = true;
}
} else {
}
else
{
stream = true;
uri = g_strdup(filename);
}
@@ -641,68 +664,86 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
uridecodebin = gst_element_make_from_uri(GST_URI_SRC, uri, "src", NULL);
#endif
element_from_uri = true;
}else{
}
else
{
uridecodebin = gst_element_factory_make("uridecodebin", NULL);
g_object_set(G_OBJECT(uridecodebin), "uri", uri, NULL);
}
g_free(protocol);
if(!uridecodebin) {
if(!uridecodebin)
{
//fprintf(stderr, "GStreamer: Error opening bin: %s\n", err->message);
close();
return false;
}
}
if(manualpipeline)
if (manualpipeline)
{
GstIterator *it = NULL;
#if GST_VERSION_MAJOR == 0
it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
if(gst_iterator_next(it, (gpointer *)&sink) != GST_ITERATOR_OK) {
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
}
#else
it = gst_bin_iterate_sinks (GST_BIN(uridecodebin));
GstIterator *it = gst_bin_iterate_elements(GST_BIN(uridecodebin));
gboolean done = FALSE;
GstElement *element = NULL;
gboolean done = false;
gchar* name = NULL;
#if GST_VERSION_MAJOR > 0
GValue value = G_VALUE_INIT;
#endif
while (!done) {
switch (gst_iterator_next (it, &value)) {
while (!done)
{
#if GST_VERSION_MAJOR > 0
switch (gst_iterator_next (it, &value))
{
case GST_ITERATOR_OK:
element = GST_ELEMENT (g_value_get_object (&value));
name = gst_element_get_name(element);
if (name){
if(strstr(name, "opencvsink") != NULL || strstr(name, "appsink") != NULL) {
sink = GST_ELEMENT ( gst_object_ref (element) );
done = TRUE;
}
g_free(name);
}
g_value_unset (&value);
element = GST_ELEMENT (g_value_get_object (&value));
#else
switch (gst_iterator_next (it, (gpointer *)&element))
{
case GST_ITERATOR_OK:
#endif
name = gst_element_get_name(element);
if (name)
{
if (strstr(name, "opencvsink") != NULL || strstr(name, "appsink") != NULL)
{
sink = GST_ELEMENT ( gst_object_ref (element) );
}
else if (strstr(name, COLOR_ELEM_NAME) != NULL)
{
color = GST_ELEMENT ( gst_object_ref (element) );
}
else if (strstr(name, "v4l") != NULL)
{
v4l2src = GST_ELEMENT ( gst_object_ref (element) );
}
g_free(name);
break;
done = sink && color && v4l2src;
}
#if GST_VERSION_MAJOR > 0
g_value_unset (&value);
#endif
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (it);
break;
gst_iterator_resync (it);
break;
case GST_ITERATOR_ERROR:
case GST_ITERATOR_DONE:
done = TRUE;
break;
}
done = TRUE;
break;
}
}
gst_iterator_free (it);
if (!sink){
if (!sink)
{
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
return false;
}
#endif
pipeline = uridecodebin;
}
else
@@ -715,18 +756,23 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
gst_bin_add_many(GST_BIN(pipeline), uridecodebin, color, sink, NULL);
if(element_from_uri) {
if(!gst_element_link(uridecodebin, color)) {
if(element_from_uri)
{
if(!gst_element_link(uridecodebin, color))
{
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
gst_object_unref(pipeline);
pipeline = NULL;
return false;
}
}else{
}
else
{
g_signal_connect(uridecodebin, "pad-added", G_CALLBACK(newPad), color);
}
if(!gst_element_link(color, sink)) {
if(!gst_element_link(color, sink))
{
CV_ERROR(CV_StsError, "GStreamer: cannot link color -> sink\n");
gst_object_unref(pipeline);
pipeline = NULL;
@@ -754,16 +800,13 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
gst_caps_unref(caps);
// For video files only: set pipeline to PAUSED state to get its duration
if (file)
{
status = gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PAUSED);
status = gst_element_set_state(GST_ELEMENT(pipeline),
file ? GST_STATE_PAUSED : GST_STATE_PLAYING);
if (status == GST_STATE_CHANGE_ASYNC)
{
// wait for status update
GstState st1;
GstState st2;
status = gst_element_get_state(pipeline, &st1, &st2, GST_CLOCK_TIME_NONE);
status = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
}
if (status == GST_STATE_CHANGE_FAILURE)
{
@@ -814,14 +857,9 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
fps = (double)num/(double)denom;
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
}
else
{
duration = -1;
width = -1;
height = -1;
fps = -1;
// GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline")
stopPipeline();
}
__END__;
@@ -852,7 +890,7 @@ double CvCapture_GStreamer::getProperty( int propId )
if(!pipeline) {
CV_WARN("GStreamer: no pipeline");
return false;
return 0;
}
switch(propId) {
@@ -861,7 +899,7 @@ double CvCapture_GStreamer::getProperty( int propId )
status = gst_element_query_position(sink, FORMAT, &value);
if(!status) {
CV_WARN("GStreamer: unable to query position of stream");
return false;
return 0;
}
return value * 1e-6; // nano seconds to milli seconds
case CV_CAP_PROP_POS_FRAMES:
@@ -869,7 +907,7 @@ double CvCapture_GStreamer::getProperty( int propId )
status = gst_element_query_position(sink, FORMAT, &value);
if(!status) {
CV_WARN("GStreamer: unable to query position of stream");
return false;
return 0;
}
return value;
case CV_CAP_PROP_POS_AVI_RATIO:
@@ -877,7 +915,7 @@ double CvCapture_GStreamer::getProperty( int propId )
status = gst_element_query_position(sink, FORMAT, &value);
if(!status) {
CV_WARN("GStreamer: unable to query position of stream");
return false;
return 0;
}
return ((double) value) / GST_FORMAT_PERCENT_MAX;
case CV_CAP_PROP_FRAME_WIDTH:
@@ -896,6 +934,21 @@ double CvCapture_GStreamer::getProperty( int propId )
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_HUE:
if (v4l2src)
{
const gchar * propName =
propId == CV_CAP_PROP_BRIGHTNESS ? "brightness" :
propId == CV_CAP_PROP_CONTRAST ? "contrast" :
propId == CV_CAP_PROP_SATURATION ? "saturation" :
propId == CV_CAP_PROP_HUE ? "hue" : NULL;
if (propName)
{
gint32 value32 = 0;
g_object_get(G_OBJECT(v4l2src), propName, &value32, NULL);
return value32;
}
}
case CV_CAP_PROP_GAIN:
case CV_CAP_PROP_CONVERT_RGB:
break;
@@ -912,7 +965,7 @@ double CvCapture_GStreamer::getProperty( int propId )
#undef FORMAT
return false;
return 0;
}
/*!
@@ -991,6 +1044,21 @@ bool CvCapture_GStreamer::setProperty( int propId, double value )
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_HUE:
if (v4l2src)
{
const gchar * propName =
propId == CV_CAP_PROP_BRIGHTNESS ? "brightness" :
propId == CV_CAP_PROP_CONTRAST ? "contrast" :
propId == CV_CAP_PROP_SATURATION ? "saturation" :
propId == CV_CAP_PROP_HUE ? "hue" : NULL;
if (propName)
{
gint32 value32 = cv::saturate_cast<gint32>(value);
g_object_set(G_OBJECT(v4l2src), propName, &value32, NULL);
return true;
}
}
case CV_CAP_PROP_GAIN:
case CV_CAP_PROP_CONVERT_RGB:
break;
+6 -1
View File
@@ -221,7 +221,12 @@ bool TiffDecoder::readData( Mat& img )
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
tile_height0 = m_height;
const size_t buffer_size = bpp * ncn * tile_height0 * tile_width0;
if(dst_bpp == 8) {
// we will use TIFFReadRGBA* functions, so allocate temporary buffer for 32bit RGBA
bpp = 8;
ncn = 4;
}
const size_t buffer_size = (bpp/bitsPerByte) * ncn * tile_height0 * tile_width0;
AutoBuffer<uchar> _buffer( buffer_size );
uchar* buffer = _buffer;
ushort* buffer16 = (ushort*)buffer;
+4
View File
@@ -396,6 +396,10 @@ TEST(Highgui_Video_parallel_writers_and_readers, accuracy)
if (code == 1)
std::cerr << "Couldn't delete " << *i << std::endl;
}
// delete the readers
for (std::vector<VideoCapture *>::iterator i = readers.begin(), end = readers.end(); i != end; ++i)
delete *i;
}
#endif
@@ -1,7 +1,3 @@
/*! \file imgproc.hpp
\brief The Image Processing
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
@@ -1,7 +1,3 @@
/*! \file imgproc.hpp
\brief The Image Processing
*/
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+19 -1
View File
@@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
struct ConversionYUV
{
ConversionYUV( const int code )
explicit ConversionYUV( const int code )
{
yuvReader_ = YUVreader :: getReader(code);
yuvWriter_ = YUVwriter :: getWriter(code);
@@ -557,6 +557,24 @@ struct ConversionYUV
grayWriter_ = GRAYwriter:: getWriter(code);
}
~ConversionYUV()
{
if (yuvReader_)
delete yuvReader_;
if (yuvWriter_)
delete yuvWriter_;
if (rgbReader_)
delete rgbReader_;
if (rgbWriter_)
delete rgbWriter_;
if (grayWriter_)
delete grayWriter_;
}
int getDcn()
{
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());
+2
View File
@@ -501,6 +501,8 @@ _exit_:
comp[6] = s1;
comp[7] = s2;
comp[8] = 0;
cvReleaseMemStorage(&st);
}
+79 -27
View File
@@ -1372,17 +1372,65 @@ void CV_GetQuadSubPixTest::prepare_to_validation( int /*test_case_idx*/ )
dst.convertTo(dst0, dst0.depth());
}
////////////////////////////// resizeArea /////////////////////////////////
template <typename T>
static void check_resize_area(const Mat& expected, const Mat& actual, double tolerance = 1.0)
{
ASSERT_EQ(actual.type(), expected.type());
ASSERT_EQ(actual.size(), expected.size());
Mat diff;
absdiff(actual, expected, diff);
Mat one_channel_diff = diff; //.reshape(1);
Size dsize = actual.size();
bool next = true;
for (int dy = 0; dy < dsize.height && next; ++dy)
{
const T* eD = expected.ptr<T>(dy);
const T* aD = actual.ptr<T>(dy);
for (int dx = 0; dx < dsize.width && next; ++dx)
if (fabs(static_cast<double>(aD[dx] - eD[dx])) > tolerance)
{
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Inf norm: %f\n", static_cast<float>(norm(actual, expected, NORM_INF)));
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Error in : (%d, %d)\n", dx, dy);
const int radius = 3;
int rmin = MAX(dy - radius, 0), rmax = MIN(dy + radius, dsize.height);
int cmin = MAX(dx - radius, 0), cmax = MIN(dx + radius, dsize.width);
std::cout << "Abs diff:" << std::endl << diff << std::endl;
std::cout << "actual result:\n" << actual(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
std::cout << "expected result:\n" << expected(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
next = false;
}
}
ASSERT_EQ(norm(one_channel_diff, cv::NORM_INF), 0);
}
///////////////////////////////////////////////////////////////////////////
TEST(Imgproc_cvWarpAffine, regression)
{
IplImage* src = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
IplImage* dst = cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 1);
cvZero(src);
float m[6];
CvMat M = cvMat( 2, 3, CV_32F, m );
int w = src->width;
int h = src->height;
cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
cvWarpAffine(src, dst, &M);
cvReleaseImage(&src);
cvReleaseImage(&dst);
}
TEST(Imgproc_fitLine_vector_3d, regression)
@@ -1496,41 +1544,45 @@ TEST(Imgproc_resize_area, regression)
cv::resize(src, actual, cv::Size(), 0.3, 0.3, INTER_AREA);
ASSERT_EQ(actual.type(), expected.type());
ASSERT_EQ(actual.size(), expected.size());
check_resize_area<ushort>(expected, actual, 1.0);
}
Mat diff;
absdiff(actual, expected, diff);
TEST(Imgproc_resize_area, regression_half_round)
{
static uchar input_data[32 * 32];
for(int i = 0; i < 32 * 32; ++i)
input_data[i] = (uchar)(i % 2 + 253 + i / (16 * 32));
Mat one_channel_diff = diff; //.reshape(1);
static uchar expected_data[16 * 16];
for(int i = 0; i < 16 * 16; ++i)
expected_data[i] = (uchar)(254 + i / (16 * 8));
float elem_diff = 1.0f;
Size dsize = actual.size();
bool next = true;
for (int dy = 0; dy < dsize.height && next; ++dy)
{
ushort* eD = expected.ptr<ushort>(dy);
ushort* aD = actual.ptr<ushort>(dy);
cv::Mat src(32, 32, CV_8UC1, input_data);
cv::Mat expected(16, 16, CV_8UC1, expected_data);
cv::Mat actual(expected.size(), expected.type());
for (int dx = 0; dx < dsize.width && next; ++dx)
if (fabs(static_cast<float>(aD[dx] - eD[dx])) > elem_diff)
{
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Inf norm: %f\n", static_cast<float>(norm(actual, expected, NORM_INF)));
cvtest::TS::ptr()->printf(cvtest::TS::SUMMARY, "Error in : (%d, %d)\n", dx, dy);
cv::resize(src, actual, cv::Size(), 0.5, 0.5, INTER_AREA);
const int radius = 3;
int rmin = MAX(dy - radius, 0), rmax = MIN(dy + radius, dsize.height);
int cmin = MAX(dx - radius, 0), cmax = MIN(dx + radius, dsize.width);
check_resize_area<uchar>(expected, actual, 0.5);
}
std::cout << "Abs diff:" << std::endl << diff << std::endl;
std::cout << "actual result:\n" << actual(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
std::cout << "expected result:\n" << expected(Range(rmin, rmax), Range(cmin, cmax)) << std::endl;
TEST(Imgproc_resize_area, regression_quarter_round)
{
static uchar input_data[32 * 32];
for(int i = 0; i < 32 * 32; ++i)
input_data[i] = (uchar)(i % 2 + 253 + i / (16 * 32));
next = false;
}
}
static uchar expected_data[8 * 8];
for(int i = 0; i < 8 * 8; ++i)
expected_data[i] = 254;
ASSERT_EQ(norm(one_channel_diff, cv::NORM_INF), 0);
cv::Mat src(32, 32, CV_8UC1, input_data);
cv::Mat expected(8, 8, CV_8UC1, expected_data);
cv::Mat actual(expected.size(), expected.type());
cv::resize(src, actual, cv::Size(), 0.25, 0.25, INTER_AREA);
check_resize_area<uchar>(expected, actual, 0.5);
}
+8 -26
View File
@@ -644,8 +644,7 @@ private:
};
CV_Remap_Test::CV_Remap_Test() :
CV_ImageWarpBaseTest(), mapx(), mapy(),
borderType(-1), borderValue()
CV_ImageWarpBaseTest(), borderType(-1)
{
funcs[0] = &CV_Remap_Test::remap_nearest;
funcs[1] = &CV_Remap_Test::remap_generic;
@@ -666,7 +665,7 @@ void CV_Remap_Test::generate_test_data()
// generating the mapx, mapy matrices
static const int mapx_types[] = { CV_16SC2, CV_32FC1, CV_32FC2 };
mapx.create(dst.size(), mapx_types[rng.uniform(0, sizeof(mapx_types) / sizeof(int))]);
mapy = Mat();
mapy.release();
const int n = std::min(std::min(src.cols, src.rows) / 10 + 1, 2);
float _n = 0; //static_cast<float>(-n);
@@ -693,7 +692,7 @@ void CV_Remap_Test::generate_test_data()
{
MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>();
for ( ; begin_y != end_y; ++begin_y)
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
*begin_y = static_cast<ushort>(rng.uniform(0, 1024));
}
break;
@@ -701,7 +700,7 @@ void CV_Remap_Test::generate_test_data()
{
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
for ( ; begin_y != end_y; ++begin_y)
begin_y[0] = static_cast<short>(rng.uniform(0, 1024));
*begin_y = static_cast<short>(rng.uniform(0, 1024));
}
break;
}
@@ -718,8 +717,8 @@ void CV_Remap_Test::generate_test_data()
MatIterator_<float> begin_y = mapy.begin<float>();
for ( ; begin_x != end_x; ++begin_x, ++begin_y)
{
begin_x[0] = rng.uniform(_n, fscols);
begin_y[0] = rng.uniform(_n, fsrows);
*begin_x = rng.uniform(_n, fscols);
*begin_y = rng.uniform(_n, fsrows);
}
}
break;
@@ -731,8 +730,8 @@ void CV_Remap_Test::generate_test_data()
fsrows = static_cast<float>(std::max(src.rows - 1 + n, 0));
for ( ; begin_x != end_x; ++begin_x)
{
begin_x[0] = rng.uniform(_n, fscols);
begin_x[1] = rng.uniform(_n, fsrows);
(*begin_x)[0] = rng.uniform(_n, fscols);
(*begin_x)[1] = rng.uniform(_n, fsrows);
}
}
break;
@@ -777,23 +776,6 @@ void CV_Remap_Test::prepare_test_data_for_reference_func()
{
CV_ImageWarpBaseTest::prepare_test_data_for_reference_func();
convert_maps();
/*
const int ksize = 3;
Mat kernel = getStructuringElement(CV_MOP_ERODE, Size(ksize, ksize));
Mat mask(src.size(), CV_8UC1, Scalar::all(255)), dst_mask;
cv::erode(src, erode_src, kernel);
cv::erode(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(0));
bitwise_not(dst_mask, mask);
src.copyTo(erode_src, mask);
dst_mask.release();
mask = Scalar::all(0);
kernel = getStructuringElement(CV_MOP_DILATE, kernel.size());
cv::dilate(src, dilate_src, kernel);
cv::dilate(mask, dst_mask, kernel, Point(-1, -1), 1, BORDER_CONSTANT, Scalar::all(255));
src.copyTo(dilate_src, dst_mask);
dst_mask.release();
*/
}
void CV_Remap_Test::run_reference_func()
+4
View File
@@ -1535,6 +1535,10 @@ void CvANN_MLP::read( CvFileStorage* fs, CvFileNode* node )
_layer_sizes = (CvMat*)cvReadByName( fs, node, "layer_sizes" );
CV_CALL( create( _layer_sizes, SIGMOID_SYM, 0, 0 ));
cvReleaseMat( &_layer_sizes );
_layer_sizes = NULL;
l_count = layer_sizes->cols;
CV_CALL( read_params( fs, node ));
+3
View File
@@ -537,6 +537,9 @@ void CvERTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
if( data )
delete data;
if ( pair16u32s_ptr )
cvFree( &pair16u32s_ptr );
if (_fdst)
cvFree( &_fdst );
if (_idst)
+9 -1
View File
@@ -259,7 +259,7 @@ CvGBTrees::train( const CvMat* _train_data, int _tflag,
for (int i=1; i<n; ++i)
{
int k = 0;
while ((int(orig_response->data.fl[i]) - class_labels->data.i[k]) && (k<j))
while ((k<j) && (int(orig_response->data.fl[i]) - class_labels->data.i[k]))
k++;
if (k == j)
{
@@ -1292,13 +1292,18 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
return -FLT_MAX;
float* pred_resp = 0;
bool needsFreeing = false;
if (resp)
{
resp->resize(n);
pred_resp = &((*resp)[0]);
}
else
{
pred_resp = new float[n];
needsFreeing = true;
}
Sample_predictor predictor = Sample_predictor(this, pred_resp, _data->get_values(),
_data->get_missing(), _sample_idx);
@@ -1331,6 +1336,9 @@ CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp )
err = err / (float)n;
}
if (needsFreeing)
delete[]pred_resp;
return err;
}
+3 -2
View File
@@ -777,7 +777,8 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
__BEGIN__;
int i, j, var_count, sample_count, s_step, v_step;
int i, j, var_count, sample_count;
size_t s_step, v_step, s;
bool copy_data;
const float* data;
const int *s_idx, *v_idx;
@@ -815,7 +816,7 @@ cvGetTrainSamples( const CvMat* train_data, int tflag,
{
samples[0] = (float*)(samples + sample_count);
if( tflag != CV_ROW_SAMPLE )
CV_SWAP( s_step, v_step, i );
CV_SWAP( s_step, v_step, s );
for( i = 0; i < sample_count; i++ )
{
+5
View File
@@ -2315,7 +2315,12 @@ void CvSVM::write( CvFileStorage* fs, const char* name ) const
params.svm_type == CvSVM::ONE_CLASS ? 1 : 0;
const CvSVMDecisionFunc* df = decision_func;
if( !isSvmModelApplicable(sv_total, var_all, var_count, class_count) )
{
cvReleaseFileStorage( &fs );
fs = NULL;
CV_ERROR( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" );
}
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_SVM );
+3 -1
View File
@@ -22,7 +22,9 @@ class NewOpenCVTests(unittest.TestCase):
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
if not filename in self.image_cache:
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
image = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
self.assertFalse(image is None)
self.image_cache[filename] = image
return self.image_cache[filename]
def setUp(self):
+2
View File
@@ -323,6 +323,7 @@ BadArgTest::BadArgTest()
progress = -1;
test_case_idx = -1;
freq = cv::getTickFrequency();
t = -1;
// oldErrorCbk = 0;
// oldErrorCbkData = 0;
}
@@ -338,6 +339,7 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
{
test_case_idx = 0;
progress = 0;
t = 0;
dt = 0;
}
else
+9 -3
View File
@@ -22,7 +22,7 @@ endif()
if(INSTALL_C_EXAMPLES)
install(FILES "CMakeLists.txt"
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
endif()
if(INSTALL_PYTHON_EXAMPLES)
@@ -68,8 +68,14 @@ endif()
add_subdirectory(c)
add_subdirectory(cpp)
add_subdirectory(ocl)
add_subdirectory(gpu)
ocv_check_dependencies(opencv_ocl)
if (OCV_DEPENDENCIES_FOUND)
add_subdirectory(ocl)
endif()
ocv_check_dependencies(opencv_gpu)
if (OCV_DEPENDENCIES_FOUND)
add_subdirectory(gpu)
endif()
#
# END OF BUILD CASE 2: Build samples with library binaries
+6 -5
View File
@@ -4,7 +4,7 @@
# ----------------------------------------------------------------------------
SET(OPENCV_C_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib)
ocv_check_dependencies(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
@@ -16,7 +16,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
endif()
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS})
ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
# ---------------------------------------------
# Define executable targets
@@ -52,8 +52,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endif()
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* *.cmd *.txt)
install(FILES ${C_SAMPLES}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
install(PROGRAMS build_all.sh DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c" COMPONENT samples)
endif ()
+24 -10
View File
@@ -4,19 +4,31 @@
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
*/
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
#include <iostream>
#include <vector>
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/objdetect/objdetect.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/imgproc/imgproc_c.h"
# include "opencv2/legacy/legacy.hpp"
# include "opencv2/legacy/compat.hpp"
# include <vector>
using namespace std;
static void help()
{
@@ -320,3 +332,5 @@ int main(int argc, char** argv)
return 0;
}
#endif
+23 -8
View File
@@ -1,12 +1,25 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include <fstream>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/core/core.hpp"
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/legacy/legacy.hpp"
# include <iostream>
# include <fstream>
using namespace std;
using namespace cv;
@@ -164,3 +177,5 @@ int main( int argc, char **argv )
return 0;
}
#endif
+22 -8
View File
@@ -7,16 +7,28 @@
*
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/imgproc/imgproc_c.h"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/legacy/legacy.hpp"
# include "opencv2/legacy/compat.hpp"
#include <string>
#include <stdio.h>
static void help()
{
@@ -116,3 +128,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
return img_corr;
}
#endif
+6 -5
View File
@@ -4,8 +4,9 @@
# ----------------------------------------------------------------------------
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_stitching opencv_videostab)
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
opencv_stitching opencv_videostab)
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
@@ -14,7 +15,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project(cpp_samples)
ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp
ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
ocv_include_modules(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
if(HAVE_opencv_gpu)
ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
@@ -93,6 +94,6 @@ endif()
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
install(FILES ${C_SAMPLES}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
endif()
+36 -22
View File
@@ -1,29 +1,41 @@
#include "opencv2/opencv_modules.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/ml/ml.hpp"
#ifdef HAVE_OPENCV_OCL
#define _OCL_SVM_ 1 //select whether using ocl::svm method or not, default is using
#include "opencv2/ocl/ocl.hpp"
#endif
#include <fstream>
#include <iostream>
#include <memory>
#include <functional>
#if defined WIN32 || defined _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef min
#undef max
#include "sys/types.h"
#endif
#include <sys/stat.h>
#ifndef HAVE_OPENCV_NONFREE
#define DEBUG_DESC_PROGRESS
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/ml/ml.hpp"
# ifdef HAVE_OPENCV_OCL
# define _OCL_SVM_ 1 //select whether using ocl::svm method or not, default is using
# include "opencv2/ocl/ocl.hpp"
# endif
# include <fstream>
# include <memory>
# include <functional>
# if defined WIN32 || defined _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef min
# undef max
# include "sys/types.h"
# endif
# include <sys/stat.h>
# define DEBUG_DESC_PROGRESS
using namespace cv;
using namespace std;
@@ -2623,3 +2635,5 @@ int main(int argc, char** argv)
}
return 0;
}
#endif
+10 -3
View File
@@ -1,8 +1,11 @@
#include "opencv2/opencv_modules.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#ifdef HAVE_OPENCV_NONFREE
# include "opencv2/nonfree/nonfree.hpp"
#endif
#include <iostream>
@@ -17,14 +20,14 @@ static void help(char** argv)
<< "Case1: second image is obtained from the first (given) image using random generated homography matrix\n"
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image] [evaluate(0 or 1)]\n"
<< "Example of case1:\n"
<< "./descriptor_extractor_matcher SURF SURF FlannBased NoneFilter cola.jpg 0\n"
<< "./descriptor_extractor_matcher ORB ORB FlannBased NoneFilter cola.jpg 0\n"
<< "\n"
<< "Case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated\n"
<< argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image1] [image2] [ransacReprojThreshold]\n"
<< "\n"
<< "Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)\n"
<< "Example of case2:\n"
<< "./descriptor_extractor_matcher SURF SURF BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3\n"
<< "./descriptor_extractor_matcher ORB ORB BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3\n"
<< "\n"
<< "Possible detectorType values: see in documentation on createFeatureDetector().\n"
<< "Possible descriptorType values: see in documentation on createDescriptorExtractor().\n"
@@ -239,7 +242,11 @@ int main(int argc, char** argv)
return -1;
}
#ifdef HAVE_OPENCV_NONFREE
cv::initModule_nonfree();
#else
cout << "Warning: OpenCV is built without nonfree support SIFT, SURF and some other algorithms are not available." << endl;
#endif
bool isWarpPerspective = argc == 7;
double ransacReprojThreshold = -1;
+16 -2
View File
@@ -49,9 +49,21 @@
//
//M*/
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/opencv.hpp"
# include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
using namespace std;
@@ -212,3 +224,5 @@ int main(int argc, char * argv[]) {
return 0;
}
#endif
+21 -7
View File
@@ -34,15 +34,27 @@
// 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.
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include <string>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/legacy/legacy.hpp>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include <string>
# include <vector>
# include <opencv2/core/core.hpp>
# include <opencv2/highgui/highgui.hpp>
# include <opencv2/features2d/features2d.hpp>
# include <opencv2/nonfree/features2d.hpp>
# include <opencv2/legacy/legacy.hpp>
using namespace cv;
@@ -126,3 +138,5 @@ int main( int argc, char** argv ) {
imshow("matches", imgMatch);
waitKey(0);
}
#endif
+20 -6
View File
@@ -1,11 +1,23 @@
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/opencv_modules.hpp"
#include <cstdio>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/opencv_modules.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
static void help()
@@ -91,3 +103,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
return img_corr;
}
#endif
+18 -4
View File
@@ -1,8 +1,20 @@
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
@@ -56,3 +68,5 @@ int main(int argc, char** argv)
return 0;
}
#endif
@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -28,7 +39,7 @@ int main( int argc, char** argv )
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
{ printf(" --(!) Error reading images \n"); return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
@@ -97,4 +108,6 @@ int main( int argc, char** argv )
* @function readme
*/
void readme()
{ std::cout << " Usage: ./SURF_FlannMatcher <img1> <img2>" << std::endl; }
{ printf(" Usage: ./SURF_FlannMatcher <img1> <img2>\n"); }
#endif
@@ -4,13 +4,24 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -29,7 +40,7 @@ int main( int argc, char** argv )
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
if( !img_object.data || !img_scene.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
{ printf(" --(!) Error reading images \n"); return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
@@ -121,4 +132,6 @@ int main( int argc, char** argv )
* @function readme
*/
void readme()
{ std::cout << " Usage: ./SURF_Homography <img1> <img2>" << std::endl; }
{ printf(" Usage: ./SURF_Homography <img1> <img2>\n"); }
#endif
@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -69,4 +80,6 @@ int main( int argc, char** argv )
* @function readme
*/
void readme()
{ std::cout << " Usage: ./SURF_descriptor <img1> <img2>" << std::endl; }
{ printf(" Usage: ./SURF_descriptor <img1> <img2>\n"); }
#endif
@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include <stdio.h>
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -60,3 +71,5 @@ int main( int argc, char** argv )
*/
void readme()
{ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; }
#endif
+2 -2
View File
@@ -112,6 +112,6 @@ if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
list_filterout(install_list ".*driver_api_stereo_multi.cpp")
endif()
install(FILES ${install_list}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
endif()
+2 -2
View File
@@ -29,7 +29,7 @@ endif()
if(INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB GPU_FILES performance/*.cpp performance/*.h performance/CMakeLists.txt)
install(FILES ${GPU_FILES}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT samples)
endif()
+5 -6
View File
@@ -1,7 +1,6 @@
SET(OPENCV_OCL_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
opencv_ml opencv_video opencv_objdetect opencv_features2d
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl
opencv_nonfree)
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl)
ocv_check_dependencies(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
@@ -11,7 +10,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project("${project}_samples")
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
ocv_include_modules(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS} opencv_nonfree)
if(HAVE_OPENCL)
ocv_include_directories(${OPENCL_INCLUDE_DIR})
@@ -52,8 +51,8 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endif()
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* *.txt)
install(FILES ${install_list}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)
endif()
+20 -7
View File
@@ -1,11 +1,22 @@
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/nonfree/ocl.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/ocl/ocl.hpp"
# include "opencv2/nonfree/ocl.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
using namespace cv::ocl;
@@ -326,3 +337,5 @@ int main(int argc, char* argv[])
waitKey(0);
return EXIT_SUCCESS;
}
#endif