Skip to content

Commit 052593c

Browse files
committed
1. Input/OutputArray optimizations;
2. Algorithm::load/save added (moved from StatModel) 3. copyrights updated; added copyright/licensing info for ffmpeg 4. some warnings from Xcode 6.x are fixed
1 parent 44f112a commit 052593c

34 files changed

+890
-209
lines changed

3rdparty/ffmpeg/build_win32.txt

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
The build script is to be fixed.
2+
Right now it assumes that 32-bit MinGW is in the system path and
3+
64-bit mingw is installed to c:\Apps\MinGW64.
4+
5+
It is important that gcc is used, not g++!
6+
Otherwise the produced DLL will likely be dependent on libgcc_s_dw2-1.dll or similar DLL.
7+
While we want to make the DLLs with minimum dependencies: Win32 libraries + msvcrt.dll.
8+
9+
ffopencv.c is really a C++ source, hence -x c++ is used.
10+
11+
How to update opencv_ffmpeg.dll and opencv_ffmpeg_64.dll when a new version of FFMPEG is release?
12+
13+
1. Install 32-bit MinGW + MSYS from
14+
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/
15+
Let's assume, it's installed in C:\MSYS32.
16+
2. Install 64-bit MinGW. http://mingw-w64.sourceforge.net/
17+
Let's assume, it's installed in C:\MSYS64
18+
3. Copy C:\MSYS32\msys to C:\MSYS64\msys. Edit C:\MSYS64\msys\etc\fstab, change C:\MSYS32 to C:\MSYS64.
19+
20+
4. Now you have working MSYS32 and MSYS64 environments.
21+
Launch, one by one, C:\MSYS32\msys\msys.bat and C:\MSYS64\msys\msys.bat to create your home directories.
22+
23+
4. Download ffmpeg-x.y.z.tar.gz (where x.y.z denotes the actual ffmpeg version).
24+
Copy it to C:\MSYS{32|64}\msys\home\<loginname> directory.
25+
26+
5. To build 32-bit ffmpeg libraries, run C:\MSYS32\msys\msys.bat and type the following commands:
27+
28+
5.1. tar -xzf ffmpeg-x.y.z.tar.gz
29+
5.2. mkdir build
30+
5.3. cd build
31+
5.4. ../ffmpeg-x.y.z/configure --enable-w32threads
32+
5.5. make
33+
5.6. make install
34+
5.7. cd /local/lib
35+
5.8. strip -g *.a
36+
37+
6. Then repeat the same for 64-bit case. The output libs: libavcodec.a etc. need to be renamed to libavcodec64.a etc.
38+
39+
7. Then, copy all those libs to <opencv>\3rdparty\lib\, copy the headers to <opencv>\3rdparty\include\ffmpeg_.
40+
41+
8. Then, go to <opencv>\3rdparty\ffmpeg, edit make.bat
42+
(change paths to the actual paths to your msys32 and msys64 distributions) and then run make.bat

3rdparty/ffmpeg/license.txt

+520
Large diffs are not rendered by default.

3rdparty/ffmpeg/readme.txt

