mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Merge pull request #15751 from TolyaTalamanov:at/refactor-render-tests
* Refactor render tests * Fix comment to review * Move ocv render tests stuff to specific file * Add OCV prefix for render tests * Fix comments to review
This commit is contained in:
committed by
Alexander Alekhin
parent
ea5499fa51
commit
ea64bb58a5
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "api/render_priv.hpp"
|
||||
|
||||
void cv::gapi::wip::draw::render(cv::Mat &bgr,
|
||||
const cv::gapi::wip::draw::Prims &prims,
|
||||
void cv::gapi::wip::draw::render(cv::Mat& bgr,
|
||||
const cv::gapi::wip::draw::Prims& prims,
|
||||
cv::GCompileArgs&& args)
|
||||
{
|
||||
cv::GMat in;
|
||||
@@ -16,9 +16,9 @@ void cv::gapi::wip::draw::render(cv::Mat &bgr,
|
||||
comp.apply(cv::gin(bgr, prims), cv::gout(bgr), std::move(args));
|
||||
}
|
||||
|
||||
void cv::gapi::wip::draw::render(cv::Mat &y_plane,
|
||||
cv::Mat &uv_plane,
|
||||
const Prims &prims,
|
||||
void cv::gapi::wip::draw::render(cv::Mat& y_plane,
|
||||
cv::Mat& uv_plane,
|
||||
const Prims& prims,
|
||||
cv::GCompileArgs&& args)
|
||||
{
|
||||
cv::GMat y_in, uv_in, y_out, uv_out;
|
||||
@@ -30,22 +30,28 @@ void cv::gapi::wip::draw::render(cv::Mat &y_plane,
|
||||
cv::gout(y_plane, uv_plane), std::move(args));
|
||||
}
|
||||
|
||||
void cv::gapi::wip::draw::BGR2NV12(const cv::Mat &bgr,
|
||||
cv::Mat &y_plane,
|
||||
cv::Mat &uv_plane)
|
||||
void cv::gapi::wip::draw::cvtYUVToNV12(const cv::Mat& yuv,
|
||||
cv::Mat& y,
|
||||
cv::Mat& uv)
|
||||
{
|
||||
GAPI_Assert(bgr.size().width % 2 == 0);
|
||||
GAPI_Assert(bgr.size().height % 2 == 0);
|
||||
|
||||
cv::Mat yuv;
|
||||
cvtColor(bgr, yuv, cv::COLOR_BGR2YUV);
|
||||
GAPI_Assert(yuv.size().width % 2 == 0);
|
||||
GAPI_Assert(yuv.size().height % 2 == 0);
|
||||
|
||||
std::vector<cv::Mat> chs(3);
|
||||
cv::split(yuv, chs);
|
||||
y_plane = chs[0];
|
||||
y = chs[0];
|
||||
|
||||
cv::merge(std::vector<cv::Mat>{chs[1], chs[2]}, uv_plane);
|
||||
cv::resize(uv_plane, uv_plane, uv_plane.size() / 2, cv::INTER_LINEAR);
|
||||
cv::merge(std::vector<cv::Mat>{chs[1], chs[2]}, uv);
|
||||
cv::resize(uv, uv, uv.size() / 2, cv::INTER_LINEAR);
|
||||
}
|
||||
|
||||
void cv::gapi::wip::draw::cvtNV12ToYUV(const cv::Mat& y,
|
||||
const cv::Mat& uv,
|
||||
cv::Mat& yuv)
|
||||
{
|
||||
cv::Mat upsample_uv;
|
||||
cv::resize(uv, upsample_uv, uv.size() * 2, cv::INTER_LINEAR);
|
||||
cv::merge(std::vector<cv::Mat>{y, upsample_uv}, yuv);
|
||||
}
|
||||
|
||||
namespace cv
|
||||
|
||||
Reference in New Issue
Block a user