File Exchange

Bregman Cookbook

version 1.1 (319 KB) by

This toolbox provides signal/image/3D processing based on Bregman Iterations

4 Downloads

Updated

This toolbox provides functions mainly to solve sparse algorithms (denoising, deconvolution) for signal processing, image processing and 3D datacube processing. It covers Rudin-Osher-Fatemi (ROF) algorithms, Total Variation (TV) deconvolution, framelet/curvelet deconvolution.

Mbvalentin

Mbvalentin (view profile)

Hello, Jerome.

Just added the following line at the end of each loop inside TVF_CartoonTexture_Decomposition(), right after the 'err' update, so the user can see what's going on in case it's taking too long to converge:

fprintf('err = %f, still greater than tol = %f...\n',err,tol);

MBV

Jerome Gilles

Jerome Gilles (view profile)

Dear Ethan,

You are totally right! Thanks for noticing this bug (I probably forgot to change it when I copy and paste the 2D code and extend it to 3D).

I'll fix it in the next version ;-)

Ethan J. Ulrich

Ethan J. Ulrich (view profile)

I was wondering if the Laplacian mask in ITV_ROF_3D.m and ATV_ROF_3D.m (Lines 44-46) should be

Lap(:,:,1)=[0,0,0;0, 1,0;0,0,0];
Lap(:,:,2)=[0,1,0;1,-6,1;0,1,0];
Lap(:,:,3)=[0,0,0;0, 1,0;0,0,0];

Otherwise the output will have scaled intensity values.

Jerome Gilles

Jerome Gilles (view profile)

Hi sreejni,

The point is that there is two functions fdct_wrapping in the Curvelab toolbox. One is obtained by compiling the mex files and the other one is pure Matlab code.

The one I call in my function is the one based on pure Matlab code (in order to avoid any compilation issues from potential users). So the trick is when you setup the Curvelab folders in the Matlab Path, you need to declare only the folder corresponding to the pure Matlab code otherwise, if Matlab finds a compiled version it will automatically prefer this one. ;-)

sreejini

sreejini (view profile)

I am using MATLAB2013b in ubuntu 14, downloded fftw-2.1.5 and curvelab-2.1.2.My gcc version is 4.7

my fftw-2.1.5 path is /home/sreejini/Downloads/BregmanCookbook_v32/BregmanCookbook/fftw-2.1.5

my curvelab path is /home/sreejini/Downloads/BregmanCookbook_v32/BregmanCookbook/CurveLab-2.1.2

i am able to run test1D.m but not other programs.

>>Test_2D
Error using fdct_wrapping
Too many input arguments.

Error in Curvelet_NB_Deconvolution (line 34)
U=fdct_wrapping(zeros(M,N),1,1,NLevel);

Error in Test_2D (line 71)
DBD=Curvelet_NB_Deconvolution(BD,gauss,Debmu,Deblambda,DebNiter,3,0);

Help me to correctly install fftw-2.1.5 too and run these test files in BregmanCookbook..

Jerome Gilles

Jerome Gilles (view profile)

Thanks Bernhard for these information!

Bernhard

Bernhard (view profile)

Few comments on the installation on OS OpenSuse , requirements:

- fftw-2.1.5

- CurveLab-2.1.2 (follow curvelab.pdf)

- g++ 3.3, if higher -> update the
appropriate *.hpp by adding
string.h".

I could compile the cpp-files using g++ 4.3 and Matlab R2012b:

mex fdct3d_param_mex.cpp fdct3d_param.o -lfftw
...

Since the installation was not that clear for me, I thought to post my experience.

Stanislas Rapacchi

Eric Diaz

Eric Diaz

Eric Diaz (view profile)

And finally for the rating, I only put 4 stars because the denoising performance does not seem to be that great, especially for the 3D, and the example files do not have good commenting for which algorithms to use, when and why. Also, the TVG_CartoonTexture_Decomposition example does not work when run, and there isn't good documentation for it. I'll be glad to upgrade to 5, if you fix the commenting parts. As for the efficacy, well, I don't know if you can do anything about that.

