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
9a11d800
Commit
9a11d800
authored
Jun 30, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
should be back to normal
parent
03e500ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
WorkingPyDemo.py
WorkingPyDemo.py
+9
-14
No files found.
WorkingPyDemo.py
View file @
9a11d800
...
...
@@ -74,8 +74,7 @@ def predict_pix(tiff_image_path, difference = True):
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_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
=
np
.
array
(
image_obj
)
.
astype
(
int
)
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)
# 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
]])
...
...
@@ -518,17 +517,13 @@ if __name__ == "__main__":
scenes
=
file_extractor
(
folder_name
)
images
=
image_extractor
(
scenes
)
newnamesforlater
=
[]
list_dic
,
bins
=
make_dictionary
(
images
[
19
:
20
]
,
4
,
False
)
list_dic
,
bins
=
make_dictionary
(
images
,
4
,
False
)
file_sizes_new
=
[]
file_sizes_old
=
[]
# list_dic = np.load("first_dic.npy", allow_pickle="TRUE")
bins
=
[
21
,
32
,
48
]
for
i
,
item
in
enumerate
(
images
):
if
"NoI"
in
item
:
print
(
item
)
print
(
i
)
# np.save("first_dic.npy", list_dic)
for
i
in
range
(
19
,
len
(
images
[
0
:
20
]
)):
for
i
in
range
(
len
(
images
)):
image
,
new_error
,
diff
=
huffman
(
images
[
i
],
4
,
False
)
encoded_string
=
encoder
(
new_error
,
list_dic
,
diff
,
bins
)
...
...
@@ -538,19 +533,19 @@ if __name__ == "__main__":
newname
=
images
[
i
][:
-
5
]
else
:
newname
=
images
[
i
][:
-
4
]
print
(
newname
)
#
print(newname)
newnamesforlater
.
append
(
newname
+
"_Compressed.txt"
)
with
open
(
newname
+
"_Compressed.txt"
,
'wb'
)
as
f
:
f
.
write
(
inletters
)
file_sizes_new
.
append
((
os
.
path
.
getsize
(
newname
+
"_Compressed.txt"
)))
file_sizes_old
.
append
((
os
.
path
.
getsize
(
images
[
i
])))
#
file_sizes_new.append((os.path.getsize(newname + "_Compressed.txt")))
#
file_sizes_old.append((os.path.getsize(images[i])))
# sleep(5)
# if i % 50 == 0:
# print(i)
# sleep(20)
print
(
np
.
sum
(
file_sizes_new
)
/
np
.
sum
(
file_sizes_old
))
file_sizes_new
.
append
(
os
.
path
.
getsize
(
"first_dic.npy"
))
print
(
np
.
sum
(
file_sizes_new
)
/
np
.
sum
(
file_sizes_old
))
#
print(np.sum(file_sizes_new)/np.sum(file_sizes_old))
#
file_sizes_new.append(os.path.getsize("first_dic.npy"))
#
print(np.sum(file_sizes_new)/np.sum(file_sizes_old))
# list_dic = np.load("first_dic.npy", allow_pickle="TRUE")
bins
=
[
21
,
32
,
48
]
...
...
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