Upload face detection method
This commit is contained in:
		
							parent
							
								
									097c52a0a0
								
							
						
					
					
						commit
						bf9977e1c3
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -1,16 +1,19 @@
 | 
				
			||||||
import cv2 
 | 
					import cv2 
 | 
				
			||||||
import numpy as np 
 | 
					import numpy as np 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys,os,glob,numpy
 | 
					import sys,os,numpy
 | 
				
			||||||
 | 
					from glob import glob
 | 
				
			||||||
from skimage import io
 | 
					from skimage import io
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#read test photo 
 | 
					#read test photo 
 | 
				
			||||||
img = cv2.imread("C:/Users/fayer/OneDrive - University of Ottawa/CEG 4912/Project Test/data/photo4.jpg") 
 | 
					pwd  =  sys.path[0]
 | 
				
			||||||
 | 
					img = cv2.imread(pwd + "/Facial_test_images/photo2.jpg")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
color = (0, 255, 0)
 | 
					color = (0, 255, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
 | 
					grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
classfier = cv2.CascadeClassifier("C:/Users/fayer/OneDrive - University of Ottawa/CEG 4912/Project Test/model/haarcascade_frontalface_alt2.xml")
 | 
					classfier = cv2.CascadeClassifier(pwd + "/Facial_models/haarcascade_frontalface_alt2.xml")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
faceRects = classfier.detectMultiScale(grey, scaleFactor=1.2, minNeighbors=3, minSize=(32, 32)) 
 | 
					faceRects = classfier.detectMultiScale(grey, scaleFactor=1.2, minNeighbors=3, minSize=(32, 32)) 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue