Commit ca0ab1b7 authored by Bryce Hepner's avatar Bryce Hepner

graphs look much better now

parent 5981345f
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -204,7 +204,8 @@ def make_dictionary(tiff_image_path_list, num_bins=4, difference = True): ...@@ -204,7 +204,8 @@ def make_dictionary(tiff_image_path_list, num_bins=4, difference = True):
# plt.ylabel('Frequency') # plt.ylabel('Frequency')
# plt.title('Histogram of Pixel Values') # plt.title('Histogram of Pixel Values')
# plt.show() # plt.show()
bins = [21,32,48]
bins = [29,44,67]
# get the boundary # get the boundary
boundary = np.hstack((image_array[0,:],image_array[-1,:],image_array[1:-1,0],image_array[1:-1,-1])) boundary = np.hstack((image_array[0,:],image_array[-1,:],image_array[1:-1,0],image_array[1:-1,-1]))
...@@ -289,7 +290,7 @@ def huffman(tiff_image_path, num_bins=4, difference = True): ...@@ -289,7 +290,7 @@ def huffman(tiff_image_path, num_bins=4, difference = True):
# get the image_as_array, etc # get the image_as_array, etc
image_as_array, diff, error= predict_pix(tiff_image_path, difference) image_as_array, diff, error= predict_pix(tiff_image_path, difference)
bins = [21,32,48] bins = [29,44,67]
# get the boundary # get the boundary
boundary = np.hstack((image_as_array[0,:],image_as_array[-1,:],image_as_array[1:-1,0],image_as_array[1:-1,-1])) boundary = np.hstack((image_as_array[0,:],image_as_array[-1,:],image_as_array[1:-1,0],image_as_array[1:-1,-1]))
...@@ -547,15 +548,16 @@ if __name__ == "__main__": ...@@ -547,15 +548,16 @@ if __name__ == "__main__":
scenes = file_extractor("images") scenes = file_extractor("images")
images = image_extractor(scenes) images = image_extractor(scenes)
newnamesforlater = [] newnamesforlater = []
list_dic, bins = make_dictionary(images, 4, False) list_dic, bins = make_dictionary(images, 4, True)
file_sizes_new = [] file_sizes_new = []
file_sizes_old = [] file_sizes_old = []
# list_dic = np.load("first_dict.npy", allow_pickle="TRUE") # list_dic = np.load("first_dict.npy", allow_pickle="True")
bins = [21,32,48] bins = [29,44,67]
#otherbins = [21,32,48]
np.save("first_dict.npy", list_dic) np.save("first_dict.npy", list_dic)
for i in range(len(images)): for i in np.random.choice(len(images), 10):
image, new_error, diff = huffman(images[i], 4, False) image, new_error, diff = huffman(images[i], 4, True)
encoded_string = encoder(new_error, list_dic, diff, bins) encoded_string = encoder(new_error, list_dic, diff, bins)
inletters = bitstring_to_bytes(encoded_string) inletters = bitstring_to_bytes(encoded_string)
...@@ -576,7 +578,7 @@ if __name__ == "__main__": ...@@ -576,7 +578,7 @@ if __name__ == "__main__":
file_sizes_new.append(os.path.getsize("first_dict.npy")) file_sizes_new.append(os.path.getsize("first_dict.npy"))
print(np.sum(file_sizes_new)/np.sum(file_sizes_old)) print(np.sum(file_sizes_new)/np.sum(file_sizes_old))
# list_dic = np.load("first_dict.npy", allow_pickle="TRUE") # list_dic = np.load("first_dict.npy", allow_pickle="TRUE")
bins = [21,32,48] bins = [29,44,67]
# for i,item in enumerate(newnamesforlater): # for i,item in enumerate(newnamesforlater):
# print(item) # print(item)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment