X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inference-engine%2Fthirdparty%2Ffluid%2Fmodules%2Fgapi%2Fsrc%2Fbackends%2Fcpu%2Fgcpuimgproc.cpp;h=cab05203ff24c7dc02c0708351b1c783647d0db9;hb=0923303e0201c5b59386ab146d0e30b2ef79272d;hp=ab5d5d8fd40f0e7049420a8ea057006ba071dea9;hpb=ba6e22b1b5ee4cbefcc30e8d9493cddb0bb3dfdf;p=platform%2Fupstream%2Fdldt.git diff --git a/inference-engine/thirdparty/fluid/modules/gapi/src/backends/cpu/gcpuimgproc.cpp b/inference-engine/thirdparty/fluid/modules/gapi/src/backends/cpu/gcpuimgproc.cpp index ab5d5d8..cab0520 100644 --- a/inference-engine/thirdparty/fluid/modules/gapi/src/backends/cpu/gcpuimgproc.cpp +++ b/inference-engine/thirdparty/fluid/modules/gapi/src/backends/cpu/gcpuimgproc.cpp @@ -7,9 +7,11 @@ #include "precomp.hpp" -#include "opencv2/gapi/imgproc.hpp" -#include "opencv2/gapi/cpu/imgproc.hpp" -#include "backends/cpu/gcpuimgproc.hpp" +#include +#include +#include + +#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){ @@ -276,6 +278,74 @@ GAPI_OCV_KERNEL(GCPURGB2GrayCustom, cv::gapi::imgproc::GRGB2GrayCustom) } }; +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(i); + uchar* out_line_p = out.ptr(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 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 @@ -303,6 +373,11 @@ cv::gapi::GKernelPackage cv::gapi::imgproc::cpu::kernels() , GCPUBGR2Gray , GCPURGB2Gray , GCPURGB2GrayCustom + , GCPUBayerGR2RGB + , GCPURGB2HSV + , GCPURGB2YUV422 + , GCPUNV12toRGBp + , GCPUNV12toBGRp >(); return pkg; }