Blank module and first draft of solver API.
authorAlex Leontiev <alozz1991@gmail.com>
Thu, 20 Jun 2013 11:54:09 +0000 (14:54 +0300)
committerAlex Leontiev <alozz1991@gmail.com>
Thu, 20 Jun 2013 11:54:09 +0000 (14:54 +0300)
At this point we have a skeleton of a new module (optim) which can
barely compile properly (unlike previous commit). Besides, there is a
first draft of solver and lpsolver (linear optimization solver) in this
commit.

18 files changed:
modules/optim/CMakeLists.txt
modules/optim/doc/denoising.rst [deleted file]
modules/optim/doc/inpainting.rst [deleted file]
modules/optim/doc/photo.rst [deleted file]
modules/optim/include/opencv2/optim.hpp [moved from modules/optim/include/opencv2/photo.hpp with 59% similarity]
modules/optim/include/opencv2/optim/optim.hpp [moved from modules/optim/include/opencv2/photo/photo.hpp with 98% similarity]
modules/optim/perf/perf_inpaint.cpp [deleted file]
modules/optim/perf/perf_main.cpp [deleted file]
modules/optim/perf/perf_precomp.cpp [deleted file]
modules/optim/perf/perf_precomp.hpp [deleted file]
modules/optim/src/lpsolver.cpp
modules/optim/src/precomp.cpp [new file with mode: 0644]
modules/optim/src/precomp.hpp [moved from modules/optim/include/opencv2/photo/photo_c.h with 77% similarity]
modules/optim/test/test_denoising.cpp [deleted file]
modules/optim/test/test_inpaint.cpp [deleted file]
modules/optim/test/test_main.cpp [deleted file]
modules/optim/test/test_precomp.cpp [deleted file]
modules/optim/test/test_precomp.hpp [deleted file]

index b5de99d..a73df32 100644 (file)
@@ -1,2 +1,3 @@
 set(the_description "Generic optimization")
