def main(): os.environ['REQUESTS_CA_BUNDLE'] = \ PyInstallerUtils.resourcePath('cacert.pem') app = wx.App() luxocator = Luxocator( PyInstallerUtils.resourcePath('classifier.mat'), verboseSearchSession=False, verboseClassifier=False) luxocator.Show() app.MainLoop()
def main(): app = wx.App() recognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_human_faces.xml') cascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalface.xml') # Uncomment the next argument for Haar. 'cascades/haarcascade_frontalface_alt.xml') interactiveRecognizer = InteractiveRecognizer( recognizerPath, cascadePath, title='Interactive Human Face Recognizer') interactiveRecognizer.Show() app.MainLoop()
def main(): app = wx.App() recognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_cat_faces.xml') cascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalcatface.xml') # Uncomment the next argument for Haar with basic # features. 'cascades/haarcascade_frontalcatface.xml') # Uncomment the next argument for Haar with extended # features. #'cascades/haarcascade_frontalcatface_extended.xml') interactiveRecognizer = InteractiveRecognizer( recognizerPath, cascadePath, minNeighbors=8, title='Interactive Cat Face Recognizer') interactiveRecognizer.Show() app.MainLoop()
def main(): app = wx.App() recognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_cat_faces.xml') cascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalcatface.xml') # Uncomment the next argument for Haar with basic # features. #'cascades/haarcascade_frontalcatface.xml') # Uncomment the next argument for Haar with extended # features. 'cascades/haarcascade_frontalcatface_extended.xml') interactiveRecognizer = InteractiveRecognizer( recognizerPath, cascadePath, scaleFactor=1.2, minNeighbors=1, minSizeProportional=(0.125, 0.125), title='Interactive Cat Face Recognizer') interactiveRecognizer.Show() app.MainLoop()
def main(): humanCascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalface.xml') # Uncomment the next argument for Haar. 'cascades/haarcascade_frontalface_alt.xml') humanRecognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_human_faces.xml') if not os.path.isfile(humanRecognizerPath): sys.stderr.write('Human face recognizer not trained. Exiting.\n') return catCascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalcatface.xml') # Uncomment the next argument for Haar with basic # features. #'cascades/haarcascade_frontalcatface.xml') # Uncomment the next argument for Haar with extended # features. 'cascades/haarcascade_frontalcatface_extended.xml') catRecognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_cat_faces.xml') if not os.path.isfile(catRecognizerPath): sys.stderr.write('Cat face recognizer not trained. Exiting.\n') return print('What email settings shall we use to send alerts?') defaultSMTPServer = 'smtp.gmail.com:587' print('Enter SMTP server (default: %s):' % defaultSMTPServer) smtpServer = sys.stdin.readline().rstrip() if not smtpServer: smtpServer = defaultSMTPServer print('Enter username:'******'Enter password:'******'') defaultAddr = '*****@*****.**' % login print('Enter "from" email address (default: %s):' % defaultAddr) fromAddr = sys.stdin.readline().rstrip() if not fromAddr: fromAddr = defaultAddr print('Enter comma-separated "to" email addresses (default: %s):' % defaultAddr) toAddrList = sys.stdin.readline().rstrip().split(',') if toAddrList == ['']: toAddrList = [defaultAddr] print('Enter comma-separated "c.c." email addresses:') ccAddrList = sys.stdin.readline().rstrip().split(',') capture = cv2.VideoCapture(0) imageWidth, imageHeight = \ ResizeUtils.cvResizeCapture(capture, (1280, 720)) minImageSize = min(imageWidth, imageHeight) humanDetector = cv2.CascadeClassifier(humanCascadePath) humanRecognizer = cv2.face.LBPHFaceRecognizer_create() humanRecognizer.read(humanRecognizerPath) humanMinSize = (int(minImageSize * 0.25), int(minImageSize * 0.25)) humanMaxDistance = 25 catDetector = cv2.CascadeClassifier(catCascadePath) catRecognizer = cv2.face.LBPHFaceRecognizer_create() catRecognizer.read(catRecognizerPath) catMinSize = (int(minImageSize * 0.125), int(minImageSize * 0.125)) catMaxDistance = 25 while True: success, image = capture.read() if image is not None: grayImage = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) equalizedGrayImage = cv2.equalizeHist(grayImage) humanRects = humanDetector.detectMultiScale(equalizedGrayImage, scaleFactor=1.3, minNeighbors=4, minSize=humanMinSize) if recognizeAndReport(humanRecognizer, grayImage, humanRects, humanMaxDistance, 'human', smtpServer, login, password, fromAddr, toAddrList, ccAddrList): break catRects = catDetector.detectMultiScale(equalizedGrayImage, scaleFactor=1.2, minNeighbors=1, minSize=catMinSize) # Reject any cat faces that overlap with human faces. catRects = GeomUtils.difference(catRects, humanRects) if recognizeAndReport(catRecognizer, grayImage, catRects, catMaxDistance, 'cat', smtpServer, login, password, fromAddr, toAddrList, ccAddrList): break
def main(): app = wx.App() configPath = PyInstallerUtils.resourcePath('config.dat') livingHeadlights = LivingHeadlights(configPath) livingHeadlights.Show() app.MainLoop()
def main(): humanCascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalface.xml') # Uncomment the next argument for Haar. 'cascades/haarcascade_frontalface_alt.xml') humanRecognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_human_faces.xml') if not os.path.isfile(humanRecognizerPath): print >> sys.stderr, \ 'Human face recognizer not trained. Exiting.' return catCascadePath = PyInstallerUtils.resourcePath( # Uncomment the next argument for LBP. #'cascades/lbpcascade_frontalcatface.xml') # Uncomment the next argument for Haar with basic # features. #'cascades/haarcascade_frontalcatface.xml') # Uncomment the next argument for Haar with extended # features. 'cascades/haarcascade_frontalcatface_extended.xml') catRecognizerPath = PyInstallerUtils.resourcePath( 'recognizers/lbph_cat_faces.xml') if not os.path.isfile(catRecognizerPath): print >> sys.stderr, \ 'Cat face recognizer not trained. Exiting.' return capture = cv2.VideoCapture(0) imageWidth, imageHeight = \ ResizeUtils.cvResizeCapture(capture, (1280, 720)) minImageSize = min(imageWidth, imageHeight) humanDetector = cv2.CascadeClassifier(humanCascadePath) humanRecognizer = cv2.createLBPHFaceRecognizer() humanRecognizer.load(humanRecognizerPath) humanMinSize = (int(minImageSize * 0.25), int(minImageSize * 0.25)) humanMaxDistance = 25 catDetector = cv2.CascadeClassifier(catCascadePath) catRecognizer = cv2.createLBPHFaceRecognizer() catRecognizer.load(catRecognizerPath) catMinSize = (int(minImageSize * 0.125), int(minImageSize * 0.125)) catMaxDistance = 25 while True: success, image = capture.read() if image is not None: grayImage = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) equalizedGrayImage = cv2.equalizeHist(grayImage) humanRects = humanDetector.detectMultiScale( equalizedGrayImage, scaleFactor=1.3, minNeighbors=4, minSize=humanMinSize, flags=cv2.cv.CV_HAAR_SCALE_IMAGE) if recognizeAndReport(humanRecognizer, grayImage, humanRects, humanMaxDistance, 'human'): break catRects = catDetector.detectMultiScale( equalizedGrayImage, scaleFactor=1.2, minNeighbors=1, minSize=catMinSize, flags=cv2.cv.CV_HAAR_SCALE_IMAGE) # Reject any cat faces that overlap with human faces. catRects = GeomUtils.difference(catRects, humanRects) if recognizeAndReport(catRecognizer, grayImage, catRects, catMaxDistance, 'cat'): break