Skip to content

Commit 6e3eea5

Browse files
ytyytyytalalek
authored andcommitted
Merge pull request #1883 from ytyytyyt:3.4
* add fast bilateral solver from master * fix unused variables warnings in disparity_filtering.cpp * trailing whitespaces removed
1 parent 37d9339 commit 6e3eea5

File tree

6 files changed

+1369
-5
lines changed

6 files changed

+1369
-5
lines changed

modules/ximgproc/doc/ximgproc.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,12 @@ @misc{M_RF
301301
url = {http://reference.wolfram.com/language/ref/RidgeFilter.html}
302302

303303
}
304+
305+
@inproceedings{BarronPoole2016,
306+
author = {Jonathan T Barron and Ben Poole},
307+
title={The Fast Bilateral Solver},
308+
booktitle={European Conference on Computer Vision (ECCV)},
309+
year={2016},
310+
publisher={Springer International Publishing},
311+
pages={617--632},
312+
}

modules/ximgproc/include/opencv2/ximgproc/edge_filter.hpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,71 @@ void rollingGuidanceFilter(InputArray src, OutputArray dst, int d = -1, double s
375375
//////////////////////////////////////////////////////////////////////////
376376
//////////////////////////////////////////////////////////////////////////
377377

378+
/** @brief Interface for implementations of The Fast Bilateral Solver.
379+
380+
For more details about this solver see @cite BarronPoole2016 .
381+
*/
382+
class CV_EXPORTS_W FastBilateralSolverFilter : public Algorithm
383+
{
384+
public:
385+
/** @brief Apply smoothing operation to the source image.
386+
387+
@param src source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 3 channels.
388+
389+
@param confidence confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel.
390+
391+
@param dst destination image.
392+
*/
393+
CV_WRAP virtual void filter(InputArray src, InputArray confidence, OutputArray dst) = 0;
394+
};
395+
396+
/** @brief Factory method, create instance of FastBilateralSolverFilter and execute the initialization routines.
397+
398+
@param guide image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels.
399+
400+
@param sigma_spatial parameter, that is similar to spatial space sigma in bilateralFilter.
401+
402+
@param sigma_luma parameter, that is similar to luma space sigma in bilateralFilter.
403+
404+
@param sigma_chroma parameter, that is similar to chroma space sigma in bilateralFilter.
405+
406+
@param num_iter number of iterations used for solving, 25 is usually enough.
407+
408+
@param max_tol solving tolerance used for solving.
409+
410+
For more details about the Fast Bilateral Solver parameters, see the original paper @cite BarronPoole2016.
411+
412+
*/
413+
CV_EXPORTS_W Ptr<FastBilateralSolverFilter> createFastBilateralSolverFilter(InputArray guide, double sigma_spatial, double sigma_luma, double sigma_chroma, int num_iter = 25, double max_tol = 1e-5);
414+
415+
/** @brief Simple one-line Fast Bilateral Solver filter call. If you have multiple images to filter with the same
416+
guide then use FastBilateralSolverFilter interface to avoid extra computations.
417+
418+
@param guide image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels.
419+
420+
@param src source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels.
421+
422+
@param confidence confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel.
423+
424+
@param dst destination image.
425+
426+
@param sigma_spatial parameter, that is similar to spatial space sigma in bilateralFilter.
427+
428+
@param sigma_luma parameter, that is similar to luma space sigma in bilateralFilter.
429+
430+
@param sigma_chroma parameter, that is similar to chroma space sigma in bilateralFilter.
431+
432+
@param num_iter number of iterations used for solving, 25 is usually enough.
433+
434+
@param max_tol solving tolerance used for solving.
435+
436+
@note Confidence images with CV_8U depth are expected to in [0, 255] and CV_32F in [0, 1] range.
437+
*/
438+
CV_EXPORTS_W void fastBilateralSolverFilter(InputArray guide, InputArray src, InputArray confidence, OutputArray dst, double sigma_spatial = 8, double sigma_luma = 8, double sigma_chroma = 8, int num_iter = 25, double max_tol = 1e-5);
439+
440+
//////////////////////////////////////////////////////////////////////////
441+
//////////////////////////////////////////////////////////////////////////
442+
378443

379444
/** @brief Interface for implementations of Fast Global Smoother filter.
380445

0 commit comments

Comments
 (0)