#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Description !!!!!!
# Alexandre Moutardier, date !!!!!!
######################################### DO NOT MODIFFY AFTER
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
def open_image(image_name):
img = np.array(Image.open(image_name))
# img = (img[:,:,0] +img[:,:,1] +img[:,:,2])/3.
return(img)
#img_avec_beam = open_image("2022-04-06_15_55_00_tl_dg_sst_01-ccd_01_OTR_10s_sans_beam_log_scale_True_despeckle_False_Auto_scale_True.png")
#img_sans_beam = open_image("2022-04-06_15_54_12_tl_dg_sst_01-ccd_01_OTR_10s_beam_log_scale_True_despeckle_False_Auto_scale_True.png")
img_avec_beam = open_image("2022-04-06_15_54_12_tl_dg_sst_01-ccd_01_OTR_10s_beam_RAW_16bits.tiff")
img_sans_beam = open_image("2022-04-06_15_55_00_tl_dg_sst_01-ccd_01_OTR_10s_sans_beam_RAW_16bits.tiff")
img_beam = img_avec_beam+-1*img_sans_beam
print(type(img_avec_beam),type(img_beam))
# print(img_beam)
# print(img_sans_beam)
img_beam[img_beam<0] = 0
img_beam[img_beam>100] = 100
# img_beam[:,:,3] = 255
# print("après tri")
# print(img_beam)
plt.figure("Avec beam ")
plt.imshow(img_avec_beam)
plt.colorbar()
plt.figure("Sans beam ")
plt.imshow(img_sans_beam)
plt.colorbar()
plt.figure("Beam only")
plt.imshow(img_beam)
plt.colorbar()
plt.show()
img = Image.fromarray(img_beam)
print(np.array(img))
img.save("img_beam_only.png")
|