mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #18451 from OrestChura:oc/count_non_zero
[G-API]: countNonZero() Standard Kernel Implementation * Add countNonZero() standard kernel - API and documentation provided - OCV backend supported - accuracy and performance tests provided - some refactoring of related documentation done * Fix GOpaque functionality for OCL Backend - test for OCL Opaque usage providied * countNonZero for GPU - OCL Backend implementation for countNonZero() added - tests provided * Addressing comments
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// 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 Intel Corporation
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
|
||||
|
||||
#include "precomp.hpp"
|
||||
@@ -342,6 +342,14 @@ GAPI_OCV_KERNEL(GCPUSum, cv::gapi::core::GSum)
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCV_KERNEL(GCPUCountNonZero, cv::gapi::core::GCountNonZero)
|
||||
{
|
||||
static void run(const cv::Mat& in, int& out)
|
||||
{
|
||||
out = cv::countNonZero(in);
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCV_KERNEL(GCPUAddW, cv::gapi::core::GAddW)
|
||||
{
|
||||
static void run(const cv::Mat& in1, double alpha, const cv::Mat& in2, double beta, double gamma, int dtype, cv::Mat& out)
|
||||
@@ -679,6 +687,7 @@ cv::gapi::GKernelPackage cv::gapi::core::cpu::kernels()
|
||||
, GCPUAbsDiff
|
||||
, GCPUAbsDiffC
|
||||
, GCPUSum
|
||||
, GCPUCountNonZero
|
||||
, GCPUAddW
|
||||
, GCPUNormL1
|
||||
, GCPUNormL2
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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 Intel Corporation
|
||||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
|
||||
|
||||
#include "precomp.hpp"
|
||||
@@ -337,6 +337,14 @@ GAPI_OCL_KERNEL(GOCLSum, cv::gapi::core::GSum)
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCL_KERNEL(GOCLCountNonZero, cv::gapi::core::GCountNonZero)
|
||||
{
|
||||
static void run(const cv::UMat& in, int& out)
|
||||
{
|
||||
out = cv::countNonZero(in);
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCL_KERNEL(GOCLAddW, cv::gapi::core::GAddW)
|
||||
{
|
||||
static void run(const cv::UMat& in1, double alpha, const cv::UMat& in2, double beta, double gamma, int dtype, cv::UMat& out)
|
||||
@@ -565,6 +573,7 @@ cv::gapi::GKernelPackage cv::gapi::core::ocl::kernels()
|
||||
, GOCLAbsDiff
|
||||
, GOCLAbsDiffC
|
||||
, GOCLSum
|
||||
, GOCLCountNonZero
|
||||
, GOCLAddW
|
||||
, GOCLNormL1
|
||||
, GOCLNormL2
|
||||
|
||||
@@ -34,6 +34,11 @@ cv::detail::VectorRef& cv::GOCLContext::outVecRef(int output)
|
||||
return util::get<cv::detail::VectorRef>(m_results.at(output));
|
||||
}
|
||||
|
||||
cv::detail::OpaqueRef& cv::GOCLContext::outOpaqueRef(int output)
|
||||
{
|
||||
return util::get<cv::detail::OpaqueRef>(m_results.at(output));
|
||||
}
|
||||
|
||||
cv::GOCLKernel::GOCLKernel()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user