oln::transforms::dwt< I, K > Class Template Reference

Object to compute dwt transforms. More...

#include <dwt.hh>

Collaboration diagram for oln::transforms::dwt< I, K >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef I original_im_t
 Exact of the image.

typedef mlc::exact< I >::ret::value_type original_im_value_t
 Original data type of the image.

typedef mute< I, ntg::float_d
>::ret 
trans_im_t
 Type of the transformed image.

typedef K::self_t coeffs_t
 Data type of coefficients.


Public Member Functions

 dwt (const original_im_t &im)
 Constructor from an image.

const trans_im_t transformed_image () const
 Accessor to the transformed image.

trans_im_ttransformed_image ()
 Accessor to the transformed image.

trans_im_t transform (dwt_transform_type t=dwt_non_std, bool normalized=true, unsigned l=0)
 Compute the dwt transform.

trans_im_t transform_inv (unsigned l=0)
 Compute the invert dwt transform.

template<class T1> mute< I, T1 >::ret transform_inv (unsigned l=0)
 Compute the invert dwt transform.


Detailed Description

template<class I, class K>
class oln::transforms::dwt< I, K >

Object to compute dwt transforms.

Parameters:
I Exact type of the image to process.
K Type of coefficients.

Definition at line 470 of file dwt.hh.


Constructor & Destructor Documentation

template<class I, class K>
oln::transforms::dwt< I, K >::dwt const original_im_t im  )  [inline]
 

Constructor from an image.

Initialization of dwt transform.

  • im Image to process.

Definition at line 486 of file dwt.hh.

References oln::transforms::dwt< I, K >::original_im_t, oln::transforms::dwt< I, K >::original_im_value_t, and oln::transforms::dwt< I, K >::trans_im_t.

00486                                    : original_im(im)
00487       {
00488         ntg_is_a(original_im_value_t, ntg::real)::ensure();
00489 
00490         im_size = im.size().nth(0);
00491         assertion(im_size >= coeffs.size());
00492         for (unsigned i = 1; i < original_im_t::dim; i++)
00493           assertion(im_size == static_cast<unsigned>(im.size().nth(i)));
00494 
00495         max_level = static_cast<unsigned>(log(2 * im_size / coeffs.size()) /
00496                                internal::ln_2_);
00497 
00498         current_level = max_level;
00499 
00500         assertion(!(im_size % (1 << max_level)));
00501 
00502         trans_im = trans_im_t(im.size());
00503       }


Member Function Documentation

template<class I, class K>
trans_im_t oln::transforms::dwt< I, K >::transform dwt_transform_type  t = dwt_non_std,
bool  normalized = true,
unsigned  l = 0
[inline]
 

Compute the dwt transform.

  • t Type of the transform (standard or non standard)
  • normalized Do you want a normalized result ?
  • l Level.

Definition at line 532 of file dwt.hh.

References oln::transforms::dwt< I, K >::trans_im_t.

00534       {
00535         if (l == 0) {
00536           l = max_level;
00537           current_level = max_level;
00538         } else {
00539           if (l > max_level)
00540             l = max_level;
00541           current_level = l;
00542         }
00543 
00544         oln_iter_type(trans_im_t) it(trans_im);
00545 
00546         if (normalized) {
00547           norm = pow(sqrt(2), original_im_t::dim * l);
00548           for_all(it)
00549             trans_im[it] = original_im[it] / norm;
00550         }
00551         else {
00552           norm = 1;
00553           for_all(it)
00554             trans_im[it] = original_im[it];
00555         }
00556 
00557         unsigned lim = im_size >> (l - 1);
00558         transform_type = t;
00559 
00560         internal::dwt_transform_(trans_im, lim, im_size, coeffs, t);
00561 
00562         return trans_im;
00563       }

template<class I, class K>
template<class T1>
mute<I, T1>::ret oln::transforms::dwt< I, K >::transform_inv unsigned  l = 0  )  [inline]
 

Compute the invert dwt transform.

Parameters:
T1 Data type you want the output image contains.
  • l Level.

Definition at line 604 of file dwt.hh.

References oln::transforms::dwt< I, K >::trans_im_t, and oln::transforms::dwt< I, K >::transform_inv().

00605       {
00606         ntg_is_a(T1, ntg::real)::ensure();
00607 
00608         trans_im_t tmp_im = transform_inv(l);
00609         typename mute<I, T1>::ret new_im(tmp_im.size());
00610 
00611         oln_iter_type(trans_im_t) it(tmp_im);
00612 
00613         for_all(it)
00614           new_im[it] = (tmp_im[it] >= ntg_inf_val(T1) ?
00615                         (tmp_im[it] <= ntg_sup_val(T1) ?
00616                          tmp_im [it] :
00617                          ntg_sup_val(T1)) :
00618                         ntg_inf_val(T1));
00619         return new_im;
00620       }

template<class I, class K>
trans_im_t oln::transforms::dwt< I, K >::transform_inv unsigned  l = 0  )  [inline]
 

Compute the invert dwt transform.

  • l Level.

Definition at line 570 of file dwt.hh.

References oln::transforms::dwt< I, K >::trans_im_t.

Referenced by oln::transforms::dwt< I, K >::transform_inv().

00571       {
00572         if (l == 0)
00573           l = current_level;
00574         else if (l > current_level)
00575           l = current_level;
00576 
00577         trans_im_t new_im(trans_im.size());
00578         oln_iter_type(trans_im_t) it(trans_im);
00579 
00580         if (norm != 1) {
00581           for_all(it)
00582             new_im[it] = trans_im[it] * norm;
00583         }
00584         else
00585           for_all(it)
00586             new_im[it] = trans_im[it];
00587 
00588         unsigned lim1 = im_size >> (current_level - 1);
00589         unsigned lim2 = im_size >> (current_level - l);
00590 
00591         internal::dwt_transform_inv_(new_im, lim1, lim2, coeffs, transform_type);
00592 
00593         return new_im;
00594       }

template<class I, class K>
trans_im_t& oln::transforms::dwt< I, K >::transformed_image  )  [inline]
 

Accessor to the transformed image.

Non const version.

Definition at line 520 of file dwt.hh.

References oln::transforms::dwt< I, K >::trans_im_t.

00521       {
00522         return trans_im;
00523       }

template<class I, class K>
const trans_im_t oln::transforms::dwt< I, K >::transformed_image  )  const [inline]
 

Accessor to the transformed image.

Const version.

Definition at line 510 of file dwt.hh.

References oln::transforms::dwt< I, K >::trans_im_t.

00511       {
00512         return trans_im;
00513       }


The documentation for this class was generated from the following file:
Generated on Thu Apr 15 20:17:15 2004 for Olena by doxygen 1.3.6-20040222