Eric Diaz

Eric Diaz (view profile)

And finally for the rating, I only put 4 stars because the denoising performance does not seem to be that great, especially for the 3D, and the example files do not have good commenting for which algorithms to use, when and why. Also, the TVG_CartoonTexture_Decomposition example does not work when run, and there isn't good documentation for it. I'll be glad to upgrade to 5, if you fix the commenting parts. As for the efficacy, well, I don't know if you can do anything about that.

Eric Diaz

Eric Diaz (view profile)

OK, finally got it. The file is online and works with a few modifications. A user with a similar system as myself, Mac OS X Lion & XCode 4.3 with Matlab 2010b or later, should go to the following thread and follow the instructions there. http://www.mathworks.ch/matlabcentral/newsreader/view_thread/317343

Jerome Gilles

Jerome Gilles (view profile)

Great, let me know when it will available online and if needed I will update my toolbox accordingly ;-)

Eric Diaz

Eric Diaz (view profile)

Good news Jerome! I received an email from Dr. Candes that there has been an update to the CurveLab package that should allow for proper building and compilation! Soon, I should be able to test this package out! :) I'll let you know if everything works out.

Eric Diaz

Eric Diaz (view profile)

Hi Jerome,

It's funny that you know nothing about Macs. They are fairly popular systems these days. Computationally powerful, elegant machines and OS X is BSD-Unix based.

It is a far stretch, but XCode is similar to Visual Studio, but for the Mac. It's a very powerful programming, building and compiling platform for the Mac. The platform uses llvm-gcc for compiling.

As for Fortran, I'm not sure either why it would be an issue or if it is an issue. I just know that I saw some 'error' messages, when running the configure file for FFTW.

As far as the documentation, I am not very familiar with all the flags and how to decipher the convoluted bash commands / flags / options / etc...

I let Dr. Candes know that there are packages being released in the present that are dependent on his package from 4 years ago. It's unfortunate that there is no technical support for it.

As for the 3D processing, I just wanted to run your example code to see how well it functions.

Jerome Gilles

Jerome Gilles (view profile)

Dear Eric,

Sorry but I know anything about Mac systems (what is XCode 4.3?) and I don't understand why you need a fortran compiler ...

Now concerning the compilation of FFTW, don't follow the documentation in curvelab but the documentation of FFTW itself and read what are the error messages. In my case it just needed to add the "-fPIC" flag in the compilation option in the Makefile (this option is useful for recent compilers).

Now concerning the use of curvelab, if you have any suggestions to replace it by an equivalent, I'm open. But curvelets are THE reference in terms of directional multiresolution expansions.
You seem interested to 3D processing, which multiresolution tool do you normally use?

The purpose of this toolbox is to show how to use the Bregman Iterations and to help people to use it for their own needs just by doing easy changes.

Eric Diaz

Eric Diaz (view profile)

I had difficulty getting the the compilation of this 2nd gcc with fortran support to work on my system, so I'll probaby give it another go tomorrow. I don't even know if not having the fortran compiler is even an issue or a reason that the curvelab build keeps failing. But hopefully eventually I'll figure it out. In the meantime, maybe you could work on developing a cookbook that isn't such a pain in the arse to work with and doesn't rely on antiquated, unsupported software packages.

Eric Diaz

Eric Diaz (view profile)

Finding a Fortran compiler for Lion 10.7 w/ XCode 4.3 is proving more difficult than I have expected. Currently looking at this article... http://solarianprogrammer.com/2012/02/20/living-on-the-edge-building-gcc-4-7-on-mac-osx-lion/

Eric Diaz

Eric Diaz (view profile)

I just noticed an error while re-running the configure file that comes with FFTW 2.1.5, that there does not seem to be a fortran compiler packaged with XCode 4.3.

