Path: blob/master/modules/gapi/test/cpu/gapi_imgproc_tests_cpu.cpp
16337 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018 Intel Corporation567#include "../test_precomp.hpp"89#include "../common/gapi_imgproc_tests.hpp"10#include "opencv2/gapi/cpu/imgproc.hpp"1112#define IMGPROC_CPU cv::gapi::imgproc::cpu::kernels()1314namespace opencv_test15{1617class AbsExact : public Wrappable<AbsExact>18{19public:20AbsExact() {}21bool operator() (const cv::Mat& in1, const cv::Mat& in2) const { return cv::countNonZero(in1 != in2)==0; }22private:23};2425class AbsTolerance : public Wrappable<AbsTolerance>26{27public:28AbsTolerance(double tol) : _tol(tol) {}29bool operator() (const cv::Mat& in1, const cv::Mat& in2) const30{31cv::Mat absDiff; cv::absdiff(in1, in2, absDiff);32return cv::countNonZero(absDiff > _tol) == 0;33}34private:35double _tol;36};3738INSTANTIATE_TEST_CASE_P(Filter2DTestCPU, Filter2DTest,39Combine(Values(AbsExact().to_compare_f()),40Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),41Values(3, 4, 5, 7),42Values(cv::Size(1280, 720),43cv::Size(640, 480),44cv::Size(128, 128)),45Values(cv::BORDER_DEFAULT),46Values(-1, CV_32F),47/*init output matrices or not*/ testing::Bool(),48Values(cv::compile_args(IMGPROC_CPU))));4950INSTANTIATE_TEST_CASE_P(BoxFilterTestCPU, BoxFilterTest,51Combine(Values(AbsTolerance(1e-6).to_compare_f()),52Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),53Values(3,5),54Values(cv::Size(1280, 720),55cv::Size(640, 480)),56Values(cv::BORDER_DEFAULT),57Values(-1, CV_32F),58/*init output matrices or not*/ testing::Bool(),59Values(cv::compile_args(IMGPROC_CPU))));6061INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_8U, SepFilterTest,62Combine(Values(AbsExact().to_compare_f()),63Values(CV_8UC1, CV_8UC3),64Values(3),65Values(cv::Size(1280, 720),66cv::Size(640, 480)),67Values(-1, CV_16S, CV_32F),68/*init output matrices or not*/ testing::Bool(),69Values(cv::compile_args(IMGPROC_CPU))));7071INSTANTIATE_TEST_CASE_P(SepFilterTestCPU_other, SepFilterTest,72Combine(Values(AbsExact().to_compare_f()),73Values(CV_16UC1, CV_16SC1, CV_32FC1),74Values(3),75Values(cv::Size(1280, 720),76cv::Size(640, 480)),77Values(-1, CV_32F),78/*init output matrices or not*/ testing::Bool(),79Values(cv::compile_args(IMGPROC_CPU))));8081INSTANTIATE_TEST_CASE_P(BlurTestCPU, BlurTest,82Combine(Values(AbsTolerance(0.0).to_compare_f()),83Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),84Values(3,5),85Values(cv::Size(1280, 720),86cv::Size(640, 480)),87Values(cv::BORDER_DEFAULT),88/*init output matrices or not*/ testing::Bool(),89Values(cv::compile_args(IMGPROC_CPU))));9091INSTANTIATE_TEST_CASE_P(gaussBlurTestCPU, GaussianBlurTest,92Combine(Values(AbsExact().to_compare_f()),93Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),94Values(3, 5),95Values(cv::Size(1280, 720),96cv::Size(640, 480)),97/*init output matrices or not*/ testing::Bool(),98Values(cv::compile_args(IMGPROC_CPU))));99100INSTANTIATE_TEST_CASE_P(MedianBlurTestCPU, MedianBlurTest,101Combine(Values(AbsExact().to_compare_f()),102Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),103Values(3, 5),104Values(cv::Size(1280, 720),105cv::Size(640, 480)),106/*init output matrices or not*/ testing::Bool(),107Values(cv::compile_args(IMGPROC_CPU))));108109INSTANTIATE_TEST_CASE_P(ErodeTestCPU, ErodeTest,110Combine(Values(AbsExact().to_compare_f()),111Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),112Values(3, 5),113Values(cv::Size(1280, 720),114cv::Size(640, 480)),115Values(cv::MorphShapes::MORPH_RECT,116cv::MorphShapes::MORPH_CROSS,117cv::MorphShapes::MORPH_ELLIPSE),118/*init output matrices or not*/ testing::Bool(),119Values(cv::compile_args(IMGPROC_CPU))));120121INSTANTIATE_TEST_CASE_P(Erode3x3TestCPU, Erode3x3Test,122Combine(Values(AbsExact().to_compare_f()),123Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),124Values(cv::Size(1280, 720),125cv::Size(640, 480)),126/*init output matrices or not*/ testing::Bool(),127Values(1,2,4),128Values(cv::compile_args(IMGPROC_CPU))));129130INSTANTIATE_TEST_CASE_P(DilateTestCPU, DilateTest,131Combine(Values(AbsExact().to_compare_f()),132Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),133Values(3, 5),134Values(cv::Size(1280, 720),135cv::Size(640, 480)),136Values(cv::MorphShapes::MORPH_RECT,137cv::MorphShapes::MORPH_CROSS,138cv::MorphShapes::MORPH_ELLIPSE),139/*init output matrices or not*/ testing::Bool(),140Values(cv::compile_args(IMGPROC_CPU))));141142INSTANTIATE_TEST_CASE_P(Dilate3x3TestCPU, Dilate3x3Test,143Combine(Values(AbsExact().to_compare_f()),144Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),145Values(cv::Size(1280, 720),146cv::Size(640, 480)),147/*init output matrices or not*/ testing::Bool(),148Values(1,2,4),149Values(cv::compile_args(IMGPROC_CPU))));150151INSTANTIATE_TEST_CASE_P(SobelTestCPU, SobelTest,152Combine(Values(AbsExact().to_compare_f()),153Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),154Values(3, 5),155Values(cv::Size(1280, 720),156cv::Size(640, 480)),157Values(-1, CV_32F),158Values(0, 1),159Values(1, 2),160/*init output matrices or not*/ testing::Bool(),161Values(cv::compile_args(IMGPROC_CPU))));162163INSTANTIATE_TEST_CASE_P(EqHistTestCPU, EqHistTest,164Combine(Values(AbsExact().to_compare_f()),165Values(cv::Size(1280, 720),166cv::Size(640, 480)),167/*init output matrices or not*/ testing::Bool(),168Values(cv::compile_args(IMGPROC_CPU))));169170INSTANTIATE_TEST_CASE_P(CannyTestCPU, CannyTest,171Combine(Values(AbsExact().to_compare_f()),172Values(CV_8UC1, CV_8UC3),173Values(cv::Size(1280, 720),174cv::Size(640, 480)),175Values(3.0, 120.0),176Values(125.0, 240.0),177Values(3, 5),178testing::Bool(),179/*init output matrices or not*/ testing::Bool(),180Values(cv::compile_args(IMGPROC_CPU))));181182INSTANTIATE_TEST_CASE_P(RGB2GrayTestCPU, RGB2GrayTest,183Combine(Values(AbsExact().to_compare_f()),184Values(cv::Size(1280, 720),185cv::Size(640, 480)),186/*init output matrices or not*/ testing::Bool(),187Values(cv::compile_args(IMGPROC_CPU))));188189INSTANTIATE_TEST_CASE_P(BGR2GrayTestCPU, BGR2GrayTest,190Combine(Values(AbsExact().to_compare_f()),191Values(cv::Size(1280, 720),192cv::Size(640, 480)),193/*init output matrices or not*/ testing::Bool(),194Values(cv::compile_args(IMGPROC_CPU))));195196INSTANTIATE_TEST_CASE_P(RGB2YUVTestCPU, RGB2YUVTest,197Combine(Values(AbsExact().to_compare_f()),198Values(cv::Size(1280, 720),199cv::Size(640, 480)),200/*init output matrices or not*/ testing::Bool(),201Values(cv::compile_args(IMGPROC_CPU))));202203INSTANTIATE_TEST_CASE_P(YUV2RGBTestCPU, YUV2RGBTest,204Combine(Values(AbsExact().to_compare_f()),205Values(cv::Size(1280, 720),206cv::Size(640, 480)),207/*init output matrices or not*/ testing::Bool(),208Values(cv::compile_args(IMGPROC_CPU))));209210INSTANTIATE_TEST_CASE_P(RGB2LabTestCPU, RGB2LabTest,211Combine(Values(AbsExact().to_compare_f()),212Values(cv::Size(1280, 720),213cv::Size(640, 480)),214/*init output matrices or not*/ testing::Bool(),215Values(cv::compile_args(IMGPROC_CPU))));216217INSTANTIATE_TEST_CASE_P(BGR2LUVTestCPU, BGR2LUVTest,218Combine(Values(AbsExact().to_compare_f()),219Values(cv::Size(1280, 720),220cv::Size(640, 480)),221/*init output matrices or not*/ testing::Bool(),222Values(cv::compile_args(IMGPROC_CPU))));223224INSTANTIATE_TEST_CASE_P(LUV2BGRTestCPU, LUV2BGRTest,225Combine(Values(AbsExact().to_compare_f()),226Values(cv::Size(1280, 720),227cv::Size(640, 480)),228/*init output matrices or not*/ testing::Bool(),229Values(cv::compile_args(IMGPROC_CPU))));230231INSTANTIATE_TEST_CASE_P(BGR2YUVTestCPU, BGR2YUVTest,232Combine(Values(AbsExact().to_compare_f()),233Values(cv::Size(1280, 720),234cv::Size(640, 480)),235/*init output matrices or not*/ testing::Bool(),236Values(cv::compile_args(IMGPROC_CPU))));237238INSTANTIATE_TEST_CASE_P(YUV2BGRTestCPU, YUV2BGRTest,239Combine(Values(AbsExact().to_compare_f()),240Values(cv::Size(1280, 720),241cv::Size(640, 480)),242/*init output matrices or not*/ testing::Bool(),243Values(cv::compile_args(IMGPROC_CPU))));244245} // opencv_test246247248