Hi,
Hardware JPEG encoder supports YUV420 format, so possible solution will be like:
- Allocate NvBufSurface in YUV420
- Allocate NvBufSurface in RGBA and map to gpuMat
- Convert data from BGR gpuMat to the NvBufSurface in RGBA
- Call NvBufsurfTransform() to convert NvBufSurface in RGBA to NvBufSurface in YUV420
- Encode the NvBufSurface in YUV420
Please refer to the sample for mapping NvBufSurface in RGBA to gpuMat:
Error generated while running the code after connecting the camera - #15 by DaveYYY