+32-42
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,32 @@
1-
The build script is to be fixed.
2-
Right now it assumes that 32-bit MinGW is in the system path and
3-
64-bit mingw is installed to c:\Apps\MinGW64.
4-
5-
It is important that gcc is used, not g++!
6-
Otherwise the produced DLL will likely be dependent on libgcc_s_dw2-1.dll or similar DLL.
7-
While we want to make the DLLs with minimum dependencies: Win32 libraries + msvcrt.dll.
8-
9-
ffopencv.c is really a C++ source, hence -x c++ is used.
10-
11-
How to update opencv_ffmpeg.dll and opencv_ffmpeg_64.dll when a new version of FFMPEG is release?
12-
13-
1. Install 32-bit MinGW + MSYS from
14-
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/
15-
Let's assume, it's installed in C:\MSYS32.
16-
2. Install 64-bit MinGW. http://mingw-w64.sourceforge.net/
17-
Let's assume, it's installed in C:\MSYS64
18-
3. Copy C:\MSYS32\msys to C:\MSYS64\msys. Edit C:\MSYS64\msys\etc\fstab, change C:\MSYS32 to C:\MSYS64.
19-
20-
4. Now you have working MSYS32 and MSYS64 environments.
21-
Launch, one by one, C:\MSYS32\msys\msys.bat and C:\MSYS64\msys\msys.bat to create your home directories.
22-
23-
4. Download ffmpeg-x.y.z.tar.gz (where x.y.z denotes the actual ffmpeg version).
24-
Copy it to C:\MSYS{32|64}\msys\home\<loginname> directory.
25-
26-
5. To build 32-bit ffmpeg libraries, run C:\MSYS32\msys\msys.bat and type the following commands:
27-
28-
5.1. tar -xzf ffmpeg-x.y.z.tar.gz
29-
5.2. mkdir build
30-
5.3. cd build
31-
5.4. ../ffmpeg-x.y.z/configure --enable-w32threads
32-
5.5. make
33-
5.6. make install
34-
5.7. cd /local/lib
35-
5.8. strip -g *.a
36-
37-
6. Then repeat the same for 64-bit case. The output libs: libavcodec.a etc. need to be renamed to libavcodec64.a etc.
38-
39-
7. Then, copy all those libs to <opencv>\3rdparty\lib\, copy the headers to <opencv>\3rdparty\include\ffmpeg_.
40-
41-
8. Then, go to <opencv>\3rdparty\ffmpeg, edit make.bat
42-
(change paths to the actual paths to your msys32 and msys64 distributions) and then run make.bat
1+
* On Linux and other Unix flavors OpenCV uses default or user-built ffmpeg/libav libraries.
2+
If user builds ffmpeg/libav from source and wants OpenCV to stay BSD library, not GPL/LGPL,
3+
he/she should use --enabled-shared configure flag and make sure that no GPL components are
4+
enabled (some notable examples are x264 (H264 encoder) and libac3 (Dolby AC3 audio codec)).
5+
See https://www.ffmpeg.org/legal.html for details.
6+
7+
If you want to play very safe and do not want to use FFMPEG at all, regardless of whether it's installed on
8+
your system or not, configure and build OpenCV using CMake with WITH_FFMPEG=OFF flag. OpenCV will then use
9+
AVFoundation (OSX), GStreamer (Linux) or other available backends supported by opencv_videoio module.
10+
11+
There is also our self-contained motion jpeg codec, which you can use without any worries.
12+
It handles CV_FOURCC('M', 'J', 'P', 'G') streams within an AVI container (".avi").
13+
14+
* On Windows OpenCV uses pre-built ffmpeg binaries, built with proper flags (without GPL components) and
15+
wrapped with simple, stable OpenCV-compatible API.
16+
The binaries are opencv_ffmpeg.dll (version for 32-bit Windows) and
17+
opencv_ffmpeg_64.dll (version for 64-bit Windows).
18+
19+
See build_win32.txt for the build instructions, if you want to rebuild opencv_ffmpeg*.dll from scratch.
20+
21+
The pre-built opencv_ffmpeg*.dll is:
22+
* LGPL library, not BSD libraries.
23+
* Loaded at runtime by opencv_videoio module.
24+
If it succeeds, ffmpeg can be used to decode/encode videos;
25+
otherwise, other API is used.
26+
27+
If LGPL/GPL software can not be supplied with your OpenCV-based product, simply exclude
28+
opencv_ffmpeg*.dll from your distribution; OpenCV will stay fully functional except for the ability to
29+
decode/encode videos using FFMPEG (though, it may still be able to do that using other API,
30+
such as Video for Windows, Windows Media Foundation or our self-contained motion jpeg codec).
31+
32+
See license.txt for the FFMPEG copyright notice and the licensing terms.

3rdparty/readme.txt

+19-25
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,34 @@ In order to use these versions of libraries instead of system ones on UNIX syste
66
should use BUILD_<library_name> CMake flags (for example, BUILD_PNG for the libpng library).
77

88
------------------------------------------------------------------------------------
9-
libjpeg 8d (8.4) - The Independent JPEG Group's JPEG software.
9+
libjpeg The Independent JPEG Group's JPEG software.
1010
Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
1111
See IGJ home page http://www.ijg.org
1212
for details and links to the source code
1313

14-
HAVE_JPEG preprocessor flag must be set to make imgcodecs use libjpeg.
15-
On UNIX systems configure script takes care of it.
14+
WITH_JPEG CMake option must be ON to add libjpeg support to imgcodecs.
1615
------------------------------------------------------------------------------------
17-
libpng 1.5.12 - Portable Network Graphics library.
16+
libpng Portable Network Graphics library.
1817
Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson.
1918
See libpng home page http://www.libpng.org
2019
for details and links to the source code
2120

22-
HAVE_PNG preprocessor flag must be set to make imgcodecs use libpng.
23-
On UNIX systems configure script takes care of it.
21+
WITH_PNG CMake option must be ON to add libpng support to imgcodecs.
2422
------------------------------------------------------------------------------------
25-
libtiff 4.0.2 - Tag Image File Format (TIFF) Software
23+
libtiff Tag Image File Format (TIFF) Software
2624
Copyright (c) 1988-1997 Sam Leffler
2725
Copyright (c) 1991-1997 Silicon Graphics, Inc.
2826
See libtiff home page http://www.remotesensing.org/libtiff/
2927
for details and links to the source code
3028

