Hi guys,
I want convert NvBufferColorFormat_GRAY8 or NVBUF_COLOR_FORMAT_GRAY8 through NvBufferTransform or NvBufSurfTransform to color full format like RGBA or NV12 or YUV422 or I420 . frame is black and white but result is green would you please help me to settings NvBufSurfTransformParams or NvBufferTransformParams or settings creation of destination DMA buffer like NvBufSurfaceCreateParams or NvBufferCreateParams. on the other hand, gray frame is one channel without color when it is converted to I420, RGBA, YUV422, NV12, Does Gray channel copy to other color channel to make result black and white not green? I don’t use Gstreamer nvvvidconv or nvvideoconvert plugin just using MMAPI.
Thanks so much.
Hi,
The use-cases are demonstrated in the sample:
/usr/src/jetson_multimedia_api/samples/07_video_convert
Please take a look and give it a try.
Thanks for your attention,
here is my example
int grayFD; NvBufferCreate(&grayFD,1920,1080,NvBufferLayout_Pitch,NvBufferColorFormat_GRAY8); int grayYUV420FD; NvBufferCreate(&grayYUV420FD,1920,1080,NvBufferLayout_Pitch,NvBufferColorFormat_YUV420); NvBufferTransformParams transParams ={0}; memset(&transParams, 0, sizeof(transParams)); NvBufferTransform(grayFD,grayYUV420FD , &transParams);
out put is green. but if i add these code at the end of above code it gets black and white.
void * grayYUV420PtrY;
void * grayYUV420PtrU;
void * grayYUV420PtrV;
NvBufferParams par;
NvBufferGetParams (grayYUV420FD, &par);
cv::Mat Y = cv::Mat(cv::Size(par.width[0], par.height[0]), CV_8UC1, grayYUV420PtrY, par.pitch[0]);
cv::Mat U = cv::Mat(cv::Size(par.width[1], par.height[1]), CV_8UC1, grayYUV420PtrU, par.pitch[1]);
cv::Mat V = cv::Mat(cv::Size(par.width[2], par.height[2]), CV_8UC1, grayYUV420PtrV, par.pitch[2]);
U.setTo(128);
V.setTo(128);
NvBufferMemSyncForCpu(grayYUV420FD, 0, &grayYUV420PtrY);
NvBufferMemSyncForCpu(grayYUV420FD, 1, &grayYUV420PtrU);
NvBufferMemSyncForCpu (grayYUV420FD, 2, &grayYUV420PtrV);
I converted GRAY frame to YUV420 It gets green beacause I think U and V is not set to 128 in grayYUV420FD U and V plane DMA buffer. please help ?
Thanks so much
Hi,
Please set UV plane to 0x80 after conversion. There is similar code in 12_camera_v4l2_cuda sample. Please refer to it and apply the code.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.