Commit a5ba77a0 authored by Bellaktris's avatar Bellaktris

Merge branch 'gsoc' of https://github.com/Bellaktris/opencv_contrib into inpainting

parents 408559d6 cc2353f3
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
#include "test_precomp.hpp"
CV_TEST_MAIN("ximpgroc")
CV_TEST_MAIN("")
......@@ -5,10 +5,11 @@ 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;
cv::String modelName = dir + "model.yml.gz";
cv::Ptr<cv::ximgproc::StructuredEdgeDetection> pDollar =
cv::ximgproc::createStructuredEdgeDetection(modelName);
......@@ -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 );
......
......@@ -5,21 +5,18 @@ 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::
:ocv:func:`cvtColor`,
:ocv:func:`equalizeHist`
\ No newline at end of file
:ocv:func:`equalizeHist`
......@@ -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__
\ No newline at end of file
......@@ -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__
\ No newline at end of file
......@@ -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__
\ No newline at end of file
......@@ -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
}
}
}
\ No newline at end of file
......@@ -68,6 +68,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)
......@@ -119,7 +122,7 @@ namespace cv
switch ( algorithmType )
{
case INPAINT_SHIFTMAP:
case xphoto::INPAINT_SHIFTMAP:
shiftMapInpaint <Tp, cn>(src, mask, dst);
break;
default:
......@@ -234,3 +237,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 );
......
#include "test_precomp.hpp"
CV_TEST_MAIN("xphoto")
CV_TEST_MAIN("")
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