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
Compare Revisions
625e9d152ca55179970ffdf6b19ce0280d54c6eb...f2ad24838aa52e6ee53a0ef63bc6d6a051a84b55
Source
f2ad24838aa52e6ee53a0ef63bc6d6a051a84b55
Select Git revision
...
Target
625e9d152ca55179970ffdf6b19ce0280d54c6eb
Select Git revision
Compare
Commits (3)
added code to run things cooler
· def994ea
Bryce Hepner
authored
Jun 23, 2022
def994ea
got rid of tif files too, used to keep seperate
· d4e64dd5
Bryce Hepner
authored
Jun 23, 2022
d4e64dd5
This is the one that should have the change messag
· f2ad2483
Bryce Hepner
authored
Jun 23, 2022
f2ad2483
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1249 additions
and
42 deletions
+1249
-42
.gitignore
.gitignore
+2
-1
FullTester.ipynb
FullTester.ipynb
+1232
-27
WorkingPyDemo.py
WorkingPyDemo.py
+15
-14
No files found.
.gitignore
View file @
f2ad2483
...
...
@@ -8,4 +8,5 @@ attic
*.txt
!backup.txt
*.tiff
*.png
\ No newline at end of file
*.png
*.tif
\ No newline at end of file
FullTester.ipynb
View file @
f2ad2483
This diff is collapsed.
Click to expand it.
WorkingPyDemo.py
View file @
f2ad2483
...
...
@@ -507,37 +507,38 @@ if __name__ == "__main__":
scenes
=
file_extractor
(
folder_name
)
images
=
image_extractor
(
scenes
)
newnamesforlater
=
[]
list_dic
,
bins
=
make_dictionary
(
images
,
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")
list_dic
=
np
.
load
(
"first_dic.npy"
,
allow_pickle
=
"TRUE"
)
bins
=
[
21
,
32
,
48
]
np
.
save
(
"first_dic.npy"
,
list_dic
)
#
np.save("first_dic.npy", list_dic)
for
i
in
range
(
len
(
images
)):
image
,
new_error
,
diff
=
huffman
(
images
[
i
],
4
,
False
)
encoded_string
=
encoder
(
new_error
,
list_dic
,
diff
,
bins
)
inletters
=
bitstring_to_bytes
(
encoded_string
)
#
image, new_error, diff = huffman(images[i], 4, False)
#
encoded_string = encoder(new_error, list_dic, diff, bins)
#
inletters = bitstring_to_bytes(encoded_string)
if
images
[
i
][
-
5
:]
==
".tiff"
:
newname
=
images
[
i
][:
-
5
]
else
:
newname
=
images
[
i
][:
-
4
]
newnamesforlater
.
append
(
newname
+
"_Compressed.txt"
)
with
open
(
newname
+
"_Compressed.txt"
,
'wb'
)
as
f
:
f
.
write
(
inletters
)
#
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
])))
sleep
(
5
)
if
i
%
50
==
0
:
print
(
i
)
sleep
(
20
)
#
sleep(5)
#
if i % 50 == 0:
#
print(i)
#
sleep(20)
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
]
# starttime = time()
for
i
,
item
in
enumerate
(
newnamesforlater
[
2
:
5
]):
for
i
,
item
in
enumerate
(
newnamesforlater
[
0
:
5
]):
print
(
item
)
image
,
new_error
,
diff
=
huffman
(
images
[
i
],
4
,
False
)
encoded_string2
=
bytes_to_bitstring
(
read_from_file
(
item
))
...
...