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
ca0ab1b7
Commit
ca0ab1b7
authored
Aug 01, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graphs look much better now
parent
5981345f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
372 additions
and
26 deletions
+372
-26
GraphMaker.ipynb
GraphMaker.ipynb
+362
-18
WorkingPyDemo.py
WorkingPyDemo.py
+10
-8
first_dict.npy
first_dict.npy
+0
-0
No files found.
GraphMaker.ipynb
View file @
ca0ab1b7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
WorkingPyDemo.py
View file @
ca0ab1b7
...
...
@@ -204,7 +204,8 @@ def make_dictionary(tiff_image_path_list, num_bins=4, difference = True):
# plt.ylabel('Frequency')
# plt.title('Histogram of Pixel Values')
# plt.show()
bins
=
[
21
,
32
,
48
]
bins
=
[
29
,
44
,
67
]
# get the boundary
boundary
=
np
.
hstack
((
image_array
[
0
,:],
image_array
[
-
1
,:],
image_array
[
1
:
-
1
,
0
],
image_array
[
1
:
-
1
,
-
1
]))
...
...
@@ -289,7 +290,7 @@ def huffman(tiff_image_path, num_bins=4, difference = True):
# get the image_as_array, etc
image_as_array
,
diff
,
error
=
predict_pix
(
tiff_image_path
,
difference
)
bins
=
[
2
1
,
32
,
48
]
bins
=
[
2
9
,
44
,
67
]
# get the boundary
boundary
=
np
.
hstack
((
image_as_array
[
0
,:],
image_as_array
[
-
1
,:],
image_as_array
[
1
:
-
1
,
0
],
image_as_array
[
1
:
-
1
,
-
1
]))
...
...
@@ -547,15 +548,16 @@ if __name__ == "__main__":
scenes
=
file_extractor
(
"images"
)
images
=
image_extractor
(
scenes
)
newnamesforlater
=
[]
list_dic
,
bins
=
make_dictionary
(
images
,
4
,
Fals
e
)
list_dic
,
bins
=
make_dictionary
(
images
,
4
,
Tru
e
)
file_sizes_new
=
[]
file_sizes_old
=
[]
# list_dic = np.load("first_dict.npy", allow_pickle="TRUE")
bins
=
[
21
,
32
,
48
]
# list_dic = np.load("first_dict.npy", allow_pickle="True")
bins
=
[
29
,
44
,
67
]
#otherbins = [21,32,48]
np
.
save
(
"first_dict.npy"
,
list_dic
)
for
i
in
range
(
len
(
images
)
):
for
i
in
np
.
random
.
choice
(
len
(
images
),
10
):
image
,
new_error
,
diff
=
huffman
(
images
[
i
],
4
,
Fals
e
)
image
,
new_error
,
diff
=
huffman
(
images
[
i
],
4
,
Tru
e
)
encoded_string
=
encoder
(
new_error
,
list_dic
,
diff
,
bins
)
inletters
=
bitstring_to_bytes
(
encoded_string
)
...
...
@@ -576,7 +578,7 @@ if __name__ == "__main__":
file_sizes_new
.
append
(
os
.
path
.
getsize
(
"first_dict.npy"
))
print
(
np
.
sum
(
file_sizes_new
)
/
np
.
sum
(
file_sizes_old
))
# list_dic = np.load("first_dict.npy", allow_pickle="TRUE")
bins
=
[
2
1
,
32
,
48
]
bins
=
[
2
9
,
44
,
67
]
# for i,item in enumerate(newnamesforlater):
# print(item)
...
...
first_dict.npy
View file @
ca0ab1b7
No preview for this file type
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