def read_image(filename):
    imarr = np.array([])
    try:
        im = Image.open(os.path.join(filename))
        im = im.convert("L") # convert to greyscale
        imarr = np.array(im, dtype=np.uint8)
    except __HOLE__ as (errno, strerror):
        print "I/O error({0}): {1}".format(errno, strerror)
    except:
        print "Cannot open image."
    return imarr
dataset/ETHPy150Open bytefish/facerec/py/facerec/util.py/read_image