Opencv face detection outputs black

asked 2015-01-02 08:54:48 -0500

i am loading grayscale images into opencv to detect faces. The data comes from csv file with images in strings separated by spaces. i use pandas. I test loading array first 2images..

The issue is opencv outputs face detected images completely blackish.. It should draw a nice rectangle to detect the face. Please need some help.

import numpy as np
import cv2, cv

import numpy as np
import pandas as pd
import pylab as pl
from skimage import transform
from numpy import ravel

import pylab as pl

df = pd.read_csv('/users/prabhubalakrishnan/Desktop/training.csv', header=0)
df = df.interpolate()

x = df['Image'][:2].values

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

X = []

for k in xrange(len(x)):
    img = np.fromstring(x[k], dtype = np.uint8, sep=' ', count=96*96)
    X.append ( ravel(transform.resize (img.reshape(96,96) , (96,96))) )

edit retag flag offensive close merge delete