Merge pull request #64 from Bellaktris/gsoc

Additions to ximgproc and xphoto modules
pull/65/head
Vadim Pisarevsky 10 years ago
commit e6d0b281da
  1. 5
      modules/tracking/doc/tracking.rst
  2. 4
      modules/ximgproc/doc/structured_edge_detection.rst
  3. 2
      modules/ximgproc/doc/ximgproc.rst
  4. 2
      modules/ximgproc/test/test_main.cpp
  5. 4
      modules/ximgproc/test/test_structured_edge_detection.cpp
  6. 0
      modules/ximgproc/testdata/ximgproc/model.yml.gz
  7. 0
      modules/ximgproc/testdata/ximgproc/results/01.png
  8. 0
      modules/ximgproc/testdata/ximgproc/results/02.png
  9. 0
      modules/ximgproc/testdata/ximgproc/results/03.png
  10. 0
      modules/ximgproc/testdata/ximgproc/results/04.png
  11. 0
      modules/ximgproc/testdata/ximgproc/results/05.png
  12. 0
      modules/ximgproc/testdata/ximgproc/results/06.png
  13. 0
      modules/ximgproc/testdata/ximgproc/results/07.png
  14. 0
      modules/ximgproc/testdata/ximgproc/results/08.png
  15. 0
      modules/ximgproc/testdata/ximgproc/results/09.png
  16. 0
      modules/ximgproc/testdata/ximgproc/results/10.png
  17. 0
      modules/ximgproc/testdata/ximgproc/results/11.png
  18. 0
      modules/ximgproc/testdata/ximgproc/results/12.png
  19. 0
      modules/ximgproc/testdata/ximgproc/sources/01.png
  20. 0
      modules/ximgproc/testdata/ximgproc/sources/02.png
  21. 0
      modules/ximgproc/testdata/ximgproc/sources/03.png
  22. 0
      modules/ximgproc/testdata/ximgproc/sources/04.png
  23. 0
      modules/ximgproc/testdata/ximgproc/sources/05.png
  24. 0
      modules/ximgproc/testdata/ximgproc/sources/06.png
  25. 0
      modules/ximgproc/testdata/ximgproc/sources/07.png
  26. 0
      modules/ximgproc/testdata/ximgproc/sources/08.png
  27. 0
      modules/ximgproc/testdata/ximgproc/sources/09.png
  28. 0
      modules/ximgproc/testdata/ximgproc/sources/10.png
  29. 0
      modules/ximgproc/testdata/ximgproc/sources/11.png
  30. 0
      modules/ximgproc/testdata/ximgproc/sources/12.png
  31. 17
      modules/xphoto/doc/colorbalance/whitebalance.rst
  32. 12
      modules/xphoto/doc/denoising/denoising.rst
  33. 10
      modules/xphoto/doc/inpainting/inpainting.rst
  34. 11
      modules/xphoto/include/opencv2/xphoto.hpp
  35. 3
      modules/xphoto/include/opencv2/xphoto/dct_image_denoising.hpp
  36. 3
      modules/xphoto/include/opencv2/xphoto/inpainting.hpp
  37. 3
      modules/xphoto/include/opencv2/xphoto/simple_color_balance.hpp
  38. 2
      modules/xphoto/samples/dct_image_denoising.cpp
  39. 2
      modules/xphoto/samples/inpainting.cpp
  40. 2
      modules/xphoto/samples/simple_color_balance.cpp
  41. 4
      modules/xphoto/src/dct_image_denoising.cpp
  42. 6
      modules/xphoto/src/inpainting.cpp
  43. 4
      modules/xphoto/src/simple_color_balance.cpp
  44. 11
      modules/xphoto/test/dct_image_denoising.cpp
  45. 6
      modules/xphoto/test/simple_color_balance.cpp
  46. 2
      modules/xphoto/test/test_main.cpp
  47. BIN
      modules/xphoto/testdata/dct_image_denoising/results/01.png
  48. 0
      modules/xphoto/testdata/x.png
  49. BIN
      modules/xphoto/testdata/xphoto/dct_image_denoising/results/.DS_Store
  50. BIN
      modules/xphoto/testdata/xphoto/dct_image_denoising/results/01.png
  51. 0
      modules/xphoto/testdata/xphoto/dct_image_denoising/sources/01.png
  52. BIN
      modules/xphoto/testdata/xphoto/inpainting/mask_1.png
  53. BIN
      modules/xphoto/testdata/xphoto/inpainting/src_1.jpg
  54. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/01.png
  55. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/02.png
  56. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/03.png
  57. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/04.png
  58. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/05.png
  59. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/06.png
  60. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/07.png
  61. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/08.png
  62. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/09.png
  63. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/10.png
  64. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/11.png
  65. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/12.png
  66. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/13.png
  67. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/results/14.png
  68. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/01.png
  69. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/02.png
  70. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/03.png
  71. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/04.png
  72. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/05.png
  73. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/06.png
  74. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/07.png
  75. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/08.png
  76. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/09.png
  77. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/10.png
  78. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/11.png
  79. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/12.png
  80. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/13.png
  81. 0
      modules/xphoto/testdata/xphoto/simple_white_balance/sources/14.png

