From 1bd5993aeb5cb84657cd1acb72f9b7c6e6c3553d Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Thu, 18 Oct 2018 12:45:55 +0100 Subject: Add training script with variable M --- image-to-array | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 image-to-array (limited to 'image-to-array') diff --git a/image-to-array b/image-to-array deleted file mode 100755 index 72abc5c..0000000 --- a/image-to-array +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -import numpy as np -import sys, os - -from PIL import Image; - -def jpg_image_to_array(image_path): - """ - Loads JPEG image into 3D Numpy array of shape - (width, height, channels) - """ - with Image.open(image_path) as image: - im_arr = np.frombuffer(image.tobytes(), dtype=np.uint8) - # im_arr = im_arr.reshape((image.size[1], image.size[0], 3)) - return im_arr - -def main(files): - for i in range(0, len(files)): - inputfile = files[i] - print(inputfile); - - if not os.path.exists(inputfile): - sys.exit('ERROR: File %s was not found!' % inputfile) - - print(jpg_image_to_array(inputfile)) - -if __name__ == "__main__": - if len(sys.argv) > 1: - main(sys.argv[1:]) - else: - print("%s: You must specify files to convert to vectors" % sys.argv[0]) - -# def compute_average_vector - -# def compute_covariance_of_normalised_faces -- cgit v1.2.3-54-g00ecf