Python3 Ubuntu

一、安装中文输入法

1.sudo apt install ibus-sunpinyin

2.点击右上角输入法,然后点击加号,输入yin添加进来,最后选中输入法即可

二、安装截屏软件

1.sudo apt install gnome-screenshot

三、安装opencv-python

1.pip3 install --upgrade pip3

2.pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ opencv-python --verbose

3.Successfully installed numpy-1.19.5 opencv-python-4.9.0.80

四、打开csi摄像头

python 复制代码
import cv2
import numpy as np

def gstreamer_pipeline0(
    capture_width=1280,
    capture_height=720,
    display_width=720,
    display_height=480,
    framerate=30,
    flip_method=0):
    return (
            "nvarguscamerasrc sensor-id=0 ! "
            "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 gstreamer_pipeline1(
    capture_width=1280,
    capture_height=720,
    display_width=1280,
    display_height=720,
    framerate=60,
    flip_method=0):
    return (
            "nvarguscamerasrc sensor-id=1 ! "
            "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():
    cap0 = cv2.VideoCapture(gstreamer_pipeline0(flip_method=0), cv2.CAP_GSTREAMER)
    #cap1 = cv2.VideoCapture(gstreamer_pipeline1(flip_method=0), cv2.CAP_GSTREAMER)
    while cap0.isOpened():
        flag0, frame0 = cap0.read()
	#flag1, frame1 = cap1.read()
        cv2.imshow("camera0", frame0)
	#cv2.imshow("camera1", frame1)
        k = cv2.waitKey(1)
        if k == ord('q'):
            break
    cap0.release()
    #cap1.release()
    cv2.destroyAllWindows()

if __name__ == '__main__':
    show_camera()
复制代码
我没k:
wget http://www.waveshare.net/w/upload/e/eb/Camera_overrides.tar.gz
tar zxvf Camera_overrides.tar.gz 
sudo cp camera_overrides.isp /var/nvidia/nvcam/settings/

我没k:
sudo chmod 664 /var/nvidia/nvcam/settings/camera_overrides.isp
sudo chown root:root /var/nvidia/nvcam/settings/camera_overrides.isp
相关推荐
guygg881 小时前
ubuntu手动编译VTK9.3 Generating qmltypes file 失败
linux·运维·ubuntu
诗意亭序4 小时前
ubuntu16.04 虚拟机与电脑共用wifi
ubuntu
scilwb5 小时前
Isaac Sim 4.5中iRobot Create 3机器人LightBeam传感器系统完整实现教程
ubuntu
applebomb10 小时前
没合适的组合wheel包,就自行编译flash_attn吧
python·ubuntu·attention·flash
Rudon滨海渔村12 小时前
解决阿里云ubuntu内存溢出导致vps死机无法访问 - 永久性增加ubuntu的swap空间 - 阿里云Linux实例内存溢出(OOM)问题修复方案
linux·运维·ubuntu
2401_8616152813 小时前
跨平台的ARM 和 x86 Docker 镜像:汇编语言实验环境搭建
linux·汇编·ubuntu·docker·容器
Ronin30514 小时前
【Linux系统】vim编辑器 | 编译器gcc/g++ | make/Makefile
linux·运维·服务器·ubuntu·编辑器·vim
Natsuagin16 小时前
【保姆级目标检测教程】Ubuntu 20.04 部署 YOLOv13 全流程(附训练/推理代码)
yolo·目标检测·ubuntu·计算机视觉
牧以南歌〆1 天前
在Ubuntu主机中修改ARM Linux开发板的根文件系统
linux·arm开发·驱动开发·ubuntu
cuijiecheng20181 天前
Ubuntu下布署mediasoup-demo
linux·运维·ubuntu