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
相关推荐
迷路爸爸18040 分钟前
无sudo权限远程连接Ubuntu服务器安装TeX Live实操记录(适配VS Code+LaTeX Workshop,含路径选择与卸载方案)
java·服务器·ubuntu·latex
gsgbgxp3 小时前
通过tailscale配置ssh远程实现wsl系统VSCode编程
vscode·深度学习·ubuntu·ssh
搬砖者(视觉算法工程师)19 小时前
Ubuntu 24.04 LTS 系统上树莓派摄像头模块 v2.1(IMX219)的安装配置与故障排查
linux·数据库·ubuntu
拓云者也20 小时前
本文汇总了Linux 主流发行版Ubuntu的命令行操作指令集------包括零基础友好的常用命令分类整理,涵盖日常操作、系统管理、软件维护等核心场景
linux·运维·ubuntu
xiyuping2420 小时前
star2026视觉冬训任务书——利用Ubuntu与ROS1,打通控制与视觉全流程
linux·运维·ubuntu
乙酸氧铍1 天前
python 实现解压7z生成的zip分卷
linux·python·ubuntu·zip·7z
林深现海1 天前
二、如何在 ROS 2 仿真中实现四足机器人的 VLA(视觉-语言-动作)控制链路
linux·vscode·yolo·ubuntu·机器人
一只自律的鸡1 天前
【Linux驱动】Ubuntu基础 上篇
linux·ubuntu
苏三福1 天前
clawdbot 使用
linux·运维·ubuntu
yumenai_1 天前
【K8s 避坑指南】2026 最新 Kubernetes v1.28 + Containerd 安装全流程(内网/离线通用版)
ubuntu·云原生·容器·kubernetes·k8s