https://doi.org/10.5201/ipol.2012.llm-ksvd
Raw File
Tip revision: c78cdcf65f9f2fd89008647de7d7776cb2454f08 authored by Software Heritage on 01 January 2011, 00:00:00 UTC
ipol: Deposit 1191 in collection ipol
Tip revision: c78cdcf
ksvd.h
/**
    ksvd.h
**/

#ifndef KSVD_H_INCLUDED
#define KSVD_H_INCLUDED

#include<vector>

typedef std::vector<std::vector<double> > matD_t;
typedef std::vector<std::vector<unsigned> > matU_t;
typedef std::vector<double> vecD_t;
typedef std::vector<unsigned> vecU_t;
typedef std::vector<double>::iterator iterD_t;
typedef std::vector<unsigned>::iterator iterU_t;

//! Run K-SVD
void ksvd_ipol(const double   sigma       ,
               double *       img_noisy   ,
               float *        img_denoised,
               const unsigned width       ,
               const unsigned height      ,
               const unsigned chnls       ,
               const bool     useT        );

//! Decompose the image into patches of size NxN
void im2patches(const double * img,
                matD_t        &patches,
                const unsigned width,
                const unsigned height,
                const unsigned chnls,
                const unsigned N);

//! Reconstruct images by aggregating patches of size N x N
void patches2im(matD_t        &patches,
                 float *        img,
                 const double * img_ref,
                 const unsigned width,
                 const unsigned height,
                 const unsigned chnls,
                 const double   lambda,
                 const unsigned N);

//! Obtain random permutation for a tabular of size N
void randperm(vecU_t &perm);

 //! Obtain the initial dictionary, which
 //! columns are normalized
void obtain_dict(matD_t        &dictionary,
                 matD_t const&  patches);

//! Process K-SVD denoising
void ksvd_process(const double *img_noisy,
                  float       * img_denoised,
                  matD_t        &patches,
                  matD_t        &dictionary,
                  const double   sigma,
                  const unsigned N1,
                  const unsigned N2,
                  const unsigned N_iter,
                  const double   gamma,
                  const double   C,
                  const unsigned width,
                  const unsigned height,
                  const unsigned chnls,
				  const bool     doReconstruction);

#endif // KSVD_H_INCLUDED
back to top