diff options
author | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-02-21 12:06:12 +0000 |
---|---|---|
committer | Daniil Kazantsev <dkazanc@hotmail.com> | 2018-02-21 12:06:12 +0000 |
commit | 49423f47c7282672fea979cd122c063c0f5ee465 (patch) | |
tree | d585ffa14de40676c8d9f742f1b9dc10eeca7a5d /Wrappers | |
parent | b8e4e8d89432cfaa860835d873b52e4df40d92d5 (diff) | |
download | regularization-49423f47c7282672fea979cd122c063c0f5ee465.tar.gz regularization-49423f47c7282672fea979cd122c063c0f5ee465.tar.bz2 regularization-49423f47c7282672fea979cd122c063c0f5ee465.tar.xz regularization-49423f47c7282672fea979cd122c063c0f5ee465.zip |
ROF_TV demo
Diffstat (limited to 'Wrappers')
-rw-r--r-- | Wrappers/Python/test/test_gpu_regularizers.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/Wrappers/Python/test/test_gpu_regularizers.py b/Wrappers/Python/test/test_gpu_regularizers.py index 735a25d..3346fb2 100644 --- a/Wrappers/Python/test/test_gpu_regularizers.py +++ b/Wrappers/Python/test/test_gpu_regularizers.py @@ -6,14 +6,12 @@ Created on Tue Jan 30 10:24:26 2018 @author: ofn77899 """ - - import matplotlib.pyplot as plt import numpy as np import os from enum import Enum import timeit -from ccpi.filters.gpu_regularizers import Diff4thHajiaboli, NML +from ccpi.filters.gpu_regularizers import Diff4thHajiaboli, NML, ROF_TV_GPU ############################################################################### def printParametersToString(pars): txt = r'' @@ -146,3 +144,43 @@ imgplot = plt.imshow((nml - u0)**2, cmap="gray") plt.show() + +## Rudin-Osher-Fatemi (ROF) TV regularization +start_time = timeit.default_timer() + +pars = { + 'input' : u0, + 'regularization_parameter': 1,\ + 'time_marching_parameter': 0.003, \ + 'number_of_iterations':300 + } + +rof_tv = ROF_TV_GPU(pars['input'], + pars['number_of_iterations'], + pars['time_marching_parameter'], + pars['number_of_iterations']) + +rms = rmse(Im, rof_tv) +pars['rmse'] = rms +txtstr = printParametersToString(pars) +txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) +print (txtstr) +a=fig.add_subplot(2,4,1) + +# these are matplotlib.patch.Patch properties +props = dict(boxstyle='round', facecolor='wheat', alpha=0.75) +# place a text box in upper left in axes coords +a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=12, + verticalalignment='top', bbox=props) +imgplot = plt.imshow(nml, cmap="gray") + +a=fig.add_subplot(2,4,2) + +# 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, 'rof_tv - u0', transform=a.transAxes, fontsize=14, + verticalalignment='top', bbox=props) +imgplot = plt.imshow((rof_tv - u0)**2, cmap="gray") + +plt.show() |