Dusty-nv inference saves pictures in nano 2G


In the dusty-nv inference, can the python program trigger a save jpg function? Thx

My program uses dusty-nv inference to check the webcam, if there is anything interesting, save the picture in jpg.
Nano 4G works when I use cudeToNumpy and then, use cv2 function to save the jpg.
However, as I can only buy nano 2G these days, when I import cv2, it is out of memory (even if I have increased the swap memory)…

import cv2
ImportError: /usr/lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block

May I know how to save the jpg without using cv2? Thx

ok, I found the solution. :>


Just want to confirm again.
Is this issue fixed by exporting the following variable?

$ export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1


Yes, but I need to type it again after reboot…

Hi @AK51, you could at it to your user’s ~/.bashrc file so that it gets set for you after reboot.

Also, you can use jetson.utils.saveImage() to save images to disk without needing cv2. Here’s an example which saves snapshots of detected objects:

Thanks, I just tried the saveImage(), it works.
However, there is a longer freeze comparing with cv2.
Anyway, it works now.