-ocv_define_module(optim)
+ocv_define_module(optim opencv_imgproc)
+#ocv_define_module(optim core)
diff --git a/modules/optim/doc/denoising.rst b/modules/optim/doc/denoising.rst
deleted file mode 100644 (file)
index 97625d3..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-Denoising
-==========
-
-.. highlight:: cpp
-
-fastNlMeansDenoising
---------------------
-Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/
-with several computational optimizations. Noise expected to be a gaussian white noise
-
-.. ocv:function:: void fastNlMeansDenoising( InputArray src, OutputArray dst, float h=3, int templateWindowSize=7, int searchWindowSize=21 )
-
-    :param src: Input 8-bit 1-channel, 2-channel or 3-channel image.
-
-    :param dst: Output image with the same size and type as  ``src`` .
-
-    :param templateWindowSize: Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
-
-    :param searchWindowSize: Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels
-
-    :param h: Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise
-
-This function expected to be applied to grayscale images. For colored images look at ``fastNlMeansDenoisingColored``.
-Advanced usage of this functions can be manual denoising of colored image in different colorspaces.
-Such approach is used in ``fastNlMeansDenoisingColored`` by converting image to CIELAB colorspace and then separately denoise L and AB components with different h parameter.
-
-fastNlMeansDenoisingColored
----------------------------
-Modification of ``fastNlMeansDenoising`` function for colored images
-
-.. ocv:function:: void fastNlMeansDenoisingColored( InputArray src, OutputArray dst, float h=3, float hColor=3, int templateWindowSize=7, int searchWindowSize=21 )
-
-    :param src: Input 8-bit 3-channel image.
-
-    :param dst: Output image with the same size and type as  ``src`` .
-
-    :param templateWindowSize: Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
-
-    :param searchWindowSize: Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels
-
-    :param h: Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise
-
-    :param hForColorComponents: The same as h but for color components. For most images value equals 10 will be enought to remove colored noise and do not distort colors
-
-The function converts image to CIELAB colorspace and then separately denoise L and AB components with given h parameters using ``fastNlMeansDenoising`` function.
-
-fastNlMeansDenoisingMulti
--------------------------
-Modification of ``fastNlMeansDenoising`` function for images sequence where consequtive images have been captured in small period of time. For example video. This version of the function is for grayscale images or for manual manipulation with colorspaces.
-For more details see http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394
-
-.. ocv:function:: void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, float h=3, int templateWindowSize=7, int searchWindowSize=21 )
-
-    :param srcImgs: Input 8-bit 1-channel, 2-channel or 3-channel images sequence. All images should have the same type and size.
-
-    :param imgToDenoiseIndex: Target image to denoise index in ``srcImgs`` sequence
-
-    :param temporalWindowSize: Number of surrounding images to use for target image denoising. Should be odd. Images from ``imgToDenoiseIndex - temporalWindowSize / 2`` to ``imgToDenoiseIndex - temporalWindowSize / 2`` from ``srcImgs`` will be used to denoise ``srcImgs[imgToDenoiseIndex]`` image.
-
-    :param dst: Output image with the same size and type as ``srcImgs`` images.
-
-    :param templateWindowSize: Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
-
-    :param searchWindowSize: Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels
-
-    :param h: Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise
-
-fastNlMeansDenoisingColoredMulti
---------------------------------
-Modification of ``fastNlMeansDenoisingMulti`` function for colored images sequences
-
-.. ocv:function:: void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst, int imgToDenoiseIndex, int temporalWindowSize, float h=3, float hColor=3, int templateWindowSize=7, int searchWindowSize=21 )
-
-    :param srcImgs: Input 8-bit 3-channel images sequence. All images should have the same type and size.
-
-    :param imgToDenoiseIndex: Target image to denoise index in ``srcImgs`` sequence
-
-    :param temporalWindowSize: Number of surrounding images to use for target image denoising. Should be odd. Images from ``imgToDenoiseIndex - temporalWindowSize / 2`` to ``imgToDenoiseIndex - temporalWindowSize / 2`` from ``srcImgs`` will be used to denoise ``srcImgs[imgToDenoiseIndex]`` image.
-
-    :param dst: Output image with the same size and type as ``srcImgs`` images.
-
-    :param templateWindowSize: Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels
-
-    :param searchWindowSize: Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels
-
-    :param h: Parameter regulating filter strength for luminance component. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
-
-    :param hForColorComponents: The same as h but for color components.
-
-The function converts images to CIELAB colorspace and then separately denoise L and AB components with given h parameters using ``fastNlMeansDenoisingMulti`` function.
-
diff --git a/modules/optim/doc/inpainting.rst b/modules/optim/doc/inpainting.rst
deleted file mode 100644 (file)
index 9b66266..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Inpainting
-==========
-
-.. highlight:: cpp
-
-inpaint
------------
-Restores the selected region in an image using the region neighborhood.
-
-.. ocv:function:: void inpaint( InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags )
-
-.. ocv:pyfunction:: cv2.inpaint(src, inpaintMask, inpaintRadius, flags[, dst]) -> dst
-
-.. ocv:cfunction:: void cvInpaint( const CvArr* src, const CvArr* inpaint_mask, CvArr* dst, double inpaintRange, int flags )
-
-    :param src: Input 8-bit 1-channel or 3-channel image.
-
-    :param inpaintMask: Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted.
-
-    :param dst: Output image with the same size and type as  ``src`` .
-
-    :param inpaintRadius: Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.
-
-    :param flags: Inpainting method that could be one of the following:
-
-            * **INPAINT_NS**     Navier-Stokes based method.
-
-            * **INPAINT_TELEA**     Method by Alexandru Telea  [Telea04]_.
-
-The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images or video. See
-http://en.wikipedia.org/wiki/Inpainting
-for more details.
diff --git a/modules/optim/doc/photo.rst b/modules/optim/doc/photo.rst
deleted file mode 100644 (file)
index fa2aa1e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-********************************
-photo. Computational Photography
-********************************
-
-.. highlight:: cpp
-
-.. toctree::
-    :maxdepth: 2
-
-    inpainting
-    denoising
similarity index 59%
rename from modules/optim/include/opencv2/photo.hpp
rename to modules/optim/include/opencv2/optim.hpp
index 185b8dc..44b01ef 100644 (file)
 //
 //M*/
 
