I would like to save the pixel of a EGLimage in a matrix

I would like to save the pixel of a EGLimage in a matrix.
image format: YUYV
I don’t want to use cv::Mat.

HandleEGLImage(&ctx->egl_image);

            
                glReadPixels(0, 0, 640, 480, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

                // Save the pixels to a file
                savePixelsToFile("image.png", pixels, 640, 480);

                // Clean up
                eglDestroyImage(eglGetDisplay, ctx->egl_image);
                glDeleteRenderbuffers(1, &renderbuffer);

                /* Destroy EGLImage */
                NvBufSurfaceUnMapEglImage(pSurf, 0);
                ctx->egl_image = NULL; 

Thanks for your help

Hi,
If you use Jetpack 5 and the frame data is in NvBufSurface, you can call dump_dmabuf() to save to a video file. dump_dmabuf() is put in

/usr/src/jetson_multimedia_api/samples/common/classes/NvUtils.cpp

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.