How to get jpeg image after nvosd step?

We are running a DeepStream application. How can we use the to encode JPEG images (with NvJPEGEncoder) in conjuction with the NvBufSurface objects that are used in DeepStream?
And how can we convert this jpeg image from GPU to CPU?

NvJPEGEncoder is the multimedia low level interface. It can not be used inside deepstream.
Jetson Linux API Reference: NvJPEGEncoder Class Reference (nvidia.com)

Thank for you quick reply. I use python deepstrem.
How can i send whole frame as metadata to kafka?

There is a sample of saving the frames to jpg files. deepstream_python_apps/apps/deepstream-imagedata-multistream at master · NVIDIA-AI-IOT/deepstream_pyt

i also try thissample. Are these any version that draw frame by nvosd (GPU) → jpeg (GPU) → kafka?

No. You need customized broker message. Please refer to Gst-nvmsgconv — DeepStream 5.1 Release documentation for customizing message. And deepstream_python_apps/apps/deepstream-test4 at master · NVIDIA-AI-IOT/deepstream_python_apps · GitH for message broker usage.

sorry because of my bad english. How do i get drawed jpeg image without using opencv?

Normal way: get_nvds_buf_surface → numpy array → opencv draw → opencv encode

But i want to get frame after draw by nvosd and encoded (GPU)

There is no hardware jpeg encoding in python.

Please refer to c/c++ deepstream.

Do you have any example?

Please refer to /opt/nvidia/deepstream/deepstream-5.1/sources/apps/sample_apps/deepstream-image-meta-test. The encoding API is introduced in Object Encoder API — Deepstream Deepstream Version: 5.1 documentation

Hi @Fiona.Chen Thank for your guide.
i can get crop jpeg image from deepstream_image_meta_test app example

          NvDsUserMeta *usrMetaData = (NvDsUserMeta *) usrMetaList->data;
          if (usrMetaData->base_meta.meta_type == NVDS_CROP_IMAGE_META) {
            NvDsObjEncOutParams *enc_jpeg_image =
                (NvDsObjEncOutParams *) usrMetaData->user_meta_data;
            /* Write to File */
            file = fopen (fileNameString, "wb");
            fwrite (enc_jpeg_image->outBuffer, sizeof (uint8_t),
                enc_jpeg_image->outLen, file);
            fclose (file);

Can you help me, how to get full drawn frame (without using opencv)?

Please refer to the interface of

bool nvds_obj_enc_process (NvDsObjEncCtxHandle, NvDsObjEncUsrArgs, NvBufSurface, NvDsObjectMeta, NvDsFrameMeta)