Skip to content

Commit 81b23b7

Browse files
committed
Merge pull request #417 from ogreen:covariance
2 parents 6bfb402 + 0966b2d commit 81b23b7

File tree

3 files changed

+458
-0
lines changed

3 files changed

+458
-0
lines changed

modules/ximgproc/include/opencv2/ximgproc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "ximgproc/structured_edge_detection.hpp"
4444
#include "ximgproc/seeds.hpp"
4545
#include "ximgproc/fast_hough_transform.hpp"
46+
#include "ximgproc/estimated_covariance.hpp"
4647

4748
/** @defgroup ximgproc Extended Image Processing
4849
@{
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
By downloading, copying, installing or using the software you agree to this license.
3+
If you do not agree to this license, do not download, install,
4+
copy or use the software.
5+
6+
7+
License Agreement
8+
For Open Source Computer Vision Library
9+
(3-clause BSD License)
10+
11+
Copyright (C) 2000-2015, Intel Corporation, all rights reserved.
12+
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
13+
Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
14+
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
15+
Copyright (C) 2015, 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+
* Redistributions of source code must retain the above copyright notice,
23+
this list of conditions and the following disclaimer.
24+
25+
* Redistributions 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+
* Neither the names of the copyright holders nor the names of the contributors
30+
may be used to endorse or promote products derived from this software
31+
without specific prior written permission.
32+
33+
This software is provided by the copyright holders and contributors "as is" and
34+
any express or implied warranties, including, but not limited to, the implied
35+
warranties of merchantability and fitness for a particular purpose are disclaimed.
36+
In no event shall copyright holders or contributors be liable for any direct,
37+
indirect, incidental, special, exemplary, or consequential damages
38+
(including, but not limited to, procurement of substitute goods or services;
39+
loss of use, data, or profits; or business interruption) however caused
40+
and on any theory of liability, whether in contract, strict liability,
41+
or tort (including negligence or otherwise) arising in any way out of
42+
the use of this software, even if advised of the possibility of such damage.
43+
44+
Algorithmic details of this algorithm can be found at:
45+
* O. Green, Y. Birk, "A Computationally Efficient Algorithm for the 2D Covariance Method", ACM/IEEE International Conference on High Performance Computing, Networking, Storage and Analysis, Denver, Colorado, 2013
46+
A previous and less efficient version of the algorithm can be found:
47+
* O. Green, L. David, A. Galperin, Y. Birk, "Efficient parallel computation of the estimated covariance matrix", arXiv, 2013
48+
49+
50+
*/
51+
#ifndef __OPENCV_ESTIMATECOVARIANCE_HPP__
52+
#define __OPENCV_ESTIMATECOVARIANCE_HPP__
53+
#ifdef __cplusplus
54+
55+
#include <opencv2/core.hpp>
56+
57+
namespace cv
58+
{
59+
namespace ximgproc
60+
{
61+
62+
/** @brief Computes the estimated covariance matrix of an image using the sliding
63+
window forumlation.
64+
65+
@param src The source image. Input image must be of a complex type.
66+
@param dst The destination estimated covariance matrix. Output matrix will be size (windowRows*windowCols, windowRows*windowCols).
67+
@param windowRows The number of rows in the window.
68+
@param windowCols The number of cols in the window.
69+
The window size parameters control the accuracy of the estimation.
70+
The sliding window moves over the entire image from the top-left corner
71+
to the bottom right corner. Each location of the window represents a sample.
72+
If the window is the size of the image, then this gives the exact covariance matrix.
73+
For all other cases, the sizes of the window will impact the number of samples
74+
and the number of elements in the estimated covariance matrix.
75+
*/
76+
77+
CV_EXPORTS_W void covarianceEstimation(InputArray src, OutputArray dst, int windowRows, int windowCols);
78+
79+
}
80+
}
81+
#endif
82+
#endif

0 commit comments

Comments
 (0)