I have an error in #import numpy as np, why is that?
The code I am trying to run is this one: ( Microsoft Visual Studio Coomunity 2015, Open cv 3.1.0. and numpy is downloaded in directory C:)
PS: how can I copy-paste the code here so you can read it properly?
#import numpy as np
#import cv2
//cargamos la plantilla e inicializamos la webcam :
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
cap = cv2.VideoCapture(0)
while (True) :
//leemos un frame y lo guardamos
ret, img = cap.read()
//convertimos la imagen a blanco y negro
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
//buscamos las coordenadas de los rostros(si los hay) y
//guardamos su posicion
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
//Dibujamos un rectangulo en las coordenadas de cada rostro
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()
is that supposed to be python ? (then you'll have to go back and learn the language basics)
yes it is... I understand... thanks for the useful tip!