Last active
November 25, 2016 10:26
-
-
Save rueedlinger/47fa1b49a9ab451da7384cfda66fa0f6 to your computer and use it in GitHub Desktop.
Raspberry Pi and OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fswebcam -r 800x600 input.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import numpy as np | |
import cv2 | |
print(cv2.__version__) | |
# install opencv-data | |
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') | |
img = cv2.imread('input.jpg') | |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
faces = face_cascade.detectMultiScale(gray, 1.3, 5) | |
for (x,y,w,h) in faces: | |
print('face found:', x, y) | |
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) | |
cv2.imwrite('output.jpg', img) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/pi | |
wget https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment