Use argus yuvJpeg sample get image. How to trans YUV420 pixel format to RGB pixel format. I want convert it to cv::Mat.
hi @vulcanyjx
Welcome to the Isaac ROS forum,
Are you working with Isaac ROS? For your post, it looks like you are working just only with the argus API.
Let me know.
best,
Raffaello
Oh, It’s a argus problem, sorry , I don’t known what forum is arugs belong
You can transform the NvBufSurface to RGB using:
- allocate output Surface in RGB format (I would suggest using RGBA)
NvBufSurface *surfRGB = 0;
NvBufSurfaceAllocateParams input_params = {{0}};
...
input_params.params.colorFormat = NVBUF_COLOR_FORMAT_RGBA;
NvBufSurfaceAllocate(&surfRGB, 1, &input_params);
- Transform YUV surface to RGB format:
NvBufSurfTransformParams transform_params = {0};
transform_params.src_top = 0;
transform_params.src_left = 0;
transform_params.src_width =width;
transform_params.src_height = height;
transform_params.dst_top = 0;
transform_params.dst_left = 0;
transform_params.dst_width = width;
transform_params.dst_height = height;
transform_params.flag = NVBUFSURF_TRANSFORM_FILTER;
transform_params.flip = NvBufSurfTransform_None;
transform_params.filter = NvBufSurfTransformInter_Default;
NvBufSurfTransform(surfYUV, surfRGB, &transform_params)
- Convert Nvbufsurface to cv::Mat as described here:
How to convert NvBufSurface to cv::Mat - #7 by ahmed.t.mohamed
Hope this helps you solve your problem.
hello vulcanyjx,
may I know what’s the actual use-case? and, is it a YUV, or bayer raw camera sensor?
besides, you may see-also previous comment #4, patrick2 has given you several approaches.
Thanks for your help. It works, I have resolve this problem.
Hi Jerry
I use hawk in our robot. But I don’t like isaac_ros_argus_camera. It depends nitros and other repositories. So I use VPI and libargus to reworte the code. Use cv::Mat is aim to publish image in ros.
Hi Raffaello
Thanks for your help.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.