Utilising GPU to perform real-time .JPG compression in Python

Hi there,

I have a Python3 script that acquires images from a FLIR Blackfly Machine Vision camera at a frame rate of 30 FPS and HD resolution. The resulting data is huge, and I have the option through the FLIR Spinnaker SDK of converting the images to a compressed format such as .JPG or .TIFF. However, as soon as I change the file format from .RAW to anything else, it the frame rate drops because the CPU is not powerful enough to keep up.

I am wondering if there is a way to utilize the GPU on the Jetson Nano to take the raw image file that has just been captured and convert it to a compressed file format, then save the image, then doing the same for the next loop (essentially performing the conversations on an individual image basis once per loop, at a rate of 30 FPS).

From the bit of research I’ve done, I see that the standard way to utilise the GPU is through the GStreamer API, but I cannot find any examples on how this will look as in Python code within my script.

I am quite a novice, so any advice or direction would be appreciated. Thank you!

For JPEG hardware encoding, we have nvjpegenc in gstreamer and NvJpegEncoder in jetson_multimedia_api. Possible solution is to launch gstreamer pipeline in python. The sample might be for reference:

Hi Dane, Thank you very much for your response. I will have a look at the resource you linked.