31-
HAVE_TIFF preprocessor flag must be set to make imgcodecs use libtiff.
32-
On UNIX systems configure script takes care of it.
33-
In this build support for ZIP (LZ77 compression) is turned on.
29+
WITH_TIFF CMake option must be ON to add libtiff & zlib support to imgcodecs.
3430
------------------------------------------------------------------------------------
35-
zlib 1.2.7 - General purpose LZ77 compression library
31+
zlib General purpose LZ77 compression library
3632
Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler.
3733
See zlib home page http://www.zlib.net
3834
for details and links to the source code
39-
40-
No preprocessor definition is needed to make imgcodecs use this library -
41-
it is included automatically if either libpng or libtiff are used.
4235
------------------------------------------------------------------------------------
43-
jasper-1.900.1 - JasPer is a collection of software
36+
jasper JasPer is a collection of software
4437
(i.e., a library and application programs) for the coding
4538
and manipulation of images. This software can handle image data in a
4639
variety of formats. One such format supported by JasPer is the JPEG-2000
@@ -50,14 +43,9 @@ jasper-1.900.1 - JasPer is a collection of software
5043
Copyright (c) 1999-2000 The University of British Columbia
5144
Copyright (c) 2001-2003 Michael David Adams
5245

53-
The JasPer license can be found in src/libjasper.
54-
55-
OpenCV on Windows uses pre-built libjasper library
56-
(lib/libjasper*). To get the latest source code,
57-
please, visit the project homepage:
58-
http://www.ece.uvic.ca/~mdadams/jasper/
46+
The JasPer license can be found in libjasper.
5947
------------------------------------------------------------------------------------
60-
openexr-1.7.1 - OpenEXR is a high dynamic-range (HDR) image file format developed
48+
openexr OpenEXR is a high dynamic-range (HDR) image file format developed
6149
by Industrial Light & Magic for use in computer imaging applications.
6250

6351
Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm
@@ -66,11 +54,17 @@ openexr-1.7.1 - OpenEXR is a high dynamic-range (HDR) image file format de
6654

6755
The project homepage: http://www.openexr.com
6856
------------------------------------------------------------------------------------
69-
ffmpeg-0.8.0 - FFmpeg is a complete, cross-platform solution to record,
57+
ffmpeg FFmpeg is a complete, cross-platform solution to record,
7058
convert and stream audio and video. It includes libavcodec -
7159
the leading audio/video codec library, and also libavformat, libavutils and
72-
other helper libraries that are used by OpenCV (in highgui module) to
60+
other helper libraries that are used by OpenCV (in videoio module) to
7361
read and write video files.
7462

75-
The project homepage: http://ffmpeg.org/
63+
Copyright (c) 2001 Fabrice Bellard
64+
65+
The project homepage: http://ffmpeg.org/.
66+
67+
* On Linux/OSX we link user-installed ffmpeg (or ffmpeg fork libav).
68+
* On Windows we use pre-built ffmpeg binaries,
69+
see opencv/3rdparty/ffmpeg/readme.txt for details and licensing information
7670
------------------------------------------------------------------------------------

LICENSE

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ copy or use the software.
77
For Open Source Computer Vision Library
88
(3-clause BSD License)
99

10+
Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
11+
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
12+
Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
13+
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
14+
Copyright (C) 2015, OpenCV Foundation, all rights reserved.
15+
Copyright (C) 2015, Itseez Inc., all rights reserved.
16+
Third party copyrights are property of their respective owners.
17+
1018
Redistribution and use in source and binary forms, with or without modification,
1119
are permitted provided that the following conditions are met:
1220