-#ifndef __OPENCV_PHOTO_HPP__
-#define __OPENCV_PHOTO_HPP__
+#ifndef __OPENCV_OPTIM_HPP__
+#define __OPENCV_OPTIM_HPP__
 
 #include "opencv2/core.hpp"
-#include "opencv2/imgproc.hpp"
+#include "opencv2/core/mat.hpp"
 
 /*! \namespace cv
  Namespace where all the C++ OpenCV functionality resides
 namespace cv
 {
 
-//! the inpainting algorithm
-enum
+/* //! restores the damaged image areas using one of the available intpainting algorithms */
+class Solver : public Algorithm /* Algorithm is the base OpenCV class */
 {
-    INPAINT_NS    = 0, // Navier-Stokes algorithm
-    INPAINT_TELEA = 1 // A. Telea algorithm
-};
-
-//! restores the damaged image areas using one of the available intpainting algorithms
-CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
-                           OutputArray dst, double inpaintRadius, int flags );
+  class Function
+  {
+  public:
+        virtual ~Function();
+        virtual double calc(InputArray args) const = 0;
+        //virtual double calc(InputArray args, OutputArray grad) const = 0;
+  };
 
+  // could be reused for all the generic algorithms like downhill simplex.
+  virtual void solve(InputArray x0, OutputArray result) const = 0;
 
-CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3,
-                                        int templateWindowSize = 7, int searchWindowSize = 21);
+  virtual void setTermCriteria(const TermCriteria& criteria) = 0;
+  virtual TermCriteria getTermCriteria() = 0;
 
-CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst,
-                                               float h = 3, float hColor = 3,
-                                               int templateWindowSize = 7, int searchWindowSize = 21);
+  // more detailed API to be defined later ...
 
-CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
-                                             int imgToDenoiseIndex, int temporalWindowSize,
-                                             float h = 3, int templateWindowSize = 7, int searchWindowSize = 21);
+};
 
-CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst,
-                                                    int imgToDenoiseIndex, int temporalWindowSize,
-                                                    float h = 3, float hColor = 3,
-                                                    int templateWindowSize = 7, int searchWindowSize = 21);
+class LPSolver : public Solver
+{
+public:
+     virtual void solve(InputArray coeffs, InputArray constraints, OutputArray result) const = 0;
+     // ...
+};
 
-} // cv
+Ptr<LPSolver> createLPSimplexSolver();
+}// cv
 
 #endif
@@ -45,4 +45,4 @@
 #error this is a compatibility header which should not be used inside the OpenCV library
 #endif
 
