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
相关推荐
enyp807 小时前
麒麟系统(基于Ubuntu)上使用Qt编译时遇到“type_traits文件未找到”的错误
linux·qt·ubuntu
明天一定早睡早起7 小时前
Ubuntu20.04 Ollama 配置相关
ubuntu·llama
涵信16 小时前
第十二节:性能优化高频题-shallowRef/shallowReactive使用场景
linux·ubuntu·性能优化
浩浩测试一下17 小时前
网络安全实战指南:从安全巡检到权限维持的应急响应与木马查杀全(命令查收表)
linux·安全·web安全·ubuntu·网络安全·负载均衡·安全架构
跳跳糖炒酸奶18 小时前
第二章、Isaaclab强化学习包装器(1)
人工智能·python·算法·ubuntu·机器人
每日出拳老爷子20 小时前
[Linux运维] [Ubuntu/Debian]在Lightsail Ubuntu服务器上安装Python环境的完整指南
linux·运维·ubuntu·debian
爱吃猫的鱼ouou20 小时前
解决Ubuntu20.04重启出现显卡驱动异常的问题(操作记录)
服务器·ubuntu
浪裡遊21 小时前
TypeScript中的函数类型定义与类型约束
javascript·ubuntu·typescript
码农研究僧21 小时前
Ubuntu 磁盘空间占用清理(宝塔)
linux·运维·ubuntu
若疆赤云online21 小时前
window和ubuntu自签证书
linux·运维·ubuntu