#include "precomp.hpp"
-#include "opencv2/gapi/imgproc.hpp"
-#include "opencv2/gapi/cpu/imgproc.hpp"
-#include "backends/cpu/gcpuimgproc.hpp"
+#include <opencv2/gapi/imgproc.hpp>
+#include <opencv2/gapi/cpu/imgproc.hpp>
+#include <opencv2/gapi/cpu/gcpukernel.hpp>
+
+#include "backends/fluid/gfluidimgproc_func.hpp"
namespace {
cv::Mat add_border(const cv::Mat& in, const int ksize, const int borderType, const cv::Scalar& bordVal){
}
};
+GAPI_OCV_KERNEL(GCPUBayerGR2RGB, cv::gapi::imgproc::GBayerGR2RGB)
+{
+ static void run(const cv::Mat& in, cv::Mat &out)
+ {
+ cv::cvtColor(in, out, cv::COLOR_BayerGR2RGB);
+ }
+};
+
+GAPI_OCV_KERNEL(GCPURGB2HSV, cv::gapi::imgproc::GRGB2HSV)
+{
+ static void run(const cv::Mat& in, cv::Mat &out)
+ {
+ cv::cvtColor(in, out, cv::COLOR_RGB2HSV);
+ }
+};
+
+GAPI_OCV_KERNEL(GCPURGB2YUV422, cv::gapi::imgproc::GRGB2YUV422)
+{
+ static void run(const cv::Mat& in, cv::Mat &out)
+ {
+ out.create(in.size(), CV_8UC2);
+
+ for (int i = 0; i < in.rows; ++i)
+ {
+ const uchar* in_line_p = in.ptr<uchar>(i);
+ uchar* out_line_p = out.ptr<uchar>(i);
+ cv::gapi::fluid::run_rgb2yuv422_impl(out_line_p, in_line_p, in.cols);
+ }
+ }
+};
+
+static void toPlanar(const cv::Mat& in, cv::Mat& out)
+{
+ GAPI_Assert(out.depth() == in.depth());
+ GAPI_Assert(out.channels() == 1);
+ GAPI_Assert(in.channels() == 3);
+ GAPI_Assert(out.cols == in.cols);
+ GAPI_Assert(out.rows == 3*in.rows);
+
+ std::vector<cv::Mat> outs(3);
+ for (int i = 0; i < 3; i++) {
+ outs[i] = out(cv::Rect(0, i*in.rows, in.cols, in.rows));
+ }
+ cv::split(in, outs);
+}
+
+
+GAPI_OCV_KERNEL(GCPUNV12toRGBp, cv::gapi::imgproc::GNV12toRGBp)
+{
+ static void run(const cv::Mat& inY, const cv::Mat& inUV, cv::Mat& out)
+ {
+ cv::Mat rgb;
+ cv::cvtColorTwoPlane(inY, inUV, rgb, cv::COLOR_YUV2RGB_NV12);
+ toPlanar(rgb, out);
+ }
+};
+
+GAPI_OCV_KERNEL(GCPUNV12toBGRp, cv::gapi::imgproc::GNV12toBGRp)
+{
+ static void run(const cv::Mat& inY, const cv::Mat& inUV, cv::Mat& out)
+ {
+ cv::Mat rgb;
+ cv::cvtColorTwoPlane(inY, inUV, rgb, cv::COLOR_YUV2BGR_NV12);
+ toPlanar(rgb, out);
+ }
+};
+
+
cv::gapi::GKernelPackage cv::gapi::imgproc::cpu::kernels()
{
static auto pkg = cv::gapi::kernels
, GCPUBGR2Gray
, GCPURGB2Gray
, GCPURGB2GrayCustom
+ , GCPUBayerGR2RGB
+ , GCPURGB2HSV
+ , GCPURGB2YUV422
+ , GCPUNV12toRGBp
+ , GCPUNV12toBGRp
>();
return pkg;
}