User:Pedro Sá Couto/Hackpact: Difference between revisions
(→NAME) |
|||
Line 10: | Line 10: | ||
=04= | =04= | ||
====Blocked Face==== | ====Blocked Face==== | ||
<gallery mode="packed" heights="130px"> | |||
File:0007.png | |||
</gallery> | |||
===My git=== | |||
https://git.xpub.nl/pedrosaclout/ | |||
<source lang="python"> | |||
import numpy as np | |||
import cv2 | |||
import time | |||
import datetime | |||
from pprint import pprint | |||
from PIL import Image | |||
import os, os.path | |||
import glob | |||
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') | |||
imgs = ['img/01.jpg','img/02.jpg','img/03.jpg','img/04.jpg','img/05.jpg','img/06.jpg','img/07.jpg','img/08.jpg','img/09.jpg'] | |||
pprint (imgs) | |||
d = 0 | |||
while True: | |||
#read selected image | |||
image = cv2.imread(imgs[d]) | |||
d+=1 | |||
imagegray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |||
faces = face_cascade.detectMultiScale(imagegray, 1.3, 5) | |||
for (x,y,w,h) in faces: | |||
cv2.rectangle(image,(x,y),(x+w,y+h),(0,0,0),-1) | |||
roi_gray = imagegray[y:y+h, x:x+w] | |||
roi_color = image[y:y+h, x:x+w] | |||
print ("Displaying image") | |||
cv2.imshow(('blocked%d.jpg'%d),image) | |||
print ("Writing image") | |||
cv2.imwrite(('blocked%d.jpg'%d),image) | |||
k = cv2.waitKey(5) & 0xff | |||
time.sleep(0.5) | |||
if k == 27: | |||
break | |||
cap.release() | |||
cv2.destroyAllWindows() | |||
</source> | |||
=05= | =05= |
Revision as of 15:54, 7 October 2019
01
Research station machine
02
Geo data
03
Sleep Heisenberg uncertanty principle
04
Blocked Face
My git
https://git.xpub.nl/pedrosaclout/
import numpy as np
import cv2
import time
import datetime
from pprint import pprint
from PIL import Image
import os, os.path
import glob
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
imgs = ['img/01.jpg','img/02.jpg','img/03.jpg','img/04.jpg','img/05.jpg','img/06.jpg','img/07.jpg','img/08.jpg','img/09.jpg']
pprint (imgs)
d = 0
while True:
#read selected image
image = cv2.imread(imgs[d])
d+=1
imagegray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(imagegray, 1.3, 5)
for (x,y,w,h) in faces:
cv2.rectangle(image,(x,y),(x+w,y+h),(0,0,0),-1)
roi_gray = imagegray[y:y+h, x:x+w]
roi_color = image[y:y+h, x:x+w]
print ("Displaying image")
cv2.imshow(('blocked%d.jpg'%d),image)
print ("Writing image")
cv2.imwrite(('blocked%d.jpg'%d),image)
k = cv2.waitKey(5) & 0xff
time.sleep(0.5)
if k == 27:
break
cap.release()
cv2.destroyAllWindows()