🔌 Let's Create Some Interesting Things By RasPi !
📖《The Official Raspberry Pi Handbook 2021》 : To help you get the most of out of your Raspberry Pi computer, this official Handbook features 200 pages of essential information, inspiring projects, practical tutorials, and definitive reviews.
# 摄像头
cap = cv2.VideoCapture(0)
# 人脸分类级联
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
# 人眼分类级联
eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_eye.xml')
# 获取摄像头拍摄到的画面
ret, frame = cap.read()
faces = face_cascade.detectMultiScale(frame, 1.3, 5)
img = frame
# 用人脸级联分类器引擎在人脸区域进行脸部识别
for (x, y, w, h) in faces:
# 画出人脸框, 蓝色, 画笔宽度为 2
img = cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
# 框选出人脸区域, 在人脸区域而不是全图中进行人眼检测, 节省计算资源
face_area = img[y:y + h, x:x + w]
eyes = eye_cascade.detectMultiScale(face_area, 1.3, 15)
# 用人眼级联分类器引擎在人脸区域进行人眼识别, 返回的 eyes 为眼睛坐标列表
for (ex, ey, ew, eh) in eyes:
# 画出人眼框, 绿色, 画笔宽度为 1
cv2.rectangle(face_area, (ex, ey), (ex + ew, ey + eh), (0, 255, 0), 1)
# 实时展示效果画面
cv2.imshow('Camera Frame', img)
📷 A simple face recognition program which base on Baidu AIP and output the voice prompt by Pyttsx3. [ github repo ]
# 百度语音播报今天天气状况
def Voice_broadcast(weather_forcast_txt):
weather_info = weather_forcast_txt
# 将天气信息推送到微信
if SendToWeChat(weather_forcast_txt):
weather_info = weather_info + \
'最后, 以上天气预报内容已通过「Server 酱」推送到了你的微信~'
else:
weather_info = weather_info + \
'注意: 以上天气预报内容无法通过「Server 酱」推送到你的微信!'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
result = client.synthesis(weather_info, 'zh', 1, {'vol': 5, 'per': 0})
if not isinstance(result, dict):
with open(BAIDU_TTS_MP3, 'wb') as f:
f.write(result)
f.close()
# 播放语音
subprocess.getoutput('mplayer .tts.mp3')
# 将获取的天气信息推送到微信
def SendToWeChat(weather_forecast_txt):
# text 为推送的 title, desp 为推送的 description
title = "天气预报来咯~"
content = weather_forecast_txt
data = {"text": title, "desp": content}
# 发送
return True if requests.post(SERVER_API, data=data).status_code == 200 else False
🌈 Get the weather information then ouput voice prompt and send it to your WeChat on the specified time. [ github repo ]
# Return ip address
def getIpAddress():
p = os.popen("hostname -I")
return p.readline().strip()
# Return CPU temperature as a character string
def getCPUtemperature():
res = os.popen('vcgencmd measure_temp').readline()
return (res.replace("temp=", "").replace("'C\n", ""))
# Return % of CPU used by user as a character string
def getCPUuse():
return (str(os.popen("top -n1 | awk '/Cpu\(s\):/ {print $2}'").readline().strip()))
👀 Get the system information of RasPi then ouput voice prompt and send it to your WeChat on the specified time. [ github repo ]
print('enter main')
while endSnow == False:
interrupted = False
detector = snowboydecoder.HotwordDetector('resources/snowboy.umdl', sensitivity=0.5)
print('等待唤醒')
detector.start(detected_callback=detected,
interrupt_check=interrupt_callback,
sleep_time=0.03)
my_record()
TOKEN = fetch_token()
speech = get_audio(FILEPATH)
result = speech2text(speech, TOKEN, int(80001))
if type(result) == str:
identifyComplete(result)
🔊 It's a simple voice assistant which base on RasPi、Snowboy and Baidu ASR~ [ github repo ]
✍ A simple personal blog system which base on vue, springboot framework and mysql8 database. [ github repo ]
✅ Let's the taks.go : it's a todo management which base on vue, gin framework and sqlite3 database. [ github repo ]
📁 A bijou file management tool and nothing framework be used on it so run it only by one command ! [ github repo ]
Welcome To Join RasPi Family And Share Your Project
hey guy if you want to join us please concat me via email or qq group