Package gov.nih.mipav.model.algorithms
Class BlindDeblur
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.BlindDeblur
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
- Author:
- ilb Ported to Java by William Gandler Title: Matlab Code for Fast Blind Removal of Non-Uniform Camera Shake Blur Author: Oliver Whyte invalid input: '<'oawhyte@gmail.com> Version: 1.0 Date: Sept 17, 2014 Copyright: 2012, Oliver Whyte URL: http://www.di.ens.fr/willow/research/deblurring/, http://www.di.ens.fr/willow/research/saturation/ Matlab Code for Fast Blind Removal of Non-Uniform Camera Shake Blur =================================================================== This package contains code to perform fast blind deblurring of images degraded by camera shake, using the MAP algorithm described in our IJCV 2012 paper [][#Whyte12], and the fast approximation of spatially-varying blur described in our CPCV 2011 paper [][#Whyte11]. Please cite these papers if using this code in an academic publication. Please send bug reports to invalid input: '<'oawhyte@gmail.com> [#Whyte11]: O. Whyte, J. Sivic, and A. Zisserman. "Deblurring Shaken and Partially Saturated Images". In Proc. CPCV Workshop, with ICCV, 2011. [#Whyte12]: O. Whyte, J. Sivic, A. Zisserman, and J. Ponce. "Non-uniform Deblurring for Shaken Images". IJCV, 2011 (accepted). ## 1 Acknowledgements ## This package includes modified versions of code published by several other authors: Sparse Deconvolution code of Levin et al. Downloaded from invalid input: '<'http://groups.csail.mit.edu/graphics/CodedAperture/DeconvolutionCode.html> Fast Deconvolution code of Krishnan and Fergus. Downloaded from invalid input: '<'http://cs.nyu.edu/~dilip/research/fast-deconvolution/> FFT-based Poisson image blending by Amit Agrawal. Downloaded May 2008 from invalid input: '<'http://www.umiacs.umd.edu/~aagrawal/ICCV2007Course/PseudoCode.PDF> Shock-filter code of Guy Gilboa. Downloaded from invalid input: '<'http://visl.technion.ac.il/~gilboa/PDE-filt/shock.m> LARS-LASSO code of Karl Skoglund. Most recent version available at invalid input: '<'http://www.imm.dtu.dk/projects/spasm/> ## 3 License ## Copyright (c) 2012, Oliver Whyte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate doubleprivate doubleprivate doubleprivate intprivate intprivate int[]private int[]private int[]private ModelImageprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringprivate Vector<BlindDeblur.Pair<String, Double>> private Stringprivate Stringprivate ModelImageprivate intprivate intprivate boolean[]private boolean[]private booleanprivate booleanprivate Stringprivate doubleprivate doubleprivate booleanprivate intprivate intprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate intprivate doubleprivate doubleprivate String(package private) BiFunction<Double, Double, Double> (package private) BiFunction<Double, Double, Double> (package private) BiFunction<Double, Double, Double> private doubleprivate doubleprivate booleanprivate booleanprivate booleanprivate intprivate Stringprivate doubleprivate doubleprivate doubleprivate Stringprivate intprivate intprivate intprivate booleanprivate intprivate intprivate int[]private intprivate doubleprivate doubleprivate doubleprivate Fileprivate Stringprivate Stringprivate doubleprivate intprivate intprivate intprivate Vector<BlindDeblur.Pair<String, Double>> (package private) BiFunction<Double, Double, Double> (package private) BiFunction<Double, Double, Double> (package private) BiFunction<Double, Double, Double> (package private) BiFunction<Double, Double, Double> private Stringprivate doubleprivate intprivate booleanprivate booleanprivate doubleprivate doubleprivate intprivate intprivate booleanprivate intprivate double(package private) doubleprivate double[]private booleanprivate ModelImageprivate Stringprivate Stringprivate Stringprivate booleanFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionBlindDeblur(ModelImage correctedImage, ModelImage blurryImage, ModelImage trueImage, String results_root, String logFile, int BLUR_KERNEL_SIZE) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate doublelinear2srgb(double imlinear) private voidmake_kernel_pyramid(Vector<double[][][]> pyr_kernel, Vector<double[][][][]> pyr_tt, Vector<double[]> pyr_tgs, double[] theta_x_lims, double[] theta_y_lims, double[] theta_z_lims, double[] tgs, double scale_ratio_k, int max_levels, boolean non_uniform, double[][][] init_kernel, boolean chain_downsampling, double[][] init_tt) voidActually runs the algorithm.private doublesrgb2linear(double imsrgb) Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
logFile
-
max_dim
private int max_dim -
synthetic
private boolean synthetic -
results_root
-
output_name
-
output_directory_name
-
output_directory
-
blurryImageFileDirectory
-
blurryImageFileName
-
blurryImageExtension
-
trueImageFileDirectory
-
trueImageFileName
-
trueImageExtension
-
israw_true
private boolean israw_true -
israw_blurry
private boolean israw_blurry -
focalLengthTrue
private double focalLengthTrue -
focalLength35True
private double focalLength35True -
cameraMakeTrue
-
cameraModelTrue
-
exposureTimeTrue
private double exposureTimeTrue -
FNumberTrue
private double FNumberTrue -
ISOSpeedRatingTrue
private double ISOSpeedRatingTrue -
focalLengthBlurry
private double focalLengthBlurry -
focalLength35Blurry
private double focalLength35Blurry -
cameraMakeBlurry
-
cameraModelBlurry
-
exposureTimeBlurry
private double exposureTimeBlurry -
FNumberBlurry
private double FNumberBlurry -
ISOSpeedRatingBlurry
private double ISOSpeedRatingBlurry -
blurryImage
-
correctedImage
-
trueImage
-
config_name
-
do_display
private boolean do_display -
save_intermediate_images
private int save_intermediate_images -
save_mat
private boolean save_mat -
save_intermediate_pyramids
private boolean save_intermediate_pyramids -
israw
private boolean israw -
bi_sigma_spatial0
private double bi_sigma_spatial0 -
bi_sigma_range0
private double bi_sigma_range0 -
bi_size
private int bi_size -
shock_dt0
private int shock_dt0 -
shock_iters
private int shock_iters -
param_decrease
private double param_decrease -
grad_dir_bins
private int grad_dir_bins -
grad_dir_quant
private double grad_dir_quant -
grad_thresh_decrease
private double grad_thresh_decrease -
r
private int r -
non_uniform
private boolean non_uniform -
num_vert_regions
private int num_vert_regions -
num_horz_regions
private int num_horz_regions -
omega0
private double omega0 -
omega1
private double omega1 -
omega2
private double omega2 -
alpha
private double alpha -
kf_lambda
private double kf_lambda -
kf_exponent
private double kf_exponent -
kernel_threshold
private double kernel_threshold -
beta
private double beta -
num_cg_iters
private int num_cg_iters -
theta_pre
private double[] theta_pre -
pixels_per_theta_step
private int pixels_per_theta_step -
BLUR_KERNEL_SIZE
private int BLUR_KERNEL_SIZE -
blur_x_lims
private int[] blur_x_lims -
blur_y_lims
private int[] blur_y_lims -
blur_z_lims
private int[] blur_z_lims -
scale_ratio_i
private double scale_ratio_i -
scale_ratio_k
private double scale_ratio_k -
max_levels
private int max_levels -
num_iters
private int[] num_iters -
recenter_kernel
private int recenter_kernel -
kernel_dilate_radius
private int kernel_dilate_radius -
sat_thresh
private double sat_thresh -
kernel_method
-
image_method
-
image_method_final
-
do_estimate_kernel
private boolean do_estimate_kernel -
do_deblur
private boolean[] do_deblur -
do_color
private boolean[] do_color -
estimate_kernel_from
-
deconv_maxit
private int deconv_maxit -
deconv_maxit_final
private int deconv_maxit_final -
threshold_kernel
private boolean threshold_kernel -
focal_length_in_35mm_true
private double focal_length_in_35mm_true -
focal_length_in_35mm_shake
private double focal_length_in_35mm_shake -
first_level
private int first_level -
final_level
private int final_level -
BtB_method
-
max_nonzeros_w
private int max_nonzeros_w -
update_saturation_mask
private boolean update_saturation_mask -
fast_approx
private boolean fast_approx -
cameraModelList
-
SYNTHETIC_BLUR_SIZE
private int SYNTHETIC_BLUR_SIZE -
SYNTHETIC_NOISE_STD
private double SYNTHETIC_NOISE_STD -
resp_params
-
respfn
BiFunction<Double,Double, respfnDouble> -
tgs_z_factor
double tgs_z_factor -
respfn_default
BiFunction<Double,Double, respfn_defaultDouble> -
invrespfn_default
BiFunction<Double,Double, invrespfn_defaultDouble> -
respfn_canon
BiFunction<Double,Double, respfn_canonDouble> -
invrespfn_canon
BiFunction<Double,Double, invrespfn_canonDouble> -
respfn_linear
BiFunction<Double,Double, respfn_linearDouble> -
invrespfn_linear
BiFunction<Double,Double, invrespfn_linearDouble>
-
-
Constructor Details
-
BlindDeblur
public BlindDeblur() -
BlindDeblur
public BlindDeblur(ModelImage correctedImage, ModelImage blurryImage, ModelImage trueImage, String results_root, String logFile, int BLUR_KERNEL_SIZE)
-
-
Method Details
-
initCameraModelList
private void initCameraModelList() -
default_config
private void default_config() -
runAlgorithm
public void runAlgorithm()Description copied from class:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin classAlgorithmBase
-
linear2srgb
private double linear2srgb(double imlinear) -
srgb2linear
private double srgb2linear(double imsrgb) -
make_kernel_pyramid
private void make_kernel_pyramid(Vector<double[][][]> pyr_kernel, Vector<double[][][][]> pyr_tt, Vector<double[]> pyr_tgs, double[] theta_x_lims, double[] theta_y_lims, double[] theta_z_lims, double[] tgs, double scale_ratio_k, int max_levels, boolean non_uniform, double[][][] init_kernel, boolean chain_downsampling, double[][] init_tt)
-