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
Nathaniel Callens
Image Compression
Commits
9187e090
Commit
9187e090
authored
Jan 18, 2022
by
Nathaniel Callens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated .py file
parent
dae4680c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
compress_start.py
compress_start.py
+27
-5
practice2.tiff
practice2.tiff
+0
-0
practice_tiff.tiff
practice_tiff.tiff
+0
-0
No files found.
compress_start.py
View file @
9187e090
...
...
@@ -12,7 +12,7 @@ images and extract important statistics from them.
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
from
itertools
import
product
import
os
import
sys
from
PIL
import
Image
...
...
@@ -41,7 +41,31 @@ def image_extractor(scenes):
return
images
#returns a list of file paths to .tiff files in the specified directory given in file_extractor
if
__name__
==
'__main__'
:
scene_names
=
file_extractor
()
image
=
Image
.
open
(
"practice_tiff.tiff"
)
image2
=
Image
.
open
(
"practice2.tiff"
)
imarray2
=
np
.
array
(
image2
)
imarray
=
np
.
array
(
image
)
work
=
imarray2
[:,:,
0
]
ind1
,
ind2
=
np
.
random
.
randint
(
0
,
434
),
np
.
random
.
randint
(
0
,
650
)
surrounding
=
[]
for
i
,
j
in
product
(
np
.
arange
(
-
1
,
2
),
repeat
=
2
):
if
i
==
0
and
j
==
0
:
continue
else
:
surrounding
.
append
(
work
[
ind1
+
i
,
ind1
+
j
])
diff
=
[]
diff
.
append
(
np
.
max
(
surrounding
)
-
np
.
min
(
surrounding
))
print
(
surrounding
)
print
(
diff
)
"""For boundary cases: Start by grabbing the shape of the images and saving those
as variables. Then, if statements for if row == 0 or row == maximum and if
col == 0 or col == maximum. Then grab corresponding open pixels. Then proceed to do
an and statement that handles the corners"""
"""scene_names = file_extractor()
images = image_extractor(scene_names)
im = Image.open(images[0])
imarray = np.array(im)
...
...
@@ -50,8 +74,6 @@ if __name__ == '__main__':
image_array = []
for r in randos:
image_array.append(np.array(Image.open(images[r])))
indices
=
[
val
[
i
][
j
]
for
val
in
image_array
]
indices = [val[i][j] for val in image_array]"""
\ No newline at end of file
practice2.tiff
0 → 100644
View file @
9187e090
This diff is collapsed.
Click to expand it.
practice_tiff.tiff
0 → 100644
View file @
9187e090
This diff is collapsed.
Click to expand it.
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