当前位置:网站首页>Opencv learning (II) -- installing opencv on raspberry pie
Opencv learning (II) -- installing opencv on raspberry pie
2022-06-25 10:21:00 【Fat brother, Miss Wang】
reason
Found the old raspberry pie , Bought a camera , See if you can do the same ubuntu Do face recognition like that , After all, considering the convenience of use . You can't use a computer to make a product .
Front face recognition with single chip microcomputer , It's quite simple , But for accuracy , It may still be relatively poor , You can fool me with a picture , You may need to add some infrared to identify the human body , But with that , Why do you have to use a face photo as a key , Use a complex photo , Would it be better , Just don't let others know what photos you use , Feel safer than your face , After all, the face is always exposed . It feels better to use a QR code .
Installation method
Don't talk much , Or how to install it on raspberry pie opencv-python Well .
The system is installed by official tools , Not here .
Refer to the A stray cat -《 Super simple to teach you how to install... On raspberry pie opencv( Two )》
However, it was not installed in his way opencv, It can also be used , It was installed in a few minutes .
But I don't know if there will be any lack of libraries , Follow up findings are being solved
So let's get started
Replace source
wget -qO- https://tech.biko.pub/resource/rpi-replace-apt-source-buster.sh | sudo bash
Upgrade software
sudo apt-get update
sudo apt-get upgrade
Installation Library
sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev
sudo apt-get install aptitude
sudo aptitude install libqtgui4
sudo apt-get install python3-pyqt5
sudo aptitude install libqt4-test
Note that some hints are not errors , Don't care
install opencv And upgrade numpy
sudo pip3 install opencv-python
pip3 install -U numpy
Other configuration
Turn on the camera
perform
sudo raspi-config
choice 3 Interface Options
And then camera and ssh open ,ssh Opening is convenient for transferring files .
Upload test files
I use it here. winscp Upload a previous test script , Test face recognition and camera
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# 1. Import library
import cv2
# 2. Load face model
faceModel = cv2.CascadeClassifier('/usr/local/lib/python3.9/dist-packages/cv2/data/haarcascade_frontalface_default.xml')
# 3. Turn on the camera
capture = cv2.VideoCapture(0)
# 4. Get the real-time picture of the camera
while True:
#4.1 Read the picture of each frame
ret,image = capture.read()
#4.2 Grayscale processing
gray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)
#4.3 Check the face
# faces = faceModel.detectMultiScale(gray,1.1,3,0)
faces = faceModel.detectMultiScale(
gray,
scaleFactor=1.15,
minNeighbors=5,
minSize=(5, 5),
# flags=cv2.cv.CV_HAAR_SCALE_IMAGE
)
print(" Find out {0} Personal face !".format(len(faces)))
#4.4 Mark the face
for(x,y,w,h) in faces:
# 1. Original picture 2. Face coordinate origin 3. Height of marker 4, Line color 5, Line width
cv2.rectangle(image,(x,y),(x+w,y+h),(0,255,0),2)
#4.5 display picture
cv2.imshow(' Face recognition camera ',image)
#4.6 Pause window
if cv2.waitKey(5) & 0xFF == ord('q'):
break
# 5. Release resources
capture.release()
# 6. Destruction of the window
cv2.destroyAllWindows()
effect
Unexpectedly, the master of dream was photographed so indistinctly .
The disadvantages of face recognition
At the beginning, we used face recognition to bring convenience and security , Later, someone used face recognition to kill people , Installed cameras in shopping malls , You can tell whether you are a first-time visitor or a regular visitor , So as to output pertinently .
Users who have done face recognition entry know , The acquiree needs to blink 、 Turn around 、 Open your mouth and other actions to cooperate with the collection “ Living information ”.
“ What kind of activation process is used for a picture , Ordinary people can make photos shake their heads 、 Blink .” Laodongyan, a professor of Law School of Tsinghua University, is right 《 China consumer daily 》 The reporters ,“ The level of software technology is relatively low .”
The human face is the most exposed biometric fingerprint , I feel that it is not suitable to use it as a security means to protect some important information .
Some people are good at forging , Some people try to solve it , Increase living judgment , Update algorithms and other technologies , But the feeling is always passive defense , It is difficult to treat symptoms in time .
Someone has begun to cheat AI 了 ,《 How to prevent face recognition ?》
Fawkes This tool can upload your photos , No machine learning . Download address
Conclusion
Yesterday, I read several college entrance examination Chinese questions ,
See what's going on ?
Put these questions together , The purpose is too obvious , The state wants our students , It has a solid foundation , And have the spirit of daring to innovate . Learn your own skills first , Learn how to do it again , Although there are Pavilion wings , But not just drunk .
The key is coming. !
The most gratifying thing for me is , This topic in Beijing , I was right ,
Look at my previous blog and you know , I have always emphasized that learning cannot be stopped !
Although it is a little late to understand , But still hope , People who see , Can keep a learning heart .
At least it has been affirmed by the government .
边栏推荐
- P2P network core technology: Gossip protocol
- 2台三菱PLC走BCNetTCP协议,能否实现网口无线通讯?
- Free platform for wechat applet making, steps for wechat applet making
- Neat Syntax Design of an ETL Language (Part 2)
- Kotlin keyword and operator
- 之前字符串反转的题目
- 什么是 CRA
- [today in history] June 24: Netease was established; The first consumer electronics exhibition was held; The first webcast in the world
- Basic use and cluster construction of consult
- 字符串 最长公共前缀
猜你喜欢
Free platform for wechat applet making, steps for wechat applet making
Webapi performance optimization
Free applet making tool, how to make wechat applet
How much does a small program cost? How much does a small program cost? It's clear at a glance
【RPC】I/O模型——BIO、NIO、AIO及NIO的Rector模式
浅谈二叉树
On binary tree
Get started quickly with jetpack compose Technology
Tiktok brand goes to sea: both exposure and transformation are required. What are the skills of information flow advertising?
Redis (I) principle and basic use
随机推荐
Consul的基本使用与集群搭建
Is GF Securities reliable? Is it legal? Is it safe to open a stock account?
DigiCert和GlobalSign单域名OV SSL证书对比评测
Kotlin Foundation
The title of my composition is - "my district head father"
Jetpack compose layout (II) - material components and layout
Computational Thinking and economic thinking
Etcd tutorial - Chapter 4 etcd cluster security configuration
clang frontend command failed with exit code 250
DDS learning notes of opendds
【论文阅读|深读】LINE: Large-scale Information Network Embedding
ScheduleMaster分布式任务调度中心基本使用和原理
Identityserver4 definition concept
Mongodb's principle, basic use, clustering and partitioned clustering
我的作文题目是——《我的区长父亲》
我希望按照我的思路尽可能将canvas基础讲明白
WPF 绑定表达式和绑定数据源(一)
之前字符串反转的题目
Flask blog practice - realize the latest articles and search in the sidebar
Kotlin keyword and operator