# Help! Show coordinates face detection

Hi! i need calculate the distance between two o more faces (the faces are inside rectangle, because i am using facedetection code in python), and if two or more faces are together(rectangles together) then print " faces together". if(distance(face1 and face2)<= "n" pixel) {print "faces together"} #n = your calibrate distance. I do not know how translate this order to python language, somebody can help me? Thanks. this is the code:

i am using other code with opencv 2.4.9, this code:

#Ejemplo de deteccion facial con OpenCV y Python
#Por Glare
#www.robologs.net

import numpy as np
import cv2

#cargamos la plantilla e inicializamos la webcam:
cap = cv2.VideoCapture(0)

while(True):
#leemos un frame y lo guardamos

#convertimos la imagen a blanco y negro
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
#buscamos las coordenadas de los rostros (si los hay) y
#guardamos su posicion

for (x,y,w,h) in faces:
cv2.rectangle(img,(x,y),(x+w,y+h),(125,255,0),2)

#Mostramos la imagen
cv2.imshow('img',img)

#con la tecla 'q' salimos del programa
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2-destroyAllWindows()

edit retag close merge delete

oh, dear, unfortunately your code is horribly outdated. you must not use the arcane cv api(it is already gone in opencv3.0), but cv2.

(grabbing things from a 2010 blog is a terrible idea...)

so, before investing into any new code, rather look at the facedetect demo , tutorials , and refactor (better rewrite) your code.

then, let's start again...

( 2015-05-29 11:30:00 -0500 )edit

HI berak, I searched info in many websites and tutorial, the code is correct run, does not it the problem, the problem is find the coordenates of each rectangle, and calculate the distance between each rectangle, after, use conditional ( if distancia(rectangle1 and rectangle2<= "n pixel") print, "face together" n= measure selected for the user, do you can help me with that function? thanks

( 2015-05-29 20:34:17 -0500 )edit

not as long as you insist on doing the wrong thing

( 2015-05-30 02:38:55 -0500 )edit

i am using other code, do you can help me?

( 2015-06-01 11:16:31 -0500 )edit

Sort by ยป oldest newest most voted

more

Official site

GitHub

Wiki

Documentation