@ -1,5 +1,6 @@
Tracking API
============
******************************************
tracking. Tracking API
******************************************
.. highlight:: cpp

@ -50,8 +50,8 @@ StructuredEdgeDetection::detectEdges
.. seealso::
:ocv:class:`Sobel`,
:ocv:class:`Canny`
:ocv:func:`Sobel`,
:ocv:func:`Canny`
createStructuredEdgeDetection
+++++++++++++++++++++++++++++

@ -7,5 +7,5 @@ ximgproc. Extended image processing module.
.. toctree::
:maxdepth: 2
edge_aware_filters
structured_edge_detection
edge_aware_filters

@ -1,3 +1,3 @@
#include "test_precomp.hpp"
CV_TEST_MAIN("ximpgroc")
CV_TEST_MAIN("")

@ -5,7 +5,8 @@ namespace cvtest
TEST(ximpgroc_StructuredEdgeDetection, regression)
{
cv::String dir = cvtest::TS::ptr()->get_data_path();
cv::String subfolder = "cv/ximgproc/";
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder;
int nTests = 12;
float threshold = 0.01f;
@ -17,6 +18,7 @@ TEST(ximpgroc_StructuredEdgeDetection, regression)
{
cv::String srcName = dir + cv::format( "sources/%02d.png", i + 1);
cv::Mat src = cv::imread( srcName, 1 );
ASSERT_TRUE(!src.empty());
cv::String previousResultName = dir + cv::format( "results/%02d.png", i + 1 );
cv::Mat previousResult = cv::imread( previousResultName, 0 );

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Before

Width:  |  Height:  |  Size: 375 KiB

After

Width:  |  Height:  |  Size: 375 KiB

Before

Width:  |  Height:  |  Size: 471 KiB

After

Width:  |  Height:  |  Size: 471 KiB

Before

Width:  |  Height:  |  Size: 520 KiB

After

Width:  |  Height:  |  Size: 520 KiB

Before

Width:  |  Height:  |  Size: 393 KiB

After

Width:  |  Height:  |  Size: 393 KiB

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 309 KiB

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 425 KiB

After

Width:  |  Height:  |  Size: 425 KiB

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 181 KiB

Before

Width:  |  Height:  |  Size: 505 KiB

After

Width:  |  Height:  |  Size: 505 KiB

Before

Width:  |  Height:  |  Size: 502 KiB

After

Width:  |  Height:  |  Size: 502 KiB

@ -5,19 +5,16 @@ Automatic white balance correction
balanceWhite
------------
.. ocv:function:: void balanceWhite(const Mat &src, Mat &dst, const int algorithmType, const float inputMin = 0.0f, const float inputMax = 255.0f, const float outputMin = 0.0f, const float outputMax = 255.0f)
The function implements different algorithm of automatic white balance, i.e.
it tries to map image's white color to perceptual white (this can be violated
due to specific illumination or camera settings).
The function implements different algorithm of automatic white balance, i.e. it tries to map image's white color to perceptual white (this can be violated due to specific illumination or camera settings).
:param src : source image
:param dst : destination image
:param algorithmType : type of the algorithm to use. Use WHITE_BALANCE_SIMPLE to perform smart histogram adjustments (ignoring 4% pixels with minimal and maximal values) for each channel.
:param inputMin : minimum value in the input image
:param inputMax : maximum value in the input image
:param outputMin : minimum value in the output image
:param outputMax : maximum value in the output image
:param algorithmType: type of the algorithm to use. Use WHITE_BALANCE_SIMPLE to perform smart histogram adjustments (ignoring 4% pixels with minimal and maximal values) for each channel.
:param inputMin: minimum value in the input image
:param inputMax: maximum value in the input image
:param outputMin: minimum value in the output image
:param outputMax: maximum value in the output image
.. seealso::

@ -7,13 +7,13 @@ dctDenoising
------------
.. ocv:function:: void dctDenoising(const Mat &src, Mat &dst, const float sigma)
The function implements simple dct-based denoising,
link: http://www.ipol.im/pub/art/2011/ys-dct/.
The function implements simple dct-based denoising,
link: http://www.ipol.im/pub/art/2011/ys-dct/.
:param src : source image
:param dst : destination image
:param sigma : expected noise standard deviation
:param psize : size of block side where dct is computed
:param src: source image
:param dst: destination image
:param sigma: expected noise standard deviation
:param psize: size of block side where dct is computed
.. seealso::

@ -7,12 +7,12 @@ Inpainting
----------
.. ocv:function:: void inpaint(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType)
The function implements different single-image inpainting algorithms.
The function implements different single-image inpainting algorithms.
:param src : source image, it could be of any type and any number of channels from 1 to 4. In case of 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first color component shows intensity, while second and third shows colors. Nonetheless you can try any colorspaces.
:param mask : mask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted
:param dst : destination image
:param algorithmType : expected noise standard deviation
:param src: source image, it could be of any type and any number of channels from 1 to 4. In case of 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first color component shows intensity, while second and third shows colors. Nonetheless you can try any colorspaces.
:param mask: mask (CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels indicate area to be inpainted
:param dst: destination image
:param algorithmType: expected noise standard deviation
* INPAINT_SHIFTMAP: This algorithm searches for dominant correspondences (transformations) of image patches and tries to seamlessly fill-in the area to be inpainted using this transformations. Look in the original paper [He2012]_ for details.
.. [He2012] K. He, J. Sun., "Statistics of Patch Offsets for Image Completion",

@ -40,11 +40,10 @@
//
//M*/
#ifndef __OPENCV_EDGEDETECTION_HPP__
#define __OPENCV_EDGEDETECTION_HPP__
#ifndef __OPENCV_XPHOTO_HPP__
#define __OPENCV_XPHOTO_HPP__
#include "opencv2/xphoto.hpp"
#include "opencv2/xphoto/inpainting.hpp"
#include "opencv2/xphoto/simple_color_balance.hpp"
#include "opencv2/xphoto/dct_image_denoising.hpp"
#include "xphoto/inpainting.hpp"
#include "xphoto/simple_color_balance.hpp"
#include "xphoto/dct_image_denoising.hpp"
#endif

@ -56,6 +56,8 @@
Namespace where all the C++ OpenCV functionality resides
*/
namespace cv
{
namespace xphoto
{
/*! This function implements simple dct-based image denoising,
* link: http://www.ipol.im/pub/art/2011/ys-dct/
@ -67,5 +69,6 @@ namespace cv
*/
CV_EXPORTS_W void dctDenoising(const Mat &src, Mat &dst, const double sigma, const int psize = 16);
}
}
#endif // __OPENCV_DCT_IMAGE_DENOISING_HPP__

@ -56,6 +56,8 @@
Namespace where all the C++ OpenCV functionality resides
*/
namespace cv
{
namespace xphoto
{
//! various inpainting algorithms
enum
@ -71,5 +73,6 @@ namespace cv
*/
CV_EXPORTS_W void inpaint(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType);
}
}
#endif // __OPENCV_INPAINTING_HPP__

@ -56,6 +56,8 @@
Namespace where all the C++ OpenCV functionality resides
*/
namespace cv
{
namespace xphoto
{
//! various white balance algorithms
enum
@ -77,5 +79,6 @@ namespace cv
const float inputMin = 0.0f, const float inputMax = 255.0f,
const float outputMin = 0.0f, const float outputMax = 255.0f);
}
}
#endif // __OPENCV_SIMPLE_COLOR_BALANCE_HPP__

@ -54,7 +54,7 @@ int main( int argc, const char** argv )
psize = 16;
cv::Mat res(src.size(), src.type());
cv::dctDenoising(src, res, sigma, psize);
cv::xphoto::dctDenoising(src, res, sigma, psize);
if ( outFilename == "" )
{

@ -56,7 +56,7 @@ int main( int argc, const char** argv )
}
cv::Mat res(src.size(), src.type());
cv::inpaint( src, mask, res, cv::INPAINT_SHIFTMAP );
cv::xphoto::inpaint( src, mask, res, cv::xphoto::INPAINT_SHIFTMAP );
cv::cvtColor(res, res, CV_Lab2RGB);
if ( outFilename == "" )

@ -44,7 +44,7 @@ int main( int argc, const char** argv )
}
cv::Mat res(src.size(), src.type());
cv::balanceWhite(src, res, cv::WHITE_BALANCE_SIMPLE);
cv::xphoto::balanceWhite(src, res, cv::xphoto::WHITE_BALANCE_SIMPLE);
if ( outFilename == "" )
{

@ -54,6 +54,9 @@
namespace cv
{
namespace xphoto
{
void grayDctDenoising(const Mat &, Mat &, const double, const int);
void rgbDctDenoising(const Mat &, Mat &, const double, const int);
void dctDenoising(const Mat &, Mat &, const double, const int);
@ -179,3 +182,4 @@ namespace cv
}
}
}

