Jetson nano + basler camera 5Mp

Hi everyone,

I’m trying to capture a video stream from a basler gige 5mp camera.

I’m using a jetson nano 4gb card I’ve installed Pypylon and opencv

I can open the camera and display it but the fps are very low with crashes.

If the display window is small it seems ok (can’t do much better) but when I enlarge the window it slows down a lot and crashes.

I tried to reduce the bandwidth (the camera consumes 102Mb/s) but same result.

on the other hand, when I reduce the number of pixels to be displayed to 500*200px, for example, I get great fluidity back.

I’m completely dry, I don’t know if it’s the nano’s network card that’s saturated (I don’t believe it) or the CPU or RAM capacity. But when I look at the RAM and CPU usage in the task manager, I’m only at about 50% usage.

Here’s my code :

 from pypylon import pylon
 import cv2
 
 # conecting to the first available camera
 camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
 
 # Grabing Continusely (video) with minimal delay
 camera.StartGrabbing(pylon.GrabStrategy_LatestImageOnly) 
 converter = pylon.ImageFormatConverter()
 
 # converting to opencv bgr format
 converter.OutputPixelFormat = pylon.PixelType_BGR8packed
 converter.OutputBitAlignment = pylon.OutputBitAlignment_MsbAligned
 
 while camera.IsGrabbing():
     grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
 
     if grabResult.GrabSucceeded():
         # Access the image data
         image = converter.Convert(grabResult)
         img = image.GetArray()
         cv2.namedWindow('title', cv2.WINDOW_NORMAL)
         cv2.imshow('title', img)
         k = cv2.waitKey(1)
         if k == 27:
             break
     grabResult.Release()
     
 # Releasing the resource    
 camera.StopGrabbing()
 
 cv2.destroyAllWindows()

Hi Thomas,

Have you tried using GStreamer: GitHub - basler/gst-plugin-pylon: The official GStreamer plug-in for Basler cameras? This should enable you to use the Nvidia accelerated elements for display and conversion.

Here are some reference pipelines:

1 Like

thanks you .
i had installed gstream (with pain) and it finaly work but not the stream i tried many things but i have still some error

ERROR: from element /GstPipeline:pipeline0/GstPylonSrc:pylonsrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstPylonSrc:pylonsrc0:
streaming stopped, reason not-negotiated (-4)

i update all my lib, now i get this :

gst-launch-1.0 pylonsrc ! videoconvert ! autovideosink

error :
Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /GstPipeline:pipeline0/GstPylonSrc:pylonsrc0: Failed to create buffer. Additional debug info: ../ext/pylon/gstpylonsrc.cpp(993): gst_pylon_src_create (): /GstPipeline:pipeline0/GstPylonSrc:pylonsrc0: The buffer was incompletely grabbed. This can be caused by performance problems of the network hardware used, i.e., the network adapter, switch, or Ethernet cable. Buffer underruns can also cause image loss. To fix this, use the pylonGigEConfigurator tool to optimize your setup and use more buffers for grabbing in your application to prevent buffer underruns. Execution ended after 0:00:00.892215426 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ...

Hi Thomas,

Can you run the pipeline with the following environment variable:

GST_DEBUG=3

This should provide more information on why it is failing to start. Also, does it also fail if you connect the pylonsrc directly to a fakesink ?

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