-#include "opencv2/photo.hpp"
\ No newline at end of file
+#include "opencv2/optim.hpp"
diff --git a/modules/optim/perf/perf_inpaint.cpp b/modules/optim/perf/perf_inpaint.cpp
deleted file mode 100644 (file)
index 2debcf5..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "perf_precomp.hpp"
-
-using namespace std;
-using namespace cv;
-using namespace perf;
-using std::tr1::make_tuple;
-using std::tr1::get;
-
-CV_ENUM(InpaintingMethod, INPAINT_NS, INPAINT_TELEA)
-typedef std::tr1::tuple<Size, InpaintingMethod> InpaintArea_InpaintingMethod_t;
-typedef perf::TestBaseWithParam<InpaintArea_InpaintingMethod_t> InpaintArea_InpaintingMethod;
-
-
-PERF_TEST_P(InpaintArea_InpaintingMethod, inpaint,
-            testing::Combine(
-                testing::Values(::perf::szSmall24, ::perf::szSmall32, ::perf::szSmall64),
-                InpaintingMethod::all()
-                )
-            )
-{
-    Mat src = imread(getDataPath("gpu/hog/road.png"));
-
-    Size sz = get<0>(GetParam());
-    int inpaintingMethod = get<1>(GetParam());
-
-    Mat mask(src.size(), CV_8UC1, Scalar(0));
-    Mat result(src.size(), src.type());
-
-    Rect inpaintArea(src.cols/3, src.rows/3, sz.width, sz.height);
-    mask(inpaintArea).setTo(255);
-
-    declare.in(src, mask).out(result).time(120);
-
-    TEST_CYCLE() inpaint(src, mask, result, 10.0, inpaintingMethod);
-
-    Mat inpaintedArea = result(inpaintArea);
-    SANITY_CHECK(inpaintedArea);
-}
diff --git a/modules/optim/perf/perf_main.cpp b/modules/optim/perf/perf_main.cpp
deleted file mode 100644 (file)
index f5863c1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "perf_precomp.hpp"
-
-CV_PERF_TEST_MAIN(photo)
diff --git a/modules/optim/perf/perf_precomp.cpp b/modules/optim/perf/perf_precomp.cpp
deleted file mode 100644 (file)
index 8552ac3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "perf_precomp.hpp"
diff --git a/modules/optim/perf/perf_precomp.hpp b/modules/optim/perf/perf_precomp.hpp
deleted file mode 100644 (file)
index 1fd0c81..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifdef __GNUC__
-#  pragma GCC diagnostic ignored "-Wmissing-declarations"
-#  if defined __clang__ || defined __APPLE__
-#    pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#    pragma GCC diagnostic ignored "-Wextra"
-#  endif
-#endif
-
-#ifndef __OPENCV_PERF_PRECOMP_HPP__
-#define __OPENCV_PERF_PRECOMP_HPP__
-
-#include "opencv2/ts.hpp"
-#include "opencv2/photo.hpp"
-#include "opencv2/highgui.hpp"
-
-#ifdef GTEST_CREATE_SHARED_LIBRARY
-#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
-#endif
-
-#endif
index 7fb62e0..5559a06 100644 (file)
@@ -1,45 +1,2 @@
-#include "opencv2/opencv.hpp"
-
-namespace cv {
-               namespace optim {
-
-class Solver : public Algorithm /* Algorithm is base OpenCV class */
-{
-      class Function
-      {
-      public:
-            virtual ~Function() {}
-            virtual double calc(InputArray args) const = 0;
-            virtual double calc(InputArgs, OutputArray grad) const = 0;
-      };
-
-      // could be reused for all the generic algorithms like downhill simplex.
-      virtual void solve(InputArray x0, OutputArray result) const = 0;
-
-      virtual void setTermCriteria(const TermCriteria& criteria) = 0;
-      virtual TermCriteria getTermCriteria() = 0;
-
-      // more detailed API to be defined later ...
-};
-
-class LPSolver : public Solver
-{
-public:
-     virtual void solve(InputArray coeffs, InputArray constraints, OutputArray result) const = 0;
-     // ...
-};
-
-Ptr<LPSolver> createLPSimplexSolver();
-
-}}
-
-/*===============
-Hill climbing solver is more generic one:*/
-/*
-class DownhillSolver : public Solver
-{
-public:
-      // various setters and getters, if needed
-};
-
-Ptr<DownhillSolver> createDownhillSolver(const Ptr<Solver::Function>& func);*/
+#include "precomp.hpp"
+#include "opencv2/optim.hpp"
diff --git a/modules/optim/src/precomp.cpp b/modules/optim/src/precomp.cpp
new file mode 100644 (file)
index 0000000..3e0ec42
--- /dev/null
@@ -0,0 +1,44 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+//   * Redistribution's of source code must retain the above copyright notice,
+//     this list of conditions and the following disclaimer.
+//
+//   * Redistribution's in binary form must reproduce the above copyright notice,
+//     this list of conditions and the following disclaimer in the documentation
+//     and/or other materials provided with the distribution.
+//
+//   * The name of Intel Corporation may not be used to endorse or promote products
+//     derived from this software without specific prior written permission.
+//
+// This software is provided by the copyright holders and contributors "as is" and
+// any express or implied warranties, including, but not limited to, the implied
+// warranties of merchantability and fitness for a particular purpose are disclaimed.
+// In no event shall the Intel Corporation or contributors be liable for any direct,
+// indirect, incidental, special, exemplary, or consequential damages
+// (including, but not limited to, procurement of substitute goods or services;
+// loss of use, data, or profits; or business interruption) however caused
+// and on any theory of liability, whether in contract, strict liability,
+// or tort (including negligence or otherwise) arising in any way out of
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#include "precomp.hpp"
+
+/* End of file. */
similarity index 77%
rename from modules/optim/include/opencv2/photo/photo_c.h
rename to modules/optim/src/precomp.hpp
index 4ca05f2..7aab572 100644 (file)
@@ -7,11 +7,11 @@
 //  copy or use the software.
 //
 //
