diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2018-01-23 22:26:58 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2018-01-23 22:45:21 +0000 |
commit | a6b0f58b6afa0f0f10cf944b1660ef774da441f2 (patch) | |
tree | 10a46ad4553d5b81d2f99191699b96a0f9360fcf /Wrappers/Python/test | |
parent | 97d2cbf43f301b2d002fc109978f9fc8a8fd5bdf (diff) | |
download | regularization-a6b0f58b6afa0f0f10cf944b1660ef774da441f2.tar.gz regularization-a6b0f58b6afa0f0f10cf944b1660ef774da441f2.tar.bz2 regularization-a6b0f58b6afa0f0f10cf944b1660ef774da441f2.tar.xz regularization-a6b0f58b6afa0f0f10cf944b1660ef774da441f2.zip |
Added all regularizers to test
Diffstat (limited to 'Wrappers/Python/test')
-rw-r--r-- | Wrappers/Python/test/test_regularizers.py | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/Wrappers/Python/test/test_regularizers.py b/Wrappers/Python/test/test_regularizers.py index 343708f..3c756f0 100644 --- a/Wrappers/Python/test/test_regularizers.py +++ b/Wrappers/Python/test/test_regularizers.py @@ -161,7 +161,16 @@ out2 = Regularizer.LLT_model(input=u0, regularization_parameter=25, tolerance_constant=0.001, number_of_iterations=300) print ("call ended??") -print (out2[0].shape) + +i = 0 +while(i < len(out2)): + shape = " not applicable" + if type (out2[i]) == np.ndarray: + shape = out2[i].shape + print ("len out2[{0}] type {1} shape {2}".format(i, type(out2[i]) , shape)) + i += 1 + +#print ("out2", out2) pars = out2[-2] reg_output.append(out2) @@ -184,24 +193,24 @@ imgplot = plt.imshow(reg_output[-1][0],cmap="gray") # # u0 = Im + .03*randn(size(Im)); u0(u0<0) = 0; % adding noise # # ImDen = PB_Regul_CPU(single(u0), 3, 1, 0.08, 0.05); -# out2 = Regularizer.PatchBased_Regul(input=u0, regularization_parameter=0.05, - # searching_window_ratio=3, - # similarity_window_ratio=1, - # PB_filtering_parameter=0.08) -# pars = out2[-2] -# reg_output.append(out2) +out2 = Regularizer.PatchBased_Regul(input=u0, regularization_parameter=0.05, + searching_window_ratio=3, + similarity_window_ratio=1, + PB_filtering_parameter=0.08) +pars = out2[-2] +reg_output.append(out2) -# a=fig.add_subplot(2,3,5) +a=fig.add_subplot(2,3,5) -# textstr = out2[-1] +textstr = out2[-1] -# # these are matplotlib.patch.Patch properties -# props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) -# # place a text box in upper left in axes coords -# a.text(0.05, 0.95, textstr, transform=a.transAxes, fontsize=14, - # verticalalignment='top', bbox=props) -# imgplot = plt.imshow(reg_output[-1][0],cmap="gray") +# these are matplotlib.patch.Patch properties +props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) +# place a text box in upper left in axes coords +a.text(0.05, 0.95, textstr, transform=a.transAxes, fontsize=14, + verticalalignment='top', bbox=props) +imgplot = plt.imshow(reg_output[-1][0],cmap="gray") # ###################### TGV_PD ######################################### @@ -211,25 +220,25 @@ imgplot = plt.imshow(reg_output[-1][0],cmap="gray") # # u = PrimalDual_TGV(single(u0), 0.02, 1.3, 1, 550); -# out2 = Regularizer.TGV_PD(input=u0, regularization_parameter=0.05, - # first_order_term=1.3, - # second_order_term=1, - # number_of_iterations=550) -# pars = out2[-2] -# reg_output.append(out2) +out2 = Regularizer.TGV_PD(input=u0, regularization_parameter=0.05, + first_order_term=1.3, + second_order_term=1, + number_of_iterations=550) +pars = out2[-2] +reg_output.append(out2) -# a=fig.add_subplot(2,3,6) +a=fig.add_subplot(2,3,6) -# textstr = out2[-1] +textstr = out2[-1] -# # these are matplotlib.patch.Patch properties -# props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) -# # place a text box in upper left in axes coords -# a.text(0.05, 0.95, textstr, transform=a.transAxes, fontsize=14, - # verticalalignment='top', bbox=props) -# imgplot = plt.imshow(reg_output[-1][0],cmap="gray") +# these are matplotlib.patch.Patch properties +props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) +# place a text box in upper left in axes coords +a.text(0.05, 0.95, textstr, transform=a.transAxes, fontsize=14, + verticalalignment='top', bbox=props) +imgplot = plt.imshow(reg_output[-1][0],cmap="gray") plt.show() |