Commit 0f3da6d0 authored by Bryce Hepner's avatar Bryce Hepner

medium update

parent 2022b169
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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()
......
...@@ -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))
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment