Jetson 系列摄像头使用说明【以Jetson Nano为例】

1、连接摄像头

首先,把Nano的这个CSI接口的这个销子轻轻拔起,记住一定要小心,轻点儿!
Jetson 系列摄像头使用说明【以Jetson Nano为例】_第1张图片
之后将摄像头连接线,如下图所示的方式插入。
Jetson 系列摄像头使用说明【以Jetson Nano为例】_第2张图片
合上插销,连接完成!

2、硬件连接

第一步:将摄像头排线,金属面朝向散热板插入Jetson NVIDIA 开发套件上的摄像头接口;
第二步:启动Jetson NVIDIA;
第三步:测试摄像头;
第四步:打开终端(键盘按下Ctrl+ALT+T快捷键打开终端),输入以下指令测试摄像头;

3、测试摄像头

方法1

输入指令:

$ nvgstcapture

方法2

测试OpenCV

import cv2

def gstreamer_pipeline(
    capture_width=1280,
    capture_height=720,
    display_width=1280,
    display_height=720,
    framerate=60,
    flip_method=0,
):
    return (
        "nvarguscamerasrc ! "
        "video/x-raw(memory:NVMM), "
        "width=(int)%d, height=(int)%d, "
        "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"
        % (
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )
 
def show_camera():
    cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
 
    while cap.isOpened():
        flag, img = cap.read()
        cv2.imshow("CSI Camera", img)
        kk = cv2.waitKey(1)
 
        # do other things
 
        if kk == ord('q'):  # 按下 q 键,退出
            break
 
    cap.release()
    cv2.destroyAllWindows()
    
if __name__ == "__main__":
    show_camera()

你可能感兴趣的:(自动驾驶,opencv,人工智能,计算机视觉)