-//                           License Agreement
+//                          License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
 // Third party copyrights are property of their respective owners.
 //
 // Redistribution and use in source and binary forms, with or without modification,
 //
 //M*/
 
-#ifndef __OPENCV_PHOTO_C_H__
-#define __OPENCV_PHOTO_C_H__
+#ifndef __OPENCV_PRECOMP_H__
+#define __OPENCV_PRECOMP_H__
 
-#include "opencv2/core/core_c.h"
+#include "opencv2/optim.hpp"
 
-#ifdef __cplusplus
-extern "C" {
 #endif
-
-/* Inpainting algorithms */
-enum
-{
-    CV_INPAINT_NS      =0,
-    CV_INPAINT_TELEA   =1
-};
-
-
-/* Inpaints the selected region in the image */
-CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask,
-                       CvArr* dst, double inpaintRange, int flags );
-
-
-#ifdef __cplusplus
-} //extern "C"
-#endif
-
-#endif //__OPENCV_PHOTO_C_H__
diff --git a/modules/optim/test/test_denoising.cpp b/modules/optim/test/test_denoising.cpp
deleted file mode 100644 (file)
index ca4f63f..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*M///////////////////////////////////////////////////////////////////////////////////////
-//
-//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-//
-//  By downloading, copying, installing or using the software you agree to this license.
-//  If you do not agree to this license, do not download, install,
-//  copy or use the software.
-//
-//
-//                           License Agreement
-//                For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
-// Third party copyrights are property of their respective owners.
-//
-// Redistribution and use in source and binary forms, with or without modification,
-// are permitted provided that the following conditions are met:
-//
-//   * Redistribution's of source code must retain the above copyright notice,
-//     this list of conditions and the following disclaimer.
-//
-//   * Redistribution's in binary form must reproduce the above copyright notice,
-//     this list of conditions and the following disclaimer in the documentation
-//     and/or other materials provided with the distribution.
-//
-//   * The name of the copyright holders may not be used to endorse or promote products
-//     derived from this software without specific prior written permission.
-//
-// This software is provided by the copyright holders and contributors "as is" and
-// any express or implied warranties, including, but not limited to, the implied
-// warranties of merchantability and fitness for a particular purpose are disclaimed.
-// In no event shall the Intel Corporation or contributors be liable for any direct,
-// indirect, incidental, special, exemplary, or consequential damages
-// (including, but not limited to, procurement of substitute goods or services;
-// loss of use, data, or profits; or business interruption) however caused
-// and on any theory of liability, whether in contract, strict liability,
-// or tort (including negligence or otherwise) arising in any way out of
-// the use of this software, even if advised of the possibility of such damage.
-//
-//M*/
-
-#include "test_precomp.hpp"
-#include "opencv2/photo.hpp"
-#include <string>
-
-using namespace cv;
-using namespace std;
-
-//#define DUMP_RESULTS
-
-#ifdef DUMP_RESULTS
-#  define DUMP(image, path) imwrite(path, image)
-#else
-#  define DUMP(image, path)
-#endif
-
-
-TEST(Photo_DenoisingGrayscale, regression)
-{
-    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
-    string original_path = folder + "lena_noised_gaussian_sigma=10.png";
-    string expected_path = folder + "lena_noised_denoised_grayscale_tw=7_sw=21_h=10.png";
-
-    Mat original = imread(original_path, IMREAD_GRAYSCALE);
-    Mat expected = imread(expected_path, IMREAD_GRAYSCALE);
-
-    ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
-    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
-
-    Mat result;
-    fastNlMeansDenoising(original, result, 10);
-
-    DUMP(result, expected_path + ".res.png");
-
-    ASSERT_EQ(0, norm(result != expected));
-}
-
-TEST(Photo_DenoisingColored, regression)
-{
-    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
-    string original_path = folder + "lena_noised_gaussian_sigma=10.png";
-    string expected_path = folder + "lena_noised_denoised_lab12_tw=7_sw=21_h=10_h2=10.png";
-
-    Mat original = imread(original_path, IMREAD_COLOR);
-    Mat expected = imread(expected_path, IMREAD_COLOR);
-
-    ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
-    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
-
-    Mat result;
-    fastNlMeansDenoisingColored(original, result, 10, 10);
-
-    DUMP(result, expected_path + ".res.png");
-
-    ASSERT_EQ(0, norm(result != expected));
-}
-
-TEST(Photo_DenoisingGrayscaleMulti, regression)
-{
-    const int imgs_count = 3;
-    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
-
-    string expected_path = folder + "lena_noised_denoised_multi_tw=7_sw=21_h=15.png";
-    Mat expected = imread(expected_path, IMREAD_GRAYSCALE);
-    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
-
-    vector<Mat> original(imgs_count);
-    for (int i = 0; i < imgs_count; i++)
-    {
-        string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
-        original[i] = imread(original_path, IMREAD_GRAYSCALE);
-        ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
-    }
-
-    Mat result;
-    fastNlMeansDenoisingMulti(original, result, imgs_count / 2, imgs_count, 15);
-
-    DUMP(result, expected_path + ".res.png");
-
-    ASSERT_EQ(0, norm(result != expected));
-}
-
-TEST(Photo_DenoisingColoredMulti, regression)
-{
-    const int imgs_count = 3;
-    string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
-
-    string expected_path = folder + "lena_noised_denoised_multi_lab12_tw=7_sw=21_h=10_h2=15.png";
-    Mat expected = imread(expected_path, IMREAD_COLOR);
-    ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
-
-    vector<Mat> original(imgs_count);
-    for (int i = 0; i < imgs_count; i++)
-    {
-        string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
-        original[i] = imread(original_path, IMREAD_COLOR);
-        ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
-    }
-
-    Mat result;
-    fastNlMeansDenoisingColoredMulti(original, result, imgs_count / 2, imgs_count, 10, 15);
-
-    DUMP(result, expected_path + ".res.png");
-
-    ASSERT_EQ(0, norm(result != expected));
-}
-
-TEST(Photo_White, issue_2646)
-{
-    cv::Mat img(50, 50, CV_8UC1, cv::Scalar::all(255));
-    cv::Mat filtered;
-    cv::fastNlMeansDenoising(img, filtered);
-
-    int nonWhitePixelsCount = (int)img.total() - cv::countNonZero(filtered == img);
-
-    ASSERT_EQ(0, nonWhitePixelsCount);
-}
diff --git a/modules/optim/test/test_inpaint.cpp b/modules/optim/test/test_inpaint.cpp
deleted file mode 100644 (file)
index 3c341b2..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*M///////////////////////////////////////////////////////////////////////////////////////
-//
-//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-//
-//  By downloading, copying, installing or using the software you agree to this license.
-//  If you do not agree to this license, do not download, install,
-//  copy or use the software.
-//
-//
-//                           License Agreement
-//                For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
-// Third party copyrights are property of their respective owners.
-//
-// Redistribution and use in source and binary forms, with or without modification,
-// are permitted provided that the following conditions are met:
-//
-//   * Redistribution's of source code must retain the above copyright notice,
-//     this list of conditions and the following disclaimer.
-//
-//   * Redistribution's in binary form must reproduce the above copyright notice,
-//     this list of conditions and the following disclaimer in the documentation
-//     and/or other materials provided with the distribution.
-//
-//   * The name of the copyright holders may not be used to endorse or promote products
-//     derived from this software without specific prior written permission.
-//
-// This software is provided by the copyright holders and contributors "as is" and
-// any express or implied warranties, including, but not limited to, the implied
-// warranties of merchantability and fitness for a particular purpose are disclaimed.
-// In no event shall the Intel Corporation or contributors be liable for any direct,
-// indirect, incidental, special, exemplary, or consequential damages
-// (including, but not limited to, procurement of substitute goods or services;
-// loss of use, data, or profits; or business interruption) however caused
-// and on any theory of liability, whether in contract, strict liability,
-// or tort (including negligence or otherwise) arising in any way out of
-// the use of this software, even if advised of the possibility of such damage.
-//
-//M*/
-
-#include "test_precomp.hpp"
-#include <string>
-
-using namespace std;
-using namespace cv;
-
-class CV_InpaintTest : public cvtest::BaseTest
-{
-public:
-    CV_InpaintTest();
-    ~CV_InpaintTest();
-protected:
-    void run(int);
-};
-
-CV_InpaintTest::CV_InpaintTest()
-{
-}
-CV_InpaintTest::~CV_InpaintTest() {}
-
-void CV_InpaintTest::run( int )
-{
-    string folder = string(ts->get_data_path()) + "inpaint/";
-    Mat orig = imread(folder + "orig.png");
-    Mat exp1 = imread(folder + "exp1.png");
-    Mat exp2 = imread(folder + "exp2.png");
-    Mat mask = imread(folder + "mask.png");
-
-    if (orig.empty() || exp1.empty() || exp2.empty() || mask.empty())
-    {
-        ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
-        return;
-    }
-
-    Mat inv_mask;
-    mask.convertTo(inv_mask, CV_8UC3, -1.0, 255.0);
-
-    Mat mask1ch;
-    cv::cvtColor(mask, mask1ch, COLOR_BGR2GRAY);
-
-    Mat test = orig.clone();
-    test.setTo(Scalar::all(255), mask1ch);
-
-    Mat res1, res2;
-    inpaint( test, mask1ch, res1, 5, INPAINT_NS );
-    inpaint( test, mask1ch, res2, 5, INPAINT_TELEA );
-
-    Mat diff1, diff2;
-    absdiff( orig, res1, diff1 );
-    absdiff( orig, res2, diff2 );
-
-    double n1 = norm(diff1.reshape(1), NORM_INF, inv_mask.reshape(1));
-    double n2 = norm(diff2.reshape(1), NORM_INF, inv_mask.reshape(1));
-
-    if (n1 != 0 || n2 != 0)
-    {
-        ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
-        return;
-    }
-
-    absdiff( exp1, res1, diff1 );
-    absdiff( exp2, res2, diff2 );
-
-    n1 = norm(diff1.reshape(1), NORM_INF, mask.reshape(1));
-    n2 = norm(diff2.reshape(1), NORM_INF, mask.reshape(1));
-
-    const int jpeg_thres = 3;
-    if (n1 > jpeg_thres || n2 > jpeg_thres)
-    {
-        ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
-        return;
-    }
-
-    ts->set_failed_test_info(cvtest::TS::OK);
-}
-
-TEST(Photo_Inpaint, regression) { CV_InpaintTest test; test.safe_run(); }
diff --git a/modules/optim/test/test_main.cpp b/modules/optim/test/test_main.cpp
deleted file mode 100644 (file)
index 6b24993..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "test_precomp.hpp"
-
-CV_TEST_MAIN("cv")
diff --git a/modules/optim/test/test_precomp.cpp b/modules/optim/test/test_precomp.cpp
deleted file mode 100644 (file)
index 5956e13..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "test_precomp.hpp"
diff --git a/modules/optim/test/test_precomp.hpp b/modules/optim/test/test_precomp.hpp
deleted file mode 100644 (file)
index 5b22a1c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifdef __GNUC__
-#  pragma GCC diagnostic ignored "-Wmissing-declarations"
-#  if defined __clang__ || defined __APPLE__
-#    pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#    pragma GCC diagnostic ignored "-Wextra"
-#  endif
-#endif
-
-#ifndef __OPENCV_TEST_PRECOMP_HPP__
-#define __OPENCV_TEST_PRECOMP_HPP__
-
-#include <iostream>
-#include "opencv2/ts.hpp"
-#include "opencv2/photo.hpp"
-#include "opencv2/highgui.hpp"
-
-#endif