Python影像辨識筆記(一):使用Open CV辨識圖片及影片中的人臉
文章推薦指數: 80 %
圖片人. “Python影像辨識筆記(一):使用Open CV辨識圖片及影片中的人臉” is published by Yanwei Liu.
GetstartedOpeninappYanweiLiuSigninGetstarted1.3KFollowersAboutGetstartedOpeninappPython影像辨識筆記(一):使用OpenCV辨識圖片及影片中的人臉YanweiLiuApr25,2019·5minread以電影海報為例圖片人臉安裝模組pipinstallopencv-python偵測人臉importcv2#載入分類器face_cascade=cv2.CascadeClassifier('haarcascade_frontalface_default.xml')#讀取圖片img=cv2.imread('a.jpg')#轉成灰階圖片gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)#偵測臉部faces=face_cascade.detectMultiScale(gray,scaleFactor=1.08,minNeighbors=5,minSize=(32,32))#繪製人臉部份的方框for(x,y,w,h)infaces:cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)#(0,255,0)欄位可以變更方框顏色(Blue,Green,Red)#顯示成果cv2.namedWindow('img',cv2.WINDOW_NORMAL)#正常視窗大小cv2.imshow('img',img)#秀出圖片cv2.imwrite("result.jpg",img)#保存圖片cv2.waitKey(0)#等待按下任一按鍵cv2.destroyAllWindows()#關閉視窗scaleFactor:Parameterspecifyinghowmuchtheimagesizeisreducedateachimagescale.Increasingitleadstofasterdetectionwiththeriskofmissingsomeobjects,whereasasmallvaluemightsometimesbetoothorough.minNeighbors:Parameterspecifyinghowmanyneighborseachcandidaterectangleshouldhavetoretainit.Highervalueresultsinlessdetectionbutwithhigherquality.minSize:Minimumpossibleobjectsize.Objectssmallerthanthatareignored.maxSize:Maximumpossibleobjectsize.Objectslargerthanthatareignored.原始圖片影片人臉importcv2#載入分類器face_cascade=cv2.CascadeClassifier('haarcascade_frontalface_default.xml')#從視訊盡頭擷取影片cap=cv2.VideoCapture(0)或者....#使用現有影片cap=cv2.VideoCapture('filename.mp4')whileTrue:#Readtheframe_,img=cap.read()#轉成灰階gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)#偵測臉部faces=face_cascade.detectMultiScale(gray,1.1,4)#繪製人臉部份的方框for(x,y,w,h)infaces:cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)#顯示成果cv2.namedWindow('img',cv2.WINDOW_NORMAL)#正常視窗大小cv2.imshow('img',img)#秀出圖片#Stopifescapekeyispressedk=cv2.waitKey(30)&0xffifk==27:break#ReleasetheVideoCaptureobjectcap.release()cv2.destroyAllWindows()adarsh1021/facedetectionEasyfacedetectionusingopenCV.Contributetoadarsh1021/facedetectiondevelopmentbycreatinganaccountonGitHub.github.comPython與OpenCV基本讀取、顯示與儲存圖片教學-G.T.Wang這裡介紹如何使用Python與OpenCV讀取影像圖檔,以及將處理好的圖形寫入檔案。
首先引入NumPy與OpenCV的Python模組:OpenCV本身就有提供讀取圖片檔的函數可用,讀取一般的圖片檔,只要呼叫…blog.gtwang.org如何破解並繞過網頁上常見的Captcha驗證?以2CaptchaAPI為例2Captcha是一個非常強大的CAPTCHA辨識服務。
在我們日常生活當中,如果要登入網站(如:AWS的帳戶登入頁面),可能就會遇到需要手動輸入驗證碼的視窗,有些可能單純只是英文及數字的組合。
但是有些卻極度複雜,扭曲的字體及顏色,常常讓使用…yanwei-liu.medium.comYanweiLiuMachineLearning|DeepLearning|https://linktr.ee/yanweiFollow8686 86PythonArtificialIntelligenceMachineLearningImageRecognitionFacedetectionMorefromYanweiLiuFollowMachineLearning|DeepLearning|https://linktr.ee/yanwei
延伸文章資訊
- 1基於python語言使用OpenCV搭配dlib實作人臉偵測與辨識
基於python語言使用OpenCV搭配dlib實作人臉偵測與辨識. 簡介. OpenCV的全名是Open Source Computer Vision Library,是一個跨平台的 ...
- 2理解優缺點及應用概況人臉辨識簡易實作動手玩
人臉辨識技術的出現,使人們的生活方式大幅改變,新技術的問世雖然帶來了便利,但是也無法阻止那伴隨而來的問題,本文將透過Python程式語言和OpenCV ...
- 3用Python實現簡單的臉部辨識,10分鐘搞定!(附原始碼)
Python裡,簡單的臉部辨識有很多種方法可以實現,依賴於python膠水語言的特性,我們通過呼叫包可以快速準確的達成這一目的。這裡介紹的是準確性比較高的 ...
- 4[Day13] 使用OpenCV & Dlib作人臉偵測需要知道的一些事
[Computer Vision] 電腦視覺下的人臉系列第13 篇 ... 如果今天要做的只是人臉偵測或是人臉辨識,那你可以很安心的使用你喜歡的方法。
- 5OPENCV in Python 電腦視覺與人臉辨識入門教學
程式四:靜態人臉辨識 ... 擴增實境、臉部辨識、手勢辨識、人機互動、動作辨識、運動跟蹤、物 ... 也有大量的Python,Java and MATLAB/OCTAVE.