My goal is to use gstreamer pipeline instead of libcamera-still. The problem is that the frames generated by the gstreamer pipeline look concave.
Gstreamer Pipeline
def gstreamer_pipeline(
# Issue: the sensor format used by Raspberry Pi 4B and NVIDIA Jetson Nano B01 are different
# in Raspberry Pi 4B, this command
# $ libcamera-still --width 1280 --height 1280 --mode 1280:1280
# uses sensor format 2328x1748.
# However, v4l2-ctl --list-formats-ext do not have such format.
sensor_id=0,
capture_width=1920,
capture_height=1080,
display_width=640,
display_height=360,
framerate=21,
flip_method=0,
):
return (
"nvarguscamerasrc sensor-id=%d ! "
"video/x-raw(memory:NVMM),format=(string)NV12,framerate=(fraction)%d/1 ! "
"nvvidconv flip-method=%d ! "
"video/x-raw,width=(int)%d,height=(int)%d,format=(string)BGRx ! "
"videoconvert ! "
"video/x-raw,format=(string)BGR ! "
"appsink"
% (
sensor_id,
framerate,
flip_method,
display_width,
display_height
)
)
The result with gstreamer pipeline
The code I run to take frame
libcamera-still -t 5000 --width 1280 --height 1280 --mode 1280:1280 --autofocus-on-capture -o test.jpg