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
0f3da6d0
Commit
0f3da6d0
authored
Aug 09, 2022
by
Bryce Hepner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
medium update
parent
2022b169
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
594 additions
and
165 deletions
+594
-165
GraphMaker.ipynb
GraphMaker.ipynb
+584
-156
Remove_Noise.py
Remove_Noise.py
+8
-7
WorkingPyDemo.py
WorkingPyDemo.py
+2
-2
first_dict.npy
first_dict.npy
+0
-0
No files found.
GraphMaker.ipynb
View file @
0f3da6d0
This diff is collapsed.
Click to expand it.
Remove_Noise.py
View file @
0f3da6d0
...
@@ -215,8 +215,8 @@ def save_testable_images(images, selected_channel, quantity_of_images):
...
@@ -215,8 +215,8 @@ def save_testable_images(images, selected_channel, quantity_of_images):
selected_images
=
np
.
array
(
images
)[
image_locations
]
selected_images
=
np
.
array
(
images
)[
image_locations
]
average_image
=
np
.
array
(
Image
.
open
(
"Average_On_Channel("
+
selected_channel
+
").tiff"
))
#
average_image = np.array(Image.open("Average_On_Channel(" + selected_channel + ").tiff"))
images_in_each_direction
=
80
#
images_in_each_direction = 80
for
i
,
item
in
enumerate
(
selected_images
):
for
i
,
item
in
enumerate
(
selected_images
):
# if image_locations[i] < images_in_each_direction:
# if image_locations[i] < images_in_each_direction:
# average_image = remote_create_average(images[image_locations[i] - image_locations[i]: image_locations[i] + images_in_each_direction + image_locations[i]], selected_channel)
# average_image = remote_create_average(images[image_locations[i] - image_locations[i]: image_locations[i] + images_in_each_direction + image_locations[i]], selected_channel)
...
@@ -226,13 +226,14 @@ def save_testable_images(images, selected_channel, quantity_of_images):
...
@@ -226,13 +226,14 @@ def save_testable_images(images, selected_channel, quantity_of_images):
# average_image = remote_create_average(images[image_locations[i] - images_in_each_direction: image_locations[i] + images_in_each_direction], selected_channel)
# average_image = remote_create_average(images[image_locations[i] - images_in_each_direction: image_locations[i] + images_in_each_direction], selected_channel)
image
=
Image
.
open
(
sftp_client
.
open
(
item
))
image
=
Image
.
open
(
sftp_client
.
open
(
item
))
wherelastslash
=
item
.
rfind
(
"/"
)
wherelastslash
=
item
.
rfind
(
"/"
)
image
=
np
.
array
(
image
)[
1
:]
# image = np.array(image)[1:]
image
=
np
.
array
(
image
)
savable_original
=
Image
.
fromarray
(
image
)
savable_original
=
Image
.
fromarray
(
image
)
savable_original
.
save
(
"original_images("
+
selected_channel
+
")/innerfolder/original"
+
item
[
wherelastslash
+
1
:])
savable_original
.
save
(
"original_images("
+
selected_channel
+
")/innerfolder/original"
+
item
[
wherelastslash
+
1
:])
altered_image
=
adjust_to_original
(
image
,
average_image
)
#
altered_image = adjust_to_original(image, average_image)
altered_image
=
Image
.
fromarray
(
altered_image
)
#
altered_image = Image.fromarray(altered_image)
altered_image
.
save
(
"averaged_images("
+
selected_channel
+
")/innerfolder"
+
item
[
wherelastslash
:])
#
altered_image.save("averaged_images(" + selected_channel + ")/innerfolder" + item[wherelastslash:])
# average_image = Image.fromarray(average_image)
# average_image = Image.fromarray(average_image)
sftp_client
.
close
()
sftp_client
.
close
()
...
@@ -270,7 +271,7 @@ if __name__ == "__main__":
...
@@ -270,7 +271,7 @@ if __name__ == "__main__":
images
=
remote_image_extractor
(
scenes
)
images
=
remote_image_extractor
(
scenes
)
images
=
find_only_in_channel
(
images
,
"11"
)
images
=
find_only_in_channel
(
images
,
"11"
)
# average_image = np.array(Image.open("Average_On_Channel(" + "11" + ").tiff"))
# average_image = np.array(Image.open("Average_On_Channel(" + "11" + ").tiff"))
# save_testable_images(images,"11",5
)
save_testable_images
(
images
,
"11"
,
500
)
# plt.imshow(color_adjust(average_image),cmap='gray',vmin = 0, vmax=1)
# plt.imshow(color_adjust(average_image),cmap='gray',vmin = 0, vmax=1)
# plt.show()
# plt.show()
...
...
WorkingPyDemo.py
View file @
0f3da6d0
...
@@ -113,7 +113,7 @@ def predict_pix(tiff_image_path, difference = True):
...
@@ -113,7 +113,7 @@ def predict_pix(tiff_image_path, difference = True):
#The res is the residuals of the four points used to fit the hyperplane (summed distance of each of the
#The res is the residuals of the four points used to fit the hyperplane (summed distance of each of the
#points to the hyperplane), it is a measure of gradient
#points to the hyperplane), it is a measure of gradient
f
,
diff
,
rank
,
s
=
la
.
lstsq
(
points
,
neighbor
.
T
,
rcond
=
None
)
f
,
diff
,
rank
,
s
=
la
.
lstsq
(
points
,
neighbor
.
T
,
rcond
=
None
)
diff
=
diff
.
astype
(
int
)
#
diff = diff.astype(int)
# Pinv = np.linalg.pinv(points)
# Pinv = np.linalg.pinv(points)
# b = [z0,z1,z2,z3]
# b = [z0,z1,z2,z3]
# x = Pinv@np.array(b)
# x = Pinv@np.array(b)
...
@@ -461,7 +461,7 @@ def decoder(encoded_string, list_dic, bins, use_diff):
...
@@ -461,7 +461,7 @@ def decoder(encoded_string, list_dic, bins, use_diff):
# x = Pinv@np.array(b)
# x = Pinv@np.array(b)
# difference = np.linalg.norm(b - points@x,ord=2)
# difference = np.linalg.norm(b - points@x,ord=2)
f
,
difference
,
rank
,
s
=
la
.
lstsq
(
points
,
[
z0
,
z1
,
z2
,
z3
],
rcond
=
None
)
f
,
difference
,
rank
,
s
=
la
.
lstsq
(
points
,
[
z0
,
z1
,
z2
,
z3
],
rcond
=
None
)
difference
=
difference
.
astype
(
int
)
#
difference = difference.astype(int)
# predict = np.round(np.round(np.linalg.solve(A,y)[-1][0],1))
# predict = np.round(np.round(np.linalg.solve(A,y)[-1][0],1))
predict
=
np
.
round
(
np
.
round
((
Ainv
[
-
1
]
@
y
)[
0
],
1
))
predict
=
np
.
round
(
np
.
round
((
Ainv
[
-
1
]
@
y
)[
0
],
1
))
...
...
first_dict.npy
View file @
0f3da6d0
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