JPEG Image quality when using EGLStream::IImageJPEG and writeJPEG()

Hi all,

I’m using the Argus C++ framework on a Jetson Nano flashed with Jetpack 4.6.4 [L4T 32.7.4]. My code successfully captures camera images and is working well.

As part of my API I’ve also added a method that saves the currently grabbed frame as a JPEG. This works as expected and is based on the code fragment show below.

EGLStream::Image* image = ...
iImageJPEG = Argus::interface_cast<EGLStream::IImageJPEG>(image);
iImageJPEG->writeJPEG("filename.jpg");

I would like to be able to specify the JPEG quality and as far as I can tell an ELGStream::IImage doesn’t provide a suitable method.

How can I do this?

I appreciate that there are other more complex ways to generate JPEG images, but it would be nice to avoid this level of complexity, especially as the above code is so simple.

I’m also interested to know what quality the above writeJPEG() method uses by default?

I should mention that I have searched for an answer to these questions, but haven’t been able to find any…

Many thanks!

1 Like

Hi,
Please refer to the sample:
Jetson Linux API Reference: 09_camera_jpeg_capture (libargus & libjpeg-8b) | NVIDIA Docs

It uses NvJpegEncoder class and there is interface for setting quality. Please take a look and try.

Thanks for the reply.

I can certainly use the method show in the sample, but I was hoping that there might be a way using the simpler approach I described above. I guess the iImageJPEG->writeJPEG() dose this behind the covers so to speak, it’s just a shame that no method to set the quality has been exposed. Not too worry.

Do you know what the quality defaults to when using the iImageJPEG->writeJPEG() method?

Many thanks!

Hi,

Quality is set to 95 in the fucntion call.

Many thanks!

1 Like

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