Skip to content

Commit f90a387

Browse files
committed
Add missing additional header files from OpenCV 2.0
1 parent 6f0ccc5 commit f90a387

File tree

10 files changed

+15038
-0
lines changed

10 files changed

+15038
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
// Intel License Agreement
11+
// For Open Source Computer Vision Library
12+
//
13+
// Copyright (C) 2000, Intel Corporation, all rights reserved.
14+
// Third party copyrights are property of their respective owners.
15+
//
16+
// Redistribution and use in source and binary forms, with or without modification,
17+
// are permitted provided that the following conditions are met:
18+
//
19+
// * Redistribution's of source code must retain the above copyright notice,
20+
// this list of conditions and the following disclaimer.
21+
//
22+
// * Redistribution's in binary form must reproduce the above copyright notice,
23+
// this list of conditions and the following disclaimer in the documentation
24+
// and/or other materials provided with the distribution.
25+
//
26+
// * The name of Intel Corporation may not be used to endorse or promote products
27+
// derived from this software without specific prior written permission.
28+
//
29+
// This software is provided by the copyright holders and contributors "as is" and
30+
// any express or implied warranties, including, but not limited to, the implied
31+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32+
// In no event shall the Intel Corporation or contributors be liable for any direct,
33+
// indirect, incidental, special, exemplary, or consequential damages
34+
// (including, but not limited to, procurement of substitute goods or services;
35+
// loss of use, data, or profits; or business interruption) however caused
36+
// and on any theory of liability, whether in contract, strict liability,
37+
// or tort (including negligence or otherwise) arising in any way out of
38+
// the use of this software, even if advised of the possibility of such damage.
39+
//
40+
//M*/
41+
42+
#ifndef _CVSTREAMS_H_
43+
#define _CVSTREAMS_H_
44+
45+
#ifdef WIN32
46+
#include <streams.h> /* !!! IF YOU'VE GOT AN ERROR HERE, PLEASE READ BELOW !!! */
47+
/***************** How to get Visual Studio understand streams.h ****************\
48+
49+
You need DirectShow SDK that is now a part of Platform SDK
50+
(Windows Server 2003 SP1 SDK or later),
51+
and DirectX SDK (2006 April or later).
52+
53+
1. Download the Platform SDK from
54+
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
55+
and DirectX SDK from msdn.microsoft.com/directx/
56+
(They are huge, but you can download it by parts).
57+
If it doesn't work for you, consider HighGUI that can capture video via VFW or MIL
58+
59+
2. Install Platform SDK together with DirectShow SDK.
60+
Install DirectX (with or without sample code).
61+
62+
3. Build baseclasses.
63+
See <PlatformSDKInstallFolder>\samples\multimedia\directshow\readme.txt.
64+
65+
4. Copy the built libraries (called strmbase.lib and strmbasd.lib
66+
in Release and Debug versions, respectively) to
67+
<PlatformSDKInstallFolder>\lib.
68+
69+
5. In Developer Studio add the following paths:
70+
<DirectXSDKInstallFolder>\include
71+
<PlatformSDKInstallFolder>\include
72+
<PlatformSDKInstallFolder>\samples\multimedia\directshow\baseclasses
73+
to the includes' search path
74+
(at Tools->Options->Directories->Include files in case of Visual Studio 6.0,
75+
at Tools->Options->Projects and Solutions->VC++ Directories->Include files in case
76+
of Visual Studio 2005)
77+
Add
78+
<DirectXSDKInstallFolder>\lib
79+
<PlatformSDKInstallFolder>\lib
80+
to the libraries' search path (in the same dialog, ...->"Library files" page)
81+
82+
NOTE: PUT THE ADDED LINES ON THE VERY TOP OF THE LISTS, OTHERWISE YOU MAY STILL GET
83+
COMPILER OR LINKER ERRORS. This is necessary, because Visual Studio
84+
may include older versions of the same headers and libraries.
85+
86+
6. Now you can build OpenCV DirectShow filters.
87+
88+
\***********************************************************************************/
89+
90+
#endif
91+
92+
#endif /*_CVSTREAMS_H_*/
93+
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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-2008, Intel Corporation, all rights reserved.
14+
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15+
// Third party copyrights are property of their respective owners.
16+
//
17+
// Redistribution and use in source and binary forms, with or without modification,
18+
// are permitted provided that the following conditions are met:
19+
//
20+
// * Redistribution's of source code must retain the above copyright notice,
21+
// this list of conditions and the following disclaimer.
22+
//
23+
// * Redistribution's in binary form must reproduce the above copyright notice,
24+
// this list of conditions and the following disclaimer in the documentation
25+
// and/or other materials provided with the distribution.
26+
//
27+
// * The name of the copyright holders may not be used to endorse or promote products
28+
// derived from this software without specific prior written permission.
29+
//
30+
// This software is provided by the copyright holders and contributors "as is" and
31+
// any express or implied warranties, including, but not limited to, the implied
32+
// warranties of merchantability and fitness for a particular purpose are disclaimed.
33+
// In no event shall the Intel Corporation or contributors be liable for any direct,
34+
// indirect, incidental, special, exemplary, or consequential damages
35+
// (including, but not limited to, procurement of substitute goods or services;
36+
// loss of use, data, or profits; or business interruption) however caused
37+
// and on any theory of liability, whether in contract, strict liability,
38+
// or tort (including negligence or otherwise) arising in any way out of
39+
// the use of this software, even if advised of the possibility of such damage.
40+
//
41+
//M*/
42+
43+
#ifndef CXFLANN_H_
44+
#define CXFLANN_H_
45+
46+
#ifdef __cplusplus
47+
48+
namespace flann
49+
{
50+
class Index;
51+
}
52+
53+
namespace cv {
54+
55+
namespace flann {
56+
57+
/* Nearest neighbor index algorithms */
58+
enum flann_algorithm_t {
59+
LINEAR = 0,
60+
KDTREE = 1,
61+
KMEANS = 2,
62+
COMPOSITE = 3,
63+
SAVED = 254,
64+
AUTOTUNED = 255
65+
};
66+
67+
enum flann_centers_init_t {
68+
CENTERS_RANDOM = 0,
69+
CENTERS_GONZALES = 1,
70+
CENTERS_KMEANSPP = 2
71+
};
72+
73+
74+
enum flann_log_level_t {
75+
LOG_NONE = 0,
76+
LOG_FATAL = 1,
77+
LOG_ERROR = 2,
78+
LOG_WARN = 3,
79+
LOG_INFO = 4
80+
};
81+
82+
enum flann_distance_t {
83+
EUCLIDEAN = 1,
84+
MANHATTAN = 2,
85+
MINKOWSKI = 3
86+
};
87+
88+
class CV_EXPORTS IndexFactory
89+
{
90+
public:
91+
virtual ~IndexFactory() {}
92+
virtual ::flann::Index* createIndex(const Mat& dataset) const = 0;
93+
};
94+
95+
struct CV_EXPORTS IndexParams : public IndexFactory {
96+
protected:
97+
IndexParams() {};
98+
99+
};
100+
101+
struct CV_EXPORTS LinearIndexParams : public IndexParams {
102+
LinearIndexParams() {};
103+
104+
::flann::Index* createIndex(const Mat& dataset) const;
105+
};
106+
107+
108+
109+
struct CV_EXPORTS KDTreeIndexParams : public IndexParams {
110+
KDTreeIndexParams(int trees_ = 4) : trees(trees_) {};
111+
112+
int trees; // number of randomized trees to use (for kdtree)
113+
114+
::flann::Index* createIndex(const Mat& dataset) const;
115+
};
116+
117+
struct CV_EXPORTS KMeansIndexParams : public IndexParams {
118+
KMeansIndexParams(int branching_ = 32, int iterations_ = 11,
119+
flann_centers_init_t centers_init_ = CENTERS_RANDOM, float cb_index_ = 0.2 ) :
120+
branching(branching_),
121+
iterations(iterations_),
122+
centers_init(centers_init_),
123+
cb_index(cb_index_) {};
124+
125+
int branching; // branching factor (for kmeans tree)
126+
int iterations; // max iterations to perform in one kmeans clustering (kmeans tree)
127+
flann_centers_init_t centers_init; // algorithm used for picking the initial cluster centers for kmeans tree
128+
float cb_index; // cluster boundary index. Used when searching the kmeans tree
129+
130+
::flann::Index* createIndex(const Mat& dataset) const;
131+
};
132+
133+
134+
struct CV_EXPORTS CompositeIndexParams : public IndexParams {
135+
CompositeIndexParams(int trees_ = 4, int branching_ = 32, int iterations_ = 11,
136+
flann_centers_init_t centers_init_ = CENTERS_RANDOM, float cb_index_ = 0.2 ) :
137+
trees(trees_),
138+
branching(branching_),
139+
iterations(iterations_),
140+
centers_init(centers_init_),
141+
cb_index(cb_index_) {};
142+
143+
int trees; // number of randomized trees to use (for kdtree)
144+
int branching; // branching factor (for kmeans tree)
145+
int iterations; // max iterations to perform in one kmeans clustering (kmeans tree)
146+
flann_centers_init_t centers_init; // algorithm used for picking the initial cluster centers for kmeans tree
147+
float cb_index; // cluster boundary index. Used when searching the kmeans tree
148+
149+
::flann::Index* createIndex(const Mat& dataset) const;
150+
};
151+
152+
153+
struct CV_EXPORTS AutotunedIndexParams : public IndexParams {
154+
AutotunedIndexParams( float target_precision_ = 0.9, float build_weight_ = 0.01,
155+
float memory_weight_ = 0, float sample_fraction_ = 0.1) :
156+
target_precision(target_precision_),
157+
build_weight(build_weight_),
158+
memory_weight(memory_weight_),
159+
sample_fraction(sample_fraction_) {};
160+
161+
float target_precision; // precision desired (used for autotuning, -1 otherwise)
162+
float build_weight; // build tree time weighting factor
163+
float memory_weight; // index memory weighting factor
164+
float sample_fraction; // what fraction of the dataset to use for autotuning
165+
166+
::flann::Index* createIndex(const Mat& dataset) const;
167+
};
168+
169+
170+
struct CV_EXPORTS SavedIndexParams : public IndexParams {
171+
SavedIndexParams() {}
172+
SavedIndexParams(std::string filename_) : filename(filename_) {}
173+
174+
std::string filename; // filename of the stored index
175+
176+
::flann::Index* createIndex(const Mat& dataset) const;
177+
};
178+
179+
180+
struct CV_EXPORTS SearchParams {
181+
SearchParams(int checks_ = 32) :
182+
checks(checks_) {};
183+
184+
int checks;
185+
};
186+
187+
188+
189+
class CV_EXPORTS Index {
190+
::flann::Index* nnIndex;
191+
192+
public:
193+
Index(const Mat& features, const IndexParams& params);
194+
195+
~Index();
196+
197+
void knnSearch(const vector<float>& queries, vector<int>& indices, vector<float>& dists, int knn, const SearchParams& params);
198+
void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const SearchParams& params);
199+
200+
int radiusSearch(const vector<float>& query, vector<int>& indices, vector<float>& dists, float radius, const SearchParams& params);
201+
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, float radius, const SearchParams& params);
202+
203+
void save(std::string filename);
204+
205+
int veclen() const;
206+
207+
int size() const;
208+
};
209+
210+
211+
CV_EXPORTS int hierarchicalClustering(const Mat& features, Mat& centers,
212+
const KMeansIndexParams& params);
213+
214+
}
215+
216+
}
217+
218+
#endif // __cplusplus
219+
220+
#endif /* CXFLANN_H_ */

0 commit comments

Comments
 (0)