diff --git a/modules/features2d/3rdparty/mscr/chi_table.h b/modules/features2d/3rdparty/mscr/chi_table.h new file mode 100644 index 0000000000000000000000000000000000000000..c0e9bae046d28ae6e281e76842b7c59fa62de51b --- /dev/null +++ b/modules/features2d/3rdparty/mscr/chi_table.h @@ -0,0 +1,135 @@ +/* +** +** License Agreement +** For chi_table.h +** +** Copyright (C) 2007 Per-Erik Forssen, all rights reserved. +** +** 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. +** +** Content origin: http://users.isy.liu.se/cvl/perfo/software/chi_table.h +*/ +#define TABLE_SIZE 400 + +static double chitab3[]={0, 0.0150057, 0.0239478, 0.0315227, + 0.0383427, 0.0446605, 0.0506115, 0.0562786, + 0.0617174, 0.0669672, 0.0720573, 0.0770099, + 0.081843, 0.0865705, 0.0912043, 0.0957541, + 0.100228, 0.104633, 0.108976, 0.113261, + 0.117493, 0.121676, 0.125814, 0.12991, + 0.133967, 0.137987, 0.141974, 0.145929, + 0.149853, 0.15375, 0.15762, 0.161466, + 0.165287, 0.169087, 0.172866, 0.176625, + 0.180365, 0.184088, 0.187794, 0.191483, + 0.195158, 0.198819, 0.202466, 0.2061, + 0.209722, 0.213332, 0.216932, 0.220521, + 0.2241, 0.22767, 0.231231, 0.234783, + 0.238328, 0.241865, 0.245395, 0.248918, + 0.252435, 0.255947, 0.259452, 0.262952, + 0.266448, 0.269939, 0.273425, 0.276908, + 0.280386, 0.283862, 0.287334, 0.290803, + 0.29427, 0.297734, 0.301197, 0.304657, + 0.308115, 0.311573, 0.315028, 0.318483, + 0.321937, 0.32539, 0.328843, 0.332296, + 0.335749, 0.339201, 0.342654, 0.346108, + 0.349562, 0.353017, 0.356473, 0.35993, + 0.363389, 0.366849, 0.37031, 0.373774, + 0.377239, 0.380706, 0.384176, 0.387648, + 0.391123, 0.3946, 0.39808, 0.401563, + 0.405049, 0.408539, 0.412032, 0.415528, + 0.419028, 0.422531, 0.426039, 0.429551, + 0.433066, 0.436586, 0.440111, 0.44364, + 0.447173, 0.450712, 0.454255, 0.457803, + 0.461356, 0.464915, 0.468479, 0.472049, + 0.475624, 0.479205, 0.482792, 0.486384, + 0.489983, 0.493588, 0.4972, 0.500818, + 0.504442, 0.508073, 0.511711, 0.515356, + 0.519008, 0.522667, 0.526334, 0.530008, + 0.533689, 0.537378, 0.541075, 0.54478, + 0.548492, 0.552213, 0.555942, 0.55968, + 0.563425, 0.56718, 0.570943, 0.574715, + 0.578497, 0.582287, 0.586086, 0.589895, + 0.593713, 0.597541, 0.601379, 0.605227, + 0.609084, 0.612952, 0.61683, 0.620718, + 0.624617, 0.628526, 0.632447, 0.636378, + 0.64032, 0.644274, 0.648239, 0.652215, + 0.656203, 0.660203, 0.664215, 0.668238, + 0.672274, 0.676323, 0.680384, 0.684457, + 0.688543, 0.692643, 0.696755, 0.700881, + 0.70502, 0.709172, 0.713339, 0.717519, + 0.721714, 0.725922, 0.730145, 0.734383, + 0.738636, 0.742903, 0.747185, 0.751483, + 0.755796, 0.760125, 0.76447, 0.768831, + 0.773208, 0.777601, 0.782011, 0.786438, + 0.790882, 0.795343, 0.799821, 0.804318, + 0.808831, 0.813363, 0.817913, 0.822482, + 0.827069, 0.831676, 0.836301, 0.840946, + 0.84561, 0.850295, 0.854999, 0.859724, + 0.864469, 0.869235, 0.874022, 0.878831, + 0.883661, 0.888513, 0.893387, 0.898284, + 0.903204, 0.908146, 0.913112, 0.918101, + 0.923114, 0.928152, 0.933214, 0.938301, + 0.943413, 0.94855, 0.953713, 0.958903, + 0.964119, 0.969361, 0.974631, 0.979929, + 0.985254, 0.990608, 0.99599, 1.0014, + 1.00684, 1.01231, 1.01781, 1.02335, + 1.02891, 1.0345, 1.04013, 1.04579, + 1.05148, 1.05721, 1.06296, 1.06876, + 1.07459, 1.08045, 1.08635, 1.09228, + 1.09826, 1.10427, 1.11032, 1.1164, + 1.12253, 1.1287, 1.1349, 1.14115, + 1.14744, 1.15377, 1.16015, 1.16656, + 1.17303, 1.17954, 1.18609, 1.19269, + 1.19934, 1.20603, 1.21278, 1.21958, + 1.22642, 1.23332, 1.24027, 1.24727, + 1.25433, 1.26144, 1.26861, 1.27584, + 1.28312, 1.29047, 1.29787, 1.30534, + 1.31287, 1.32046, 1.32812, 1.33585, + 1.34364, 1.3515, 1.35943, 1.36744, + 1.37551, 1.38367, 1.39189, 1.4002, + 1.40859, 1.41705, 1.42561, 1.43424, + 1.44296, 1.45177, 1.46068, 1.46967, + 1.47876, 1.48795, 1.49723, 1.50662, + 1.51611, 1.52571, 1.53541, 1.54523, + 1.55517, 1.56522, 1.57539, 1.58568, + 1.59611, 1.60666, 1.61735, 1.62817, + 1.63914, 1.65025, 1.66152, 1.67293, + 1.68451, 1.69625, 1.70815, 1.72023, + 1.73249, 1.74494, 1.75757, 1.77041, + 1.78344, 1.79669, 1.81016, 1.82385, + 1.83777, 1.85194, 1.86635, 1.88103, + 1.89598, 1.91121, 1.92674, 1.94257, + 1.95871, 1.97519, 1.99201, 2.0092, + 2.02676, 2.04471, 2.06309, 2.08189, + 2.10115, 2.12089, 2.14114, 2.16192, + 2.18326, 2.2052, 2.22777, 2.25101, + 2.27496, 2.29966, 2.32518, 2.35156, + 2.37886, 2.40717, 2.43655, 2.46709, + 2.49889, 2.53206, 2.56673, 2.60305, + 2.64117, 2.6813, 2.72367, 2.76854, + 2.81623, 2.86714, 2.92173, 2.98059, + 3.04446, 3.1143, 3.19135, 3.27731, + 3.37455, 3.48653, 3.61862, 3.77982, + 3.98692, 4.2776, 4.77167, 133.333 }; diff --git a/modules/features2d/3rdparty/mscr/chi_table_LICENSE.txt b/modules/features2d/3rdparty/mscr/chi_table_LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..66b272dd2d09ba491f5bf82e581b3ad2a645d1f2 --- /dev/null +++ b/modules/features2d/3rdparty/mscr/chi_table_LICENSE.txt @@ -0,0 +1,28 @@ + License Agreement + For chi_table.h + +Copyright (C) 2007 Per-Erik Forssen, all rights reserved. + +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. diff --git a/modules/features2d/CMakeLists.txt b/modules/features2d/CMakeLists.txt index a586d4606e792d9e448320f5736d23b117e50168..91fea8bcc8d363d1945c1d47b000dbf2f775699f 100644 --- a/modules/features2d/CMakeLists.txt +++ b/modules/features2d/CMakeLists.txt @@ -7,3 +7,5 @@ if(DEBUG_opencv_features2d) list(APPEND debug_modules opencv_highgui) endif() ocv_define_module(features2d opencv_imgproc ${debug_modules} OPTIONAL opencv_flann WRAP java objc python js) + +ocv_install_3rdparty_licenses(mscr "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mscr/chi_table_LICENSE.txt") diff --git a/modules/features2d/src/mser.cpp b/modules/features2d/src/mser.cpp index d59ed39574161be2e5c6ce8742517b3f617967f1..5c8db481b1c301c8f670167b4d5b31c0ed876b90 100644 --- a/modules/features2d/src/mser.cpp +++ b/modules/features2d/src/mser.cpp @@ -30,18 +30,23 @@ * OpenCV functions for MSER extraction * * 1. there are two different implementation of MSER, one for gray image, one for color image - * 2. the gray image algorithm is taken from: Linear Time Maximally Stable Extremal Regions; + * 2. the gray image algorithm is taken from: + * Linear Time Maximally Stable Extremal Regions; * the paper claims to be faster than union-find method; * it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop. - * 3. the color image algorithm is taken from: Maximally Stable Colour Regions for Recognition and Match; + * 3. the color image algorithm is taken from: + * Maximally Stable Colour Regions for Recognition and Match; * it should be much slower than gray image method ( 3~4 times ); - * the chi_table.h file is taken directly from paper's source code which is distributed under permissive BSD-like license: http://users.isy.liu.se/cvl/perfo/software/chi_table.h + * the chi_table.h file is taken directly from the paper's source code: + * http://users.isy.liu.se/cvl/perfo/software/chi_table.h + * license (BSD-like) is located in the file: 3rdparty/mscr/chi_table_LICENSE.txt * 4. though the name is *contours*, the result actually is a list of point set. */ #include "precomp.hpp" #include "opencv2/imgproc/imgproc_c.h" #include +#include "../3rdparty/mscr/chi_table.h" namespace cv { @@ -613,113 +618,6 @@ the color MSER has not been completely refactored yet. We leave it mostly as-is, with just enough changes to convert C structures to C++ ones and add support for color images into MSER_Impl::detectAndLabel. */ - -const int TABLE_SIZE = 400; - -static const float chitab3[]= -{ - 0.f, 0.0150057f, 0.0239478f, 0.0315227f, - 0.0383427f, 0.0446605f, 0.0506115f, 0.0562786f, - 0.0617174f, 0.0669672f, 0.0720573f, 0.0770099f, - 0.081843f, 0.0865705f, 0.0912043f, 0.0957541f, - 0.100228f, 0.104633f, 0.108976f, 0.113261f, - 0.117493f, 0.121676f, 0.125814f, 0.12991f, - 0.133967f, 0.137987f, 0.141974f, 0.145929f, - 0.149853f, 0.15375f, 0.15762f, 0.161466f, - 0.165287f, 0.169087f, 0.172866f, 0.176625f, - 0.180365f, 0.184088f, 0.187794f, 0.191483f, - 0.195158f, 0.198819f, 0.202466f, 0.2061f, - 0.209722f, 0.213332f, 0.216932f, 0.220521f, - 0.2241f, 0.22767f, 0.231231f, 0.234783f, - 0.238328f, 0.241865f, 0.245395f, 0.248918f, - 0.252435f, 0.255947f, 0.259452f, 0.262952f, - 0.266448f, 0.269939f, 0.273425f, 0.276908f, - 0.280386f, 0.283862f, 0.287334f, 0.290803f, - 0.29427f, 0.297734f, 0.301197f, 0.304657f, - 0.308115f, 0.311573f, 0.315028f, 0.318483f, - 0.321937f, 0.32539f, 0.328843f, 0.332296f, - 0.335749f, 0.339201f, 0.342654f, 0.346108f, - 0.349562f, 0.353017f, 0.356473f, 0.35993f, - 0.363389f, 0.366849f, 0.37031f, 0.373774f, - 0.377239f, 0.380706f, 0.384176f, 0.387648f, - 0.391123f, 0.3946f, 0.39808f, 0.401563f, - 0.405049f, 0.408539f, 0.412032f, 0.415528f, - 0.419028f, 0.422531f, 0.426039f, 0.429551f, - 0.433066f, 0.436586f, 0.440111f, 0.44364f, - 0.447173f, 0.450712f, 0.454255f, 0.457803f, - 0.461356f, 0.464915f, 0.468479f, 0.472049f, - 0.475624f, 0.479205f, 0.482792f, 0.486384f, - 0.489983f, 0.493588f, 0.4972f, 0.500818f, - 0.504442f, 0.508073f, 0.511711f, 0.515356f, - 0.519008f, 0.522667f, 0.526334f, 0.530008f, - 0.533689f, 0.537378f, 0.541075f, 0.54478f, - 0.548492f, 0.552213f, 0.555942f, 0.55968f, - 0.563425f, 0.56718f, 0.570943f, 0.574715f, - 0.578497f, 0.582287f, 0.586086f, 0.589895f, - 0.593713f, 0.597541f, 0.601379f, 0.605227f, - 0.609084f, 0.612952f, 0.61683f, 0.620718f, - 0.624617f, 0.628526f, 0.632447f, 0.636378f, - 0.64032f, 0.644274f, 0.648239f, 0.652215f, - 0.656203f, 0.660203f, 0.664215f, 0.668238f, - 0.672274f, 0.676323f, 0.680384f, 0.684457f, - 0.688543f, 0.692643f, 0.696755f, 0.700881f, - 0.70502f, 0.709172f, 0.713339f, 0.717519f, - 0.721714f, 0.725922f, 0.730145f, 0.734383f, - 0.738636f, 0.742903f, 0.747185f, 0.751483f, - 0.755796f, 0.760125f, 0.76447f, 0.768831f, - 0.773208f, 0.777601f, 0.782011f, 0.786438f, - 0.790882f, 0.795343f, 0.799821f, 0.804318f, - 0.808831f, 0.813363f, 0.817913f, 0.822482f, - 0.827069f, 0.831676f, 0.836301f, 0.840946f, - 0.84561f, 0.850295f, 0.854999f, 0.859724f, - 0.864469f, 0.869235f, 0.874022f, 0.878831f, - 0.883661f, 0.888513f, 0.893387f, 0.898284f, - 0.903204f, 0.908146f, 0.913112f, 0.918101f, - 0.923114f, 0.928152f, 0.933214f, 0.938301f, - 0.943413f, 0.94855f, 0.953713f, 0.958903f, - 0.964119f, 0.969361f, 0.974631f, 0.979929f, - 0.985254f, 0.990608f, 0.99599f, 1.0014f, - 1.00684f, 1.01231f, 1.01781f, 1.02335f, - 1.02891f, 1.0345f, 1.04013f, 1.04579f, - 1.05148f, 1.05721f, 1.06296f, 1.06876f, - 1.07459f, 1.08045f, 1.08635f, 1.09228f, - 1.09826f, 1.10427f, 1.11032f, 1.1164f, - 1.12253f, 1.1287f, 1.1349f, 1.14115f, - 1.14744f, 1.15377f, 1.16015f, 1.16656f, - 1.17303f, 1.17954f, 1.18609f, 1.19269f, - 1.19934f, 1.20603f, 1.21278f, 1.21958f, - 1.22642f, 1.23332f, 1.24027f, 1.24727f, - 1.25433f, 1.26144f, 1.26861f, 1.27584f, - 1.28312f, 1.29047f, 1.29787f, 1.30534f, - 1.31287f, 1.32046f, 1.32812f, 1.33585f, - 1.34364f, 1.3515f, 1.35943f, 1.36744f, - 1.37551f, 1.38367f, 1.39189f, 1.4002f, - 1.40859f, 1.41705f, 1.42561f, 1.43424f, - 1.44296f, 1.45177f, 1.46068f, 1.46967f, - 1.47876f, 1.48795f, 1.49723f, 1.50662f, - 1.51611f, 1.52571f, 1.53541f, 1.54523f, - 1.55517f, 1.56522f, 1.57539f, 1.58568f, - 1.59611f, 1.60666f, 1.61735f, 1.62817f, - 1.63914f, 1.65025f, 1.66152f, 1.67293f, - 1.68451f, 1.69625f, 1.70815f, 1.72023f, - 1.73249f, 1.74494f, 1.75757f, 1.77041f, - 1.78344f, 1.79669f, 1.81016f, 1.82385f, - 1.83777f, 1.85194f, 1.86635f, 1.88103f, - 1.89598f, 1.91121f, 1.92674f, 1.94257f, - 1.95871f, 1.97519f, 1.99201f, 2.0092f, - 2.02676f, 2.04471f, 2.06309f, 2.08189f, - 2.10115f, 2.12089f, 2.14114f, 2.16192f, - 2.18326f, 2.2052f, 2.22777f, 2.25101f, - 2.27496f, 2.29966f, 2.32518f, 2.35156f, - 2.37886f, 2.40717f, 2.43655f, 2.46709f, - 2.49889f, 2.53206f, 2.56673f, 2.60305f, - 2.64117f, 2.6813f, 2.72367f, 2.76854f, - 2.81623f, 2.86714f, 2.92173f, 2.98059f, - 3.04446f, 3.1143f, 3.19135f, 3.27731f, - 3.37455f, 3.48653f, 3.61862f, 3.77982f, - 3.98692f, 4.2776f, 4.77167f, 133.333f -}; - struct MSCRNode; struct TempMSCR