Commit 25c48887 authored by Pavel Vlasanek's avatar Pavel Vlasanek Committed by Pavel Vlasanek

F1-transform added and F0 minor fixes.

Documentation added.

Linux build fix.

Doc update.

Doc update.

Code review related fixes.

Whitespace fix.
parent 941a33ae
......@@ -20,3 +20,13 @@
doi = {10.1016/j.knosys.2014.04.007},
publisher={Elsevier}
}
@article{Vlas:FT,
title={The F-transform in Terms of Image Processing Tools},
author={Vla{\v{s}}{\'a}nek, Pavel and Perfilieva, Irina},
journal={Journal of Fuzzy Set Valued Analysis},
volume={2016},
number={1},
pages={54--62},
year={2016}
}
......@@ -44,6 +44,7 @@
#include "opencv2/fuzzy/types.hpp"
#include "opencv2/fuzzy/fuzzy_F0_math.hpp"
#include "opencv2/fuzzy/fuzzy_F1_math.hpp"
#include "opencv2/fuzzy/fuzzy_image.hpp"
/**
......@@ -52,13 +53,17 @@
Namespace for all functions is **ft**. The module brings implementation of the last image processing algorithms based on fuzzy mathematics.
@{
@defgroup f0_math Math with F0-transfrom support
@defgroup f0_math Math with F0-transform support
Fuzzy transform (F-transform) of the 0th degree transform whole image to a vector of its components. These components are used in latter computation.
Fuzzy transform (F0-transform) of the 0th degree transforms whole image to a matrix of its components. These components are used in latter computation where each of them represents average color of certain subarea.
@defgroup f1_math Math with F1-transform support
Fuzzy transform (F1-transform) of the 1th degree transforms whole image to a matrix of its components. Each component is polynomial of the 1th degree carrying information about average color and average gradient of certain subarea.
@defgroup f_image Fuzzy image processing
Image proceesing based on F-transform is fast to process and easy to understand.
Image proceesing based on fuzzy mathematics namely F-transform.
@}
*/
......
......@@ -56,7 +56,7 @@ namespace ft
/** @brief Computes components of the array using direct F0-transform.
@param matrix Input array.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param components Output 32-bit array for the components.
@param components Output 32-bit float array for the components.
@param mask Mask can be used for unwanted area marking.
The function computes components using predefined kernel and mask.
......@@ -64,24 +64,12 @@ namespace ft
@note
F-transform technique is described in paper @cite Perf:FT.
*/
CV_EXPORTS_AS(FT02D_components1) void FT02D_components(InputArray matrix, InputArray kernel, OutputArray components, InputArray mask);
/** @brief Computes components of the array using direct F0-transform.
@param matrix Input array.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param components Output 32-bit array for the components.
The function computes components using predefined kernel.
@note
F-transform technique is described in paper @cite Perf:FT.
*/
CV_EXPORTS_W void FT02D_components(InputArray matrix, InputArray kernel, OutputArray components);
CV_EXPORTS_W void FT02D_components(InputArray matrix, InputArray kernel, OutputArray components, InputArray mask = noArray());
/** @brief Computes inverse F0-transfrom.
@param components Input 32-bit single channel array for the components.
@param components Input 32-bit float single channel array for the components.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param output Output 32-bit array.
@param output Output 32-bit float array.
@param width Width of the output array.
@param height Height of the output array.
......@@ -93,26 +81,17 @@ namespace ft
/** @brief Computes F0-transfrom and inverse F0-transfrom at once.
@param matrix Input matrix.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param output Output 32-bit array.
@param output Output 32-bit float array.
@param mask Mask used for unwanted area marking.
This function computes F-transfrom and inverse F-transfotm in one step. It is fully sufficient and optimized for **Mat**.
*/
CV_EXPORTS_AS(FT02D_process1) void FT02D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask);
/** @brief Computes F0-transfrom and inverse F0-transfrom at once.
@param matrix Input matrix.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param output Output 32-bit array.
This function computes F-transfrom and inverse F-transfotm in one step. It is fully sufficient and optimized for **Mat**.
*/
CV_EXPORTS_W void FT02D_process(InputArray matrix, InputArray kernel, OutputArray output);
CV_EXPORTS_W void FT02D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask = noArray());
/** @brief Computes F0-transfrom and inverse F0-transfrom at once and return state.
@param matrix Input matrix.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param output Output 32-bit array.
@param output Output 32-bit float array.
@param mask Mask used for unwanted area marking.
@param maskOutput Mask after one iteration.
@param firstStop If **true** function returns -1 when first problem appears. In case of **false**, the process is completed and summation of all problems returned.
......
/*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) 2015, University of Ostrava, Institute for Research and Applications of Fuzzy Modeling,
// Pavel Vlasanek, 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*/
#ifndef __OPENCV_FUZZY_F1_MATH_H__
#define __OPENCV_FUZZY_F1_MATH_H__
#include "opencv2/fuzzy/types.hpp"
#include "opencv2/core.hpp"
namespace cv
{
namespace ft
{
//! @addtogroup f1_math
//! @{
/** @brief Computes components of the array using direct F1-transform.
@param matrix Input array.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param components Output 32-bit float array for the components.
The function computes linear components using predefined kernel.
@note
F-transform technique of first degreee is described in paper @cite Vlas:FT.
*/
CV_EXPORTS_W void FT12D_components(InputArray matrix, InputArray kernel, OutputArray components);
/** @brief Computes elements of F1-transform components.
@param matrix Input array.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param c00 Elements represent average color.
@param c10 Elements represent average vertical gradient.
@param c01 Elements represent average horizontal gradient.
@param components Output 32-bit float array for the components.
@param mask Mask can be used for unwanted area marking.
The function computes components and its elements using predefined kernel and mask.
@note
F-transform technique of first degreee is described in paper @cite Vlas:FT.
*/
CV_EXPORTS_W void FT12D_polynomial(InputArray matrix, InputArray kernel, OutputArray c00, OutputArray c10, OutputArray c01, OutputArray components, InputArray mask = noArray());
/** @brief Creates vertical matrix for F1-transform computation.
@param radius Radius of the basic function.
@param matrix The vertical matrix.
@param chn Number of channels.
The function creates helper vertical matrix for F1-transfrom processing. It is used for gradient computation.
*/
CV_EXPORTS_W void FT12D_createPolynomMatrixVertical(int radius, OutputArray matrix, const int chn);
/** @brief Creates horizontal matrix for F1-transform computation.
@param radius Radius of the basic function.
@param matrix The horizontal matrix.
@param chn Number of channels.
The function creates helper horizontal matrix for F1-transfrom processing. It is used for gradient computation.
*/
CV_EXPORTS_W void FT12D_createPolynomMatrixHorizontal(int radius, OutputArray matrix, const int chn);
/** @brief Computes F1-transfrom and inverse F1-transfrom at once.
@param matrix Input matrix.
@param kernel Kernel used for processing. Function **createKernel** can be used.
@param output Output 32-bit float array.
@param mask Mask used for unwanted area marking.
This function computes F1-transfrom and inverse F1-transfotm in one step. It is fully sufficient and optimized for **Mat**.
*/
CV_EXPORTS_W void FT12D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask = noArray());
/** @brief Computes inverse F1-transfrom.
@param components Input 32-bit float single channel array for the components.
@param kernel Kernel used for processing. The same kernel as for components computation must be used.
@param output Output 32-bit float array.
@param width Width of the output array.
@param height Height of the output array.
@note
F-transform technique of first degreee is described in paper @cite Vlas:FT.
*/
CV_EXPORTS_W void FT12D_inverseFT(InputArray components, InputArray kernel, OutputArray output, int width, int height);
//! @}
}
}
#endif // __OPENCV_FUZZY_F1_MATH_H__
......@@ -301,7 +301,20 @@ void ft::FT02D_FL_process_float(InputArray matrix, const int radius, OutputArray
void ft::FT02D_components(InputArray matrix, InputArray kernel, OutputArray components, InputArray mask)
{
CV_Assert(matrix.channels() == kernel.channels() && mask.channels() == 1);
CV_Assert(matrix.channels() == kernel.channels());
Mat inputMask;
if (mask.getMat().empty())
{
inputMask = Mat::ones(matrix.size(), CV_8U);
}
else
{
CV_Assert(mask.channels() == 1);
inputMask = mask.getMat();
}
int radiusX = (kernel.cols() - 1) / 2;
int radiusY = (kernel.rows() - 1) / 2;
......@@ -312,7 +325,7 @@ void ft::FT02D_components(InputArray matrix, InputArray kernel, OutputArray comp
Mat maskPadded;
copyMakeBorder(matrix, matrixPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
copyMakeBorder(mask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
copyMakeBorder(inputMask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
components.create(Bn, An, CV_MAKETYPE(CV_32F, matrix.channels()));
......@@ -343,13 +356,6 @@ void ft::FT02D_components(InputArray matrix, InputArray kernel, OutputArray comp
}
}
void ft::FT02D_components(InputArray matrix, InputArray kernel, OutputArray components)
{
Mat mask = Mat::ones(matrix.size(), CV_8U);
ft::FT02D_components(matrix, kernel, components, mask);
}
void ft::FT02D_inverseFT(InputArray components, InputArray kernel, OutputArray output, int width, int height)
{
CV_Assert(components.channels() == 1 && kernel.channels() == 1);
......@@ -386,16 +392,22 @@ void ft::FT02D_inverseFT(InputArray components, InputArray kernel, OutputArray o
outputZeroes(Rect(radiusX, radiusY, width, height)).copyTo(output);
}
void ft::FT02D_process(InputArray matrix, InputArray kernel, OutputArray output)
void ft::FT02D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask)
{
Mat mask = Mat::ones(matrix.size(), CV_8U);
CV_Assert(matrix.channels() == kernel.channels());
ft::FT02D_process(matrix, kernel, output, mask);
}
Mat inputMask;
void ft::FT02D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask)
{
CV_Assert(matrix.channels() == kernel.channels() && mask.channels() == 1);
if (mask.getMat().empty())
{
inputMask = Mat::ones(matrix.size(), CV_8U);
}
else
{
CV_Assert(mask.channels() == 1);
inputMask = mask.getMat();
}
int radiusX = (kernel.cols() - 1) / 2;
int radiusY = (kernel.rows() - 1) / 2;
......@@ -412,7 +424,7 @@ void ft::FT02D_process(InputArray matrix, InputArray kernel, OutputArray output,
Mat outputZeroes(outputHeightPadded, outputWidthPadded, output.type(), Scalar(0));
copyMakeBorder(matrix, matrixPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
copyMakeBorder(mask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
copyMakeBorder(inputMask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
for (int i = 0; i < An; i++)
{
......
/*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) 2015, University of Ostrava, Institute for Research and Applications of Fuzzy Modeling,
// Pavel Vlasanek, 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 "precomp.hpp"
using namespace cv;
void ft::FT12D_components(InputArray matrix, InputArray kernel, OutputArray components)
{
Mat c00, c10, c01;
FT12D_polynomial(matrix, kernel, c00, c10, c01, components);
}
void ft::FT12D_polynomial(InputArray matrix, InputArray kernel, OutputArray c00, OutputArray c10, OutputArray c01, OutputArray components, InputArray mask)
{
CV_Assert(matrix.channels() == 1 && kernel.channels() == 1);
Mat inputMask;
if (mask.getMat().empty())
{
inputMask = Mat::ones(matrix.size(), CV_8U);
}
else
{
CV_Assert(mask.channels() == 1);
inputMask = mask.getMat();
}
int radiusX = (kernel.cols() - 1) / 2;
int radiusY = (kernel.rows() - 1) / 2;
int An = matrix.cols() / radiusX + 1;
int Bn = matrix.rows() / radiusY + 1;
Mat matrixPadded, maskPadded;
copyMakeBorder(matrix, matrixPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_ISOLATED, Scalar(0));
copyMakeBorder(inputMask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_ISOLATED, Scalar(0));
c00.create(Bn, An, CV_32F);
c10.create(Bn, An, CV_32F);
c01.create(Bn, An, CV_32F);
components.create(Bn * kernel.rows(), An * kernel.cols(), CV_32F);
Mat c00Mat = c00.getMat();
Mat c10Mat = c10.getMat();
Mat c01Mat = c01.getMat();
Mat componentsMat = components.getMat();
Mat vecX, vecY;
FT12D_createPolynomMatrixVertical(radiusX, vecX, 1);
FT12D_createPolynomMatrixHorizontal(radiusY, vecY, 1);
for (int i = 0; i < An; i++)
{
for (int o = 0; o < Bn; o++)
{
int centerX = (i * radiusX) + radiusX;
int centerY = (o * radiusY) + radiusY;
Rect area(centerX - radiusX, centerY - radiusY, kernel.cols(), kernel.rows());
Mat roiImage(matrixPadded, area);
Mat roiMask(maskPadded, area);
Mat kernelMasked;
kernel.copyTo(kernelMasked, roiMask);
Mat numerator00, numerator10, numerator01;
multiply(roiImage, kernelMasked, numerator00, 1, CV_32F);
multiply(numerator00, vecX, numerator10, 1, CV_32F);
multiply(numerator00, vecY, numerator01, 1, CV_32F);
Mat denominator00, denominator10, denominator01;
denominator00 = kernelMasked;
multiply(vecX.mul(vecX), kernelMasked, denominator10, 1, CV_32F);
multiply(vecY.mul(vecY), kernelMasked, denominator01, 1, CV_32F);
Scalar c00sum, c10sum, c01sum;
divide(sum(numerator00), sum(denominator00), c00sum, 1, CV_32F);
divide(sum(numerator10), sum(denominator10), c10sum, 1, CV_32F);
divide(sum(numerator01), sum(denominator01), c01sum, 1, CV_32F);
c00Mat.row(o).col(i) = c00sum;
c10Mat.row(o).col(i) = c10sum;
c01Mat.row(o).col(i) = c01sum;
Mat vecXMasked, vecYMasked;
vecX.copyTo(vecXMasked, roiMask);
vecY.copyTo(vecYMasked, roiMask);
Mat updatedC10, updatedC01;
multiply(c10sum, vecXMasked, updatedC10, 1, CV_32F);
multiply(c01sum, vecYMasked, updatedC01, 1, CV_32F);
Mat component(componentsMat, Rect(i * kernelMasked.cols, o * kernelMasked.rows, kernelMasked.cols, kernelMasked.rows));
add(updatedC01, updatedC10, component);
add(component, c00sum, component);
}
}
}
void ft::FT12D_createPolynomMatrixVertical(int radius, OutputArray matrix, const int chn)
{
int dimension = radius * 2 + 1;
std::vector<Mat> channels;
Mat oneChannel(dimension, dimension, CV_16SC1, Scalar(0));
for (int i = 0; i < radius; i++)
{
oneChannel.col(i) = i - radius;
oneChannel.col(dimension - 1 - i) = radius - i;
}
for (int i = 0; i < chn; i++)
{
channels.push_back(oneChannel);
}
merge(channels, matrix);
}
void ft::FT12D_createPolynomMatrixHorizontal(int radius, OutputArray matrix, const int chn)
{
int dimension = radius * 2 + 1;
std::vector<Mat> channels;
Mat oneChannel(dimension, dimension, CV_16SC1, Scalar(0));
for (int i = 0; i < radius; i++)
{
oneChannel.row(i) = i - radius;
oneChannel.row(dimension - 1 - i) = radius - i;
}
for (int i = 0; i < chn; i++)
{
channels.push_back(oneChannel);
}
merge(channels, matrix);
}
void ft::FT12D_inverseFT(InputArray components, InputArray kernel, OutputArray output, int width, int height)
{
CV_Assert(components.channels() == 1 && kernel.channels() == 1);
Mat componentsMat = components.getMat();
int radiusX = (kernel.cols() - 1) / 2;
int radiusY = (kernel.rows() - 1) / 2;
int outputWidthPadded = radiusX + width + kernel.cols();
int outputHeightPadded = radiusY + height + kernel.rows();
output.create(height, width, CV_32F);
Mat outputZeroes(outputHeightPadded, outputWidthPadded, CV_32F, Scalar(0));
for (int i = 0; i < componentsMat.cols / kernel.cols(); i++)
{
for (int o = 0; o < componentsMat.rows / kernel.rows(); o++)
{
int centerX = (i * radiusX) + radiusX;
int centerY = (o * radiusY) + radiusY;
Rect area(centerX - radiusX, centerY - radiusY, kernel.cols(), kernel.rows());
Mat component(componentsMat, Rect(i * kernel.cols(), o * kernel.rows(), kernel.cols(), kernel.rows()));
Mat inverse;
multiply(kernel, component, inverse, 1, CV_32F);
Mat roiOutput(outputZeroes, area);
add(roiOutput, inverse, roiOutput);
}
}
outputZeroes(Rect(radiusX, radiusY, width, height)).copyTo(output);
}
void ft::FT12D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask)
{
CV_Assert(matrix.channels() == kernel.channels());
Mat inputMask;
if (mask.getMat().empty())
{
inputMask = Mat::ones(matrix.size(), CV_8U);
}
else
{
CV_Assert(mask.channels() == 1);
inputMask = mask.getMat();
}
Mat matrixPadded;
Mat maskPadded;
int radiusX = (kernel.cols() - 1) / 2;
int radiusY = (kernel.rows() - 1) / 2;
int An = matrix.cols() / radiusX + 1;
int Bn = matrix.rows() / radiusY + 1;
int outputWidthPadded = radiusX + matrix.cols() + kernel.cols();
int outputHeightPadded = radiusY + matrix.rows() + kernel.rows();
output.create(matrix.size(), CV_MAKETYPE(CV_32F, matrix.channels()));
Mat outputZeroes(outputHeightPadded, outputWidthPadded, output.type(), Scalar(0));
copyMakeBorder(matrix, matrixPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
copyMakeBorder(inputMask, maskPadded, radiusY, kernel.rows(), radiusX, kernel.cols(), BORDER_CONSTANT, Scalar(0));
Mat vecX;
Mat vecY;
ft::FT12D_createPolynomMatrixVertical(radiusX, vecX, matrix.channels());
ft::FT12D_createPolynomMatrixHorizontal(radiusY, vecY, matrix.channels());
for (int i = 0; i < An; i++)
{
for (int o = 0; o < Bn; o++)
{
int centerX = (i * radiusX) + radiusX;
int centerY = (o * radiusY) + radiusY;
Rect area(centerX - radiusX, centerY - radiusY, kernel.cols(), kernel.rows());
Mat roiImage(matrixPadded, area);
Mat roiMask(maskPadded, area);
Mat kernelMasked;
kernel.copyTo(kernelMasked, roiMask);
Mat numerator00, numerator10, numerator01;
multiply(roiImage, kernelMasked, numerator00, 1, CV_32F);
multiply(numerator00, vecX, numerator10, 1, CV_32F);
multiply(numerator00, vecY, numerator01, 1, CV_32F);
Mat denominator00, denominator10, denominator01;
denominator00 = kernelMasked;
multiply(vecX.mul(vecX), kernelMasked, denominator10, 1, CV_32F);
multiply(vecY.mul(vecY), kernelMasked, denominator01, 1, CV_32F);
Scalar c00, c10, c01;
divide(sum(numerator00), sum(denominator00), c00, 1, CV_32F);
divide(sum(numerator10), sum(denominator10), c10, 1, CV_32F);
divide(sum(numerator01), sum(denominator01), c01, 1, CV_32F);
Mat component, updatedC10, updatedC01;
multiply(c10, vecX, updatedC10, 1, CV_32F);
multiply(c01, vecY, updatedC01, 1, CV_32F);
add(updatedC01, updatedC10, component);
add(component, c00, component);
Mat inverse;
multiply(kernel, component, inverse, 1, CV_32F);
Mat roiOutput(outputZeroes, area);
add(roiOutput, inverse, roiOutput);
}
}
outputZeroes(Rect(radiusX, radiusY, matrix.cols(), matrix.rows())).copyTo(output);
}
......@@ -96,27 +96,6 @@ TEST(fuzzy_f0, components)
TEST(fuzzy_f0, inversion)
{
float arI[16][16] =
{
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 }
};
Mat I = Mat(16, 16, CV_32F, arI);
float arDemandedO[16][16] =
{
{ 0, 1.25, 2.5, 18.125, 33.75, 57, 80.25, 103.625, 127, 150.375, 173.75, 197.25, 220.75, 236.5, 252.25, 253.625 },
......
/*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) 2015, University of Ostrava, Institute for Research and Applications of Fuzzy Modeling,
// Pavel Vlasanek, 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;
TEST(fuzzy_f1, elements)
{
float arI[16][16] =
{
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255},
{0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255}
};
Mat I = Mat(16, 16, CV_32F, arI);
float arDemandedC00[9][9] =
{
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255}
};
Mat demandedC00 = Mat(9, 9, CV_32F, arDemandedC00);
float arDemandedC10[9][9] =
{
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255},
{0, 5, 23.5, 23.5, 23, 23.5, 23.5, 5.5, -255}
};
Mat demandedC10 = Mat(9, 9, CV_32F, arDemandedC10);
float arDemandedC01[9][9] =
{
{0, 2.5, 33.75, 80.25, 127, 173.75, 220.75, 252.25, 255},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, -2.5, -33.75, -80.25, -127, -173.75, -220.75, -252.25, -255}
};
Mat demandedC01 = Mat(9, 9, CV_32F, arDemandedC01);
float arDemandedComp[45][45] =
{
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255},
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255},
{0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255},
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255},
{0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255},
{0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255},
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255},
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255},
{0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255}
};
Mat demandedComp = Mat(45, 45, CV_32F, arDemandedComp);
Mat kernel;
ft::createKernel(ft::LINEAR, 2, kernel, 1);
Mat c00, c10, c01, f1comp;
ft::FT12D_polynomial(I, kernel, c00, c10, c01, f1comp);
double n1 = cvtest::norm(demandedC00, c00, NORM_INF);
double n2 = cvtest::norm(demandedC10, c10, NORM_INF);
double n3 = cvtest::norm(demandedC01, c01, NORM_INF);
double n4 = cvtest::norm(demandedComp, f1comp, NORM_INF);
EXPECT_DOUBLE_EQ(n1 + n2 + n3 + n4, 0);
}
TEST(fuzzy_f1, components)
{
float arI[16][16] =
{
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 }
};
Mat I = Mat(16, 16, CV_32F, arI);
float arDemandedComp[45][45] =
{
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 }
};
Mat demandedComp = Mat(45, 45, CV_32F, arDemandedComp);
Mat kernel;
ft::createKernel(ft::LINEAR, 2, kernel, 1);
Mat f1comp;
ft::FT12D_components(I, kernel, f1comp);
double n1 = cvtest::norm(demandedComp, f1comp, NORM_INF);
EXPECT_DOUBLE_EQ(n1, 0);
}
TEST(fuzzy_f1, process)
{
float arI[16][16] =
{
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 },
{ 0, 0, 0, 10, 34, 57, 80, 104, 127, 150, 174, 197, 221, 244, 255, 255 }
};
Mat I = Mat(16, 16, CV_32F, arI);
float arDemandedO[16][16] =
{
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -0.625, 3.75, 17.9375, 50.625, 85.5, 120.375, 155.6875, 190.5, 225.3125, 260.625, 295.875, 331.125, 363.75, 378.375, 510.6875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -0.625, 3.75, 17.9375, 50.625, 85.5, 120.375, 155.6875, 190.5, 225.3125, 260.625, 295.875, 331.125, 363.75, 378.375, 510.6875 }
};
Mat demandedO = Mat(16, 16, CV_32F, arDemandedO);
Mat kernel;
ft::createKernel(ft::LINEAR, 2, kernel, 1);
Mat O;
ft::FT12D_process(I, kernel, O);
double n1 = cvtest::norm(demandedO, O, NORM_INF);
EXPECT_DOUBLE_EQ(n1, 0);
}
TEST(fuzzy_f1, inversion)
{
float arDemandedO[16][16] =
{
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -0.625, 3.75, 17.9375, 50.625, 85.5, 120.375, 155.6875, 190.5, 225.3125, 260.625, 295.875, 331.125, 363.75, 378.375, 510.6875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -1.25, 2.5, 8.875, 33.75, 57, 80.25, 103.875, 127, 150.125, 173.75, 197.25, 220.75, 245.5, 252.25, 383.875 },
{ 0, -0.625, 3.75, 17.9375, 50.625, 85.5, 120.375, 155.6875, 190.5, 225.3125, 260.625, 295.875, 331.125, 363.75, 378.375, 510.6875 }
};
Mat demandedO = Mat(16, 16, CV_32F, arDemandedO);
float arComp[45][45] =
{
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -7.5, -2.5, 2.5, 7.5, 12.5, -13.25, 10.25, 33.75, 57.25, 80.75, 33.25, 56.75, 80.25, 103.75, 127.25, 81, 104, 127, 150, 173, 126.75, 150.25, 173.75, 197.25, 220.75, 173.75, 197.25, 220.75, 244.25, 267.75, 241.25, 246.75, 252.25, 257.75, 252.25, 765, 510, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -2.5, 2.5, 7.5, 12.5, 17.5, 54.25, 77.75, 101.25, 124.75, 148.25, 193.75, 217.25, 240.75, 264.25, 287.75, 335, 358, 381, 404, 427, 474.25, 497.75, 521.25, 544.75, 568.25, 615.25, 638.75, 662.25, 685.75, 709.25, 745.75, 751.25, 756.75, 762.25, 252.25, 1275, 1020, 255, 255, 255 },
{ 0, 0, 0, 0, 0, -5, 0, 5, 10, 15, 20.5, 44, 67.5, 91, 114.5, 113.5, 137, 160.5, 184, 207.5, 208, 231, 254, 277, 300, 300.5, 324, 347.5, 371, 394.5, 394.5, 418, 441.5, 465, 488.5, 493.5, 499, 504.5, 510, 252.25, 1020, 765, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 },
{ 0, 0, 0, 0, 0, 2.5, 2.5, 2.5, 2.5, 2.5, 33.75, 33.75, 33.75, 33.75, 33.75, 80.25, 80.25, 80.25, 80.25, 80.25, 127, 127, 127, 127, 127, 173.75, 173.75, 173.75, 173.75, 173.75, 220.75, 220.75, 220.75, 220.75, 220.75, 252.25, 252.25, 252.25, 252.25, 252.25, 255, 255, 255, 255, 255 }
};
Mat comp = Mat(45, 45, CV_32F, arComp);
Mat kernel;
ft::createKernel(ft::LINEAR, 2, kernel, 1);
Mat O;
ft::FT12D_inverseFT(comp, kernel, O, 16, 16);
double n1 = cvtest::norm(demandedO, O, NORM_INF);
EXPECT_DOUBLE_EQ(n1, 0);
}
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