
树莓派
程序员正茂
好好干活
展开
-
Unity3d从树莓派拉取视频流
树莓派端python示例及代码import ioimport picameraimport loggingimport socketserverfrom threading import Conditionfrom http import serverPAGE="""\<html><head><title>Picamera MJPEG Streaming</title></head><body><i原创 2022-05-10 15:00:24 · 1805 阅读 · 4 评论 -
pyinstaller error loading python dll python37.dll
pyinstaller error loading python dll python37.dll解决方法:点击dist文件夹中的exe运行,不要点击build文件下的exe。原创 2022-01-21 09:52:40 · 3324 阅读 · 0 评论 -
opencv-python使用cvui编写界面
安装cvuipip install cvui说明文档中用到指针的地方,使用列表代替(如low_threshold = [5]),取值时为low_threshold[0]import cv2import numpy as npimport cvuiWINDOW_NAME = 'CVUI Test'cvui.init(WINDOW_NAME)low_threshold = [5]method = cv2.THRESH_BINARYcap = cv2.VideoCap...原创 2022-01-19 18:11:55 · 4496 阅读 · 0 评论 -
PyInstaller Pre-Compiled Bootloader Not Found and Build Fails
解决方法有两种1.使用低版本pyinstallersudo pip3 install pyinstaller==4.5 -i https://pypi.tuna.tsinghua.edu.cn/simple some-package2.编译Bootloadergit clone https://github.com/pyinstaller/pyinstallercd pyinstaller/bootloaderpython3 ./waf distclean all...原创 2022-01-13 16:15:14 · 473 阅读 · 0 评论 -
树莓派刷系统
1.磁盘命令diskpartlist diskselect disk 2cleancreate partition primaryactive2.用SDFormatter格式化3.Win32Disk刷系统4.刷完后,连接3.5寸屏(注意:2.4寸需要装驱动才能正常显示),开机初始化配置。...原创 2022-01-13 12:59:25 · 735 阅读 · 0 评论 -
Python树莓派TCP客户端
import os,sys,timeimport socketimport threading#接收来自服务端的消息def recv(): global client global ip global connect while True: try: byData = client.recv(30) except Exception as e: print("recei.原创 2021-06-21 14:38:45 · 546 阅读 · 0 评论 -
树莓派4b适配2.4英寸显示屏命令
一、安装及切换2.4寸屏显示sudo rm -rf LCD-showgit clone https://github.com/goodtft/LCD-show.git chmod -R 755 LCD-show cd LCD-show/sudo ./LCD24-show二、旋转180度cd LCD-show/sudo ./rotate.sh 180三、HDMI显示cd LCD-show/./LCD-hd...原创 2020-11-19 11:58:34 · 1004 阅读 · 0 评论 -
树莓派4b读取串口数据
import serialimport timeser = serial.Serial('/dev/ttyUSB0',9600,parity=serial.PARITY_NONE)if ser.isOpen()==0: ser.open()while ser.isOpen(): size = ser.inWaiting() if size !=0: response = ser.read(size) print(response)...原创 2020-11-16 16:52:23 · 7665 阅读 · 3 评论 -
树莓派常用命令
将文件件压缩成zipzip -r base.zip /home/pi/dist/base将zip解压unzip base.zip -d base原创 2020-11-14 18:02:55 · 529 阅读 · 0 评论 -
opencv-python 视频鼠标动态选择矩形区域ROI
opencv-python本身有个cv2.selectROI函数用于选择矩形区域ROI,但在只能用于静态图像中,在视频中会卡死。只能自定义实现了。import cv2 def OnMouseAction(event, x, y, flags, param): global img, position1, position2 if event == cv2.EVENT_LBUTTONDOWN:原创 2020-11-03 12:05:26 · 2468 阅读 · 3 评论 -
树莓派4b创建虚拟串口并写入数据(非阻塞)
1.创建虚拟串口使用python代码,创建两个虚拟串口(串口1和串口2),写串口1时串口2将收到消息,写串口2时串口1将收到消息。import ptyimport osimport selectdef mkpty(): # master1, slave = pty.openpty() slaveName1 = os.ttyname(slave) master2, slave = pty.openpty() slaveName2 = os.ttyn..原创 2020-11-02 11:33:05 · 1327 阅读 · 0 评论 -
树莓派4b将程序加入开机启动
一、将现有程序加入开机启动以Thonny Python IDE加入开机启动为例。先到/usr/share/applications文件夹找到Thonny Python IDE,点击右键选择【文件属性】选择该Thonny Python IDE快捷方式,点击左上角的【编辑(E)】【复制路径(H)】,执行如下命令,将该快捷方式复制到~/.config/autostart/目录下sudo cp /usr/share/applications/Thonny.desktop -a ~/.conf原创 2020-10-30 18:42:23 · 1565 阅读 · 3 评论 -
树莓派4b快速安装Opencv4.4
最近因为项目需要,需要在树莓派4b上安装OpenCV, 网上的方法需要用到CMake和OpenCV源代码编辑,装了一上午还没成功。只好重头再来,换种方法,采用下面的方法只需半小时左右即可完成安装。一、安装最新树莓派系统1.下载最新的操作系统,我这里用的是2020-08-20-raspios-buster-armhf-full二、连接启用摄像头2.开机设置初始化项目,执行以下两个命令。(需要下载几百兆的文件,时间稍长)sudo apt-get updatesudo apt-get up原创 2020-10-19 15:16:24 · 1407 阅读 · 4 评论