/* * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ #include "test_precomp.hpp" namespace opencv_test { namespace { typedef std::tuple ChannelMergeTestParams; class ChannelMergeTest : public ::testing::TestWithParam {}; typedef std::tuple ChannelSplitTestParams; class ChannelSplitTest : public ::testing::TestWithParam {}; TEST_P(ChannelMergeTest, accuracy) { int depth = CV_8UC1; Size sz = std::get<0>(GetParam()); int count = std::get<1>(GetParam()); std::vector src_mats; RNG& rng = cv::theRNG(); for(int i = 0; i < count; i++) { Mat tmp(sz, depth); src_mats.push_back(tmp); cvtest::randUni(rng, src_mats[i], Scalar::all(0), Scalar::all(127)); } Mat dst; cv::fastcv::merge(src_mats, dst); Mat ref; cv::merge(src_mats, ref); double normInf = cvtest::norm(ref, dst, cv::NORM_INF); EXPECT_EQ(normInf, 0); } TEST_P(ChannelSplitTest, accuracy) { Size sz = std::get<0>(GetParam()); int cn = std::get<1>(GetParam()); std::vector dst_mats(cn), ref_mats(cn); RNG& rng = cv::theRNG(); Mat src(sz, CV_MAKE_TYPE(CV_8U,cn)); cvtest::randUni(rng, src, Scalar::all(0), Scalar::all(127)); cv::fastcv::split(src, dst_mats); cv::split(src, ref_mats); for(int i=0; i