-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TernenceWang
committed
Jun 2, 2016
1 parent
18ffab5
commit 6e2c5e6
Showing
70 changed files
with
13,009 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# C source code | ||
CSRC = io_png.c \ | ||
mt19937ar.c | ||
# C++ source code | ||
CXXSRC = main.cpp \ | ||
bm3d.cpp \ | ||
utilities.cpp \ | ||
lib_transforms.cpp | ||
|
||
# all source code | ||
SRC = $(CSRC) $(CXXSRC) | ||
|
||
# C objects | ||
COBJ = $(CSRC:.c=.o) | ||
# C++ objects | ||
CXXOBJ = $(CXXSRC:.cpp=.o) | ||
# all objects | ||
OBJ = $(COBJ) $(CXXOBJ) | ||
# binary target | ||
BIN = BM3Ddenoising | ||
|
||
# C optimization flags | ||
COPT = -O3 -ftree-vectorize -funroll-loops | ||
|
||
# C++ optimization flags | ||
CXXOPT = $(COPT) | ||
|
||
# C compilation flags | ||
CFLAGS = $(COPT) -Wall -Wextra \ | ||
-Wno-write-strings -ansi | ||
# C++ compilation flags | ||
CXXFLAGS = $(CXXOPT) -Wall -Wextra \ | ||
-Wno-write-strings -Wno-deprecated -ansi | ||
# link flags | ||
LDFLAGS = -lpng -lm -lfftw3f | ||
|
||
# use openMP with `make OMP=1` | ||
ifdef OMP | ||
CFLAGS += -fopenmp | ||
CXXFLAGS += -fopenmp | ||
LDFLAGS += -lgomp | ||
else | ||
CFLAGS += -Wno-unknown-pragmas | ||
CXXFLAGS += -Wno-unknown-pragmas | ||
endif | ||
|
||
# partial compilation of C source code | ||
%.o: %.c %.h | ||
$(CC) -c -o $@ $< $(CFLAGS) | ||
# partial compilation of C++ source code | ||
%.o: %.cpp %.h | ||
$(CXX) -c -o $@ $< $(CXXFLAGS) | ||
|
||
# link all the object code | ||
$(BIN): $(OBJ) $(LIBDEPS) | ||
$(CXX) -o $@ $(OBJ) $(LDFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
% BM3D image denoising. | ||
|
||
# ABOUT | ||
|
||
* Author : Marc Lebrun <[email protected]> | ||
* Copyright : (C) 2011 IPOL Image Processing On Line http://www.ipol.im/ | ||
* Licence : GPL v3+, see GPLv3.txt | ||
|
||
# OVERVIEW | ||
|
||
This source code provides an implementation of the BM3D image denoising. | ||
|
||
# UNIX/LINUX/MAC USER GUIDE | ||
|
||
The code is compilable on Unix/Linux and Mac OS. | ||
|
||
- Compilation. | ||
Automated compilation requires the make program. | ||
|
||
- Library. | ||
This code requires the libpng library and the fftw library. | ||
|
||
- Image format. | ||
Only the PNG format is supported. | ||
|
||
------------------------------------------------------------------------- | ||
Usage: | ||
1. Download the code package and extract it. Go to that directory. | ||
|
||
2. Compile the source code (on Unix/Linux/Mac OS). | ||
There are two ways to compile the code. | ||
(1) RECOMMENDED, with Open Multi-Processing multithread parallelization | ||
(http://openmp.org/). Roughly speaking, it accelerates the program using the | ||
multiple processors in the computer. Run | ||
make OMP=1 | ||
|
||
OR | ||
(2) If the complier does not support OpenMp, run | ||
make | ||
|
||
3. Run BM3D image denoising. | ||
./BM3Ddenoising | ||
The generic way to run the code is: | ||
|
||
./BM3Ddenoising cinput.png sigma ImNoisy.png ImBasic.png ImDenoised.png ImDiff.png ImBias.png | ||
ImDiffBias.png computeBias 2DtransformStep1 useSD1 2DtransformStep2 useSD2 ColorSpace | ||
|
||
with : | ||
- cinput.png is a noise-free image; | ||
- sigma is the value of the noise which will be added to cinput.png; | ||
- ImNoisy.png will contain the noisy image; | ||
- ImBasic.png will contain the result of the first step of the algorithm; | ||
- ImDenoised.png will contain the final result of the algorithm; | ||
- ImDiff.png will contain the difference between cinput.png and ImDenoised.png; | ||
- ImBias.png will contain the result of the algorithm applied on cinput.png; | ||
- ImDiffBias.png will contain the difference between cinput.png and ImBias.png; | ||
- computeBias : see (3); | ||
- 2DtransformStep1: choice of the 2D transform which will be applied in the first step of the | ||
algorithm. See (4); | ||
- useSD1 : see (1) below; | ||
- 2DtransformStep2: choice of the 2D transform which will be applied in the second step of the | ||
algorithm. See (4); | ||
- useSD2 : see (2); | ||
- ColorSpace : choice of the color space on which the image will be applied. See (5). | ||
|
||
There are multiple ways to run the code: | ||
(1) for the first step, users can choose if they prefer to use | ||
standard variation for the weighted aggregation (useSD1 = 1) | ||
(2) for the second step, users can choose if they prefer to use | ||
standard variation for the weighted aggregation (useSD2 = 1) | ||
(3) you can moreover want to compute the bias (algorithm applied to the original | ||
image). To do this, use computeBias = 1. | ||
(4) you can choose the DCT transform or the Bior1.5 transform for the 2D transform | ||
in the step 1 (tau_2D_hard = dct or bior) and/or the step 2. (tau_2d_wien = dct or | ||
bior). | ||
(5) you can choose the colorspace for both steps between : rgb, yuv, ycbcr and opp. | ||
|
||
Example, run | ||
./BM3Ddenoising cinput.png 10 ImNoisy.png ImBasic.png ImDenoised.png ImDiff.png ImBias.png | ||
ImDiffBias.png 1 bior 0 dct 1 opp | ||
|
||
|
||
# ABOUT THIS FILE | ||
|
||
Copyright 2011 IPOL Image Processing On Line http://www.ipol.im/ | ||
|
||
Copying and distribution of this file, with or without modification, | ||
are permitted in any medium without royalty provided the copyright | ||
notice and this notice are preserved. This file is offered as-is, | ||
without any warranty. |
Oops, something went wrong.