Skip to content

Instantly share code, notes, and snippets.

@yingted
Created September 15, 2013 04:03
Show Gist options
  • Save yingted/6567921 to your computer and use it in GitHub Desktop.
Save yingted/6567921 to your computer and use it in GitHub Desktop.
From UWaterloo Fall Orientation 2013 SCUNT
#!/usr/bin/python
from scipy.signal import *
from cv2 import *
from numpy import *
cap=VideoCapture(0)
cc=CascadeClassifier("/usr/share/OpenCV/haarcascades/haarcascade"
"_frontalface_default.xml")
face=imread("joshua_kalpin.png")
while cap.grab():
frame=cap.retrieve()[1]
for x,y,w,h in cc.detectMultiScale(frame):
frame[y:y+h,x:x+w]=floor(.5+resample(resample
(face,h),w,axis=1)).clip(0,255).astype("uint8")
imshow("output",frame)
waitKey(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment