Class BlindDeblur

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class BlindDeblur
    extends AlgorithmBase
    Author:
    ilb Ported to Java by William Gandler Title: Matlab Code for Fast Blind Removal of Non-Uniform Camera Shake Blur Author: Oliver Whyte 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 [#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 Fast Deconvolution code of Krishnan and Fergus. Downloaded from FFT-based Poisson image blending by Amit Agrawal. Downloaded May 2008 from Shock-filter code of Guy Gilboa. Downloaded from LARS-LASSO code of Karl Skoglund. Most recent version available at ## 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.
    • Field Detail

      • logFile

        private java.lang.String logFile
      • max_dim

        private int max_dim
      • synthetic

        private boolean synthetic
      • results_root

        private java.lang.String results_root
      • output_name

        private java.lang.String output_name
      • output_directory_name

        private java.lang.String output_directory_name
      • output_directory

        private java.io.File output_directory
      • blurryImageFileDirectory

        private java.lang.String blurryImageFileDirectory
      • blurryImageFileName

        private java.lang.String blurryImageFileName
      • blurryImageExtension

        private java.lang.String blurryImageExtension
      • trueImageFileDirectory

        private java.lang.String trueImageFileDirectory
      • trueImageFileName

        private java.lang.String trueImageFileName
      • trueImageExtension

        private java.lang.String trueImageExtension
      • israw_true

        private boolean israw_true
      • israw_blurry

        private boolean israw_blurry
      • focalLengthTrue

        private double focalLengthTrue
      • focalLength35True

        private double focalLength35True
      • cameraMakeTrue

        private java.lang.String cameraMakeTrue
      • cameraModelTrue

        private java.lang.String cameraModelTrue
      • exposureTimeTrue

        private double exposureTimeTrue
      • FNumberTrue

        private double FNumberTrue
      • ISOSpeedRatingTrue

        private double ISOSpeedRatingTrue
      • focalLengthBlurry

        private double focalLengthBlurry
      • focalLength35Blurry

        private double focalLength35Blurry
      • cameraMakeBlurry

        private java.lang.String cameraMakeBlurry
      • cameraModelBlurry

        private java.lang.String cameraModelBlurry
      • exposureTimeBlurry

        private double exposureTimeBlurry
      • FNumberBlurry

        private double FNumberBlurry
      • ISOSpeedRatingBlurry

        private double ISOSpeedRatingBlurry
      • correctedImage

        private ModelImage correctedImage
      • config_name

        private java.lang.String 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

        private java.lang.String kernel_method
      • image_method

        private java.lang.String image_method
      • image_method_final

        private java.util.Vector<java.lang.String> 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

        private java.lang.String 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

        private java.lang.String 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

        private java.util.Vector<BlindDeblur.Pair<java.lang.String,​java.lang.Double>> cameraModelList
      • SYNTHETIC_BLUR_SIZE

        private int SYNTHETIC_BLUR_SIZE
      • SYNTHETIC_NOISE_STD

        private double SYNTHETIC_NOISE_STD
      • resp_params

        private java.util.Vector<BlindDeblur.Pair<java.lang.String,​java.lang.Double>> resp_params
      • respfn

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> respfn
      • tgs_z_factor

        double tgs_z_factor
      • respfn_default

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> respfn_default
      • invrespfn_default

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> invrespfn_default
      • respfn_canon

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> respfn_canon
      • invrespfn_canon

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> invrespfn_canon
      • respfn_linear

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> respfn_linear
      • invrespfn_linear

        java.util.function.BiFunction<java.lang.Double,​java.lang.Double,​java.lang.Double> invrespfn_linear
    • Constructor Detail

      • BlindDeblur

        public BlindDeblur()
      • BlindDeblur

        public BlindDeblur​(ModelImage correctedImage,
                           ModelImage blurryImage,
                           ModelImage trueImage,
                           java.lang.String results_root,
                           java.lang.String logFile,
                           int BLUR_KERNEL_SIZE)
    • Method Detail

      • initCameraModelList

        private void initCameraModelList()
      • default_config

        private void default_config()
      • runAlgorithm

        public void runAlgorithm()
        Description copied from class: AlgorithmBase
        Actually runs the algorithm. Implemented by inheriting algorithms.
        Specified by:
        runAlgorithm in class AlgorithmBase
      • linear2srgb

        private double linear2srgb​(double imlinear)
      • srgb2linear

        private double srgb2linear​(double imsrgb)
      • make_kernel_pyramid

        private void make_kernel_pyramid​(java.util.Vector<double[][][]> pyr_kernel,
                                         java.util.Vector<double[][][][]> pyr_tt,
                                         java.util.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)