opencv/modules/gapi/test/common/gapi_imgproc_tests.hpp

131 lines
8.0 KiB
C++
Raw Normal View History

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018-2020 Intel Corporation
#ifndef OPENCV_GAPI_IMGPROC_TESTS_HPP
#define OPENCV_GAPI_IMGPROC_TESTS_HPP
#include <iostream>
#include "gapi_tests_common.hpp"
namespace opencv_test
{
2019-08-23 18:15:35 +08:00
// Create new value-parameterized test fixture:
// Filter2DTest - fixture name
// initMatrixRandN - function that is used to initialize input/output data
// FIXTURE_API(CompareMats,int,int) - test-specific parameters (types)
// 3 - number of test-specific parameters
2019-12-26 19:45:03 +08:00
// cmpF, kernSize, borderType - test-specific parameters (names)
2019-08-23 18:15:35 +08:00
//
// We get:
// 1. Default parameters: int type, cv::Size sz, int dtype, getCompileArgs() function
// - available in test body
// 2. Input/output matrices will be initialized by initMatrixRandN (in this fixture)
2019-11-26 08:55:07 +08:00
// 3. Specific parameters: cmpF, kernSize, borderType of corresponding types
2019-08-23 18:15:35 +08:00
// - created (and initialized) automatically
// - available in test body
// Note: all parameter _values_ (e.g. type CV_8UC3) are set via INSTANTIATE_TEST_CASE_P macro
GAPI_TEST_FIXTURE(Filter2DTest, initMatrixRandN, FIXTURE_API(CompareMats,cv::Size,int), 3,
cmpF, filterSize, borderType)
GAPI_TEST_FIXTURE(BoxFilterTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
2019-06-26 23:33:16 +08:00
cmpF, filterSize, borderType)
GAPI_TEST_FIXTURE(SepFilterTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(BlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
2019-06-26 23:33:16 +08:00
cmpF, filterSize, borderType)
GAPI_TEST_FIXTURE(GaussianBlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(MedianBlurTest, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, kernSize)
GAPI_TEST_FIXTURE(ErodeTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
2019-06-26 23:33:16 +08:00
cmpF, kernSize, kernType)
GAPI_TEST_FIXTURE(Erode3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2,
2019-06-26 23:33:16 +08:00
cmpF, numIters)
GAPI_TEST_FIXTURE(DilateTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int), 3,
2019-06-26 23:33:16 +08:00
cmpF, kernSize, kernType)
GAPI_TEST_FIXTURE(Dilate3x3Test, initMatrixRandN, FIXTURE_API(CompareMats,int), 2, cmpF, numIters)
2020-12-22 05:03:06 +08:00
GAPI_TEST_FIXTURE(MorphologyExTest, initMatrixRandN, FIXTURE_API(CompareMats,cv::MorphTypes),
2, cmpF, op)
GAPI_TEST_FIXTURE(SobelTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int,int), 4,
2019-06-26 23:33:16 +08:00
cmpF, kernSize, dx, dy)
GAPI_TEST_FIXTURE(SobelXYTest, initMatrixRandN, FIXTURE_API(CompareMats,int,int,int,int), 5,
2019-06-26 23:33:16 +08:00
cmpF, kernSize, order, border_type, border_val)
GAPI_TEST_FIXTURE(LaplacianTest, initMatrixRandN,
FIXTURE_API(CompareMats,int,double,int), 4,
cmpF, kernSize, scale, borderType)
GAPI_TEST_FIXTURE(BilateralFilterTest, initMatrixRandN,
FIXTURE_API(CompareMats,int,double,double,int), 5,
cmpF, d, sigmaColor, sigmaSpace, borderType)
GAPI_TEST_FIXTURE(EqHistTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(CannyTest, initMatrixRandN, FIXTURE_API(CompareMats,double,double,int,bool), 5,
2019-06-26 23:33:16 +08:00
cmpF, thrLow, thrUp, apSize, l2gr)
GAPI_TEST_FIXTURE_SPEC_PARAMS(GoodFeaturesTest,
FIXTURE_API(CompareVectors<cv::Point2f>,std::string,int,int,double,
double,int,bool),
8, cmpF, fileName, type, maxCorners, qualityLevel, minDistance,
blockSize, useHarrisDetector)
Merge pull request #18510 from OrestChura:oc/boundingRect [G-API]: findContours() and boundingRect() Standard Kernels Implementation * Add findContours() standard kernel - API and documentation provided: - as OpenCV provides two overloads whether to calculate hierarchy or not, but they differ by only the output in sight of G-API, two different G-API functions and kernels implemented - G-API Imgproc documentation divided into more parts according to imgproc module parts - some typos connected with division into parts corrected - `GArray<GArray<U>>` overload for `get_out` function provided to coonvert correctly into `vector<vector<U>>` - OCV backend supported - accuracy tests provided * Add boundingRect() standard kernel - API and documentation provided: - GOpaque<Rect> used as an output - as OpenCV provides two possibilities whether to take a gray-scale image or a set of 2D points (`Point2i` or `Point2f` supported), three different overloads of a single G-API function and three kernels implemented - for a gray-scale image the overload via `GMat` - for a set of `Point2i` - the one via GArray<`Point2i`> - set of `Point2f` -> GArray<`Point2f`> - OCV backend supported - accuracy tests provided - comparison function for Rects provided - some typos in `gapi_tests_common` corrected * Fix precommit windows warnings * - Addressing comments: - split tests - Fix Windows warnings * Static_cast for warnings * - Remove randomness - Fix unnecessary precision losses * - Forgot reference for RNG * addressing comments * equalizeHist -> no group * `const` addedin new functions * Address suggestions: - Hierarchical -> H - added cv::GMatDesc::isVectorPoins() - added support of giving a set of points to boundingRect() * Addressing comments - IoU comparison function added for Rects - isPointsVector moved from a GMatDesc method to a separate function in imgproc.hpp - enums instead of int - typos corrected * Addressing comments - findContours: Point offset -> GOpaque<Point> - removed "straight" comparison for Rects, IoU available only - changed vectors initialization -> fix Debug test run - Some typos * added comment for later upgrades * Fix not to corrupt docs by FIXME * Addressing commens - overload without offset added (as a temporary workaround) - checkMetaForFindingContours -> validateFindingContoursMeta - added ostream overload for enums used in tests
2020-11-11 20:13:10 +08:00
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursNoOffsetTest,
FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
cv::ContourApproximationModes, CompareMats),
5, sz, type, mode, method, cmpF)
Merge pull request #18510 from OrestChura:oc/boundingRect [G-API]: findContours() and boundingRect() Standard Kernels Implementation * Add findContours() standard kernel - API and documentation provided: - as OpenCV provides two overloads whether to calculate hierarchy or not, but they differ by only the output in sight of G-API, two different G-API functions and kernels implemented - G-API Imgproc documentation divided into more parts according to imgproc module parts - some typos connected with division into parts corrected - `GArray<GArray<U>>` overload for `get_out` function provided to coonvert correctly into `vector<vector<U>>` - OCV backend supported - accuracy tests provided * Add boundingRect() standard kernel - API and documentation provided: - GOpaque<Rect> used as an output - as OpenCV provides two possibilities whether to take a gray-scale image or a set of 2D points (`Point2i` or `Point2f` supported), three different overloads of a single G-API function and three kernels implemented - for a gray-scale image the overload via `GMat` - for a set of `Point2i` - the one via GArray<`Point2i`> - set of `Point2f` -> GArray<`Point2f`> - OCV backend supported - accuracy tests provided - comparison function for Rects provided - some typos in `gapi_tests_common` corrected * Fix precommit windows warnings * - Addressing comments: - split tests - Fix Windows warnings * Static_cast for warnings * - Remove randomness - Fix unnecessary precision losses * - Forgot reference for RNG * addressing comments * equalizeHist -> no group * `const` addedin new functions * Address suggestions: - Hierarchical -> H - added cv::GMatDesc::isVectorPoins() - added support of giving a set of points to boundingRect() * Addressing comments - IoU comparison function added for Rects - isPointsVector moved from a GMatDesc method to a separate function in imgproc.hpp - enums instead of int - typos corrected * Addressing comments - findContours: Point offset -> GOpaque<Point> - removed "straight" comparison for Rects, IoU available only - changed vectors initialization -> fix Debug test run - Some typos * added comment for later upgrades * Fix not to corrupt docs by FIXME * Addressing commens - overload without offset added (as a temporary workaround) - checkMetaForFindingContours -> validateFindingContoursMeta - added ostream overload for enums used in tests
2020-11-11 20:13:10 +08:00
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursOffsetTest, <>, 0)
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHNoOffsetTest,
FIXTURE_API(cv::Size,MatType2,cv::RetrievalModes,
cv::ContourApproximationModes, CompareMats),
5, sz, type, mode, method, cmpF)
Merge pull request #18510 from OrestChura:oc/boundingRect [G-API]: findContours() and boundingRect() Standard Kernels Implementation * Add findContours() standard kernel - API and documentation provided: - as OpenCV provides two overloads whether to calculate hierarchy or not, but they differ by only the output in sight of G-API, two different G-API functions and kernels implemented - G-API Imgproc documentation divided into more parts according to imgproc module parts - some typos connected with division into parts corrected - `GArray<GArray<U>>` overload for `get_out` function provided to coonvert correctly into `vector<vector<U>>` - OCV backend supported - accuracy tests provided * Add boundingRect() standard kernel - API and documentation provided: - GOpaque<Rect> used as an output - as OpenCV provides two possibilities whether to take a gray-scale image or a set of 2D points (`Point2i` or `Point2f` supported), three different overloads of a single G-API function and three kernels implemented - for a gray-scale image the overload via `GMat` - for a set of `Point2i` - the one via GArray<`Point2i`> - set of `Point2f` -> GArray<`Point2f`> - OCV backend supported - accuracy tests provided - comparison function for Rects provided - some typos in `gapi_tests_common` corrected * Fix precommit windows warnings * - Addressing comments: - split tests - Fix Windows warnings * Static_cast for warnings * - Remove randomness - Fix unnecessary precision losses * - Forgot reference for RNG * addressing comments * equalizeHist -> no group * `const` addedin new functions * Address suggestions: - Hierarchical -> H - added cv::GMatDesc::isVectorPoins() - added support of giving a set of points to boundingRect() * Addressing comments - IoU comparison function added for Rects - isPointsVector moved from a GMatDesc method to a separate function in imgproc.hpp - enums instead of int - typos corrected * Addressing comments - findContours: Point offset -> GOpaque<Point> - removed "straight" comparison for Rects, IoU available only - changed vectors initialization -> fix Debug test run - Some typos * added comment for later upgrades * Fix not to corrupt docs by FIXME * Addressing commens - overload without offset added (as a temporary workaround) - checkMetaForFindingContours -> validateFindingContoursMeta - added ostream overload for enums used in tests
2020-11-11 20:13:10 +08:00
GAPI_TEST_FIXTURE_SPEC_PARAMS(FindContoursHOffsetTest, <>, 0)
GAPI_TEST_FIXTURE(BoundingRectMatTest, initNothing, FIXTURE_API(CompareRects,bool),
2, cmpF, initByVector)
Merge pull request #18510 from OrestChura:oc/boundingRect [G-API]: findContours() and boundingRect() Standard Kernels Implementation * Add findContours() standard kernel - API and documentation provided: - as OpenCV provides two overloads whether to calculate hierarchy or not, but they differ by only the output in sight of G-API, two different G-API functions and kernels implemented - G-API Imgproc documentation divided into more parts according to imgproc module parts - some typos connected with division into parts corrected - `GArray<GArray<U>>` overload for `get_out` function provided to coonvert correctly into `vector<vector<U>>` - OCV backend supported - accuracy tests provided * Add boundingRect() standard kernel - API and documentation provided: - GOpaque<Rect> used as an output - as OpenCV provides two possibilities whether to take a gray-scale image or a set of 2D points (`Point2i` or `Point2f` supported), three different overloads of a single G-API function and three kernels implemented - for a gray-scale image the overload via `GMat` - for a set of `Point2i` - the one via GArray<`Point2i`> - set of `Point2f` -> GArray<`Point2f`> - OCV backend supported - accuracy tests provided - comparison function for Rects provided - some typos in `gapi_tests_common` corrected * Fix precommit windows warnings * - Addressing comments: - split tests - Fix Windows warnings * Static_cast for warnings * - Remove randomness - Fix unnecessary precision losses * - Forgot reference for RNG * addressing comments * equalizeHist -> no group * `const` addedin new functions * Address suggestions: - Hierarchical -> H - added cv::GMatDesc::isVectorPoins() - added support of giving a set of points to boundingRect() * Addressing comments - IoU comparison function added for Rects - isPointsVector moved from a GMatDesc method to a separate function in imgproc.hpp - enums instead of int - typos corrected * Addressing comments - findContours: Point offset -> GOpaque<Point> - removed "straight" comparison for Rects, IoU available only - changed vectors initialization -> fix Debug test run - Some typos * added comment for later upgrades * Fix not to corrupt docs by FIXME * Addressing commens - overload without offset added (as a temporary workaround) - checkMetaForFindingContours -> validateFindingContoursMeta - added ostream overload for enums used in tests
2020-11-11 20:13:10 +08:00
GAPI_TEST_FIXTURE(BoundingRectVector32STest, initNothing, FIXTURE_API(CompareRects), 1, cmpF)
GAPI_TEST_FIXTURE(BoundingRectVector32FTest, initNothing, FIXTURE_API(CompareRects), 1, cmpF)
GAPI_TEST_FIXTURE(FitLine2DMatVectorTest, initMatByPointsVectorRandU<cv::Point_>,
FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine2DVector32STest, initNothing,
FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine2DVector32FTest, initNothing,
FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine2DVector64FTest, initNothing,
FIXTURE_API(CompareVecs<float, 4>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine3DMatVectorTest, initMatByPointsVectorRandU<cv::Point3_>,
FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine3DVector32STest, initNothing,
FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine3DVector32FTest, initNothing,
FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(FitLine3DVector64FTest, initNothing,
FIXTURE_API(CompareVecs<float, 6>,cv::DistanceTypes), 2, cmpF, distType)
GAPI_TEST_FIXTURE(BGR2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2YUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2I420Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2I420Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(I4202BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(I4202RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(YUV2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(YUV2GrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toRGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toBGRpTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toRGBpTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toBGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(NV12toGrayTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2LabTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2LUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(LUV2BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(BGR2YUVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(YUV2BGRTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2HSVTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(BayerGR2RGBTest, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(RGB2YUV422Test, initMatrixRandN, FIXTURE_API(CompareMats), 1, cmpF)
GAPI_TEST_FIXTURE(ResizeTest, initNothing, FIXTURE_API(CompareMats,int,cv::Size), 3,
cmpF, interp, sz_out)
GAPI_TEST_FIXTURE(ResizePTest, initNothing, FIXTURE_API(CompareMats,int,cv::Size), 3,
cmpF, interp, sz_out)
GAPI_TEST_FIXTURE(ResizeTestFxFy, initNothing, FIXTURE_API(CompareMats,int,double,double), 4,
cmpF, interp, fx, fy)
} // opencv_test
#endif //OPENCV_GAPI_IMGPROC_TESTS_HPP