# Revision history [back]

### Gstreamer Pipeline to NV12toBGR using GAPI

I am using a gstreamer pipeline with OpenCV VideoCapture on Jetson Nano. The source is captured in NV12 and I have to convert to BGR in the gstreamer pipeline. In order to optimize it, I thought I would use Graph-API. My understanding is that I would leave the pipeline in the NV12 format and then I would do something like the following for GAPI:

cv::GMat in;
cv::GMat out = cv::gapi::NV12toBGR(in);
cv::GComputation ac(in, out);
//videocapture stuff
ac.apply(input, output);


But as it turns out, NV12toBGR has two parameters for y and uv respectively. How are you supposed to use this function alongside a gstreamer pipeline that would capture in NV12?

### Gstreamer Pipeline to NV12toBGR using GAPI

I am using a gstreamer pipeline with OpenCV VideoCapture on Jetson Nano. The source is captured in NV12 and I have to convert to BGR in the gstreamer pipeline. In order to optimize it, I thought I would use Graph-API. My understanding is that I would leave the pipeline in the NV12 format and then I would do something like the following for GAPI:

cv::GMat in;
cv::GMat out = cv::gapi::NV12toBGR(in);
cv::GComputation ac(in, out);
//videocapture stuff
ac.apply(input, output);


But as it turns out, NV12toBGR has two parameters for y and uv respectively. How are you supposed to use this function alongside a gstreamer pipeline that would capture in NV12?

My gstreamer pipeline for VdieoCapture typically looks like this:

nvarugscamerasrc sensor_id=0 ! video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12 ! nvvidconv ! video/x-raw, format=I420 ! appsink max-buffers=1 drop=true


Later, I convert the YUV_I420 to BGR with cvtColor. I figured I could just go from NV12 to BGR instead of this current method.