mirror of
https://github.com/opencv/opencv.git
synced 2026-09-28 04:09:42 +03:00
Imgproc test cleanup - #29740 co-authored by: @Prasadayus ### Re-enabled as-is (stale disable reasons) - `FillPolyFully.fillpoly_fully` (`test_drawing.cpp:1142`) - `Resize_Bitexact` (`test_resize_bitexact.cpp:188`, 4 instantiations): `INTER_NEAREST` and `INTER_NEAREST_EXACT` agree exactly at integer upscale factors; measured 0.0 diff on all 4. ### Add assertions - **imgproc** — new `Imgproc_Watershed.regression`: `cv::watershed` had no working coverage at all. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
74 lines
3.3 KiB
C++
74 lines
3.3 KiB
C++
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
//
|
|
// By downloading, copying, installing or using the software you agree to this license.
|
|
// If you do not agree to this license, do not download, install,
|
|
// copy or use the software.
|
|
//
|
|
//
|
|
// License Agreement
|
|
// For Open Source Computer Vision Library
|
|
//
|
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
// Third party copyrights are property of their respective owners.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without modification,
|
|
// are permitted provided that the following conditions are met:
|
|
//
|
|
// * Redistribution's of source code must retain the above copyright notice,
|
|
// this list of conditions and the following disclaimer.
|
|
//
|
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
// and/or other materials provided with the distribution.
|
|
//
|
|
// * The name of the copyright holders may not be used to endorse or promote products
|
|
// derived from this software without specific prior written permission.
|
|
//
|
|
// This software is provided by the copyright holders and contributors "as is" and
|
|
// any express or implied warranties, including, but not limited to, the implied
|
|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
// indirect, incidental, special, exemplary, or consequential damages
|
|
// (including, but not limited to, procurement of substitute goods or services;
|
|
// loss of use, data, or profits; or business interruption) however caused
|
|
// and on any theory of liability, whether in contract, strict liability,
|
|
// or tort (including negligence or otherwise) arising in any way out of
|
|
// the use of this software, even if advised of the possibility of such damage.
|
|
//
|
|
//M*/
|
|
|
|
#include "test_precomp.hpp"
|
|
|
|
namespace opencv_test { namespace {
|
|
|
|
TEST(Imgproc_UMat, regression)
|
|
{
|
|
const string imgpath = cvtest::findDataFile("shared/lena.png");
|
|
Mat img = imread(imgpath, IMREAD_COLOR);
|
|
ASSERT_FALSE(img.empty());
|
|
|
|
Mat gray, smallimg, result;
|
|
cvtColor(img, gray, COLOR_BGR2GRAY);
|
|
resize(gray, smallimg, Size(), 0.75, 0.75, INTER_LINEAR_EXACT);
|
|
equalizeHist(smallimg, result);
|
|
|
|
// Deliberately getUMat() rather than copyTo(): the ocl/ tests always upload
|
|
// by copy (UMAT_UPLOAD_INPUT_PARAMETER), so this is the only coverage of an
|
|
// imgproc chain fed by a UMat view over a Mat that stays alive alongside it.
|
|
UMat uimg = img.getUMat(ACCESS_READ), ugray, usmallimg, uresult;
|
|
cvtColor(uimg, ugray, COLOR_BGR2GRAY);
|
|
resize(ugray, usmallimg, Size(), 0.75, 0.75, INTER_LINEAR_EXACT);
|
|
equalizeHist(usmallimg, uresult);
|
|
|
|
// Measured identical here; the tolerance of 1 matches OCL_TEST_P(EqualizeHist, Mat),
|
|
// since bit-exactness was only confirmed on one device.
|
|
Mat uresult_host = uresult.getMat(ACCESS_READ);
|
|
EXPECT_LE(cv::norm(result, uresult_host, NORM_INF), 1)
|
|
<< "Mat and UMat imgproc pipelines disagree";
|
|
}
|
|
|
|
}} // namespace
|