I am going to try and find a compatible fortran compiler for my system specs and I will let you know if it fixes the problem.

Just want to add, that I came across an Intel thread 3/2012, that says to NOT to install Intel Fortran compiler, if you have XCode 4.3, as it does not work. There is some hack, but I'm not really willing to explore it right now.

Eric Diaz

Eric Diaz (view profile)

I did compile the specified FFTW 2.1.5, as directed in the curvelab pdf, but it still did not work. I modified the makefile for curvelab to give it the appropriate local FFTW subdirectory, but it still did not work.

That's about as far as I know how to go. I mentioned that I tried adding mex to the /usr/bin path, (just as you would have to do in linux, I presume, since Mac OS X is Unix based as well), but that just resulted in a bigger cluster of error outputs than just a simple failed to compile mex.

I was just going to comment about the path conflict with the installed version.

Jerome Gilles

Jerome Gilles (view profile)

I'm on a linux 64bit computer and I also had some trouble to compile the mex files of curvelab. The point is that you need to install the last 2.x version of FFTW (you can install it locally in order to discard version conflicts with an already installed version on your system). I remember that I modified the makefiles files in order to suit with my compiler and librairies versions to properly compile FFTW.
Next to you can compile the curvelab toolbox.

In my knowledge, Curvelab is the only toolbox which implement the 3D curvelets. Another option is to use some other expansion.

Eric Diaz

Eric Diaz (view profile)

After installing the fspecial3 function, I ran into trouble with the required curvelab package. I'm not sure if you are aware, but curvelab has not been updated since 2008 and there is no technical support for their package. Also, curvelab is dependent on an obsolete version of FFTW. Anyways, the trouble I am having with the curvelab package is that the files are not mex-ing properly. As such, your test_3d example which calls the mex files from curvelab does not function and gives an error. Unfortunately, as their is no technical support for mexing the files, I cannot do it and I have spent way too much time trying to do so. Might I recommend moving away from dependencies on these packages.

If you have any suggestions, I am running Mac OS X 10.7.3, XCode 4.3.1, with i686-apple-darwin11-llvm-gcc-4.2, and MATLAB 2010b. At first, the mex function was not even being called from the bash shell, and so I linked it to the /usr/bin/ path, which then allowed it to be called but it just failed repeatedly.

Eric Diaz

Eric Diaz (view profile)

After installing the fspecial3 function, I ran into trouble with the required curvelab package. I'm not sure if you are aware, but curvelab has not been updated since 2008 and there is no technical support for their package. Also, curvelab is dependent on an obsolete version of FFTW. Anyways, the trouble I am having with the curvelab package is that the files are not mex-ing properly. As such, your test_3d example which calls the mex files from curvelab does not function and gives an error. Unfortunately, as their is no technical support for mexing the files, I cannot do it and I have spent way too much time trying to do so. Might I recommend moving away from dependencies on these packages.

Eric Diaz

Eric Diaz (view profile)

OK...I did a google search for fspecial3 and say Mr. Garcia's version, but also found another version authored by someone else, so I wasn't sure which one it was.

You know 'Us' put together a file dependency checker on the FEX. maybe you should check it out. File ID#17291

Jerome Gilles

Jerome Gilles (view profile)

oups sorry!

the fspecial3 function was written by Damien Garcia, a PhD student in Montreal.
It is available via this link:

http://www.biomecardio.com/matlab/fspecial3.html

I will ask Damien if he is agree if I put his function into the Bregman Cookbook ;-)

Eric Diaz

Eric Diaz (view profile)

Quite a package, I must admit! However, when running the example Test_3D.m, I had an error when fspecial3 function is called. Apparently, I don't have it in my distro and it isn't packaged. So, I'm unable to run the test.

Updates

 24 Jun 2013 1.1 Convergence criteria are updated for all functions (previous bugs are now fixed) + test script for 1D case.
MATLAB Release
MATLAB 7.13 (R2011b)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.