Commit 18a92d19 authored by Kelly Chang's avatar Kelly Chang

Kelly

parent 697f75e8
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 397,
"id": "76317b02", "id": "76317b02",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -72,14 +72,14 @@ ...@@ -72,14 +72,14 @@
" \"\"\"\n", " \"\"\"\n",
" tiff = []\n", " tiff = []\n",
" for im in images:\n", " for im in images:\n",
" if im[-7:-6] == num:\n", " if im[-7:-5] == num:\n",
" tiff.append(im)\n", " tiff.append(im)\n",
" return tiff" " return tiff"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 398,
"id": "be1ff8a1", "id": "be1ff8a1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 399,
"id": "8483903e", "id": "8483903e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 86, "execution_count": 400,
"id": "64a3a193", "id": "64a3a193",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -227,181 +227,690 @@ ...@@ -227,181 +227,690 @@
" return new_e" " return new_e"
] ]
}, },
{
"cell_type": "markdown",
"id": "c7104fbf",
"metadata": {},
"source": [
"### Huffman without dividing into bins"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 132, "execution_count": 401,
"id": "91879f19", "id": "a43f3f1c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"257\n" "0.444949904726781\n"
] ]
}, }
],
"source": [
"scenes = file_extractor()\n",
"images = image_extractor(scenes)\n",
"def huffman_nb(image):\n",
" origin, predict, diff, error, A = plot_hist(image)\n",
" image = Image.open(image)\n",
" image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n",
" image = image.astype(int)\n",
" \n",
" new_error = np.copy(image)\n",
" new_error[1:-1,1:-1] = np.reshape(error,(510, 638))\n",
" keep = new_error[0,0]\n",
" new_error[0,:] = new_error[0,:] - keep\n",
" new_error[-1,:] = new_error[-1,:] - keep\n",
" new_error[1:-1,0] = new_error[1:-1,0] - keep\n",
" new_error[1:-1,-1] = new_error[1:-1,-1] - keep\n",
" new_error[0,0] = keep\n",
" new_error = np.ravel(new_error)\n",
" \n",
" \n",
" \n",
" #ab_error = np.abs(new_error)\n",
" #string = [str(i) for i in ab_error]\n",
" string = [str(i) for i in new_error.astype(int)]\n",
" freq = dict(Counter(string))\n",
" \n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encoding = huffman_code_tree(node)\n",
" #encoded = [\"1\"+encoding[str(-i)] if i < 0 else \"0\"+encoding[str(i)] for i in error]\n",
" \n",
" # return the huffman dictionary\n",
" return encoding, new_error, image.reshape(-1)\n",
" \n",
" \n",
"def compress_rate_nb(image, error, encoding):\n",
" #original = original.reshape(-1)\n",
" #error = error.reshape(-1)\n",
" o_len = 0\n",
" c_len = 0\n",
" for i in range(0, len(original)):\n",
" o_len += len(bin(original[i])[2:])\n",
" c_len += len(encoding[str(int(error[i]))])\n",
"\n",
" \n",
" return c_len/o_len\n",
"\n",
"\n",
"encoding, error, image = huffman_nb(images[0])\n",
"print(compress_rate_nb(image, error, encoding))"
]
},
{
"cell_type": "markdown",
"id": "eac2f456",
"metadata": {},
"source": [
"### Huffman with dividing into non-uniform bins"
]
},
{
"cell_type": "code",
"execution_count": 407,
"id": "207b0bd2",
"metadata": {},
"outputs": [
{ {
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAD4CAYAAAAO9oq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7v7PIYilFdX9tnzqeAJ6rq451R87NsF+rI+Cjc6P1DH6e3FXAK2Nvqvws8BhwCvgn8Tuc56+mtHN8D/pr2re1h9drG3dn6eZLO2U30zib4bht35xCX898DR4DDbQVdOVXvQ14vRmK5DejtTfTOaPl2W0fvbPU3APuBo8BXgcuH2ONn6e1q/e+2zt42qD96Z7p8oi3rI3TOlBtiryO5vgJvo7fr6nD7bDrU1tV5WbZejkKS5G4iSZJhIEnCMJAkYRhIkjAMJEkYBpIkDANJEvB/DrQFsWZUkGEAAAAASUVORK5CYII=\n",
"text/plain": [ "text/plain": [
"<Figure size 432x288 with 1 Axes>" "0.44205322265625"
] ]
}, },
"metadata": { "execution_count": 407,
"needs_background": "light" "metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def huffman(image):\n",
" origin, predict, diff, error, A = plot_hist(image)\n",
" image = Image.open(image)\n",
" image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n",
" image = image.astype(int)\n",
"\n",
" \n",
" boundary = np.hstack((image[0,:],image[-1,:],image[1:-1,0],image[1:-1,-1]))\n",
" boundary = boundary - image[0,0]\n",
" boundary[0] = image[0,0]\n",
"\n",
" string = [str(i) for i in boundary]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode1 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff <= 25\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode2 = huffman_code_tree(node)\n",
"\n",
" \n",
" mask = diff > 25\n",
" new_error = error[mask]\n",
" mask2 = diff[mask] <= 40\n",
" string = [str(i) for i in new_error[mask2].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode3 = huffman_code_tree(node)\n",
" \n",
"\n",
" mask = diff > 40\n",
" new_error = error[mask]\n",
" mask2 = diff[mask] <= 70\n",
" string = [str(i) for i in new_error[mask2].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode4 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff > 70\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode5 = huffman_code_tree(node)\n",
"\n",
" \n",
" \n",
"\n",
" new_error = np.copy(image)\n",
" new_error[1:-1,1:-1] = np.reshape(error,(510, 638))\n",
" keep = new_error[0,0]\n",
" new_error[0,:] = new_error[0,:] - keep\n",
" new_error[-1,:] = new_error[-1,:] - keep\n",
" new_error[1:-1,0] = new_error[1:-1,0] - keep\n",
" new_error[1:-1,-1] = new_error[1:-1,-1] - keep\n",
" new_error[0,0] = keep\n",
" new_error = np.ravel(new_error)\n",
" \n",
" # return the huffman dictionary\n",
" return encode1, encode2, encode3, encode4, encode5, np.ravel(image), error, diff, boundary\n",
"\n",
"def compress_rate(image, error, diff, bound, encode1, encode2, encode3, encode4, encode5):\n",
" #original = original.reshape(-1)\n",
" #error = error.reshape(-1)\n",
" o_len = 0\n",
" c_len = 0\n",
" im = np.reshape(image,(512, 640))\n",
" real_b = np.hstack((im[0,:],im[-1,:],im[1:-1,0],im[1:-1,-1]))\n",
" original = im[1:-1,1:-1].reshape(-1)\n",
"\n",
" for i in range(0,len(bound)):\n",
" o_len += len(bin(real_b[i])[2:])\n",
" c_len += len(encode1[str(bound[i])])\n",
" \n",
" for i in range(0, len(original)):\n",
" o_len += len(bin(original[i])[2:])\n",
" if diff[i] <= 25:\n",
" c_len += len(encode2[str(int(error[i]))])\n",
"\n",
" if diff[i] <= 40 and diff[i] > 25:\n",
" c_len += len(encode3[str(int(error[i]))])\n",
" \n",
" if diff[i] <= 70 and diff[i] > 40:\n",
" c_len += len(encode4[str(int(error[i]))])\n",
" \n",
" if diff[i] > 70:\n",
" c_len += len(encode5[str(int(error[i]))])\n",
" \n",
" return c_len/o_len\n",
"scenes = file_extractor()\n",
"images = image_extractor(scenes)\n",
"encode1, encode2, encode3, encode4, encode5, image, error, diff, boundary = huffman(images[0])\n",
"compress_rate(image, error, diff, boundary, encode1, encode2, encode3, encode4, encode5)\n"
]
},
{
"cell_type": "markdown",
"id": "3a3f06a5",
"metadata": {},
"source": [
"### Huffman with dividing into uniform bins"
]
},
{
"cell_type": "code",
"execution_count": 415,
"id": "14075c94",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.4432273356119792"
]
}, },
"output_type": "display_data" "execution_count": 415,
}, "metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def huffman_u(image):\n",
" origin, predict, diff, error, A = plot_hist(image)\n",
" image = Image.open(image)\n",
" image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n",
" image = image.astype(int)\n",
"\n",
" \n",
" boundary = np.hstack((image[0,:],image[-1,:],image[1:-1,0],image[1:-1,-1]))\n",
" boundary = boundary - image[0,0]\n",
" boundary[0] = image[0,0]\n",
"\n",
" string = [str(i) for i in boundary]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode1 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff <= 100\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode2 = huffman_code_tree(node)\n",
"\n",
" \n",
" mask = diff > 100\n",
" #new_error = error[mask]\n",
" #mask2 = diff[mask] <= 200\n",
" #string = [str(i) for i in new_error[mask2].astype(int)]\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode3 = huffman_code_tree(node)\n",
" \n",
"\n",
" '''mask = diff > 200\n",
" new_error = error[mask]\n",
" mask2 = diff[mask] <= 300\n",
" string = [str(i) for i in new_error[mask2].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode4 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff > 300\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode5 = huffman_code_tree(node)'''\n",
"\n",
" \n",
" \n",
"\n",
" new_error = np.copy(image)\n",
" new_error[1:-1,1:-1] = np.reshape(error,(510, 638))\n",
" keep = new_error[0,0]\n",
" new_error[0,:] = new_error[0,:] - keep\n",
" new_error[-1,:] = new_error[-1,:] - keep\n",
" new_error[1:-1,0] = new_error[1:-1,0] - keep\n",
" new_error[1:-1,-1] = new_error[1:-1,-1] - keep\n",
" new_error[0,0] = keep\n",
" new_error = np.ravel(new_error)\n",
" \n",
" # return the huffman dictionary\n",
" #return encode1, encode2, encode3, encode4, encode5, np.ravel(image), error, diff, boundary\n",
" return encode1, encode2, encode3, np.ravel(image), error, diff, boundary\n",
"\n",
"#def compress_rate_u(image, error, diff, bound, encode1, encode2, encode3, encode4, encode5):\n",
"def compress_rate_u(image, error, diff, bound, encode1, encode2, encode3):\n",
" #original = original.reshape(-1)\n",
" #error = error.reshape(-1)\n",
" o_len = 0\n",
" c_len = 0\n",
" im = np.reshape(image,(512, 640))\n",
" real_b = np.hstack((im[0,:],im[-1,:],im[1:-1,0],im[1:-1,-1]))\n",
" original = im[1:-1,1:-1].reshape(-1)\n",
"\n",
" for i in range(0,len(bound)):\n",
" o_len += len(bin(real_b[i])[2:])\n",
" c_len += len(encode1[str(bound[i])])\n",
" \n",
" for i in range(0, len(original)):\n",
" o_len += len(bin(original[i])[2:])\n",
" if diff[i] <= 100:\n",
" c_len += len(encode2[str(int(error[i]))])\n",
" \n",
" if diff[i] > 100:\n",
" c_len += len(encode3[str(int(error[i]))])\n",
"\n",
" '''if diff[i] <= 200 and diff[i] > 100:\n",
" c_len += len(encode3[str(int(error[i]))])'''\n",
" \n",
" '''if diff[i] <= 300 and diff[i] > 200:\n",
" c_len += len(encode4[str(int(error[i]))])\n",
" \n",
" if diff[i] > 300:\n",
" c_len += len(encode5[str(int(error[i]))])'''\n",
" \n",
" return c_len/o_len\n",
"scenes = file_extractor()\n",
"images = image_extractor(scenes)\n",
"encode1, encode2, encode3, image, error, diff, boundary = huffman_u(images[0])\n",
"compress_rate_u(image, error, diff, boundary, encode1, encode2, encode3)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f8b93cc5",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 417,
"id": "6abed5da",
"metadata": {},
"outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-154.0\n", "Compression rate of huffman with different bins: 0.44946919759114584\n",
"197.0\n" "Compression rate of huffman without bins: 0.4513634314749933\n",
"Compression rate of huffman with uniform bins: 0.44956921895345053\n"
] ]
} }
], ],
"source": [ "source": [
"scenes = file_extractor()\n", "scenes = file_extractor()\n",
"images = image_extractor(scenes)\n", "images = image_extractor(scenes)\n",
"origin, predict, diff, error, A = plot_hist(images[0])\n", "num_images = im_distribution(images, \"_9\")\n",
"image = Image.open(images[0]) #Open the image and read it as an Image object\n", "rate = []\n",
"image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n", "rate_nb = []\n",
"image = image.astype(int)\n", "rate_u = []\n",
"print(len(set(list(error))))\n", "for i in range(len(num_images)):\n",
"plt.hist(error,100)\n", " encode1, encode2, encode3, encode4, encode5, image, error, diff, bound = huffman(num_images[i])\n",
"plt.show()\n", " r = compress_rate(image, error, diff, bound, encode1, encode2, encode3, encode4, encode5)\n",
"print(min(error))\n", " rate.append(r)\n",
"print(max(error))" " encoding, error, image = huffman_nb(num_images[i])\n",
" r = compress_rate_nb(image, error, encoding)\n",
" rate_nb.append(r)\n",
" encode1, encode2, encode3, image, error, diff, bound = huffman_u(num_images[i])\n",
" r = compress_rate_u(image, error, diff, bound, encode1, encode2, encode3)\n",
" rate_u.append(r)\n",
" \n",
"print(f\"Compression rate of huffman with different bins: {np.mean(rate)}\")\n",
"print(f\"Compression rate of huffman without bins: {np.mean(rate_nb)}\")\n",
"print(f\"Compression rate of huffman with uniform bins: {np.mean(rate_u)}\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 145, "execution_count": 427,
"id": "207b0bd2", "id": "15eecad3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAD4CAYAAAAO9oqkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVyUlEQVR4nO3db4yd5X3m8e9VHAhKC7bD1ItsZ+2obiqSVQhMwVG6VYo3xkAU86JFRKvipSzeDSRKtJW6TvPCu9BIkEpLYiklQuBit2mJQ5PFClB36iTd3RcGhj+BAGE9EBBjAXZjA+2igkh+++LchsNwZuYY22dm7O9HOjr383vu55n75oy5zvPnnElVIUk6vv3STA9AkjTzDANJkmEgSTIMJEkYBpIkYN5MD+CdOu2002rZsmUzPQxJmjPuv//+f6yqoV7r5mwYLFu2jNHR0ZkehiTNGUmemWzdtKeJknwgyUNdj5eTfCHJwiQjSXa35wWtf5JsSjKW5OEkZ3Xta13rvzvJuq762UkeadtsSpLDnbQkqX/ThkFVPVFVZ1bVmcDZwCvAd4ENwM6qWgHsbMsAFwAr2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JK8i04QfLOqvtPKLyQ5vaqea6caDp5unc3z/BjwqSQXAu8GTqHzN1HmJ5nX3v13j/fgXMaTzANOBX42+GFPahwYr6p72vLtdMJgMK/NTF8wOQIXXP4zcE1r/zqdw6YAH+StFyifonPRb15rL+fNC38fnOl5TDK3p3nzAvJFvPVi0b2tvhD4KZ2Lxwtae+FMj71rDmvofBX50IT6nH595so4e4w7wFbgqxPqf8pbL1J+Zarfu9n2oPOG6OAF5G/z1gvIV7X21bz1AvK2mR53j3n8b+ADrf3f2usykNdmxid/BP7jnQj8JfBj4AHgvK51X6Jzx8cTwAVd9Qvp3EXxJJ1TGTM+j0nm1h0GofMHgJ4EHgGGu/r9AZ0LsGPA5TM97glzGKMT0A+1xzeOoddnToxzwph/i86NCQ93vSYX0jl3vhPYTefuvIXT/d7NpseEMHg/cG/73fs2b95p+O62PNbWv3+mx91jHmcCo+31+Z903uAN5LXx6ygkScfE3USSpMNkGEiSDANJkmEgScIwkCRhGEiSMAwkScD/B/uJlQ2NeHvcAAAAAElFTkSuQmCC\n",
"text/plain": [ "text/plain": [
"<Figure size 432x288 with 1 Axes>" "0.44225341796875"
] ]
}, },
"metadata": { "execution_count": 427,
"needs_background": "light" "metadata": {},
}, "output_type": "execute_result"
"output_type": "display_data" }
}, ],
"source": [
"def huffman(image):\n",
" origin, predict, diff, error, A = plot_hist(image)\n",
" image = Image.open(image)\n",
" image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n",
" image = image.astype(int)\n",
"\n",
" \n",
" boundary = np.hstack((image[0,:],image[-1,:],image[1:-1,0],image[1:-1,-1]))\n",
" boundary = boundary - image[0,0]\n",
" boundary[0] = image[0,0]\n",
"\n",
" string = [str(i) for i in boundary]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode1 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff <= 10\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode2 = huffman_code_tree(node)\n",
"\n",
" \n",
" mask = diff > 10\n",
" new_error = error[mask]\n",
" mask2 = diff[mask] <= 25\n",
" string = [str(i) for i in new_error[mask2].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode3 = huffman_code_tree(node)\n",
" \n",
"\n",
" mask = diff > 25\n",
" new_error = error[mask]\n",
" mask2 = diff[mask] <= 45\n",
" string = [str(i) for i in new_error[mask2].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode4 = huffman_code_tree(node)\n",
" \n",
" \n",
" mask = diff > 45\n",
" string = [str(i) for i in error[mask].astype(int)]\n",
" freq = dict(Counter(string))\n",
" freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
" node = make_tree(freq)\n",
" encode5 = huffman_code_tree(node)\n",
"\n",
" \n",
" \n",
"\n",
" new_error = np.copy(image)\n",
" new_error[1:-1,1:-1] = np.reshape(error,(510, 638))\n",
" keep = new_error[0,0]\n",
" new_error[0,:] = new_error[0,:] - keep\n",
" new_error[-1,:] = new_error[-1,:] - keep\n",
" new_error[1:-1,0] = new_error[1:-1,0] - keep\n",
" new_error[1:-1,-1] = new_error[1:-1,-1] - keep\n",
" new_error[0,0] = keep\n",
" new_error = np.ravel(new_error)\n",
" \n",
" # return the huffman dictionary\n",
" return encode1, encode2, encode3, encode4, encode5, np.ravel(image), error, diff, boundary\n",
"\n",
"def compress_rate(image, error, diff, bound, encode1, encode2, encode3, encode4, encode5):\n",
" #original = original.reshape(-1)\n",
" #error = error.reshape(-1)\n",
" o_len = 0\n",
" c_len = 0\n",
" im = np.reshape(image,(512, 640))\n",
" real_b = np.hstack((im[0,:],im[-1,:],im[1:-1,0],im[1:-1,-1]))\n",
" original = im[1:-1,1:-1].reshape(-1)\n",
"\n",
" for i in range(0,len(bound)):\n",
" o_len += len(bin(real_b[i])[2:])\n",
" c_len += len(encode1[str(bound[i])])\n",
" \n",
" for i in range(0, len(original)):\n",
" o_len += len(bin(original[i])[2:])\n",
" if diff[i] <= 10:\n",
" c_len += len(encode2[str(int(error[i]))])\n",
"\n",
" if diff[i] <= 25 and diff[i] > 10:\n",
" c_len += len(encode3[str(int(error[i]))])\n",
" \n",
" if diff[i] <= 45 and diff[i] > 25:\n",
" c_len += len(encode4[str(int(error[i]))])\n",
" \n",
" if diff[i] > 45:\n",
" c_len += len(encode5[str(int(error[i]))])\n",
" \n",
" return c_len/o_len\n",
"scenes = file_extractor()\n",
"images = image_extractor(scenes)\n",
"encode1, encode2, encode3, encode4, encode5, image, error, diff, boundary = huffman(images[0])\n",
"compress_rate(image, error, diff, boundary, encode1, encode2, encode3, encode4, encode5)\n"
]
},
{
"cell_type": "code",
"execution_count": 428,
"id": "f8a8c717",
"metadata": {},
"outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"458\n", "Compression rate of huffman with different bins: 0.4488415273030599\n"
"{'61': '000000000', '87': '000000001000', '140': '000000001001000', '142': '000000001001001', '250': '000000001001010', '179': '000000001001011', '151': '000000001001100', '207': '0000000010011010', '141': '0000000010011011', '101': '00000000100111', '77': '00000000101', '69': '0000000011', '53': '00000001', '44': '0000001', '33': '000001', '20': '00001', '19': '00010', '18': '00011', '43': '0010000', '75': '00100010000', '84': '001000100010', '104': '00100010001100', '122': '001000100011010', '120': '001000100011011', '94': '0010001000111', '83': '001000100100', '153': '001000100101000', '130': '001000100101001', '143': '001000100101010', '127': '001000100101011', '93': '0010001001011', '115': '0010001001100000', '375': '0010001001100001', '366': '0010001001100010', '373': '0010001001100011', '377': '0010001001100100', '314': '0010001001100101', '402': '0010001001100110', '367': '0010001001100111', '133': '0010001001101000', '210': '0010001001101001', '334': '0010001001101010', '298': '0010001001101011', '176': '0010001001101100', '332': '0010001001101101', '335': '0010001001101110', '362': '0010001001101111', '371': '0010001001110000', '333': '0010001001110001', '251': '0010001001110010', '226': '0010001001110011', '247': '0010001001110100', '315': '0010001001110101', '304': '0010001001110110', '258': '0010001001110111', '306': '0010001001111000', '261': '0010001001111001', '289': '0010001001111010', '372': '0010001001111011', '239': '0010001001111100', '252': '0010001001111101', '224': '0010001001111110', '205': '0010001001111111', '60': '001000101', '52': '00100011', '32': '001001', '17': '00101', '51': '00110000', '139': '001100010000000', '149': '001100010000001', '132': '001100010000010', '154': '001100010000011', '163': '001100010000100', '162': '001100010000101', '281': '001100010000110', '346': '001100010000111', '384': '00110001000100000', '331': '00110001000100001', '383': '00110001000100010', '155': '00110001000100011', '354': '00110001000100100', '456': '00110001000100101', '229': '00110001000100110', '388': '00110001000100111', '294': '00110001000101000', '413': '00110001000101001', '211': '00110001000101010', '292': '00110001000101011', '376': '00110001000101100', '382': '00110001000101101', '387': '00110001000101110', '309': '00110001000101111', '158': '001100010001100', '159': '001100010001101', '313': '00110001000111000', '126': '00110001000111001', '327': '00110001000111010', '319': '00110001000111011', '302': '00110001000111100', '330': '00110001000111101', '385': '00110001000111110', '573': '00110001000111111', '76': '00110001001', '214': '0011000101000000', '259': '0011000101000001', '243': '0011000101000010', '255': '0011000101000011', '410': '0011000101000100', '399': '0011000101000101', '134': '0011000101000110', '270': '0011000101000111', '216': '0011000101001000', '236': '0011000101001001', '213': '0011000101001010', '196': '0011000101001011', '290': '0011000101001100', '231': '0011000101001101', '128': '0011000101001110', '193': '0011000101001111', '169': '0011000101010000', '178': '0011000101010001', '328': '0011000101010010', '160': '0011000101010011', '394': '0011000101010100', '336': '0011000101010101', '204': '0011000101010110', '227': '0011000101010111', '200': '0011000101011000', '212': '0011000101011001', '352': '0011000101011010', '147': '0011000101011011', '342': '0011000101011100', '308': '0011000101011101', '329': '0011000101011110', '379': '0011000101011111', '221': '00110001011000000', '267': '00110001011000001', '269': '001100010110000100', '177': '001100010110000101', '220': '001100010110000110', '202': '001100010110000111', '225': '00110001011000100', '185': '00110001011000101', '170': '00110001011000110', '198': '00110001011000111', '429': '001100010110010000', '206': '001100010110010001', '426': '001100010110010010', '438': '001100010110010011', '403': '001100010110010100', '424': '001100010110010101', '299': '001100010110010110', '325': '001100010110010111', '237': '001100010110011000', '152': '001100010110011001', '145': '001100010110011010', '230': '001100010110011011', '411': '001100010110011100', '286': '001100010110011101', '374': '001100010110011110', '469': '001100010110011111', '293': '00110001011010000', '406': '00110001011010001', '407': '00110001011010010', '421': '00110001011010011', '301': '00110001011010100', '275': '00110001011010101', '423': '00110001011010110', '395': '00110001011010111', '244': '00110001011011000', '337': '00110001011011001', '300': '00110001011011010', '233': '00110001011011011', '322': '00110001011011100', '400': '00110001011011101', '253': '00110001011011110', '361': '00110001011011111', '297': '001100010111000000', '390': '001100010111000001', '444': '001100010111000010', '242': '001100010111000011', '606': '001100010111000100', '498': '001100010111000101', '397': '001100010111000110', '532': '001100010111000111', '209': '001100010111001000', '283': '001100010111001001', '430': '001100010111001010', '351': '001100010111001011', '539': '001100010111001100', '530': '001100010111001101', '256': '001100010111001110', '491': '001100010111001111', '511': '001100010111010000', '570': '001100010111010001', '559': '001100010111010010', '478': '001100010111010011', '359': '001100010111010100', '22554': '001100010111010101', '512': '001100010111010110', '503': '001100010111010111', '474': '001100010111011000', '489': '001100010111011001', '404': '001100010111011010', '380': '001100010111011011', '519': '001100010111011100', '568': '001100010111011101', '515': '001100010111011110', '543': '001100010111011111', '439': '001100010111100000', '418': '001100010111100001', '419': '001100010111100010', '425': '001100010111100011', '454': '001100010111100100', '228': '001100010111100101', '447': '001100010111100110', '452': '001100010111100111', '414': '001100010111101000', '435': '001100010111101001', '416': '001100010111101010', '345': '001100010111101011', '401': '001100010111101100', '440': '001100010111101101', '409': '001100010111101110', '350': '001100010111101111', '494': '001100010111110000', '482': '001100010111110001', '502': '001100010111110010', '393': '001100010111110011', '422': '001100010111110100', '370': '001100010111110101', '461': '001100010111110110', '369': '001100010111110111', '398': '001100010111111000', '445': '001100010111111001', '203': '001100010111111010', '249': '001100010111111011', '405': '001100010111111100', '486': '001100010111111101', '467': '001100010111111110', '470': '001100010111111111', '68': '0011000110', '74': '00110001110', '91': '0011000111100', '114': '001100011110100', '307': '001100011110101', '199': '001100011110110', '110': '001100011110111', '89': '0011000111110', '109': '00110001111110', '105': '001100011111110', '150': '0011000111111110', '129': '0011000111111111', '42': '0011001', '31': '001101', '16': '00111', '15': '01000', '67': '0100100000', '66': '0100100001', '59': '010010001', '50': '01001001', '41': '0100101', '30': '010011', '14': '01010', '13': '01011', '12': '01100', '29': '011010', '49': '01101100', '73': '01101101000', '82': '011011010010', '88': '0110110100110', '90': '0110110100111', '264': '0110110101000000', '272': '0110110101000001', '181': '0110110101000010', '218': '0110110101000011', '368': '0110110101000100', '347': '0110110101000101', '186': '0110110101000110', '248': '0110110101000111', '365': '0110110101001000', '187': '0110110101001001', '165': '0110110101001010', '164': '0110110101001011', '305': '0110110101001100', '161': '0110110101001101', '271': '0110110101001110', '340': '0110110101001111', '386': '0110110101010000', '280': '0110110101010001', '112': '0110110101010010', '137': '0110110101010011', '100': '01101101010101', '326': '0110110101011000', '277': '0110110101011001', '288': '0110110101011010', '316': '0110110101011011', '148': '0110110101011100', '287': '0110110101011101', '131': '0110110101011110', '183': '0110110101011111', '81': '011011010110', '188': '011011010111000', '125': '011011010111001', '171': '0110110101110100', '166': '0110110101110101', '167': '011011010111011', '116': '011011010111100', '174': '011011010111101', '108': '011011010111110', '107': '011011010111111', '58': '011011011', '40': '0110111', '11': '01110', '10': '01111', '28': '100000', '39': '1000010', '57': '100001100', '65': '1000011010', '72': '10000110110', '70': '10000110111', '48': '10000111', '9': '10001', '7': '10010', '8': '10011', '27': '101000', '38': '1010010', '47': '10100110', '63': '1010011100', '71': '10100111010', '79': '101001110110', '97': '10100111011100', '103': '10100111011101', '96': '10100111011110', '138': '10100111011111000', '146': '10100111011111001', '282': '10100111011111010', '222': '10100111011111011', '118': '101001110111111', '56': '101001111', '6': '10101', '5': '10110', '0': '101110', '26': '101111', '3': '11000', '2': '11001', '1': '11010', '4': '11011', '25': '111000', '37': '1110010', '64': '1110011000', '119': '11100110010000000', '349': '11100110010000001', '364': '11100110010000010', '392': '11100110010000011', '358': '11100110010000100', '378': '11100110010000101', '197': '11100110010000110', '279': '11100110010000111', '323': '11100110010001000', '318': '11100110010001001', '360': '11100110010001010', '436': '11100110010001011', '217': '11100110010001100', '124': '11100110010001101', '311': '11100110010001110', '324': '11100110010001111', '274': '11100110010010000', '278': '11100110010010001', '310': '11100110010010010', '296': '11100110010010011', '353': '11100110010010100', '357': '11100110010010101', '262': '11100110010010110', '223': '11100110010010111', '303': '11100110010011000', '284': '11100110010011001', '396': '11100110010011010', '338': '11100110010011011', '135': '11100110010011100', '355': '11100110010011101', '234': '11100110010011110', '441': '11100110010011111', '195': '1110011001010000', '320': '1110011001010001', '257': '11100110010100100', '215': '11100110010100101', '254': '11100110010100110', '263': '11100110010100111', '157': '1110011001010100', '285': '1110011001010101', '172': '1110011001010110', '192': '1110011001010111', '381': '11100110010110000', '389': '11100110010110001', '321': '11100110010110010', '189': '11100110010110011', '415': '11100110010110100', '190': '11100110010110101', '232': '11100110010110110', '245': '11100110010110111', '180': '11100110010111000', '235': '11100110010111001', '273': '11100110010111010', '317': '11100110010111011', '240': '11100110010111100', '219': '11100110010111101', '182': '11100110010111110', '246': '11100110010111111', '113': '1110011001100000', '276': '1110011001100001', '265': '1110011001100010', '175': '1110011001100011', '121': '1110011001100100', '123': '1110011001100101', '144': '1110011001100110', '156': '1110011001100111', '184': '1110011001101000', '344': '1110011001101001', '266': '1110011001101010', '173': '1110011001101011', '348': '1110011001101100', '268': '1110011001101101', '363': '1110011001101110', '312': '1110011001101111', '80': '111001100111', '55': '111001101', '46': '11100111', '24': '111010', '36': '1110110', '54': '111011100', '62': '1110111010', '92': '11101110110000', '98': '11101110110001', '86': '1110111011001', '95': '11101110110100', '99': '11101110110101', '106': '111011101101100', '117': '111011101101101', '136': '1110111011011100', '241': '1110111011011101', '102': '111011101101111', '85': '1110111011100', '201': '1110111011101000', '238': '1110111011101001', '191': '1110111011101010', '208': '1110111011101011', '343': '1110111011101100', '111': '1110111011101101', '168': '1110111011101110', '339': '1110111011101111', '78': '111011101111', '45': '11101111', '23': '111100', '35': '1111010', '34': '1111011', '22': '111110', '21': '111111'}\n"
] ]
} }
], ],
"source": [ "source": [
"scenes = file_extractor()\n", "scenes = file_extractor()\n",
"images = image_extractor(scenes)\n", "images = image_extractor(scenes)\n",
"start = time.time()\n", "num_images = im_distribution(images, \"_9\")\n",
"origin, predict, diff, error, A = plot_hist(images[0])\n", "rate = []\n",
"image = Image.open(images[0]) #Open the image and read it as an Image object\n", "\n",
"image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n", "for i in range(len(num_images)):\n",
"image = image.astype(int)\n", " encode1, encode2, encode3, encode4, encode5, image, error, diff, bound = huffman(num_images[i])\n",
"new_error = np.copy(image)\n", " r = compress_rate(image, error, diff, bound, encode1, encode2, encode3, encode4, encode5)\n",
"new_error[1:-1,1:-1] = np.reshape(error,(510, 638))\n", " rate.append(r)\n",
"keep = new_error[0,0]\n", " \n",
"new_error[0,:] = new_error[0,:] - keep\n", " \n",
"new_error[-1,:] = new_error[-1,:] - keep\n", "print(f\"Compression rate of huffman with different bins: {np.mean(rate)}\")\n"
"new_error[1:-1,0] = new_error[1:-1,0] - keep\n",
"new_error[1:-1,-1] = new_error[1:-1,-1] - keep\n",
"new_error[0,0] = keep\n",
"new_error = np.ravel(new_error)\n",
"plt.hist(new_error[1:],bins=100)\n",
"plt.show()\n",
"ab_error = np.abs(new_error)\n",
"string = [str(i) for i in ab_error]\n",
"#string = [str(i) for i in new_error]\n",
"#string = [str(i) for i in np.arange(0,5)] + [str(i) for i in np.arange(0,5)] + [str(i) for i in np.arange(0,2)]*2\n",
"freq = dict(Counter(string))\n",
"#print(freq)\n",
"freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)\n",
"node = make_tree(freq)\n",
"encoding = huffman_code_tree(node)\n",
"#encoded = [\"1\"+encoding[str(-i)] if i < 0 else \"0\"+encoding[str(i)] for i in error]\n",
"#print(time.time()-start)\n",
"print(len(encoding))\n",
"print(encoding)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 154, "execution_count": 238,
"id": "14075c94", "id": "992dd8bb",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def compress_rate(original, error, encoding):\n", "origin, predict, diff, error, A = plot_hist(images[0])"
" original = original.reshape(-1)\n",
" error = error.reshape(-1)\n",
" o_len = 0\n",
" c_len = 0\n",
" for i in range(0, len(original)):\n",
" o_len += len(bin(original[i])[2:])\n",
" c_len += len(encoding[str(abs(error[i]))])\n",
" c_len += 1\n",
" \n",
" return c_len/o_len"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 155, "execution_count": 418,
"id": "b93c068b", "id": "904ba7b1",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAD4CAYAAAAO9oqkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAU0ElEQVR4nO3df6zd9X3f8eerDlDUNgPCLbNsMzuNt86JVAfuwFO7KSMLGNBkoqUR/FGsDMWdAlIrZVNM8wdpCBNMStHYCJMzPEzVxUFpMyxi5rqULsofBl8SBzCUcQOOsOVgF/OjUTZSsvf+OJ9bnTnn3Ht8fe8958TPh/TV/Z739/s9532Oz70vf7/fz/meVBWSpDPbzw27AUnS8BkGkiTDQJJkGEiSMAwkScC7ht3AfF144YW1evXqYbchSWPlqaee+quqmji5PrZhsHr1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k21CZ769fjSL72VfXqzPyov4c9TLQAkky072QgyXuBtcBLbXf2rSQb2iiiG4FR+N/6LuD6JOckWUOn3ycZscuCnHTM96PAzCiNfv0P20i9fv0k+YUkvzQzD1xJ57XdBWxuq21mNN6rJ+vX4y7gxjaqaAPwZtfhpKEZq/fwMM9ej9tE5x/zMJ29gFeBPa3+L4GDwAHg28C/6Npmks4b4HvAf6J96nuY/bZln209vUDXCCc6ozL+V1v22SG/3n8IPAM8TeeXZ/lc/Q97GqXXb5Ye30tnJMt32/v2s63+HuAx4EXgz4ALhtznV+gcgv2b9j6+qV+PdEYR3dte92foGj035H7H5j3s5SgkSR4mkiQZBpIkDANJEoaBJAnDQJKEYSBJwjCQJAH/D/aeEE4BsmffAAAAAElFTkSuQmCC\n",
"text/plain": [ "text/plain": [
"0.4473590087890625" "<Figure size 432x288 with 1 Axes>"
] ]
}, },
"execution_count": 155, "metadata": {
"metadata": {}, "needs_background": "light"
"output_type": "execute_result" },
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOr0lEQVR4nO3dX4ycV33G8e+Dw5+qf0hCtm5kR91IWKrCRUNkhVT0gpKSOElVhwpQUFUsasm9CBKVKhWnvUhLiGQqtSlUBSklFga1BIsWxSJRqRtAqBeQbJo0xEmjbCFRbAVscEiLEKkcfr2YYzQ1M7uz8e7Mrs/3I432fc97Zua8x+Nnzr5z9kyqCklSH14x6wZIkqbH0Jekjhj6ktQRQ1+SOmLoS1JHzpt1A5Zy0UUX1fz8/KybIUkbykMPPfTdqpobdWxdh/78/DwLCwuzboYkbShJnhl3zMs7ktQRQ1+SOmLoS1JHDH1J6oihL0kdMfQlqSOGviR1xNCXpI4Y+pLUkXX9F7n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+eHMvi/O+dCvqt98GXdbarmIc24ZiUn7KMnfAV9ou70vqdH7+f8/VXWs/Tye5PMMLn99J8nFVfVcu2RxfKaNnK1xfTH115GXd0Y7BNyU5NVJLmXwIcsDdLiMxBnXF9/O4MNvGN9HvejutTBOkp9N8vOnt4FrGLxODgG7WrVdQM+/WY/ri0PAe9osnquAF4YuA62Jc36kv5Qkbwf+BpgD7k3ySFVdW1VHkhxksM7/KeDmqnqp3WcjLCOxmv4iyeUMLu88DfwBwFJ91IMNtKTINGwGPp8EBpnyD1X1z0keBA4m2Q08A7xrhm2cmiSfAd4CXJTkKHArsI/RfXEfcD2DiRA/BN675u1zGQZJ6oeXdySpI4a+JHXE0Jekjhj6ktQRQ1+SOmLoS1JHDH1J6sj/AWcE/seQ9eQkAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAATV0lEQVR4nO3df6zd9X3f8eerpKRV1sUm3FmWDTNZrLT0jxBmAVWraAuLMTDVVGoQ1TQ8ZMn7g06ttGl11mnuIJHIpC0LUorEgjcTtSEsW4SVsFLXCar6BwSTH/ws8w0BYctgNyZsLSod6Xt/nM9NTtx7fM/1Pfdc3/t5PqSj8/2+v5/zPZ+Pjs/rfP053/s9qSokSX34iZXugCRpegx9SeqIoS9JHTH0Jakjhr4kdeQdK92Bs7n44otry5YtK90NSVpVnnzyyT+rqpn5tp3Xob9lyxaOHDmy0t2QpFUlycujtjm9I0kdMfQlqSOGviR1xNCXpI4Y+pLUEUNfkjpi6EtSRwx9SeqIoS9JHTmv/yJXOldb9n5l3vpLd9045Z5I5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pytN2vX+l+LkWS/UlOJnlmqDbvGDNwd3vNn0py5cr1/NyMGO/k379VtaZvwM8B7wceBbYN1S8Hvg28E7gM+A6DL5cvaMvvBS5sbS5f6XEsYfy/A/yreerzjn+l+zuB8a6p1+8s43wJuPiM2n8A9rblvcAnV7qfSxzjh4ArgWcWGiNwA/C/gADXAI+vdP8nNN6Jv3/X/JF+VT1fVfP9Ve9O4IGqequqvgvMMrhMxA8vFVFVfwXMXSpirRk1/tWul9dvPjuBA235AHDTynVl6arqj4HTZ5RHjXEncH8NPAasS7JxKh2dkBHjHeWc379rPvTPYr5LQmw6S301+/X2X979Q//lX4vjhLU7rjMV8IdJnmyXLgHYUFUn2vKrwIaV6dqyGjXGtfy6T/T9uyZCP8kfJXlmnlsXR3gLjP8e4O8BVwAngP+4kn3VxPxSVV0JXA/cnuRDwxtrMAewps/H7mGMLMP797y79s65qKp/dA4PO9slIVbVpSLGHX+S/wJ8ua2u1UtirNVx/ZiqOt7uTyb5EoP/2r+WZGNVnWhTGydXtJPLY9QY1+TrXlWvzS1P6v27Jo70z9FB4JYk70xyGbAV+Dpr7FIRZ8xr/gowd2bAqPGvdmvq9ZtPkncl+Zm5ZWA7g9f1ILCrNdsFPLQyPVxWo8Z4ELi1ncVzDfDG0DTQqrUs79+V/sZ6Ct+I/wqD+a63gNeAR4a2/TaDb71fAK4fqt8A/O+27bdXegxLHP/ngKeBp9o/lI0LjX+139bS6zdifO9lcObGt4Fn58YIvAc4DBwF/gi4aKX7usRxfp7BlMb/a+/h3aPGyOCsnc+01/xphs7UWy23EeOd+PvXyzBIUkd6nt6RpO4Y+pLUEUNfkjpi6EtSRwx9SeqIoS9JHTH0Jakj/x8d/DvFR3CV6wAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFW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8eQ3/5vgz8IvDZ4cIkr2ewGukNwDbg/UnOGdp64irg9cAvt7qr0W1VdXH7uQdG93slG3m61thrNspPt9fxxMBlN3C4qrYAh9v5avTXDP47HDaqb1cBW9rPLuD2KbVxRRn6y1RVj1bVYt8S3g7cVVXfrKqvAfMMtp14aeuJqvof4MTWE2vFqH6vZmv9NVvMdmB/O94PXLtyTTl1VfVZ4PjLikf1bTtwZw3cB6xLcsFUGrqCDP3JWWyLiY0nKV+N3tb+DN439Of/WurfCWuxT8MK+IckD7RtTwA2VNXT7fgZYMPKNO2MGNW3tf46L+qs24bhbJDkH4EfXOTS71fV3dNuz7ScrN8M/vS9lUFg3Ar8CfDr02udJugnq+pokh8ADiX5yvDFqqoka3It91ru27gM/UVU1c+cwm0n22JiVWw9MW6/k/wl8PF2uha31liLfXpJVR1tj8eSfIzBdNazSS6oqqfbFMexFW3kZI3q25p+nUdxemdyDgLXJ3llkosYfDj0edbI1hMvm+v8BQYfaMPofq9ma+I1W0ySVyV59YljYCuD1/IgsKNV2wGspb9oR/XtIHBDW8VzOfD80DTQmuVIf5mS/ALw58AM8IkkD1bVlVX1cJIDDP5tgBeBm6rqW+2etbD1xB8nuZjB9M4TwG8AnKzfq9Ua3y5kA/CxJDD4//9DVfXJJPcDB5LsBJ4ErlvBNp6yJB8G3gycn+QIcAuwh8X7dg9wNYPFBy8AN069wSvAbRgkqSNO70hSRwx9SeqIoS9JHTH0Jakjhr4kdcTQl6SOGPqS1JH/A7XwOEnPU1+DAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAD4CAYAAAAO9oqkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYA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VcBR7cxpwzw9f4g8BfT1KftfwjeH0P1+h2i10eBE6bU/grY0KY3AJcNuMc3Aqd1/2716hE4t/1+pf2+3TYk/Y7Me9gtgxmoqgeq6rDPek5yEvCKqrq1Ou+Aq4Hzj1R/Ux2k3zXAtqp6vqoeASboXBLkR5cFqarvAQcuCzJsevU/aKPy+vWyBtjaprcyj+/V6VTVV4F9U8q9elwDXF0dtwKL2+/fvOnRby9D9x42DObOiiR3Jfn3JL/RakvpXFrjgF2tNmjTXf5j6UHqg/Tettm/pWu3xTD2CcPb13QK+GKSO9tlXgBOrKo9bfoJ4MTBtHZQvXoc5td+JN7DQ3GewTBJ8iXgZ6dZdElVXd9jtT3Az1fVU0leD/xrklOPWJNdZtnv0DhY/8CVwKV0/uO6FPhb4D3z192L2q9X1e4kPwPsSPKN7oVVVUmG+rjzUeiREXoPGwZTVNVvzmKd54Hn2/SdSb4F/CKdS2os6xo655fZmE2/HPzyH/N6WZDD7T/JPwGfb7PDevmSYe3rx1TV7vZzb5LP0dlF8WSSk6pqT9vFsnegTU6vV49D+dpX1ZMHpof9PexuojmQZEn7TgaSvApYCTzcNme/m2RVO4roQmAY/lrfDlyQ5JgkK+j0eztDdlmQKft8fwc4cJRGr/4Hbahev16SvDzJTx+YBs6i89puB9a2YWsZjvfqVL163A5c2I4qWgU827U7aWBG6j08yE+vR+1G5x9zF52tgCeBm1r9d4GdwN3A14Df7lpnjM4b4FvAP9DO+h5kv23ZJa2nB+k6wonOURnfbMsuGfDr/SngXuAeOr88Jx2q/0Hfhun1O0iPr6JzJMvX2/v2klY/HrgZeAj4EnDcgPu8hs4u2O+39/G6Xj3SOYroY+11v5euo+cG3O/IvIe9HIUkyd1EkiTDQJKEYSBJwjCQJGEYSJIwDCRJGAaSJOD/AMyO8nqDsqJOAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
} }
], ],
"source": [ "source": [
"compress_rate(image,new_error,encoding)" "plt.hist(error,bins=50)\n",
"plt.show()\n",
"mask = diff <= 20\n",
"plt.hist(error[mask],bins=50)\n",
"plt.show()\n",
"\n",
"mask = diff > 20\n",
"new_error = error[mask]\n",
"mask2 = diff[mask] <= 35\n",
"plt.hist(new_error[mask2],bins=50)\n",
"plt.show()\n",
"\n",
"mask = diff > 35\n",
"new_error = error[mask]\n",
"mask2 = diff[mask] <= 50\n",
"plt.hist(new_error[mask2],bins=50)\n",
"plt.show()\n",
"\n",
"mask = diff > 50\n",
"#new_error = error[mask]\n",
"#mask2 = diff[mask] <= 400\n",
"plt.hist(error[mask],bins=50)\n",
"plt.show()"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 140, "execution_count": 236,
"id": "a8dc8674", "id": "2f5ef010",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "name": "stdout",
"text/plain": [ "output_type": "stream",
"4" "text": [
] "(512, 640)\n"
}, ]
"execution_count": 140, }
"metadata": {}, ],
"output_type": "execute_result" "source": [
"image = Image.open(images[0])\n",
"image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data\n",
"image = image.astype(int)\n",
"boundary = np.hstack((image[0,:],image[-1,:],image[1:-1,0],image[1:-1,-1]))\n",
"boundary = boundary - image[0,0]\n",
"boundary[0] = image[0,0]\n",
"print(image.shape)"
]
},
{
"cell_type": "code",
"execution_count": 228,
"id": "4860903b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[22554 -2 -35 ... -16 40 19]\n"
]
} }
], ],
"source": [ "source": [
"int('0100',2)" "print(boundary)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "992dd8bb", "id": "f145c221",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 28,
"id": "dbef8759", "id": "dbef8759",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 29,
"id": "b7a550e0", "id": "b7a550e0",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 30,
"id": "9ed20f84", "id": "9ed20f84",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
...@@ -119,14 +119,25 @@ ...@@ -119,14 +119,25 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 34,
"id": "8e3ef654", "id": "8e3ef654",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"120\n",
"8\n"
]
}
],
"source": [ "source": [
"scenes = file_extractor()\n", "scenes = file_extractor()\n",
"images = image_extractor(scenes)\n", "images = image_extractor(scenes)\n",
"num_images = im_distribution(images, \"_9\")\n", "num_images = im_distribution(images, \"_9\")\n",
"print(len(images))\n",
"print(len(num_images))\n",
"error_mean = []\n", "error_mean = []\n",
"error_mean1 = []\n", "error_mean1 = []\n",
"diff_mean = []\n", "diff_mean = []\n",
......
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