image and noisy image mse as first mse, visibility changes
This commit is contained in:
@@ -100,9 +100,7 @@ class DeconvolveWithBead:
|
||||
win_size = 7 #default = 7
|
||||
#ms_ssim = []
|
||||
|
||||
# minimum = None #[]
|
||||
# previous = None
|
||||
best_mse = np.inf #float('inf')
|
||||
best_mse = np.inf
|
||||
minn = None
|
||||
|
||||
print("Deconvolving:", psf.min(), psf.max(), psf.sum(), otf.sum(), on.sum())
|
||||
@@ -116,35 +114,10 @@ class DeconvolveWithBead:
|
||||
#slicing mse to remove unwanted irrelevant data around the "sõõr"
|
||||
onsum = on.sum()
|
||||
|
||||
# # saving the previous image
|
||||
# if previous is None:
|
||||
# minimum = on.copy() #[on]
|
||||
# else:
|
||||
# minimum = previous.copy() #[previous]
|
||||
# previous = on.copy()
|
||||
|
||||
if mse[-1] < best_mse:
|
||||
best_mse = mse[-1]
|
||||
minn = on.copy()
|
||||
|
||||
# if len(mse) >= 2 and mse[-2] < mse[-1]:
|
||||
# minn = minimum
|
||||
# print("---------------------miinimum-pilt-on-leitud------------------------------------")
|
||||
|
||||
|
||||
# fig = plt.figure()
|
||||
# ax1 = fig.add_subplot(141)
|
||||
# ax2 = fig.add_subplot(142)
|
||||
# ax3 = fig.add_subplot(143)
|
||||
# ax4 = fig.add_subplot(144)
|
||||
|
||||
# ax1.imshow(bead)
|
||||
# ax2.imshow(im)
|
||||
# ax3.imshow(on)
|
||||
# ax4.imshow(bead-on)
|
||||
# plt.show()
|
||||
#ms_ssim.append(msssim(on,bead))
|
||||
|
||||
itr.append(it) # for iterations
|
||||
_mssim = ssim(bead, on,
|
||||
win_size = win_size, # okaalsem siis 3,5,7, kui globaalsem võrdlus, siis suurem
|
||||
|
||||
6
pohi.py
6
pohi.py
@@ -88,6 +88,7 @@ with h5py.File(args.output, 'w') as hdf5_file:
|
||||
mssim = []
|
||||
|
||||
for j in g_sigma:
|
||||
MSE = np.sum((noisy_image - scaled_original)**2) / noisy_image.size # adding image and noisy image mse
|
||||
image_kerneled = gaussian_filter(noisy_image, sigma = j)
|
||||
psf_kerneled = gaussian_filter(psf, sigma = j)
|
||||
print(np.sum(image_kerneled),np.sum(noisy_image), np.sum(psf_kerneled), np.sum(psf))
|
||||
@@ -102,7 +103,10 @@ with h5py.File(args.output, 'w') as hdf5_file:
|
||||
hdf5_file.create_dataset(f'ch{w:03d}/intensity_{i:08.3f}/SIGMA_{j:03.1f}', data = dec[0])
|
||||
hdf5_file.create_dataset(f"ch{w:03d}/intensity_{i:08.3f}/minimum_image_{j:03.1f}", data = dec[4])
|
||||
|
||||
mses.append(dec[1])
|
||||
dec[1][-1] = MSE
|
||||
meansquare = np.concatenate(([dec[1][-1]], dec[1][:-1]))
|
||||
mses.append(meansquare)
|
||||
#mses.append(dec[1])
|
||||
mssim.append(dec[2])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user