diff options
author | algol <dkazanc@hotmail.com> | 2018-03-06 11:45:53 +0000 |
---|---|---|
committer | algol <dkazanc@hotmail.com> | 2018-03-06 11:45:53 +0000 |
commit | 8d310478254f3cda63f3663729b416f425ad70b6 (patch) | |
tree | 63d5132feec37d5b99ca8f6879363d9dd88520a9 /Wrappers/Python | |
parent | ccf9b61bba1004af783c6333d58ea9611c0f81f2 (diff) | |
download | regularization-8d310478254f3cda63f3663729b416f425ad70b6.tar.gz regularization-8d310478254f3cda63f3663729b416f425ad70b6.tar.bz2 regularization-8d310478254f3cda63f3663729b416f425ad70b6.tar.xz regularization-8d310478254f3cda63f3663729b416f425ad70b6.zip |
work on FGP intergration
Diffstat (limited to 'Wrappers/Python')
-rw-r--r-- | Wrappers/Python/demo/test_cpu_regularizers.py | 17 | ||||
-rw-r--r-- | Wrappers/Python/src/cpu_regularizers.pyx | 14 |
2 files changed, 14 insertions, 17 deletions
diff --git a/Wrappers/Python/demo/test_cpu_regularizers.py b/Wrappers/Python/demo/test_cpu_regularizers.py index 53b8538..f1eb3c3 100644 --- a/Wrappers/Python/demo/test_cpu_regularizers.py +++ b/Wrappers/Python/demo/test_cpu_regularizers.py @@ -131,9 +131,9 @@ imgplot = plt.imshow(splitbregman,\ start_time = timeit.default_timer() pars = {'algorithm' : TV_FGP_CPU , \ 'input' : u0, - 'regularization_parameter':0.05, \ - 'number_of_iterations' :200 ,\ - 'tolerance_constant':1e-5,\ + 'regularization_parameter':0.07, \ + 'number_of_iterations' :300 ,\ + 'tolerance_constant':0.00001,\ 'methodTV': 0 ,\ 'nonneg': 0 ,\ 'printingOut': 0 @@ -156,7 +156,7 @@ txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) print (txtstr) -a=fig.add_subplot(2,4,3) +a=fig.add_subplot(2,4,4) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) @@ -168,8 +168,9 @@ imgplot = plt.imshow(fgp, \ a.text(0.05, 0.95, txtstr, transform=a.transAxes, fontsize=14, verticalalignment='top', bbox=props) -###################### LLT_model ######################################### +###################### LLT_model ######################################### +""" start_time = timeit.default_timer() pars = {'algorithm': LLT_model , \ @@ -204,7 +205,7 @@ a.text(0.05, 0.95, txtstr, transform=a.transAxes, fontsize=14, imgplot = plt.imshow(llt,\ cmap="gray" ) - +""" # ###################### PatchBased_Regul ######################################### # # Quick 2D denoising example in Matlab: @@ -292,8 +293,8 @@ pars = {'algorithm': TV_ROF_CPU , \ 'number_of_iterations': 300 } rof = TV_ROF_CPU(pars['input'], - pars['number_of_iterations'], - pars['regularization_parameter'], + pars['regularization_parameter'], + pars['number_of_iterations'], pars['marching_step'] ) #tgv = out diff --git a/Wrappers/Python/src/cpu_regularizers.pyx b/Wrappers/Python/src/cpu_regularizers.pyx index 2654831..d62ca59 100644 --- a/Wrappers/Python/src/cpu_regularizers.pyx +++ b/Wrappers/Python/src/cpu_regularizers.pyx @@ -21,14 +21,11 @@ cimport numpy as np cdef extern float TV_ROF_CPU_main(float *Input, float *Output, float lambdaPar, int iterationsNumb, float tau, int dimX, int dimY, int dimZ); cdef extern float TV_FGP_CPU_main(float *Input, float *Output, float lambdaPar, int iterationsNumb, float epsil, int methodTV, int nonneg, int printM, int dimX, int dimY, int dimZ); -def TV_ROF_CPU(inputData, regularization_parameter, iterationsNumb - marching_step_parameter): +def TV_ROF_CPU(inputData, regularization_parameter, iterationsNumb, marching_step_parameter): if inputData.ndim == 2: - return TV_ROF_2D(inputData, regularization_parameter, iterationsNumb - marching_step_parameter) + return TV_ROF_2D(inputData, regularization_parameter, iterationsNumb, marching_step_parameter) elif inputData.ndim == 3: - return TV_ROF_3D(inputData, regularization_parameter, iterationsNumb - marching_step_parameter) + return TV_ROF_3D(inputData, regularization_parameter, iterationsNumb, marching_step_parameter) def TV_ROF_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData, float regularization_parameter, @@ -47,10 +44,9 @@ def TV_ROF_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData, return outputData def TV_ROF_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData, - int iterations, + int iterationsNumb, float regularization_parameter, - float marching_step_parameter - ): + float marching_step_parameter): cdef long dims[3] dims[0] = inputData.shape[0] dims[1] = inputData.shape[1] |