So I was trying a face detection program, and used this code below: import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('sachin.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray) for (ex,ey,ew,eh) in eyes: cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2) cv2.imshow('img',img) cv2.waitKey(0) cv2.destroyAllWindows() The code is actually from here and it did not do its job. It showed me the image, but did not mark the face or eyes. I'm working on Raspberry Pi with Rasbian Jessie OS. Here are some things I tried: I tried cv2.imshow('img',gray) and it showed the gray image, which means BRG => gray is good. I tried drawing a rectangle at a random place, so the cv2.rectangle function is good. I checked the OpenCV/data folder, both 'haarcascade_frontalface_default.xml' and 'haarcascade_eye.xml' files are there. I tried print (faces_cascade), and it returned CascadeClaasifier 0x741b48d0 I tried print (faces), and it returned (), which means nothing is inside this array. I have tried 4,5 images with different brightness, none of them worked I feel like the only part that could go wrong is this line: faces = face_cascade.detectMultiScale(gray, 1.3, 5) since print(faces) did not return any value. Could anyone help? Continue reading...