Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
image-compression
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
image-compression
Commits
342c5f6e
Commit
342c5f6e
authored
Jul 13, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more renamings
parent
596da333
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
13 deletions
+13
-13
FullTester.ipynb
FullTester.ipynb
+10
-10
WorkingPyDemo.py
WorkingPyDemo.py
+3
-3
first_dic.npy
first_dic.npy
+0
-0
first_dict.npy
first_dict.npy
+0
-0
second_dict.npy
second_dict.npy
+0
-0
No files found.
FullTester.ipynb
View file @
342c5f6e
...
@@ -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",
"5
21
\n",
"
5
\n",
"
263
\n",
"0.
30596738362283216
\n"
"0.
4041653243824837
\n"
]
]
}
}
],
],
"source": [
"source": [
"scenes = file_extractor(\"
better
images\")\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"
]
]
}
}
...
...
WorkingPyDemo.py
View file @
342c5f6e
...
@@ -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
)
...
...
first_dic.npy
deleted
100644 → 0
View file @
596da333
File deleted
first_dict.npy
0 → 100644
View file @
342c5f6e
File added
second_dic.npy
→
second_dic
t
.npy
View file @
342c5f6e
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment