Siempre creciendo, siempre aprendiendo. Cultura Maker.

Ratio: 5 / 5

Inicio activadoInicio activadoInicio activadoInicio activadoInicio activado

Ok, estoy en  medio de la redacción de la serie de artículos intentando dar una visión para aprendices (básica y funcional, sobre todo) de Open CV en Python, y una de las cosas que quiero explicar en ella es la posibilidad de trabajar con librerías haarcascade que pueden detectar e incluso reconocer rasgos faciales. Como eso puede alargarse en el tiempo, y yo ahora mismo tengo que recoger a mis chiquillas del cole, no quiero dejar pasar la oportunidad de mostraros el código que podéis implementar para hacer esta tontuna:




Es una chorradica, pero espectacular. La idea es ir revisando las imágenes que envía la webcam, y si en algún momento detecta un rostro, recuadrarlo con un rectángulo, y reducir el tamaño de la ventana para que encaje con dicho rectángulo. Dicho de otro modo: tenemos una ventana dinámica que se redimensiona según acerquemos o alejemos nuestros jetos de la webcam.


Ya te digo que ando algo corto de tiempo. Aquí os dejo el código para que trasteéis. Cualquier duda, tiráis de comentario o me venís al Twitter:


import numpy as np
import cv2

cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')

    ret, frame =

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x,y,w,h) in faces:

    if cv2.waitKey(1) &0xFF == ord('q'):


Comparte este post

Submit to FacebookSubmit to Google PlusSubmit to TwitterSubmit to LinkedInEnviar a Menéame
0 #17 Cialis 20-11-2019 18:19
Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is valuable and all. Nevertheless imagine if
you added some great images or video clips to give your
posts more, "pop"! Your content is excellent but with pics and clips, this website
could certainly be one of the greatest in its field.
Very good blog!
0 #16 mobile legends cheat 20-11-2019 08:36
Fantastic website. Plenty of useful info here.
I'm sending it to several friends ans additionally sharing in delicious.
And naturally, thanks on your sweat!
0 #15 generic cialis 03-11-2019 02:53
It's very simple to find out any topic on web as compared
to textbooks, as I found this article at this site.
0 #14 cheap cialis 01-11-2019 00:47
It's going to be ending of mine day, however
before ending I am reading this great article to improve my knowledge.
0 #13 viagra cialis 28-10-2019 01:18
This post is worth everyone's attention. When can I find out
0 #12 buy cialis 25-10-2019 13:03
In fact when someone doesn't be aware of after that its up to other people that they will assist, so here it occurs.
0 #11 フェラチオ 25-10-2019 03:51
What's up, the whole thing is going sound here and ofcourse every one
is sharing data, that's really fine, keep up writing.
0 #10 viagra cialis 20-10-2019 06:40
Hi there! I know this is kinda off topic nevertheless I'd
figured I'd ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa?
My blog addresses a lot of the same topics as yours and
I think we could greatly benefit from each other. If you
are interested feel free to shoot me an e-mail. I look forward to hearing from you!
Great blog by the way!
0 #9 viagra cialis 19-10-2019 08:06
constantly i used to read smaller content that also clear their motive, and that is
also happening with this post which I am reading here.
0 #8 cialis online 17-10-2019 07:28
What's up friends, fastidious piece of writing and good arguments commented at this place, I am genuinely enjoying by these.
Escribir un comentario

Código de seguridad

Mientras navegas por esta web, posiblemente interactuemos con tu equipo mediante el uso de cookies. La actual legislación de la UE (European Union) me obliga a informarte de ello, caminante. We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of this site have already been set. To find out more about the cookies we use and how to delete them, see our privacy policy.

  I accept cookies from this site.
EU Cookie Directive Module Information