Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
8b831fef
Commit
8b831fef
authored
Mar 29, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ximgproc: wrap weightedMedianFilter into python
parent
31e96057
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
weighted_median_filter.hpp
...gproc/include/opencv2/ximgproc/weighted_median_filter.hpp
+8
-7
weighted_median_filter.cpp
modules/ximgproc/src/weighted_median_filter.cpp
+3
-3
No files found.
modules/ximgproc/include/opencv2/ximgproc/weighted_median_filter.hpp
View file @
8b831fef
...
...
@@ -63,12 +63,12 @@ namespace ximgproc
*/
enum
WMFWeightType
{
WMF_EXP
,
//!< \f$exp(-|I1-I2|^2/(2*sigma^2))\f$
WMF_IV1
,
//!< \f$(|I1-I2|+sigma)^-1\f$
WMF_IV2
,
//!< \f$(|I1-I2|^2+sigma^2)^-1\f$
WMF_COS
,
//!< \f$dot(I1,I2)/(|I1|*|I2|)\f$
WMF_JAC
,
//!< \f$(min(r1,r2)+min(g1,g2)+min(b1,b2))/(max(r1,r2)+max(g1,g2)+max(b1,b2))\f$
WMF_OFF
//!< unweighted
WMF_EXP
=
1
,
//!< \f$exp(-|I1-I2|^2/(2*sigma^2))\f$
WMF_IV1
=
1
<<
1
,
//!< \f$(|I1-I2|+sigma)^-1\f$
WMF_IV2
=
1
<<
2
,
//!< \f$(|I1-I2|^2+sigma^2)^-1\f$
WMF_COS
=
1
<<
3
,
//!< \f$dot(I1,I2)/(|I1|*|I2|)\f$
WMF_JAC
=
1
<<
4
,
//!< \f$(min(r1,r2)+min(g1,g2)+min(b1,b2))/(max(r1,r2)+max(g1,g2)+max(b1,b2))\f$
WMF_OFF
=
1
<<
5
//!< unweighted
};
/**
...
...
@@ -87,7 +87,8 @@ enum WMFWeightType
*
* @sa medianBlur, jointBilateralFilter
*/
CV_EXPORTS
void
weightedMedianFilter
(
InputArray
joint
,
InputArray
src
,
OutputArray
dst
,
int
r
,
double
sigma
=
25.5
,
WMFWeightType
weightType
=
WMF_EXP
,
Mat
mask
=
Mat
());
CV_EXPORTS_W
void
weightedMedianFilter
(
InputArray
joint
,
InputArray
src
,
OutputArray
dst
,
int
r
,
double
sigma
=
25.5
,
int
weightType
=
WMF_EXP
,
InputArray
mask
=
noArray
());
}
}
...
...
modules/ximgproc/src/weighted_median_filter.cpp
View file @
8b831fef
...
...
@@ -231,7 +231,7 @@ inline void updateBCB(int &num,int *f,int *b,int i,int v)
* If F is 3-channel, perform k-means clustering
* If F is 1-channel, only perform type-casting
***************************************************************/
void
featureIndexing
(
Mat
&
F
,
float
**&
wMap
,
int
&
nF
,
float
sigmaI
,
WMFWeightType
weightType
){
void
featureIndexing
(
Mat
&
F
,
float
**&
wMap
,
int
&
nF
,
float
sigmaI
,
int
weightType
){
// Configuration and Declaration
Mat
FNew
;
int
cols
=
F
.
cols
,
rows
=
F
.
rows
;
...
...
@@ -636,7 +636,7 @@ namespace cv
{
namespace
ximgproc
{
void
weightedMedianFilter
(
InputArray
joint
,
InputArray
src
,
OutputArray
dst
,
int
r
,
double
sigma
,
WMFWeightType
weightType
,
Mat
mask
)
void
weightedMedianFilter
(
InputArray
joint
,
InputArray
src
,
OutputArray
dst
,
int
r
,
double
sigma
,
int
weightType
,
InputArray
mask
)
{
CV_Assert
(
!
src
.
empty
());
CV_Assert
(
r
>
0
&&
sigma
>
0
);
...
...
@@ -697,7 +697,7 @@ void weightedMedianFilter(InputArray joint, InputArray src, OutputArray dst, int
//Filtering - Joint-Histogram Framework
for
(
int
i
=
0
;
i
<
(
int
)
Is
.
size
();
i
++
)
{
Is
[
i
]
=
filterCore
(
Is
[
i
],
F
,
wMap
,
r
,
nF
,
nI
,
mask
);
Is
[
i
]
=
filterCore
(
Is
[
i
],
F
,
wMap
,
r
,
nF
,
nI
,
mask
.
getMat
()
);
}
float2D_release
(
wMap
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment