当前位置:网站首页>Opencv learning (II) -- installing opencv on raspberry pie
Opencv learning (II) -- installing opencv on raspberry pie
2022-06-10 06:58: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 .
边栏推荐
- 2022-2027 (New Edition) report on the prospect and future development of China's property rights trading industry
- How to get the small icon in the title on the website
- Notes for beginners
- 智能合并视频,随机合并视频封面,并预设新标题
- 在 Kubernetes 中基于 StatefulSet 部署 MySQL(下)
- Long press the page at the mobile terminal, do not copy text and single picture
- 小程序:滚动到页面顶部或者某个元素位置
- go-zero 微服务实战系列(二、服务拆分)
- Principe de l'algorithme d'extraction de l'ensemble d'éléments fréquents associés à l'alarme dans le cadre de l'exploitation et de l'entretien intelligents
- 告警消息何去何从?在飞书中飞起来
猜你喜欢

LabVIEW controls Arduino to realize infrared ranging (advanced chapter-6)

Nextcloud internal server error the server cannot complete your request workaround

Cython的使用

在 Kubernetes 中基于 StatefulSet 部署 MySQL(下)

Teleyecontroller v8.47 release changes socket framework

深度解析智能运维下告警关联频繁项集挖掘算法原理

我的作文题目是——《我的区长父亲》

Multiple solutions to one problem × 5 (array + circular linked list)

TeleyeControlor V8.16发布 完成注册表功能

智能合并视频,随机合并视频封面,并预设新标题
随机推荐
GO+VUE+PGSQL-家族管理系统项目结项
UFIDA OA vulnerability recurrence manual
Typecho模板 vCards/简约个性便的个人博客主题模板
Daily practice: Longest symmetric string (pay attention to the last two methods)
Spark avoids repeatedly parsing JSON for a column
Matlab: polynomial representation and its basic operations
Qt--- create dialog 2: quick dialog design
Matlab: 多项式表示及其基本运算
Longest common subsequence
小程序:通过getCurrentPages获取当前页面路由信息
Print linked list from end to end of sword finger offer
Principe de l'algorithme d'extraction de l'ensemble d'éléments fréquents associés à l'alarme dans le cadre de l'exploitation et de l'entretien intelligents
【宽度优先搜索】LeetCode1091二进制矩阵中的最短路径
原博客的地址
Notes for beginners
26. difference between mouseenter and mouseover
openGauss 数据库 ODBC 环境连接配置 (Windows)
一举刷新 54 个中文 NLP 任务基准,ERNIE3.0加持下的EasyDL可能是市面上最好用的NLP开发平台...
成功解决:ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing
scala fastjson 获取jsonArray中 某个key的最大值