Commit 8b831fef authored by Vladislav Sovrasov's avatar Vladislav Sovrasov

ximgproc: wrap weightedMedianFilter into python

parent 31e96057
......@@ -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());
}
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment