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()