Commit 342c5f6e authored by Bryce Hepner's avatar Bryce Hepner

more renamings

parent 596da333
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -15,21 +15,21 @@ ...@@ -15,21 +15,21 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"5\n", "521\n",
"5\n", "263\n",
"0.30596738362283216\n" "0.4041653243824837\n"
] ]
} }
], ],
"source": [ "source": [
"scenes = file_extractor(\"betterimages\")\n", "scenes = file_extractor(\"images\")\n",
"images = image_extractor(scenes)\n", "images = image_extractor(scenes)\n",
"print(len(images))\n", "print(len(images))\n",
"newnamesforlater = []\n", "newnamesforlater = []\n",
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
" # with open(newname + \"_Compressed.txt\", 'wb') as f:\n", " # with open(newname + \"_Compressed.txt\", 'wb') as f:\n",
" # f.write(inletters)\n", " # f.write(inletters)\n",
" file_sizes_new.append((os.path.getsize(newname + \"_Compressed.txt\")))\n", " file_sizes_new.append((os.path.getsize(newname + \"_Compressed.txt\")))\n",
" # file_sizes_old.append((os.path.getsize(newname + \"RemovedFirstLine\" + \".tif\")))\n", " file_sizes_old.append((os.path.getsize(newname + \"RemovedFirstLine\" + \".tif\")))\n",
" file_sizes_old.append((os.path.getsize(newname + \".tiff\")))\n", " # file_sizes_old.append((os.path.getsize(newname + \".tiff\")))\n",
"file_sizes_new.append(os.path.getsize(\"first_dic.npy\"))\n", "file_sizes_new.append(os.path.getsize(\"first_dic.npy\"))\n",
"print(len(newnamesforlater))\n", "print(len(newnamesforlater))\n",
"print(np.sum(file_sizes_new)/np.sum(file_sizes_old))\n" "print(np.sum(file_sizes_new)/np.sum(file_sizes_old))\n"
...@@ -601,14 +601,14 @@ ...@@ -601,14 +601,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"263\n", "521\n",
"263\n" "263\n"
] ]
} }
......
...@@ -75,7 +75,7 @@ def predict_pix(tiff_image_path, difference = True): ...@@ -75,7 +75,7 @@ def predict_pix(tiff_image_path, difference = True):
A ndarray(3 X 3): system of equation A ndarray(3 X 3): system of equation
""" """
image_obj = Image.open(tiff_image_path) #Open the image and read it as an Image object image_obj = Image.open(tiff_image_path) #Open the image and read it as an Image object
image_array = np.array(image_obj).astype(int) #Convert to an array, leaving out the first row because the first row is just housekeeping data image_array = np.array(image_obj)[1:].astype(int) #Convert to an array, leaving out the first row because the first row is just housekeeping data
# image_array = image_array.astype(int) # image_array = image_array.astype(int)
# A = np.array([[3,0,-1],[0,3,3],[1,-3,-4]]) # the matrix for system of equation # A = np.array([[3,0,-1],[0,3,3],[1,-3,-4]]) # the matrix for system of equation
Ainv = np.array([[0.5,-0.5,-0.5],[-0.5,1.83333333,1.5],[0.5,-1.5,-1.5]]) Ainv = np.array([[0.5,-0.5,-0.5],[-0.5,1.83333333,1.5],[0.5,-1.5,-1.5]])
...@@ -523,8 +523,8 @@ if __name__ == "__main__": ...@@ -523,8 +523,8 @@ if __name__ == "__main__":
file_sizes_old = [] file_sizes_old = []
# list_dic = np.load("first_dic.npy", allow_pickle="TRUE") # list_dic = np.load("first_dic.npy", allow_pickle="TRUE")
bins = [21,32,48] bins = [21,32,48]
np.save("second_dic.npy", list_dic) np.save("first_dict.npy", list_dic)
for i in range(len(images)): for i in range(0,3):
image, new_error, diff = huffman(images[i], 4, False) image, new_error, diff = huffman(images[i], 4, False)
encoded_string = encoder(new_error, list_dic, diff, bins) encoded_string = encoder(new_error, list_dic, diff, bins)
......
File added
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