I am using ridgerun’s IMX708 driver and got it to work no problem.
I want to create a python program that takes pictures and do some stuff with the picture captured. How im currently doing it is on the ridgerun’s guide they have an example pipeline for taking an image, which works and does captures and save the image :
gst-launch-1.0 nvarguscamerasrc num-buffers=1 sensor_id=0 ! 'video/x-raw(memory:NVMM), width=4608, height=2592, framerate=14/1, format=NV12' ! nvjpegenc ! filesink location=image.jpg
I then look for this file in my python script (stripped down):
import os
import time
#capture the image and save it to location
os.system("gst-launch-1.0 nvarguscamerasrc num-buffers=1 sensor_id=0 ! 'video/x-raw(memory:NVMM), width=4608, height=2592, framerate=14/1, format=NV12' ! nvjpegenc ! filesink location=image.jpg")
# Load image
time.sleep(0.5) # wait for the image to be created
fd = open('image.jpg','rb')
img_str = fd.read()
fd.close()
I do not like this method though as it would create a temporary file somewhere, and i foresee that this has a lot of failure points to protect against
Can anybody point me to guides/show an example of how to capture and image from the csi camera directly inside of python (Specifically python3.7)?