最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

樹莓派之人臉識(shí)別與智能家居

2023-05-09 23:20 作者:玟玟的大寶貝  | 我要投稿

訪問【W(wǎng)RITE-BUG數(shù)字空間】_[內(nèi)附完整源碼和文檔]

樹莓派加上攝像頭之后就可以拍照、錄視頻等各種功能了,這樣做一個(gè)樹莓派相機(jī)已經(jīng)是非常簡單的事情了。我們?cè)谶@里做一個(gè)簡單的人臉區(qū)域檢測的功能實(shí)驗(yàn),然后我們?cè)谙乱粋€(gè)實(shí)驗(yàn)讓樹莓派來控制風(fēng)扇轉(zhuǎn)動(dòng)。發(fā)現(xiàn)有人臉了,就開始轉(zhuǎn)動(dòng)風(fēng)扇。這也是生活中的一個(gè)場景,當(dāng)然加入實(shí)驗(yàn)3的溫度檢測根據(jù)溫度和人臉一起決定是否吹風(fēng)扇會(huì)更加精確化。

raspberry4

樹莓派之人臉識(shí)別與智能家居

樹莓派加上攝像頭之后就可以拍照、錄視頻等各種功能了,這樣做一個(gè)樹莓派相機(jī)已經(jīng)是非常簡單的事情了。我們?cè)谶@里做一個(gè)簡單的人臉區(qū)域檢測的功能實(shí)驗(yàn),然后我們?cè)谙乱粋€(gè)實(shí)驗(yàn)讓樹莓派來控制風(fēng)扇轉(zhuǎn)動(dòng)。發(fā)現(xiàn)有人臉了,就開始轉(zhuǎn)動(dòng)風(fēng)扇。這也是生活中的一個(gè)場景,當(dāng)然加入實(shí)驗(yàn) 3 的溫度檢測根據(jù)溫度和人臉一起決定是否吹風(fēng)扇會(huì)更加精確化。

實(shí)驗(yàn)材料準(zhǔn)備:原裝樹莓派 800?萬像素 CSI 攝像頭。

軟件:rasbian?系統(tǒng)、opencv

安裝必要的依賴庫:

安裝 OpenCV

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install libopencv-dev

sudo apt-get install python-opencv

安裝 PiCamera 庫:

sudo apt-get install python-pip

sudo apt-get install python-dev

sudo pip install picamera

測試人臉識(shí)別代碼

import io import picamera import CV2 import numpy # Create a memory stream so photos doesn't need to be saved in a file stream = io.BytesIO() # Get the picture (low resolution, so it should be quite fast) # Here you can also specify other parameters (e.g.:rotate the image) with picamera.PiCamera() as camera: ? ?camera.resolution = (320, 240) ? ?camera.capture(stream, format='jpeg') # Convert the picture into a numpy array buff = numpy.fromstring(stream.getvalue(), dtype=numpy.uint8) # Now creates an OpenCV image image = CV2.imdecode(buff, 1) # Load a cascade file for detecting faces face_cascade = CV2.CascadeClassifier('/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml') # Convert to grayscale gray = CV2.cvtColor(image,CV2.COLOR_BGR2GRAY) # Look for faces in the image using the loaded cascade file faces = face_cascade.detectMultiScale(gray, 1.1, 5) print "Found "+str(len(faces))+" face(s)" # Draw a rectangle around every found face for (x,y,w,h) in faces: CV2.rectangle(image,(x,y),(x+w,y+h),(255,255,0),2) # Save the result image CV2.imwrite('result.jpg',image) CV2.imshow('face_detect', image) c = CV2.waitKey(0) CV2.destroyAllWindows()


樹莓派之人臉識(shí)別與智能家居的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
廊坊市| 大冶市| 海晏县| 阳西县| 闽侯县| 贺州市| 古交市| 长阳| 宁津县| 柞水县| 巴彦淖尔市| 北宁市| 柏乡县| 紫金县| 东兰县| 文化| 思南县| 武川县| 靖远县| 新乐市| 开平市| 剑河县| 阿克苏市| 景谷| 达州市| 来宾市| 宁海县| 郓城县| 登封市| 孟津县| 霞浦县| 旌德县| 南木林县| 定州市| 班戈县| 双辽市| 荔波县| 通州区| 长葛市| 民县| 潢川县|