apps/traincascade/old_ml_inner_functions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void CvStatModel::load( const char* filename, const char* name )
8282
{
8383
CvFileStorage* fs = 0;
8484

85-
CV_FUNCNAME( "CvStatModel::load" );
85+
CV_FUNCNAME( "CvAlgorithm::load" );
8686

8787
__BEGIN__;
8888

modules/core/include/opencv2/core.hpp

+72-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
// License Agreement
1111
// For Open Source Computer Vision Library
1212
//
13-
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
13+
// Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
1414
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
15+
// Copyright (C) 2015, OpenCV Foundation, all rights reserved.
16+
// Copyright (C) 2015, Itseez Inc., all rights reserved.
1517
// Third party copyrights are property of their respective owners.
1618
//
1719
// Redistribution and use in source and binary forms, with or without modification,
@@ -2921,13 +2923,82 @@ class CV_EXPORTS_W Algorithm
29212923
Algorithm();
29222924
virtual ~Algorithm();
29232925

2926+
/** @brief Clears the algorithm state
2927+
*/
2928+
CV_WRAP virtual void clear() {}
2929+
29242930
/** @brief Stores algorithm parameters in a file storage
29252931
*/
29262932
virtual void write(FileStorage& fs) const { (void)fs; }
29272933

29282934
/** @brief Reads algorithm parameters from a file storage
29292935
*/
29302936
virtual void read(const FileNode& fn) { (void)fn; }
2937+
2938+
/** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
2939+
*/
2940+
virtual bool empty() const { return false; }
2941+
2942+
/** @brief Reads algorithm from the file node
2943+
2944+
This is static template method of Algorithm. It's usage is following (in the case of SVM):
2945+
@code
2946+
Ptr<SVM> svm = Algorithm::read<SVM>(fn);
2947+
@endcode
2948+
In order to make this method work, the derived class must overwrite Algorithm::read(const
2949+
FileNode& fn) and also have static create() method without parameters
2950+
(or with all the optional parameters)
2951+
*/
2952+
template<typename _Tp> static Ptr<_Tp> read(const FileNode& fn)
2953+
{
2954+
Ptr<_Tp> obj = _Tp::create();
2955+
obj->read(fn);
2956+
return !obj->empty() ? obj : Ptr<_Tp>();
2957+
}
2958+
2959+
/** @brief Loads algorithm from the file
2960+
2961+
This is static template method of Algorithm. It's usage is following (in the case of SVM):
2962+
@code
2963+
Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
2964+
@endcode
2965+
In order to make this method work, the derived class must overwrite Algorithm::read(const
2966+
FileNode& fn).
2967+
*/
2968+
template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String())
2969+
{
2970+
FileStorage fs(filename, FileStorage::READ);
2971+
FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
2972+
Ptr<_Tp> obj = _Tp::create();
2973+
obj->read(fn);
2974+
return !obj->empty() ? obj : Ptr<_Tp>();
2975+
}
2976+
2977+
/** @brief Loads algorithm from a String
2978+
2979+
@param strModel The string variable containing the model you want to load.
2980+
2981+
This is static template method of Algorithm. It's usage is following (in the case of SVM):
2982+
@code
2983+
Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
2984+
@endcode
2985+
*/
2986+
template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String())
2987+
{
2988+
FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
2989+
FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
2990+
Ptr<_Tp> obj = _Tp::create();
2991+
obj->read(fn);
2992+
return !obj->empty() ? obj : Ptr<_Tp>();
2993+
}
2994+
2995+
/** Saves the algorithm to a file.
2996+
In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */
2997+
CV_WRAP virtual void save(const String& filename) const;
2998+
2999+
/** Returns the algorithm string identifier.
3000+
This string is used as top level xml/yml node tag when the object is saved to a file or string. */
3001+
CV_WRAP virtual String getDefaultName() const;
29313002
};
29323003

29333004
struct Param {

modules/core/include/opencv2/core/ippasync.hpp

+44
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
/*M///////////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4+
//
5+
// By downloading, copying, installing or using the software you agree to this license.
6+
// If you do not agree to this license, do not download, install,
7+
// copy or use the software.
8+
//
9+
//
10+
// License Agreement
11+
// For Open Source Computer Vision Library
12+
//
13+
// Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
14+
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15+
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
16+
// Copyright (C) 2015, Itseez Inc., all rights reserved.
17+
// Third party copyrights are property of their respective owners.
18+
//
19+
// Redistribution and use in source and binary forms, with or without modification,
20+
// are permitted provided that the following conditions are met:
21+
//
22+
// * Redistribution's of source code must retain the above copyright notice,
23+
// this list of conditions and the following disclaimer.
24+
//
25+
// * Redistribution's in binary form must reproduce the above copyright notice,
26+
// this list of conditions and the following disclaimer in the documentation
27+
// and/or other materials provided with the distribution.
28+
//
29+
// * The name of the copyright holders may not be used to endorse or promote products
30+
// derived from this software without specific prior written permission.
31+
//
32+
// This software is provided by the copyright holders and contributors "as is" and
33+
// any express or implied warranties, including, but not limited to, the implied
34+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
35+
// In no event shall the Intel Corporation or contributors be liable for any direct,
36+
// indirect, incidental, special, exemplary, or consequential damages
37+
// (including, but not limited to, procurement of substitute goods or services;
38+
// loss of use, data, or profits; or business interruption) however caused
39+
// and on any theory of liability, whether in contract, strict liability,
40+
// or tort (including negligence or otherwise) arising in any way out of
41+
// the use of this software, even if advised of the possibility of such damage.
42+
//
43+
//M*/
44+
145
#ifndef __OPENCV_CORE_IPPASYNC_HPP__
246
#define __OPENCV_CORE_IPPASYNC_HPP__
347

0 commit comments

Comments
 (0)