@ -67,6 +67,9 @@ namespace xphotoInternal
namespace cv
{
namespace xphoto
{
template <typename Tp, unsigned int cn>
static void shiftMapInpaint(const Mat &src, const Mat &mask, Mat &dst,
const int nTransform = 60, const int psize = 8)
@ -117,7 +120,7 @@ namespace cv
switch ( algorithmType )
{
case INPAINT_SHIFTMAP:
case xphoto::INPAINT_SHIFTMAP:
shiftMapInpaint <Tp, cn>(src, mask, dst);
break;
default:
@ -232,3 +235,4 @@ namespace cv
}
}
}
}

@ -54,6 +54,9 @@
namespace cv
{
namespace xphoto
{
template <typename T>
void balanceWhite(std::vector < Mat_<T> > &src, Mat &dst,
const float inputMin, const float inputMax,
@ -205,3 +208,4 @@ namespace cv
}
}
}
}

@ -4,10 +4,11 @@ namespace cvtest
{
TEST(xphoto_dctimagedenoising, regression)
{
cv::String dir = cvtest::TS::ptr()->get_data_path() + "dct_image_denoising/";
cv::String subfolder = "cv/xphoto/";
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder + "dct_image_denoising/";
int nTests = 1;
double thresholds[] = {0.1};
double thresholds[] = {0.2};
int psize[] = {8};
double sigma[] = {9.0};
@ -16,13 +17,15 @@ namespace cvtest
{
cv::String srcName = dir + cv::format( "sources/%02d.png", i + 1);
cv::Mat src = cv::imread( srcName, 1 );
ASSERT_TRUE(!src.empty());
cv::String previousResultName = dir + cv::format( "results/%02d.png", i + 1 );
cv::Mat previousResult = cv::imread( previousResultName, 1 );
ASSERT_TRUE(!src.empty());
cv::Mat currentResult, fastNlMeansResult;
cv::Mat currentResult;
cv::dctDenoising(src, currentResult, sigma[i], psize[i]);
cv::xphoto::dctDenoising(src, currentResult, sigma[i], psize[i]);
cv::Mat sqrError = ( currentResult - previousResult )
.mul( currentResult - previousResult );

@ -4,7 +4,8 @@ namespace cvtest
{
TEST(xphoto_simplecolorbalance, regression)
{
cv::String dir = cvtest::TS::ptr()->get_data_path() + "simple_white_balance/";
cv::String subfolder = "cv/xphoto/";
cv::String dir = cvtest::TS::ptr()->get_data_path() + subfolder + "simple_white_balance/";
int nTests = 12;
float threshold = 0.005f;
@ -12,12 +13,13 @@ namespace cvtest
{
cv::String srcName = dir + cv::format( "sources/%02d.png", i + 1);
cv::Mat src = cv::imread( srcName, 1 );
ASSERT_TRUE(!src.empty());
cv::String previousResultName = dir + cv::format( "results/%02d.png", i + 1 );
cv::Mat previousResult = cv::imread( previousResultName, 1 );
cv::Mat currentResult;
cv::balanceWhite(src, currentResult, cv::WHITE_BALANCE_SIMPLE);
cv::xphoto::balanceWhite(src, currentResult, cv::xphoto::WHITE_BALANCE_SIMPLE);
cv::Mat sqrError = ( currentResult - previousResult )
.mul( currentResult - previousResult );

@ -1,3 +1,3 @@
#include "test_precomp.hpp"
CV_TEST_MAIN("xphoto")
CV_TEST_MAIN("")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Loading…
Cancel
Save