Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/basics.hh: Add comments.
* olena/oln/convert/bound.hh: Likewise.
* olena/oln/convert/abstract/colorconv.hh: Likewise.
* olena/oln/convert/conversion.hh: Likewise.
* olena/oln/convert/conversion_ng_se.hh: Likewise.
* olena/oln/convert/force.hh: Likewise.
* olena/oln/convert/nrgbxyz.hh: Likewise.
* olena/oln/convert/rgbnrgb.hh: Likewise.
* olena/oln/convert/rgbxyz.hh: Likewise.
* olena/oln/convert/abstract/conversion.hh: Likewise.
* olena/oln/convert/cast.hh: Likewise.
* olena/oln/convert/rgbhsv.hh: Likewise.
* olena/oln/convert/rgbhsl.hh: Likewise.
* olena/oln/convert/rgbhsi.hh: Likewise.
* olena/oln/convert/rgbyuv.hh: Likewise.
* olena/oln/convert/rgbyiq.hh: Likewise.
* olena/oln/convert/value_to_point.hh: Likewise.
* olena/oln/convert/stretch.hh: Fix bug.
+2004-03-13 Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/stretch.hh: Add stretch_balance. Add comments.
2004-03-12 Damien Thivolle <damien(a)lrde.epita.fr>
Index: olena/oln/convert/basics.hh
--- olena/oln/convert/basics.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/23_basics.hh 1.6 640)
+++ olena/oln/convert/basics.hh Sat, 13 Mar 2004 17:12:58 +0100 van-vl_n
(oln/23_basics.hh 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
Index: olena/oln/convert/bound.hh
--- olena/oln/convert/bound.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/22_bound.hh 1.10 640)
+++ olena/oln/convert/bound.hh Sat, 13 Mar 2004 17:07:14 +0100 van-vl_n
(oln/22_bound.hh 1.10 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -35,9 +35,10 @@
namespace oln {
namespace convert {
- // FIXME: is this really useful with new types ?
-
- /* Like convert::force, but with saturation. */
+ /*! Like convert::force, but with saturation.
+ **
+ ** \note FIXME: is this really useful with new types ?
+ */
template<class Output, class Exact = mlc::final>
struct bound : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<bound<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/abstract/colorconv.hh
--- olena/oln/convert/abstract/colorconv.hh Thu, 31 Jul 2003 17:33:04
+0200 reda (oln/18_colorconv. 1.10 640)
+++ olena/oln/convert/abstract/colorconv.hh Sat, 13 Mar 2004 17:38:05
+0100 van-vl_n (oln/18_colorconv. 1.10 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,6 +37,16 @@
namespace abstract {
+ /*! Base class for color conversion.
+ **
+ ** \param icomps Number of components in the input.
+ ** \param iqbits Number of bits per components in the input.
+ ** \param icolor Input color.
+ ** \param ocomps Number of components in the output.
+ ** \param oqbits Number of bits per components in the output.
+ ** \param ocolor Output color.
+ ** \param Exact Exact class.
+ */
template< unsigned icomps,
unsigned iqbits,
template<unsigned> class icolor,
Index: olena/oln/convert/conversion.hh
--- olena/oln/convert/conversion.hh Thu, 07 Aug 2003 02:08:21 +0200
david (oln/21_conversion 1.16 640)
+++ olena/oln/convert/conversion.hh Sat, 13 Mar 2004 17:12:22 +0100
van-vl_n (oln/21_conversion 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -36,21 +36,31 @@
# include <functional>
namespace oln {
+ /*!
+ ** \brief Namespace for conversion (for example cast, color, or
neighborhood to window).
+ */
namespace convert {
- /* ConvOutput queries the output type of conversion ConvType for
- an input of type InputType. This comes handy when computing
- the return type of a function which takes a conversion function
- in argument. */
+ /*! Trait that returns the output of a conversion.
+ **
+ ** convoutput queries the output type of conversion ConvType for
+ ** an input of type InputType. This comes handy when computing
+ ** the return type of a function which takes a conversion function
+ ** in argument.
+ **
+ ** \note convoutput is exported in the namespace oln for convenience.
+ */
template<class ConvType, class Base, class InputType>
struct convoutput
{
typedef typename abstract::conversion<ConvType, Base>::template
output<InputType>::ret ret;
};
+ /// namespace internal, should not be used by end user.
namespace internal {
- /* Compose a conversion C and an adaptable unary function UF,
- producing an adaptable unary function. */
+ /*! Compose a conversion C and an adaptable unary function UF,
+ ** producing an adaptable unary function.
+ */
template <class C, class UF>
struct compconv1_ :
public std::unary_function <typename UF::argument_type,
@@ -72,8 +82,9 @@
const UF func_;
};
- /* Compose a conversion C and an adaptable binary function BF,
- producing an adaptable binary function. */
+ /*! Compose a conversion C and an adaptable binary function BF,
+ ** producing an adaptable binary function.
+ */
template <class C, class BF>
struct compconv2_ :
public std::binary_function <typename BF::first_argument_type,
@@ -99,8 +110,9 @@
} // end of internal
- /* Friendly procedure that build an internal::compconv1_ with
- type deduction. */
+ /*! Friendly procedure that build an internal::compconv1_ with
+ ** type deduction.
+ */
template <class C, class B, class UF>
internal::compconv1_<C, UF>
compconv1(const abstract::conversion<C, B>& conv, const UF &func)
@@ -108,7 +120,7 @@
return internal::compconv1_<C, UF>(conv.exact(), func);
}
- /* Likewise for compconv2_. */
+ /*! Likewise for compconv2_. */
template <class C, class B, class BF>
internal::compconv2_<C, BF>
compconv2(const abstract::conversion<C, B>& conv, const BF &func)
@@ -117,9 +129,12 @@
}
- /* The core oln::apply function, cannot apply all conversion function,
- because they do not all define result_type. So we define another
- apply function here, to apply conversions. */
+ /*! Apply function that retrive the result type within the
conversion class.
+ **
+ ** The core oln::apply function, cannot apply all conversion function,
+ ** because they do not all define result_type. So we define another
+ ** apply function here, to apply conversions.
+ */
template<class C, class B, class I> inline
typename mute<I, typename convoutput<C, B,
oln_value_type(I)>::ret>::ret
apply(const abstract::conversion<C, B>& conv, const
oln::abstract::image<I>& input)
Index: olena/oln/convert/conversion_ng_se.hh
--- olena/oln/convert/conversion_ng_se.hh Thu, 07 Aug 2003 02:08:21
+0200 david (oln/e/24_conversion 1.11 640)
+++ olena/oln/convert/conversion_ng_se.hh Sat, 13 Mar 2004 17:07:14
+0100 van-vl_n (oln/e/24_conversion 1.11 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2002, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -40,7 +40,10 @@
namespace oln {
namespace convert {
-
+ /*! Convert a neighborhood to a window.
+ **
+ ** \see ng_to_cse
+ */
template<class N>
typename oln::abstract::neighborhood<N>::win_type
ng_to_se(const oln::abstract::neighborhood<N>& Ng)
@@ -52,6 +55,10 @@
return output;
}
+ /*! Convert a neighborhood to a window and add the center.
+ **
+ ** \see ng_to_cs
+ */
template<class N>
typename oln::abstract::neighborhood<N>::win_type
ng_to_cse(const oln::abstract::neighborhood<N>& Ng)
Index: olena/oln/convert/force.hh
--- olena/oln/convert/force.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/20_force.hh 1.12 640)
+++ olena/oln/convert/force.hh Sat, 13 Mar 2004 17:07:14 +0100 van-vl_n
(oln/20_force.hh 1.12 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -35,7 +35,7 @@
namespace oln {
namespace convert {
- /* Like cast::force, but as a conversion functor. */
+ /*! Like cast::force, but as a conversion functor. */
template<class Output, class Exact = mlc::final>
struct force : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<force<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/nrgbxyz.hh
--- olena/oln/convert/nrgbxyz.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/16_nrgbxyz.hh 1.12 640)
+++ olena/oln/convert/nrgbxyz.hh Sat, 13 Mar 2004 17:11:38 +0100
van-vl_n (oln/16_nrgbxyz.hh 1.12 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,19 +37,47 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file nrgbxyz.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
+ // FIXME: should it be removed?
using namespace ntg;
namespace convert {
- /*!
- ** obsolete a composition should be performed with nrgb->rgb and
rgb->xyz
+ /*! Functor for conversion from N-RGB to XYZ color space.
+ **
+ ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz. It has
+ ** not been replaced within the function because a double
conversion 'reduces'
+ ** the color space. See the following example:
+ ** \code
+ ** // Obsolete:
+ ** //
+ ** // #include <oln/convert/nrgbxyz.hh>
+ ** // #include <ntg/all.hh>
+ ** // int main(int argc, char **argv)
+ ** // {
+ ** // ntg::nrgb_8 in(100, 60, 64);
+ ** // ntg::xyz_8 out = oln::convert::f_nrgb_to_xyz<8, 8>()(in);
+ ** // }
+ ** //
+ ** // Should be replaced by:
+ ** //
+ ** #include <oln/convert/rgbxyz.hh>
+ ** #include <oln/convert/rgbnrgb.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** ntg::nrgb_8 in(100, 60, 64);
+ ** ntg::xyz_8 out = oln::convert::f_rgb_to_xyz<8, 8>()
+ ** (oln::convert::f_nrgb_to_rgb<8, 8>()(in));
+ ** }
+ ** \endcode
*/
template <unsigned inbits, unsigned outbits>
struct f_nrgb_to_xyz
@@ -82,6 +110,12 @@
}
};
+ /*! Conversion from N-RGB to XYZ color space.
+ **
+ ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz.
+ **
+ ** \see f_nrgb_to_xyz for more information.
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, xyz_traits>
nrgb_to_xyz(const color<3, inbits, nrgb_traits>& v)
@@ -91,8 +125,11 @@
return f(v);
}
- /*!
- ** obsolete a composition should be performed with xyz->rgb and
rgb->nrgb
+ /*! Functor for conversion from XYZ to N-RGB color space.
+ **
+ ** \obsolete A composition should be performed with xyz->rgb and
rgb->nrgb.
+ **
+ ** \see f_nrgb_to_xyz for more information.
*/
template<unsigned inbits, unsigned outbits>
struct f_xyz_to_nrgb
@@ -122,6 +159,13 @@
}
};
+
+ /*! Conversion from XYZ to N-RGB color space.
+ **
+ ** \obsolete a composition should be performed with xyz->rgb and
rgb->nrgb.
+ **
+ ** \see f_nrgb_to_xyz for more information.
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, nrgb_traits>
xyz_to_nrgb(const color<3, inbits, xyz_traits>& v)
Index: olena/oln/convert/rgbnrgb.hh
--- olena/oln/convert/rgbnrgb.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/17_rgbnrgb.hh 1.11 640)
+++ olena/oln/convert/rgbnrgb.hh Sat, 13 Mar 2004 17:10:08 +0100
van-vl_n (oln/17_rgbnrgb.hh 1.11 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,10 +37,10 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbnrgb.hh
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -48,6 +48,10 @@
namespace convert {
+ /*! Functor for conversion from RGB to N-RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_nrgb
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -76,6 +80,10 @@
}
};
+ /*! Conversion from RGB to N-RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, nrgb_traits>
rgb_to_nrgb(const color<3, inbits, rgb_traits>& v)
@@ -85,6 +93,10 @@
return f(v);
}
+ /*! Functor for conversion from N-RGB to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_nrgb_to_rgb
: public abstract::color_conversion<3, inbits, nrgb_traits,
@@ -113,6 +125,10 @@
}
};
+ /*! Conversion from N-RGB to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
nrgb_to_rgb(const color<3, inbits, nrgb_traits>& v)
Index: olena/oln/convert/rgbxyz.hh
--- olena/oln/convert/rgbxyz.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/19_rgbxyz.hh 1.12 640)
+++ olena/oln/convert/rgbxyz.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/19_rgbxyz.hh 1.12 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,10 +37,11 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbxyz.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -48,6 +49,10 @@
namespace convert {
+ /* Functor for conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_rgb_to_xyz
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -73,6 +78,11 @@
}
};
+
+ /* Conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, xyz_traits>
rgb_to_xyz(const color<3, inbits, rgb_traits>& v)
@@ -82,6 +92,10 @@
return f(v);
}
+ /* Functor for conversion from XYZ to RGB
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_xyz_to_rgb
: public abstract::color_conversion<3, inbits, xyz_traits,
@@ -110,6 +124,10 @@
}
};
+ /* Functor for conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
xyz_to_rgb(const color<3, outbits, xyz_traits>& v)
Index: olena/oln/convert/stretch.hh
--- olena/oln/convert/stretch.hh Sat, 13 Mar 2004 17:04:01 +0100
van-vl_n (oln/f/51_stretch.hh 1.14 640)
+++ olena/oln/convert/stretch.hh Sat, 13 Mar 2004 17:30:38 +0100
van-vl_n (oln/f/51_stretch.hh 1.14 640)
@@ -36,6 +36,8 @@
# include <set>
+# include <vector>
+
namespace oln {
namespace convert {
@@ -143,9 +145,9 @@
** = oln::level::frontp_connected_component<ntg::int_u8>(light,
** oln::neighb_c8(),
** card);
- ** oln::io::save(cc, "oln_convert_stretch_dark.pgm");
+ ** oln::io::save(cc, IMG_OUT "oln_convert_stretch_dark.pgm");
** oln::io::save(oln::convert::stretch_balance<ntg::int_u8>(cc),
- ** "oln_convert_stretch_balance.pgm");
+ ** IMG_OUT "oln_convert_stretch_balance.pgm");
** }
** \endcode
** \image html face_se.png
@@ -173,7 +175,8 @@
typename mute<I, DestValue>::ret out(in.size());
//FIXME: I would like to remove the static_cast.
- ntg_cumul_type(DestValue) tab[static_cast<int>(max_in - min_in + 1)];
+ std::vector<ntg_cumul_type(DestValue)>
+ tab(static_cast<int>(max_in - min_in + 1));
typedef typename std::set<oln_value_type(I)> set_type;
set_type s;
oln_iter_type(I) it(in);
Index: olena/oln/convert/abstract/conversion.hh
--- olena/oln/convert/abstract/conversion.hh Thu, 07 Aug 2003 02:08:21
+0200 david (oln/u/31_conversion 1.4 640)
+++ olena/oln/convert/abstract/conversion.hh Sat, 13 Mar 2004 17:14:06
+0100 van-vl_n (oln/u/31_conversion 1.4 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,6 +34,9 @@
namespace oln {
namespace convert {
+ /*!
+ ** \brief Namespace oln::convert::abstract.
+ */
namespace abstract {
// fwd_decl
@@ -51,7 +54,11 @@
template<class Conv>
struct conversion_traits;
+ /*!
+ ** Namespace oln::convert::abstract::internal, for internal usage
only.
+ */
namespace internal {
+ /// Retrieve the result type of a conversion.
template <class Base, class T>
struct output {};
@@ -73,7 +80,11 @@
} // end of namespace abstract
namespace abstract {
-
+ /*! Base class for conversion.
+ **
+ ** \note If you write an class inherited from this one, you
+ ** must write the specialization of the output trait.
+ */
template<class Exact, class Base>
struct conversion : public mlc_hierarchy::any< Exact >
{
@@ -90,6 +101,7 @@
typedef typename internal::output<Base, T>::ret ret;
};
+ /// Call the conversion written in the exact class.
template <class T>
typename output<T>::ret
operator()(const T& in) const
@@ -101,6 +113,7 @@
conversion() {}
};
+ /// Base class for the conversion to a specific type.
template<class Result_Type, class Exact = mlc::final, class Base
= mlc::final>
struct conversion_to_type :
public conversion< typename mlc::exact_vt<conversion_to_type<
Result_Type, Exact >, Exact>::ret,
@@ -128,9 +141,7 @@
conversion_to_type() {}
};
- /* If both input and output types of the conversion are fixed.
- Inherit from conversion_from_type_to_type<>. */
-
+ /// Base class if both input and output types of the conversion
are fixed.
template<class Argument_Type, class Result_Type,
class Exact = mlc::final, class Base = mlc::final>
struct conversion_from_type_to_type:
Index: olena/oln/convert/cast.hh
--- olena/oln/convert/cast.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/v/35_cast.hh 1.1 600)
+++ olena/oln/convert/cast.hh Sat, 13 Mar 2004 17:12:39 +0100 van-vl_n
(oln/v/35_cast.hh 1.1 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -34,6 +34,8 @@
namespace oln {
namespace convert {
+ /*! Cast to an output.
+ */
template<class Output, class Exact = mlc::final>
struct cast : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<cast<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/rgbhsv.hh
--- olena/oln/convert/rgbhsv.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/35_rgbhsv.hh 1.1 644)
+++ olena/oln/convert/rgbhsv.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/35_rgbhsv.hh 1.1 644)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -40,9 +40,9 @@
# include <sstream>
-/*-----------------------------------------------------------------.
-| The formulas used here come from ``Color Conversion Algorithms'' |
-`-----------------------------------------------------------------*/
+/*! \file rgbhsv.hh
+** \ref The formulas used here come from ``Color Conversion Algorithms''
+*/
namespace oln {
@@ -50,6 +50,10 @@
namespace convert {
+ /*! Functor for conversion from RGB to HSV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsv
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -98,6 +102,10 @@
}
};
+ /*! Conversion from RGB to HSV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, hsv_traits>
rgb_to_hsv(const color<3, inbits, rgb_traits>& v)
@@ -106,6 +114,10 @@
return f(v);
}
+ /*! Functor conversion from HSV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsv_to_rgb
: public abstract::color_conversion<3, inbits, hsv_traits,
@@ -174,6 +186,10 @@
}
};
+ /*! Conversion from HSV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsv_to_rgb(const color<3, inbits, hsv_traits>& v)
Index: olena/oln/convert/rgbhsl.hh
--- olena/oln/convert/rgbhsl.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/36_rgbhsl.hh 1.1 644)
+++ olena/oln/convert/rgbhsl.hh Sat, 13 Mar 2004 17:10:46 +0100 van-vl_n
(oln/j/36_rgbhsl.hh 1.1 644)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -41,15 +41,44 @@
# include <cstdlib>
# include <sstream>
-/*------------------------------------------------------------------.
-| The formulas used here come from ``Color space conversion''; Paul |
-| Bourke. |
-`------------------------------------------------------------------*/
+/*! \file rgbhsl.hh
+**
+** \ref The formulas used here come from ``Color space conversion''; Paul
+** Bourke.
+*/
namespace oln {
using namespace ntg;
namespace convert {
+ /*! Functor for conversion from RGB to HSL color space.
+ **
+ ** \note Every conversion should go though the RGB color space.
+ **
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <oln/convert/rgbhsl.hh>
+ ** #include <ntg/all.hh>
+ **
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> lena_rgb = oln::load(IMG_IN
"lena.ppm");
+ **
+ ** oln::image2d<ntg::hsl_8> lena_hsl =
apply(oln::convert::f_rgb_to_hsl<8, 8>(), lena_rgb);
+ ** oln::image2d<ntg::hsl_8>::iter_type it(lena_hsl);
+ ** for_all(it)
+ ** lena_hsl[it][ntg::hsl_L] = 127;
+ **
+ ** oln::io::save(apply(oln::convert::f_hsl_to_rgb<8, 8>(), lena_hsl),
+ ** IMG_OUT "oln_convert_f_rgb_to_hsl.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena.png
+ ** \image latex lena.png
+ ** =>
+ ** \image html oln_convert_f_rgb_to_hsl.png
+ ** \image latex oln_convert_f_rgb_to_hsl.png
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsl
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -104,6 +133,10 @@
}
};
+ /*! Conversion from RGB to HSL color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, inbits, hsl_traits>
rgb_to_hsl(const color<3, outbits, rgb_traits>& v)
@@ -131,6 +164,10 @@
}
}
+ /*! Functor for conversion from HSL to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsl_to_rgb
: public abstract::color_conversion<3, inbits, hsl_traits,
@@ -171,6 +208,10 @@
}
};
+ /*! Conversion from HSL to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsl_to_rgb(const color<3, inbits, hsl_traits>& v)
Index: olena/oln/convert/rgbhsi.hh
--- olena/oln/convert/rgbhsi.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/37_rgbhsi.hh 1.1 644)
+++ olena/oln/convert/rgbhsi.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/37_rgbhsi.hh 1.1 644)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,10 +37,11 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbhsi.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -52,6 +53,10 @@
static const float inv_sqrt6 = 1 / sqrt(6);
static const float inv_sqrt2 = 1 / sqrt(2);
+ /*! Functor for conversion from RGB to HSI color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsi
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -84,6 +89,10 @@
}
};
+ /*! Conversion from RGB to HSI color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, hsi_traits>
rgb_to_hsi(const color<3, inbits, rgb_traits>& v)
@@ -93,6 +102,10 @@
return f(v);
}
+ /*! Functor conversion from HSI to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsi_to_rgb
: public abstract::color_conversion<3, inbits, hsi_traits,
@@ -121,6 +134,10 @@
}
};
+ /*! Conversion from HSI to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsi_to_rgb (const color<3, inbits, hsi_traits>& v)
Index: olena/oln/convert/rgbyuv.hh
--- olena/oln/convert/rgbyuv.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/38_rgbyuv.hh 1.1 644)
+++ olena/oln/convert/rgbyuv.hh Sat, 13 Mar 2004 17:09:18 +0100 van-vl_n
(oln/j/38_rgbyuv.hh 1.1 644)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,17 +37,20 @@
# include <sstream>
-/*---------------------------------------------------------------.
-| The formulas used here come from ``Colour Space Conversions'', |
-| IAdrian Ford and Alan Roberts; August 11,1998. |
-`---------------------------------------------------------------*/
-
+/*!\file rgbyuv.hh
+**
+** \ref The formulas used here come from ``Colour Space Conversions'',
+** IAdrian Ford and Alan Roberts; August 11,1998.
+*/
namespace oln {
using namespace ntg;
namespace convert {
-
+ /* Functor for conversion from RGB to YUV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_rgb_to_yuv
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -75,7 +78,10 @@
s.str();
}
};
-
+ /* Conversion from RGB to YUV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, yuv_traits>
rgb_to_yuv(const color<3, inbits, rgb_traits>& v)
@@ -84,7 +90,10 @@
return f(v);
}
-
+ /* Functor for conversion from YUV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_yuv_to_rgb
: public abstract::color_conversion<3, inbits, yuv_traits,
@@ -111,6 +120,10 @@
}
};
+ /* Conversion from YUV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
yuv_to_rgb(const color<3, inbits, yuv_traits>& v)
Index: olena/oln/convert/rgbyiq.hh
--- olena/oln/convert/rgbyiq.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/39_rgbyiq.hh 1.1 644)
+++ olena/oln/convert/rgbyiq.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/39_rgbyiq.hh 1.1 644)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development
Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development
Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,17 +37,21 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
-
+/*! \file rgbyiq.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
using namespace ntg;
namespace convert {
+ /* Functor for conversion from RGB to YIQ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_yiq
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -76,6 +80,10 @@
}
};
+ /* Conversion from RGB to YIQ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, yiq_traits>
rgb_to_yiq(const color<3, inbits, rgb_traits>& v)
@@ -85,6 +93,10 @@
return f(v);
}
+ /* Functor for conversion from YIQ to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_yiq_to_rgb
: public abstract::color_conversion<3, inbits, yiq_traits,
@@ -110,6 +122,10 @@
}
};
+ /* Conversion from YIQ to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
yiq_to_rgb(const color<3, inbits, yiq_traits>& v)
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Fri, 06 Feb 2004 15:26:24 +0100
van-vl_n (oln/j/43_value_to_p 1.2 644)
+++ olena/oln/convert/value_to_point.hh Sat, 13 Mar 2004 17:25:49 +0100
van-vl_n (oln/j/43_value_to_p 1.2 644)
@@ -35,7 +35,17 @@
namespace oln {
namespace convert {
-
+ /*! Convert a value of pixel to a point.
+ **
+ ** For example it transforms an RGB color to a 3D point (ntg::rgb_8
=> oln::point3d).
+ ** This function is useful to build the histogram. \n
+ ** Example:
+ ** \verbatim
+ ** f(oln::convert::value_to_point<ntg::rgb_8>()(ntg::rgb_8(1,6,64)));
+ ** // is equivalent to:
+ ** f(oln::point3d(1, 6, 64));
+ ** \endverbatim
+ */
template <typename Argument_type,
class Exact = mlc::final>
struct value_to_point:
@@ -47,8 +57,10 @@
Exact>::ret>
{
private:
+ /// By default a scalar is expected. If the type is a vector, a
specialization should be written.
typedef typename ntg_is_a(Argument_type,
ntg::non_vectorial)::ensure_type ensure_type;
public:
+ /// By default it return a point1d.
typedef point1d result_type;
typedef Argument_type argument_type;
@@ -61,6 +73,11 @@
}
};
+ /*! Specialization for color of three dimension.
+ **
+ ** \todo It could be generalized to n dimensions if there were a
trait that
+ ** give a pointkd for a given dimension k.
+ */
template <unsigned Qbits, template <unsigned> class S, class Exact>
struct value_to_point<ntg::color<3, Qbits, S>, Exact>:
public abstract::conversion_from_type_to_type