My goal is to mimic $ libcamera-still --width 1280 --height 1280 -o pi.jpg
which only available on Raspberry Pi 4B.
The problem is that the frame produced in NVIDIA Jetson Nano B01 is significantly poorer than the frame produced in Raspberry Pi 4B. This maybe because of gstreamer_pipeline
as I can’t find good documentation regarding this.
My expected result is that the resized frame have good detail when zoomed by 700%. This is because the frame produced in Raspberry Pi 4B have good detail when zoomed by 700%.
The actual result is that the resized frame do not have any detail.
Frame produced in Raspberry Pi 4B
Frame produced in Jetson Nano B01
What I’ve tried is:
- use this repository ArduCAM/Jetson_IMX519_Focus_Example (github.com)
- Then, rewrite the repository to only support some features that I need.
- Change the
gstreamer_pipeline
function
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=4656,
capture_height=3496,
# known issue:
# if the frame_rate is set to the suggested frame rate by `$ v4l2-ctl --list-formats-ext``
# the captured frame will have black pixels at the bottom of the frame.
# the solution:
# subtract the suggested frame rate by 1.
frame_rate=10-1,
display_width=1280,
display_height=1280
):
return (
f"nvarguscamerasrc sensor-id={sensor_id} ! "
f"video/x-raw(memory:NVMM),width=(int){capture_width},height=(int){capture_height},format=(string)NV12,framerate=(fraction){frame_rate}/1 ! "
# comment if prefer the crop strategy.
f"nvvidconv flip-method=0 ! "
# uncomment if prefer the crop strategy.
# f"nvvidconv flip-method=0 "
# f"left={int(capture_width/2 - display_width/2)} "
# f"right={int(capture_width/2 + display_width/2)} "
# f"top={int(capture_height/2 - display_height/2)} "
# f"bottom={int(capture_height/2 + display_height/2)} ! "
# f"video/x-raw,width=(int){display_width},height=(int){display_height},format=(string)BGRx ! "
# comment if prefer the crop strategy.
f"video/x-raw,width=(int){display_width},height=(int){display_height},format=(string)BGRx ! "
f"videoconvert ! "
f"video/x-raw,format=(string)BGR ! "
f"appsink"
)