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
204424b1
Commit
204424b1
authored
Jan 13, 2022
by
Nathaniel Callens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial files
parent
5b604f32
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
.gitignore
.gitignore
+5
-0
compress_start.py
compress_start.py
+57
-0
No files found.
.gitignore
0 → 100644
View file @
204424b1
__pycache__
/.project
/.pydevproject
attic
*.log
\ No newline at end of file
compress_start.py
0 → 100644
View file @
204424b1
'''
Created on Jan 11, 2022
@author: nathanielc
python file located in the Image Compression project
folder under nathanielc user. This python file is for
exploring possible image compression techniques and is by
no means a final product. Goal is to learn how to download
images and extract important statistics from them.
'''
import
numpy
as
np
from
matplotlib
import
pyplot
as
plt
import
os
import
sys
from
PIL
import
Image
def
file_extractor
(
dirname
=
"/media/elphel/SSD3-4GB/lwir16-proc/captures/teasdale/scenes"
):
files
=
os
.
listdir
(
dirname
)
scenes
=
[]
for
file
in
files
:
scenes
.
append
(
os
.
path
.
join
(
dirname
,
file
))
return
scenes
def
image_extractor
(
scenes
):
image_folder
=
[]
for
scene
in
scenes
:
files
=
os
.
listdir
(
scene
)
for
file
in
files
:
image_folder
.
append
(
os
.
path
.
join
(
scene
,
file
))
images
=
[]
for
folder
in
image_folder
:
ims
=
os
.
listdir
(
folder
)
for
im
in
ims
:
if
im
[
-
4
:]
==
".jp4"
or
im
[
-
7
:]
==
"_6.tiff"
:
continue
else
:
images
.
append
(
os
.
path
.
join
(
folder
,
im
))
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
()
images
=
image_extractor
(
scene_names
)
im
=
Image
.
open
(
images
[
0
])
imarray
=
np
.
array
(
im
)
randos
=
np
.
random
.
randint
(
0
,
len
(
images
),
10
)
i
,
j
=
np
.
random
.
randint
(
0
,
imarray
.
shape
[
0
]),
np
.
random
.
randint
(
0
,
imarray
.
shape
[
1
])
image_array
=
[]
for
r
in
randos
:
image_array
.
append
(
np
.
array
(
Image
.
open
(
images
[
r
])))
indices
=
[
val
[
i
][
j
]
for
val
in
image_array
]
\ No newline at end of file
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