贴个系统链接自己去下,我使用的2021-10-30-raspios-bullseye-arm64.img,刷机请自行找帖子。
官网树莓派64位地址
sudo raspi-config 修改接口使能ssh和vnc
64位系统只需要修改一个文件即可。32位复制会错误,进网站自行寻找。
阿里云源:https://developer.aliyun.com/mirror/debian?spm=a2c6h.13651102.0.0.13741b11xkP9S3
清华源:https://mirrors.tuna.tsinghua.edu.cn/help/debian/
sudo nano /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
sudo apt-get install python3-opencv
import cv2
import time
# 打开摄像头或视频文件
cap = cv2.VideoCapture(0, cv2.CAP_V4L)
# 初始化计时器
start_time = time.time()
frame_counter = 0
# 创建窗口并设置大小
cv2.namedWindow('Frame', cv2.WINDOW_NORMAL)
cv2.resizeWindow('Frame', 640, 480) # 设置窗口大小为 640x480 像素
# 循环读取图像
while True:
ret, frame = cap.read() # 读取图像帧
if not ret:
break
# 显示图像
cv2.imshow('Frame', frame)
# 更新帧数计数器
frame_counter += 1
# 按下 'q' 键退出循环
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# 计算帧率
end_time = time.time()
fps = frame_counter / (end_time - start_time)
# 打印帧率
print("FPS: {:.2f}".format(fps))
# 释放摄像头或关闭视频文件
cap.release()
# 关闭窗口
cv2.destroyAllWindows()
安装
sudo apt-get install libx264-dev libjpeg-dev
sudo apt-get install libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools \
gstreamer1.0-gl \
gstreamer1.0-gtk3
测试
gst-launch-1.0 libcamerasrc ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! autovideosink
离线下载包
下载链接
我的版本如下:这个系统默认python3.9 cp39 系统aarch64 ,按照顺序执行:
pip install torch-1.8.1-cp39-cp39-manylinux2014_aarch64.whl
sudo pip install --upgrade numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install torchvision-0.9.1-cp39-cp39-manylinux2014_aarch64.whl
简单测试:
python
import torch
print("PyTorch version:", torch.__version__)
#gpio安装
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
sudo apt-get install -f
#matplotlib安装
sudo apt-get install python3-matplotlib
sudo apt-get install python3-pil python3-pil.imagetk
https://github.com/Qengineering/PyTorch-Raspberry-Pi-64-OS
https://huaweicloud.csdn.net/63564514d3efff3090b5d03f.html#%E5%AE%89%E8%A3%85pytorch
https://zhuanlan.zhihu.com/p/446627852?utm_id=0&wd=&eqid=9a01630d0004c0eb00000002648ee021
https://blog.csdn.net/z3447643805/article/details/129834605?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-129834605-blog-105055856.235%5Ev38%5Epc_relevant_sort_base1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-129834605-blog-105055856.235%5Ev38%5Epc_relevant_sort_base1&utm_relevant_index=2
https://blog.csdn.net/m0_46324847/article/details/122766960
https://blog.csdn.net/z3447643805/article/details/129834605?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-129834605-blog-105055856.235%5Ev38%5Epc_relevant_sort_base1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-129834605-blog-105055856.235%5Ev38%5Epc_relevant_sort_base1&utm_relevant_index=2