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.

Definition at line 486 of file dwt.hh.

References oln::internal::ln_2_.

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


Member Function Documentation

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 514 of file dwt.hh.

00515       {
00516         return trans_im;
00517       }

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 524 of file dwt.hh.

00525       {
00526         return trans_im;
00527       }

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.

Definition at line 536 of file dwt.hh.

References oln::internal::dwt_transform_().

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

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

Compute the invert dwt transform.

Definition at line 574 of file dwt.hh.

References oln::internal::dwt_transform_inv_().

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

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

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.

Definition at line 608 of file dwt.hh.

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

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


The documentation for this class was generated from the following file:
Generated on Tue Feb 20 20:29:48 2007 for Olena by  doxygen 1.5.1