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
18e8282a
Project 'Elphel/master' was moved to 'Elphel/image-compression'. Please update any links and bookmarks that may still have the old path.
Commit
18e8282a
authored
Jun 22, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests
parent
669a9a33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
12 deletions
+91
-12
FullTester.ipynb
FullTester.ipynb
+91
-12
No files found.
FullTester.ipynb
View file @
18e8282a
...
...
@@ -15,13 +15,14 @@
},
{
"cell_type": "code",
"execution_count":
4
,
"execution_count":
15
,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"262\n",
"262\n",
"0.3968581030135283\n"
]
...
...
@@ -37,23 +38,25 @@
"list_dic = np.load(\"first_dic.npy\", allow_pickle=\"TRUE\")\n",
"bins = [21,32,48]\n",
"for i in range(len(images)):\n",
"\n",
"
\n",
" if images[i][-5:] == \".tiff\":\n",
" newname = images[i][:-5]\n",
" else:\n",
" newname = images[i][:-4]\n",
" newnamesforlater.append(newname + \"_Compressed.txt\")\n",
" if images[i][-18:] != \"Compressedlzw.tiff\":\n",
" newnamesforlater.append(newname + \"_Compressed.txt\")\n",
" # with open(newname + \"_Compressed.txt\", 'wb') as f:\n",
" # f.write(inletters)\n",
" file_sizes_new.append((os.path.getsize(newname + \"_Compressed.txt\")))\n",
" file_sizes_old.append((os.path.getsize(images[i])))\n",
"
file_sizes_new.append((os.path.getsize(newname + \"_Compressed.txt\")))\n",
"
file_sizes_old.append((os.path.getsize(images[i])))\n",
"file_sizes_new.append(os.path.getsize(\"first_dic.npy\"))\n",
"print(len(newnamesforlater))\n",
"print(np.sum(file_sizes_new)/np.sum(file_sizes_old))"
]
},
{
"cell_type": "code",
"execution_count":
5
,
"execution_count":
16
,
"metadata": {},
"outputs": [
{
...
...
@@ -115,7 +118,7 @@
},
{
"cell_type": "code",
"execution_count":
29
,
"execution_count":
17
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -130,19 +133,19 @@
},
{
"cell_type": "code",
"execution_count":
31
,
"execution_count":
18
,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.
34740136372336333
\n"
"0.
6104417990437042
\n"
]
}
],
"source": [
"print((np.sum(pngsizes)
- np.sum(file_sizes_new))/np.sum(pngsizes
))"
"print((np.sum(pngsizes)
)/np.sum(file_sizes_old
))"
]
},
{
...
...
@@ -154,7 +157,7 @@
},
{
"cell_type": "code",
"execution_count":
6
,
"execution_count":
19
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -164,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count":
7
,
"execution_count":
20
,
"metadata": {},
"outputs": [
{
...
...
@@ -185,6 +188,82 @@
"print(np.sum(lwz_sizes)/np.sum(file_sizes_old))"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"524\n",
"262\n"
]
}
],
"source": [
"print(len(images))\n",
"for i, item in enumerate(images):\n",
" # print(item[-18:])\n",
" if item[-18:] == \"Compressedlzw.tiff\":\n",
" os.remove(item)\n",
"scenes = file_extractor(folder_name)\n",
"images = image_extractor(scenes)\n",
"print(len(images))"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"def all_image_extractor(scenes):\n",
" \"\"\"\n",
" This function gives the list of all of the valid images\n",
" Parameters:\n",
" scenes (list): a list of all the files in the directory\n",
" Returns:\n",
" images (list): a list of all the images in the directory\n",
" \"\"\"\n",
" image_folder = []\n",
" for scene in scenes:\n",
" files = os.listdir(scene)\n",
" for file in files:\n",
" if file[-7:] == \"_6.tiff\":\n",
" continue\n",
" else:\n",
" image_folder.append(os.path.join(scene, file))\n",
" return image_folder #returns a list of file paths to .tiff files in the specified directory given in file_extractor"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1178\n",
"1178\n"
]
}
],
"source": [
"all_files = all_image_extractor(scenes)\n",
"print(len(all_files))\n",
"for i, item in enumerate(all_files):\n",
" # print(item[-18:])\n",
" if item[-4:] == \"..png\":\n",
" os.remove(item)\n",
"scenes = file_extractor(folder_name)\n",
"all_files = all_image_extractor(scenes)\n",
"print(len(all_files))"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
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