Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
17 Aug '09
---
milena/ChangeLog | 4 ++++
milena/mln/labeling/relabel.hh | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index b5c3acf..8de7538 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * mln/labeling/relabel.hh: Add missing preconditions.
+
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* mln/labeling/superpose.hh: New. Superpose two labeled images.
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/milena/mln/labeling/relabel.hh b/milena/mln/labeling/relabel.hh
index 4477ee9..0e89e3c 100644
--- a/milena/mln/labeling/relabel.hh
+++ b/milena/mln/labeling/relabel.hh
@@ -183,6 +183,8 @@ namespace mln
{
trace::entering("labeling::relabel");
+
+ mlc_not_equal(mln_result(F),bool)::check();
internal::relabel_tests(label, nlabels, fv2v);
mln_concrete(I) output = data::transform(label, fv2v);
@@ -223,6 +225,7 @@ namespace mln
{
trace::entering("labeling::relabel_inplace");
+ mlc_not_equal(mln_result(F),bool)::check();
internal::relabel_inplace_tests(label, nlabels, fv2v);
data::transform_inplace(label, fv2v);
--
1.5.6.5
1
0
17 Aug '09
---
milena/ChangeLog | 4 +
milena/mln/labeling/superpose.hh | 120 ++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/labeling/superpose.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1aaa8de..b5c3acf 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * mln/labeling/superpose.hh: New. Superpose two labeled images.
+
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* mln/util/array.hh: Fix invalid read-only return type.
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
diff --git a/milena/mln/labeling/superpose.hh b/milena/mln/labeling/superpose.hh
new file mode 100644
index 0000000..2054649
--- /dev/null
+++ b/milena/mln/labeling/superpose.hh
@@ -0,0 +1,120 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_LABELING_SUPERPOSE_HH
+# define MLN_LABELING_SUPERPOSE_HH
+
+/// \file
+///
+/// \brief Superpose two labeled images.
+
+
+# include <mln/core/concept/image.hh>
+# include <mln/util/array.hh>
+# include <mln/labeling/relabel.hh>
+
+namespace mln
+{
+
+ namespace labeling
+ {
+
+
+ /*!
+ \brief Superpose two labeled image.
+
+ Labels in \p lhs are preserved in the output. Labels of \p rhs
+ are renumbered from the last label value of \p lhs. It avoids
+ duplicate label values in several components.
+
+ \param[in] lhs A labeled image.
+ \param[in] lhs_nlabels The number of labels in \p lhs.
+ \param[in] rhs A labeled image.
+ \param[in] rhs_nlabels The number of labels in \p rhs.
+ \param[out] new_nlabels The number of labels in the output image.
+
+ \return An image with all the components of \p rhs and \p lhs.
+
+ @pre \p rhs and lhs must have the same domain.
+ @pre \p The value type of rhs must be convertible towards lhs's.
+
+ */
+ template <typename I, typename J>
+ mln_concrete(I)
+ superpose(const Image<I>& lhs, const mln_value(I)& lhs_nlabels,
+ const Image<J>& rhs, const mln_value(J)& rhs_nlabels,
+ mln_value(I)& new_nlabels);
+
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename J>
+ mln_concrete(I)
+ superpose(const Image<I>& lhs_, const mln_value(I)& lhs_nlabels,
+ const Image<J>& rhs_, const mln_value(J)& rhs_nlabels,
+ mln_value(I)& new_nlabels)
+ {
+ trace::entering("mln::labeling::superpose");
+
+ const I& lhs = exact(lhs_);
+ const J& rhs = exact(rhs_);
+
+ mlc_converts_to(mln_value(I), mln_value(J))::check();
+ mln_precondition(lhs.is_valid());
+ mln_precondition(rhs.is_valid());
+ mln_precondition(lhs.domain() == rhs.domain());
+ /// Check if there are enough free labels?
+
+ mln_concrete(I) output = duplicate(lhs);
+
+ util::array<mln_value(J)>
+ rebase_lbl(static_cast<unsigned>(rhs_nlabels) + 1);
+
+ rebase_lbl(0) = 0;
+ for (unsigned i = 1; i <= rhs_nlabels; ++i)
+ rebase_lbl(i) = i + static_cast<unsigned>(lhs_nlabels);
+
+ data::paste(labeling::relabel(rhs, rhs_nlabels, rebase_lbl)
+ | (pw::value(rhs) != pw::cst(literal::zero)),
+ output);
+
+ new_nlabels = static_cast<unsigned>(lhs_nlabels)
+ + static_cast<unsigned>(rhs_nlabels) + 1;
+
+ trace::exiting("mln::labeling::superpose");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::labeling
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LABELING_SUPERPOSE_HH
--
1.5.6.5
1
0
* icdar/2009/hsc/input_to_lines_dat.cc,
* icdar/2009/hsc/input_to_words_dat.cc: Add copyright and a
reference to the paper in which the results are published.
---
milena/sandbox/ChangeLog | 20 +++++++---
.../sandbox/icdar/2009/hsc/input_to_lines_dat.cc | 35 ++++++++++++++++++
.../sandbox/icdar/2009/hsc/input_to_words_dat.cc | 37 +++++++++++++++++++-
3 files changed, 85 insertions(+), 7 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 8580972..fd3149d 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Add missing copyright and reference in ICDAR code.
+
+ * icdar/2009/hsc/input_to_lines_dat.cc,
+ * icdar/2009/hsc/input_to_words_dat.cc: Add copyright and a
+ reference to the paper in which the results are published.
+
2009-08-15 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
New candidates to replace value types.
@@ -278,6 +286,12 @@
* inim/2010/page/Makefile: New.
* inim/2010/page/white.hh: New.
+2009-07-17 Edwin Carlinet <carlinet(a)lrde.epita.fr>
+
+ Fix bugs in segmentation with delta colormean method.
+ * edwin/exec/max_delta_colormean_obj.cc,
+ * edwin/mln/morpho/tree/components_debug.hh: Minor fixes.
+
2009-07-22 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
First test with git, test c++ install with HelloWorld program
@@ -285,12 +299,6 @@
* green/HelloWorld/Makefile.am : Bypass .gitignore, New
* green/HelloWorld/HelloWorld.cc: Write "HelloWorld" on CRT.
* green/HelloWorld/Print.cc : Deported cout call
-
-2009-07-17 Edwin Carlinet <carlinet(a)lrde.epita.fr>
-
- Fix bugs in segmentation with delta colormean method.
- * edwin/exec/max_delta_colormean_obj.cc,
- * edwin/mln/morpho/tree/components_debug.hh: Minor fixes.
2009-07-16 Edwin Carlinet <carlinet(a)lrde.epita.fr>
diff --git a/milena/sandbox/icdar/2009/hsc/input_to_lines_dat.cc b/milena/sandbox/icdar/2009/hsc/input_to_lines_dat.cc
index ba7f668..cc1fdee 100644
--- a/milena/sandbox/icdar/2009/hsc/input_to_lines_dat.cc
+++ b/milena/sandbox/icdar/2009/hsc/input_to_lines_dat.cc
@@ -1,3 +1,38 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+
+// Results published in:
+//
+// `ICDAR2009 Handwriting Segmentation Contest`.
+// B. Gatos, N. Stamatopoulos and G. Louloudis
+// 2009 10th International Conference on Document Analysis and Recognition
+//
+// http://www.cvc.uab.es/icdar2009/papers/3725b393.pdf
+
+
#include <sandbox/icdar/2009/hsc/input_to_lines.hh>
#include <sandbox/icdar/2009/hsc/io/icdar/save.hh>
diff --git a/milena/sandbox/icdar/2009/hsc/input_to_words_dat.cc b/milena/sandbox/icdar/2009/hsc/input_to_words_dat.cc
index e6b01ca..56f3cc1 100644
--- a/milena/sandbox/icdar/2009/hsc/input_to_words_dat.cc
+++ b/milena/sandbox/icdar/2009/hsc/input_to_words_dat.cc
@@ -1,3 +1,38 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+
+// Results published in:
+//
+// `ICDAR2009 Handwriting Segmentation Contest`.
+// B. Gatos, N. Stamatopoulos and G. Louloudis
+// 2009 10th International Conference on Document Analysis and Recognition
+//
+// http://www.cvc.uab.es/icdar2009/papers/3725b393.pdf
+
+
#include <mln/value/int_u16.hh>
#include <mln/value/rgb8.hh>
@@ -29,7 +64,7 @@ namespace mln
output(p) = l_1st.to_enc() + words(p).to_enc();
}
}
-
+
} // mln
--
1.5.6.5
1
0
17 Aug '09
---
milena/ChangeLog | 4 ++++
milena/mln/util/array.hh | 41 ++++++++++++++++++++++++-----------------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 8ee6e28..1aaa8de 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,9 @@
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * mln/util/array.hh: Fix invalid read-only return type.
+
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* mln/data/compute.hh: Add an overload with non const
accumulators.
diff --git a/milena/mln/util/array.hh b/milena/mln/util/array.hh
index 69206a6..d94534d 100644
--- a/milena/mln/util/array.hh
+++ b/milena/mln/util/array.hh
@@ -41,6 +41,7 @@
# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/iterator.hh>
+# include <mln/fun/internal/selector.hh>
namespace mln
@@ -90,7 +91,10 @@ namespace mln
/// \ingroup modutil
//
template <typename T>
- class array : public Function_v2v< mln::util::array<T> >
+ class array
+ : public fun::internal::selector_from_result_<T, array<T> >::ret
+
+ // public Function_v2v< mln::util::array<T> >
{
public:
@@ -101,6 +105,7 @@ namespace mln
/// Related to the Function_v2v concept.
/// @{
typedef T result;
+ typedef typename std::vector<T>::const_reference ro_result;
typedef typename std::vector<T>::reference mutable_result;
/// @}
@@ -163,7 +168,7 @@ namespace mln
/// \brief Return the \p i-th element of the array.
/// \pre i < nelements()
- const T& operator()(unsigned i) const;
+ ro_result operator()(unsigned i) const;
/// \brief Return the \p i-th element of the array.
/// \pre i < nelements()
@@ -171,7 +176,7 @@ namespace mln
/// \brief Return the \p i-th element of the array.
/// \pre i < nelements()
- const T& operator[](unsigned i) const;
+ ro_result operator[](unsigned i) const;
/// \brief Return the \p i-th element of the array.
/// \pre i < nelements()
@@ -244,10 +249,10 @@ namespace mln
void invalidate();
/// Give the element the iterator designates.
- const T& element() const;
+ T element() const;
// As a Proxy.
- const T& subj_();
+ T subj_();
/// Give the current index.
unsigned index_() const;
@@ -293,10 +298,10 @@ namespace mln
void invalidate();
/// Give the element the iterator designates.
- const T& element() const;
+ T element() const;
// As a Proxy.
- const T& subj_();
+ T subj_();
/// Give the current index.
unsigned index_() const;
@@ -315,11 +320,13 @@ namespace mln
template <typename T, typename E>
struct subject_impl<const util::array<T>&, E>
{
+ typedef typename util::array<T>::ro_result ro_result;
+
unsigned nelements() const;
unsigned size() const;
bool is_empty() const;
- const T& operator()(unsigned i) const;
- const T& operator[](unsigned i) const;
+ ro_result operator()(unsigned i) const;
+ ro_result operator[](unsigned i) const;
const std::vector<T>& std_vector() const;
private:
@@ -493,7 +500,7 @@ namespace mln
template <typename T>
inline
- const T&
+ typename array<T>::ro_result
array<T>::operator()(unsigned i) const
{
return (*this)[i];
@@ -509,7 +516,7 @@ namespace mln
template <typename T>
inline
- const T&
+ typename array<T>::ro_result
array<T>::operator[](unsigned i) const
{
mln_precondition(i < nelements());
@@ -623,7 +630,7 @@ namespace mln
template <typename T>
inline
- const T&
+ T
array_fwd_iter<T>::element() const
{
mln_precondition(is_valid());
@@ -632,7 +639,7 @@ namespace mln
template <typename T>
inline
- const T&
+ T
array_fwd_iter<T>::subj_()
{
mln_precondition(is_valid());
@@ -717,7 +724,7 @@ namespace mln
template <typename T>
inline
- const T&
+ T
array_bkd_iter<T>::element() const
{
mln_precondition(is_valid());
@@ -726,7 +733,7 @@ namespace mln
template <typename T>
inline
- const T&
+ T
array_bkd_iter<T>::subj_()
{
mln_precondition(is_valid());
@@ -893,7 +900,7 @@ namespace mln
template <typename T, typename E>
inline
- const T&
+ typename util::array<T>::ro_result
subject_impl<const util::array<T>&, E>::operator()(unsigned i) const
{
return exact_().get_subject()(i);
@@ -901,7 +908,7 @@ namespace mln
template <typename T, typename E>
inline
- const T&
+ typename util::array<T>::ro_result
subject_impl<const util::array<T>&, E>::operator[](unsigned i) const
{
return exact_().get_subject()[i];
--
1.5.6.5
1
0
4360: mln/data/compute.hh: Add an overload with non const accumulators.
by Guillaume Lazzara 17 Aug '09
by Guillaume Lazzara 17 Aug '09
17 Aug '09
---
milena/ChangeLog | 5 +++++
milena/mln/data/compute.hh | 29 ++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 24e679a..8ee6e28 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,10 @@
2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ * mln/data/compute.hh: Add an overload with non const
+ accumulators.
+
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
* headers.mk: Regen.
2009-08-15 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
diff --git a/milena/mln/data/compute.hh b/milena/mln/data/compute.hh
index c0d87cc..6a234a9 100644
--- a/milena/mln/data/compute.hh
+++ b/milena/mln/data/compute.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,6 +43,8 @@ namespace mln
{
/// Compute an accumulator onto the pixel values of the image \p input.
+ /// Be ware that the given accumulator won't be modified and won't
+ /// store any result.
///
/// \param[in] a An accumulator.
/// \param[in] input The input image.
@@ -56,6 +59,19 @@ namespace mln
/// Compute an accumulator onto the pixel values of the image \p input.
///
+ /// \param[in, out] a An accumulator.
+ /// \param[in] input The input image.
+ /// \return The accumulator result.
+ ///
+ /// It fully relies on data::update.
+ //
+ template <typename A, typename I>
+ mln_result(A)
+ compute(Accumulator<A>& a, const Image<I>& input);
+
+
+ /// Compute an accumulator onto the pixel values of the image \p input.
+ ///
/// \param[in] a A meta-accumulator.
/// \param[in] input The input image.
/// \return The accumulator result.
@@ -76,6 +92,16 @@ namespace mln
mln_result(A)
compute(const Accumulator<A>& a_, const Image<I>& input)
{
+ A a;
+ return compute(a, input);
+ }
+
+
+ template <typename A, typename I>
+ inline
+ mln_result(A)
+ compute(Accumulator<A>& a_, const Image<I>& input)
+ {
trace::entering("data::compute");
A a = exact(a_);
@@ -88,6 +114,7 @@ namespace mln
return a;
}
+
template <typename A, typename I>
inline
mln_meta_accu_result(A, mln_value(I))
--
1.5.6.5
1
0
---
milena/ChangeLog | 4 ++
milena/headers.mk | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4882916..24e679a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ * headers.mk: Regen.
+
2009-08-15 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Preparing a revamp of value types.
diff --git a/milena/headers.mk b/milena/headers.mk
index 4af9e99..bdc488f 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -1222,3 +1222,90 @@ mln/world/inter_pixel/is_pixel.hh \
mln/world/inter_pixel/is_separator.hh \
mln/world/inter_pixel/neighb2d.hh \
mln/world/inter_pixel/separator_to_pixels.hh
+#<<lrde
+nobase_include_HEADERS += \
+mln/accu/math/inf.hh \
+mln/accu/math/sup.hh \
+mln/core/image/vmorph/thru_image.hh \
+mln/core/image/vmorph/thrubin_image.hh \
+mln/data/was.median.hh \
+mln/extract/all.hh \
+mln/extract/blue.hh \
+mln/extract/essential.hh \
+mln/extract/green.hh \
+mln/extract/hue.hh \
+mln/extract/lum.hh \
+mln/extract/red.hh \
+mln/extract/sat.hh \
+mln/fun/access/all.hh \
+mln/fun/access/mean.hh \
+mln/fun/accu_result.hh \
+mln/fun/binary.hh \
+mln/fun/binary_param.hh \
+mln/fun/component/blue.hh \
+mln/fun/component/comp.hh \
+mln/fun/component/comp_count.hh \
+mln/fun/component/green.hh \
+mln/fun/component/ithcomp.hh \
+mln/fun/component/red.hh \
+mln/fun/component/rgb.hh \
+mln/fun/component/scomp.hh \
+mln/fun/compose.hh \
+mln/fun/composition.hh \
+mln/fun/from_accu.hh \
+mln/fun/math/abs.hh \
+mln/fun/math/cos.hh \
+mln/fun/math/inf.hh \
+mln/fun/math/norm.hh \
+mln/fun/math/sup.hh \
+mln/fun/meta/all.hh \
+mln/fun/meta/blue.hh \
+mln/fun/meta/essential.hh \
+mln/fun/meta/first.hh \
+mln/fun/meta/green.hh \
+mln/fun/meta/hue.hh \
+mln/fun/meta/inty.hh \
+mln/fun/meta/lum.hh \
+mln/fun/meta/red.hh \
+mln/fun/meta/sat.hh \
+mln/fun/meta/second.hh \
+mln/fun/meta/to_enc.hh \
+mln/fun/param.hh \
+mln/fun/point/col.hh \
+mln/fun/point/row.hh \
+mln/fun/point/sli.hh \
+mln/fun/spe/binary.hh \
+mln/fun/spe/unary.hh \
+mln/fun/unary.hh \
+mln/fun/unary_param.hh \
+mln/fun/v2v/hsi_to_rgb.hh \
+mln/fun/v2v/hsl_to_rgb.hh \
+mln/fun/v2v/rgb_to_hsi.hh \
+mln/fun/v2v/rgb_to_hsl.hh \
+mln/linear/gaussian.hh \
+mln/linear/gaussian/filter.hh \
+mln/linear/gaussian/impl.hh \
+mln/linear/gaussian/internal/coefficients.hh \
+mln/linear/gaussian_1d.hh \
+mln/linear/gaussian_directional_2d.hh \
+mln/registration/all.hh \
+mln/registration/essential.hh \
+mln/registration/get_rot.hh \
+mln/registration/get_rtransf.hh \
+mln/registration/icp.hh \
+mln/registration/internal/rms.hh \
+mln/registration/registration.hh \
+mln/subsampling/all.hh \
+mln/subsampling/essential.hh \
+mln/subsampling/gaussian_subsampling.hh \
+mln/subsampling/subsampling.hh \
+mln/trait/functions.hh \
+mln/trait/next/solve.hh \
+mln/trait/next/solve_binary.hh \
+mln/trait/next/solve_proxy.hh \
+mln/trait/next/solve_unary.hh \
+mln/value/hsi.hh \
+mln/value/hsl.hh \
+mln/value/shell.hh \
+mln/value/stack.hh
+#>>
--
1.5.6.5
1
0
* build-aux/generate_dist_headers.sh: install non distributed
files if installing from a repository copy.
---
ChangeLog | 7 +++++++
build-aux/generate_dist_headers.sh | 22 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c272ea5..49781e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-17 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Fix installation of non distributed files.
+
+ * build-aux/generate_dist_headers.sh: install non distributed
+ files if installing from a repository copy.
+
2009-08-15 Thierry Geraud <theo@este>
* ChangeLog: Fix. Wrong commit directory, sorry.
diff --git a/build-aux/generate_dist_headers.sh b/build-aux/generate_dist_headers.sh
index 60aa946..02898b5 100755
--- a/build-aux/generate_dist_headers.sh
+++ b/build-aux/generate_dist_headers.sh
@@ -22,7 +22,7 @@ test -f "$nodist_headers" \
echo "Generating $output..." >&2
rm -f "$output"
-cat <<EOF >"$output"
+cat <<EOF > "$output"
## Generated by \`$me', do not edit by hand.
nobase_include_HEADERS = \\
@@ -33,7 +33,27 @@ find $scanned_dir -type f -a \( -name '*.hh' -o -name '*.hxx' \) \
| comm -23 - "$nodist_headers" \
| sed -e 's/$/ \\/g' >> $output
+
last_line=`tail -n 1 $output | sed -e 's/\\\//g'` # remove '\' in last line
sed '$d' < $output > $output.tmp # remove last line
mv $output.tmp $output
echo $last_line >> $output # put the cleaned last line back.
+
+
+# Add non distributed files to installed headers list.
+#
+# Non distributed headers will be installed if the installation
+# process is launched from the repository copy.
+cat <<EOF >> "$output"
+#<<lrde
+nobase_include_HEADERS += \\
+EOF
+
+cat $nodist_headers | sed -e 's/$/ \\/g' >> $output
+
+last_line=`tail -n 1 $output | sed -e 's/\\\//g'` # remove '\' in last line
+sed '$d' < $output > $output.tmp # remove last line
+mv $output.tmp $output
+echo $last_line >> $output # put the cleaned last line back.
+
+echo "#>>" >> $output
\ No newline at end of file
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/scribo
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing qualification for left and right.
* text/grouping/internal/find_left_link.hh (find_left_link):
Qualify left with mln.
* text/grouping/internal/find_right_link.hh (find_right_link):
Qualify right with mln.
find_left_link.hh | 2 +-
find_right_link.hh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: text/grouping/internal/find_left_link.hh
--- text/grouping/internal/find_left_link.hh (revision 4356)
+++ text/grouping/internal/find_left_link.hh (working copy)
@@ -81,7 +81,7 @@
{
///FIXME: the following code is not generic...
/// First site on the right of the central site
- mln_site(L) p = c + left;
+ mln_site(L) p = c + mln::left;
while (objects.domain().has(p) // Not outside image domain
&& (objects(p) == literal::zero // Is the background
Index: text/grouping/internal/find_right_link.hh
--- text/grouping/internal/find_right_link.hh (revision 4356)
+++ text/grouping/internal/find_right_link.hh (working copy)
@@ -84,7 +84,7 @@
{
///FIXME: the following code is not generic...
/// First site on the right of the central site
- mln_site(L) p = c + right;
+ mln_site(L) p = c + mln::right;
while (objects.domain().has(p) // Not outside image domain
&& (objects(p) == literal::zero // Is the background
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
New candidates to replace value types.
* theo/mln: New directory.
* theo/mln/core,
* theo/mln/core/concept,
* theo/mln/walue,
* theo/mln/walue/internal: New sub-directories.
* theo/mln/core/concept/walue.hh: New.
* theo/mln/walue/gl.cc: New.
* theo/mln/walue/gl8.hh: New.
* theo/mln/walue/rgb_t.hh: New.
* theo/mln/walue/glf.cc: New.
* theo/mln/walue/approx_equal.hh: New.
* theo/mln/walue/set_encoding.hh: New.
* theo/mln/walue/gl.hh: New.
* theo/mln/walue/rgb_3xn.hh: New.
* theo/mln/walue/rgb_3x8.cc: New.
* theo/mln/walue/int_u.cc: New.
* theo/mln/walue/glf.hh: New.
* theo/mln/walue/gl16.hh: New.
* theo/mln/walue/rgb.hh: New.
* theo/mln/walue/rgb_3x8.hh: New.
* theo/mln/walue/internal/rgb_base.hh: New.
* theo/mln/walue/color.hh: New.
* theo/mln/walue/int_u.hh: New.
core/concept/walue.hh | 80 +++++++++
walue/approx_equal.hh | 98 ++++++++++++
walue/color.hh | 66 ++++++++
walue/gl.cc | 76 +++++++++
walue/gl.hh | 362 +++++++++++++++++++++++++++++++++++++++++++++
walue/gl16.hh | 50 ++++++
walue/gl8.hh | 50 ++++++
walue/glf.cc | 39 ++++
walue/glf.hh | 152 ++++++++++++++++++
walue/int_u.cc | 32 +++
walue/int_u.hh | 170 +++++++++++++++++++++
walue/internal/rgb_base.hh | 240 +++++++++++++++++++++++++++++
walue/rgb.hh | 86 ++++++++++
walue/rgb_3x8.cc | 26 +++
walue/rgb_3x8.hh | 51 ++++++
walue/rgb_3xn.hh | 98 ++++++++++++
walue/rgb_t.hh | 97 ++++++++++++
walue/set_encoding.hh | 176 +++++++++++++++++++++
18 files changed, 1949 insertions(+)
Index: theo/mln/core/concept/walue.hh
--- theo/mln/core/concept/walue.hh (revision 0)
+++ theo/mln/core/concept/walue.hh (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_CORE_CONCEPT_WALUE_HH
+# define MLN_CORE_CONCEPT_WALUE_HH
+
+/// \file
+/// \brief Definition of the concept of mln::Walue.
+///
+/// \todo Activate traits.
+
+# include <mln/core/concept/object.hh>
+// # include <mln/trait/value_.hh>
+
+
+namespace mln
+{
+
+ // Forward declaration.
+ template <typename E> struct Walue;
+
+ // Value category flag type.
+ template <>
+ struct Walue<void>
+ {
+ typedef Object<void> super;
+ };
+
+
+ /// \brief Concept for classes of values.
+ //
+ template <typename E>
+ struct Walue : public Object<E>
+ {
+ typedef Walue<void> category;
+
+ // FIXME
+
+ protected:
+ Walue();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ inline
+ Walue<E>::Walue()
+ {
+ // FIXME
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_WALUE_HH
Index: theo/mln/walue/gl.cc
--- theo/mln/walue/gl.cc (revision 0)
+++ theo/mln/walue/gl.cc (revision 0)
@@ -0,0 +1,76 @@
+#include <mln/walue/gl8.hh>
+#include <mln/walue/gl16.hh>
+#include <mln/literal/white.hh>
+#include <mln/literal/black.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+ using walue::gl8;
+ using walue::gl16;
+ using walue::glf1;
+ using walue::set_encoding;
+
+ {
+ gl8 g1 = set_encoding(127);
+ mln_assertion(g1.encoding() == 127);
+ gl8 g2 = set_encoding(128);
+ mln_assertion((g1 + g2) / 2 == 0.5);
+ }
+
+ {
+ gl8 g8 = set_encoding(51);
+ mln_assertion(approx_equal(g8, 0.2));
+
+ gl16 g16 = 0.2;
+ mln_assertion(g16.encoding() == 13107);
+ mln_assertion(approx_equal(g8, g16));
+ }
+
+ {
+ gl8 g;
+
+ g = 0.;
+ mln_assertion(g == literal::black);
+
+ g = 1.;
+ mln_assertion(g == literal::white);
+
+ g = 0.2;
+ mln_assertion(5 * g == literal::white);
+ }
+
+ {
+ gl8 g1 = literal::white;
+ gl16 g2 = g1;
+ mln_assertion(g2 == literal::white);
+ }
+
+ {
+ gl8 g1 = literal::white;
+ gl16 g2 = literal::white;
+ mln_assertion((g1 + g2) / 2 == literal::white);
+ // std::cout << "g1 = " << g1 << ", " << "g2 = " << g2 << std::endl;
+ mln_assertion(g1 <= g2 && g2 >= g1);
+ mln_assertion(g1 == g2);
+ }
+
+
+ {
+ using walue::gl;
+ gl<31> g1 = literal::white;
+ gl<32> g2 = literal::white;
+ mln_assertion(g2 == g1);
+ g2.set_encoding(g2.encoding() - 1);
+ mln_assertion(g2 < g1);
+ }
+
+// // KO: Ambiguous code do not compile :-)
+// {
+// walue::int_u8 i = 1;
+// g = i;
+// }
+
+}
Index: theo/mln/walue/gl8.hh
--- theo/mln/walue/gl8.hh (revision 0)
+++ theo/mln/walue/gl8.hh (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_GL8_HH
+# define MLN_WALUE_GL8_HH
+
+/// \file
+///
+/// Define a 8-bit gray-level type.
+
+# include <mln/walue/gl.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ /// 8-bit gray-level type.
+ typedef gl<8> gl8;
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_GL8_HH
Index: theo/mln/walue/rgb_t.hh
--- theo/mln/walue/rgb_t.hh (revision 0)
+++ theo/mln/walue/rgb_t.hh (revision 0)
@@ -0,0 +1,97 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_RGB_T_HH
+# define MLN_WALUE_RGB_T_HH
+
+/// \file
+/// \brief FIXME
+
+# include <mln/walue/internal/rgb_base.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ // Forward declaration.
+ template <typename T> class rgb_t;
+
+
+ // FIXME...
+
+
+ /// \brief FIXME
+ //
+ template <typename T>
+ class rgb_t : public internal::rgb_base< T, T, T,
+ rgb_t<T> >
+ {
+ typedef internal::rgb_base< T, T, T,
+ rgb_t<T> > super_;
+ public:
+
+ // Constructor without argument.
+ rgb_t();
+
+ rgb_t(float r, float g, float b);
+
+ template <typename T>
+ rgb_t(const internal::encoding<T,T,T>& e)
+ : super_(set_encoding(e.t0),
+ set_encoding(e.t1),
+ set_encoding(e.t2))
+ {
+ }
+
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ rgb_t<T>::rgb_t()
+ {
+ }
+
+ template <typename T>
+ inline
+ rgb_t<T>::rgb_t(float r, float g, float b)
+ : super_(r, g, b)
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_RGB_T_HH
Index: theo/mln/walue/glf.cc
--- theo/mln/walue/glf.cc (revision 0)
+++ theo/mln/walue/glf.cc (revision 0)
@@ -0,0 +1,39 @@
+#include <mln/walue/glf.hh>
+#include <mln/walue/gl8.hh>
+#include <mln/literal/white.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using walue::glf1;
+ using walue::glf2;
+
+ glf1 g = walue::set_encoding(0.5);
+ g = g * 2;
+ mln_assertion(g == literal::white);
+
+
+ {
+ using walue::gl8;
+ gl8 g = literal::white;
+ glf1 f = g;
+ mln_assertion(f == g);
+ }
+
+ // Tests on approx_equal.
+ {
+ glf1 g = 0.49999, g_ = 0.50001;
+ mln_assertion(approx_equal(g, g_) == false);
+ }
+ {
+ glf1 g = 0.499999, g_ = 0.500001;
+ mln_assertion(approx_equal(g, g_));
+ mln_assertion(approx_equal(g, 0.5));
+ }
+ {
+ glf1 g1 = 0.499999;
+ glf2 g2 = 0.500001;
+ mln_assertion(approx_equal(g1, g2));
+ }
+}
Index: theo/mln/walue/approx_equal.hh
--- theo/mln/walue/approx_equal.hh (revision 0)
+++ theo/mln/walue/approx_equal.hh (revision 0)
@@ -0,0 +1,98 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_APPROX_EQUAL_HH
+# define MLN_APPROX_EQUAL_HH
+
+/// \file
+///
+/// Define an approximative equality test.
+
+
+namespace mln
+{
+
+
+ namespace def
+ {
+
+ /// Epsilon.
+ const float epsilon = 1e-5; // FIXME
+ const float minus_epsilon = - epsilon;
+ const float one_plus_epsilon = 1 + epsilon;
+
+ } // def
+
+
+ bool approx_equal(float lhs, float rhs);
+ bool approx_equal(float lhs, double rhs);
+ bool approx_equal(double lhs, float rhs);
+ bool approx_equal(double lhs, double rhs);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+ inline float my_fabs_(float f) { return f > 0.f ? f : - f; }
+ }
+
+ inline
+ bool approx_equal(float lhs, float rhs)
+ {
+ // FIXME: Cf. boost.
+ float
+ diff = lhs > rhs ? lhs - rhs : rhs - lhs,
+ mean = internal::my_fabs_(lhs + rhs) / 2;
+ return
+ mean > def::epsilon ?
+ diff / mean < def::epsilon :
+ diff < def::epsilon;
+ }
+
+ inline
+ bool approx_equal(float lhs, double rhs)
+ {
+ return approx_equal(lhs, float(rhs));
+ }
+
+ inline
+ bool approx_equal(double lhs, float rhs)
+ {
+ return approx_equal(float(lhs), rhs);
+ }
+
+ inline
+ bool approx_equal(double lhs, double rhs)
+ {
+ return approx_equal(float(lhs), float(rhs));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_APPROX_EQUAL_HH
Index: theo/mln/walue/set_encoding.hh
--- theo/mln/walue/set_encoding.hh (revision 0)
+++ theo/mln/walue/set_encoding.hh (revision 0)
@@ -0,0 +1,176 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_SET_ENCODING_HH
+# define MLN_WALUE_SET_ENCODING_HH
+
+/// \file
+/// \brief Routine to set an encoding value.
+
+# include <mln/core/concept/walue.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ namespace internal
+ {
+
+ template < typename T0, typename T1, typename T2 >
+ struct encoding_base
+ {
+ encoding_base(const T0& t0, const T1& t1, const T2& t2)
+ : t0(t0), t1(t1), t2(t2)
+ {
+ }
+ const T0& t0;
+ const T1& t1;
+ const T2& t2;
+ };
+
+ template < typename T0, typename T1 >
+ struct encoding_base< T0, T1, void >
+ {
+ encoding_base(const T0& t0, const T1& t1)
+ : t0(t0), t1(t1)
+ {
+ }
+ const T0& t0;
+ const T1& t1;
+ };
+
+ template < typename T0 >
+ struct encoding_base< T0, void, void >
+ {
+ encoding_base(const T0& t0)
+ : t0(t0)
+ {
+ }
+ const T0& t0;
+ const T0& value() const { return t0; }
+ };
+
+
+ template < typename T0,
+ typename T1 = void,
+ typename T2 = void >
+ struct encoding : encoding_base<T0,T1,T2>
+ {
+
+ template < typename U0 >
+ encoding(const U0& u0)
+ : encoding_base<T0,T1,T2>(u0)
+ {}
+
+ template < typename U0, typename U1 >
+ encoding(const U0& u0, const U1& u1)
+ : encoding_base<T0,T1,T2>(u0, u1)
+ {}
+
+ template < typename U0, typename U1, typename U2 >
+ encoding(const U0& u0, const U1& u1, const U2& u2)
+ : encoding_base<T0,T1,T2>(u0, u1, u2)
+ {}
+ };
+
+
+ } // end of namespace mln::walue::internal
+
+
+ /// \brief Set an encoding value.
+ //
+ template <typename T>
+ inline
+ internal::encoding<T,void,void>
+ set_encoding(const T& t)
+ {
+ internal::encoding<T,void,void> tmp(t);
+ return tmp;
+ }
+
+
+ template <typename T0, typename T1>
+ inline
+ internal::encoding<T0,T1,void>
+ set_encoding(const T0& t0, const T1& t1)
+ {
+ internal::encoding<T0,T1,void> tmp(t0,t1);
+ return tmp;
+ }
+
+ template <typename T0, typename T1, typename T2>
+ inline
+ internal::encoding<T0,T1,T2>
+ set_encoding(const T0& t0, const T1& t1, const T2& t2)
+ {
+ internal::encoding<T0,T1,T2> tmp(t0,t1,t2);
+ return tmp;
+ }
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+// namespace internal
+// {
+
+// template <typename T>
+// inline
+// encoding<T>::encoding(const T& t)
+// : t_(t)
+// {
+// }
+
+// template <typename T>
+// inline
+// const T&
+// encoding<T>::value() const
+// {
+// return t_;
+// }
+
+// // const T& operator[](unsigned i)) const;
+
+// } // end of namespace mln::walue::internal
+
+// template <typename T>
+// inline
+// internal::encoding<T>
+// set_encoding(const T& t)
+// {
+// internal::encoding<T> tmp(t);
+// return tmp;
+// }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_SET_ENCODING_HH
Index: theo/mln/walue/gl.hh
--- theo/mln/walue/gl.hh (revision 0)
+++ theo/mln/walue/gl.hh (revision 0)
@@ -0,0 +1,362 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_GL_HH
+# define MLN_WALUE_GL_HH
+
+/// \file
+///
+/// Define a gray-level type with discrete quantization.
+
+# include <mln/core/concept/walue.hh>
+# include <mln/walue/int_u.hh>
+# include <mln/walue/glf.hh>
+# include <mln/walue/set_encoding.hh>
+
+// Extra usefull includes.
+# include <mln/value/scalar.hh>
+# include <mln/value/builtin/ops.hh>
+
+
+namespace mln
+{
+
+
+ // Forward declarations.
+ namespace walue {
+ template <unsigned n> struct gl;
+ }
+ namespace literal {
+ struct white_t;
+ struct black_t;
+ }
+
+
+ namespace walue
+ {
+
+ namespace internal
+ {
+
+ // Max encoding with n bits.
+
+ template <unsigned n>
+ struct pow_two
+ {
+ static const unsigned long max_ = 2 * pow_two<n - 1>::max_ + 1;
+ static float max() { return float(max_); }
+ };
+
+ template <>
+ struct pow_two< 1 >
+ {
+ static const unsigned long max_ = 1;
+ };
+
+ } // internal
+
+
+
+ /// FIXME
+ //
+ template <unsigned n>
+ class gl
+ : public Proxy< gl<n> >,
+ public mln::internal::proxy_impl< glf1, gl<n> >,
+ private metal::bool_<(n > 1)>::check_t
+ {
+ public:
+
+ /// Encoding associated type.
+ typedef typename internal::encoding_type_<n>::ret encoding_t;
+
+ /// Constructor without argument.
+ gl()
+ {
+ }
+
+ /// Copy constructor.
+ gl(const gl<n>& g)
+ {
+ v_ = g.v_;
+ }
+
+ /// Assignment operator.
+ gl& operator=(const gl<n>& g)
+ {
+ v_ = g.v_;
+ return *this;
+ }
+
+
+ /// From a floating value.
+ gl(float f) { set_(f); }
+ gl& operator=(float f) { set_(f); return *this; }
+
+ /// From a double precision floating value.
+ gl(double f) { set_(f); }
+ gl& operator=(double f) { set_(f); return *this; }
+
+ /// From another discrete gray-level.
+ template <unsigned m>
+ gl(const gl<m>& g) { set_(g); }
+ template <unsigned m>
+ gl& operator=(const gl<m>& g) { set_(g); return *this; }
+
+ /// From a floating encoded gray-level.
+ template <typename F>
+ gl(const glf<F>& f) { set_(f); }
+ template <typename F>
+ gl& operator=(const glf<F>& f) { set_(f); return *this; }
+
+ // Safety.
+ template <typename T>
+ gl(T)
+ {
+ mlc_abort(T)::check();
+ }
+
+ // Safety.
+ template <typename T>
+ void operator=(T)
+ {
+ mlc_abort(T)::check();
+ }
+
+
+ gl(const mln::literal::white_t&)
+ {
+ v_ = internal::pow_two<n>::max_;
+ }
+ gl& operator=(const mln::literal::white_t&)
+ {
+ v_ = internal::pow_two<n>::max_;
+ return *this;
+ }
+
+ gl(const mln::literal::black_t&) { v_ = 0; }
+ gl& operator=(const mln::literal::black_t&) { v_ = 0; return *this; }
+
+
+ template <typename T>
+ gl(const internal::encoding<T>& e)
+ {
+ // Dev note: no need for operator==(internal::encoding).
+ mlc_converts_to(T, encoding_t)::check();
+ mln_precondition(e.value() >= 0 &&
+ e.value() <= internal::pow_two<n>::max_);
+ v_ = e.value();
+ mln_postcondition(static_cast<T>(v_) == e.value());
+ }
+
+ encoding_t encoding() const
+ {
+ return v_;
+ }
+
+ gl& set_encoding(encoding_t v)
+ {
+ v_ = v;
+ return *this;
+ }
+
+
+ // Give the subject (as a Proxy).
+ glf1 subj_()
+ {
+ return float(v_) / internal::pow_two<n>::max();
+ }
+
+ protected:
+
+ encoding_t v_;
+
+ private:
+
+ void set_(float f)
+ {
+ mln_precondition(f >= def::minus_epsilon &&
+ f <= def::one_plus_epsilon);
+ v_ = encoding_t(f * internal::pow_two<n>::max() + 0.5f);
+ }
+
+ }; // end of class gl<n>
+
+
+ template <unsigned n>
+ std::ostream&
+ operator<<(std::ostream& ostr, const gl<n>& g)
+ {
+ return ostr << (unsigned long)(g.encoding());
+ }
+
+
+ // approx_equal
+
+ template <unsigned n>
+ inline
+ bool approx_equal(const gl<n>& lhs, const gl<n>& rhs)
+ {
+ return lhs.encoding() == rhs.encoding();
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool approx_equal(const gl<n>& lhs, const gl<m>& rhs)
+ {
+ if (n < m)
+ return lhs.encoding() == gl<n>(rhs).encoding();
+ else
+ return approx_equal(rhs, lhs);
+ }
+
+ template <unsigned n, typename F>
+ inline
+ bool approx_equal(const gl<n>& lhs, const glf<F>& rhs)
+ {
+ return lhs.encoding() == gl<n>(rhs).encoding();
+ }
+
+ template <unsigned n>
+ inline
+ bool approx_equal(const gl<n>& lhs, float rhs)
+ {
+ return lhs.encoding() == gl<n>(rhs).encoding();
+ }
+
+ template <unsigned n>
+ inline
+ bool approx_equal(const gl<n>& lhs, double rhs)
+ {
+ return lhs.encoding() == gl<n>(rhs).encoding();
+ }
+
+ // Safety.
+ template <unsigned n, typename T>
+ inline
+ bool approx_equal(const gl<n>& lhs, T)
+ {
+ mlc_abort(T)::check();
+ return false;
+ }
+
+ // With glf<F> as left hand side.
+ template <typename F, unsigned n>
+ inline
+ bool approx_equal(const glf<F>& lhs, const gl<n>& rhs)
+ {
+ return approx_equal(rhs, lhs);
+ }
+
+
+ // Operators.
+
+ template <unsigned n>
+ bool operator==(const gl<n>& lhs, const gl<n>& rhs);
+
+ template <unsigned n>
+ bool operator<(const gl<n>& lhs, const gl<n>& rhs);
+
+
+ template <unsigned n, unsigned m>
+ bool operator==(const gl<n>& lhs, const gl<m>& rhs);
+
+ template <unsigned n, unsigned m>
+ bool operator<(const gl<n>& lhs, const gl<m>& rhs);
+
+ template <unsigned n, unsigned m>
+ bool operator<=(const gl<n>& lhs, const gl<m>& rhs);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // FIXME: Move definitions here...
+
+
+ // Operators.
+
+ template <unsigned n>
+ inline
+ bool operator==(const gl<n>& lhs, const gl<n>& rhs)
+ {
+ return lhs.encoding() == rhs.encoding();
+ }
+
+ template <unsigned n>
+ inline
+ bool operator<(const gl<n>& lhs, const gl<n>& rhs)
+ {
+ return lhs.encoding() < rhs.encoding();
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool operator==(const gl<n>& lhs, const gl<m>& rhs)
+ {
+ typedef unsigned long long ull_t;
+ return
+ (ull_t)lhs.encoding() * (ull_t)internal::pow_two<m>::max_ ==
+ (ull_t)rhs.encoding() * (ull_t)internal::pow_two<n>::max_;
+ }
+
+ // FIXME: For low quantizations, some better code can be
+ // implemented. For instance
+ // op == { return std::abs(float(lhs) - float(rhs)) < def::epsilon; }
+ // op < { return float(lhs) < float(rhs) - def::epsilon; }
+ // op <= { return float(lhs) < float(rhs) + def::epsilon; }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool operator<(const gl<n>& lhs, const gl<m>& rhs)
+ {
+ typedef unsigned long long ull_t;
+ return
+ (ull_t)lhs.encoding() * (ull_t)internal::pow_two<m>::max_ <
+ (ull_t)rhs.encoding() * (ull_t)internal::pow_two<n>::max_;
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool operator<=(const gl<n>& lhs, const gl<m>& rhs)
+ {
+ typedef unsigned long long ull_t;
+ return
+ (ull_t)lhs.encoding() * (ull_t)internal::pow_two<m>::max_ <=
+ (ull_t)rhs.encoding() * (ull_t)internal::pow_two<n>::max_;
+ }
+
+
+ // FIXME: Add specializations with float and double?
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_GL_HH
Index: theo/mln/walue/rgb_3xn.hh
--- theo/mln/walue/rgb_3xn.hh (revision 0)
+++ theo/mln/walue/rgb_3xn.hh (revision 0)
@@ -0,0 +1,98 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_RGB_3XN_HH
+# define MLN_WALUE_RGB_3XN_HH
+
+/// \file
+/// \brief FIXME
+
+# include <mln/walue/internal/rgb_base.hh>
+# include <mln/walue/gl.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ // Forward declaration.
+ template <unsigned n> class rgb_3xn;
+
+
+ // FIXME...
+
+
+ /// \brief FIXME
+ //
+ template <unsigned n>
+ class rgb_3xn : public internal::rgb_base< gl<n>, gl<n>, gl<n>,
+ rgb_3xn<n> >
+ {
+ typedef internal::rgb_base< gl<n>, gl<n>, gl<n>,
+ rgb_3xn<n> > super_;
+ public:
+
+ // Constructor without argument.
+ rgb_3xn();
+
+ rgb_3xn(float r, float g, float b);
+
+ template <typename T>
+ rgb_3xn(const internal::encoding<T,T,T>& e)
+ : super_(set_encoding(e.t0),
+ set_encoding(e.t1),
+ set_encoding(e.t2))
+ {
+ }
+
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n>
+ inline
+ rgb_3xn<n>::rgb_3xn()
+ {
+ }
+
+ template <unsigned n>
+ inline
+ rgb_3xn<n>::rgb_3xn(float r, float g, float b)
+ : super_(r, g, b)
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_RGB_3XN_HH
Index: theo/mln/walue/rgb_3x8.cc
--- theo/mln/walue/rgb_3x8.cc (revision 0)
+++ theo/mln/walue/rgb_3x8.cc (revision 0)
@@ -0,0 +1,26 @@
+#include <mln/walue/rgb_3x8.hh>
+#include <mln/core/var.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+ using walue::rgb_3x8;
+ using walue::set_encoding;
+
+ {
+ rgb_3x8 c(0, 0.5, 1);
+ std::cout << c.to_vec() << std::endl;
+ }
+ {
+ rgb_3x8 c = set_encoding(0, 128, 255);
+ std::cout << c << std::endl;
+ }
+
+// // mln_VAR(e, walue::set_encoding(0,1,2));
+// walue::internal::encoding<int> e = walue::set_encoding(0,1,2);
+// std::cout << e.t0 << ' ' << e.t1 << ' ' << e.t2 << std::endl;
+
+
+}
Index: theo/mln/walue/int_u.cc
--- theo/mln/walue/int_u.cc (revision 0)
+++ theo/mln/walue/int_u.cc (revision 0)
@@ -0,0 +1,32 @@
+#include <mln/walue/int_u.hh>
+#include <mln/literal/zero.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using walue::int_u8;
+
+ int_u8 i = 1;
+ mln_assertion(i == 1);
+ i = 2;
+ mln_assertion(i == 2);
+
+ mln_assertion((i - i) == 0);
+ mln_assertion((i + 2 * i) == (i * 3));
+ mln_assertion((+i) == i);
+ mln_assertion((-i) == (0 - i));
+
+ float f = i;
+ mln_assertion(f == 2);
+ mln_assertion(f == i);
+ mln_assertion((f + i) == 2 * f);
+
+ i = literal::zero;
+ mln_assertion(0 == i);
+
+ {
+ int_u8 i = walue::set_encoding(51);
+ mln_assertion(i.encoding() == 51);
+ }
+}
Index: theo/mln/walue/glf.hh
--- theo/mln/walue/glf.hh (revision 0)
+++ theo/mln/walue/glf.hh (revision 0)
@@ -0,0 +1,152 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_GLF_HH
+# define MLN_WALUE_GLF_HH
+
+/// \file
+///
+/// Define a gray-level type with floating quantization.
+
+# include <mln/core/concept/proxy.hh>
+# include <mln/value/scalar.hh>
+# include <mln/value/builtin/ops.hh>
+# include <mln/walue/set_encoding.hh>
+# include <mln/walue/approx_equal.hh>
+
+
+namespace mln
+{
+
+
+ // Forward declarations.
+ namespace walue {
+ template <typename F> struct glf;
+ template <unsigned n> struct gl;
+ }
+ namespace literal {
+ struct white_t;
+ struct black_t;
+ }
+
+
+ namespace walue
+ {
+
+ /// Type aliases.
+ typedef glf<float> glf1;
+ typedef glf<double> glf2;
+
+
+ /// FIXME
+ //
+ template <typename F>
+ class glf
+ : public Proxy< glf<F> >,
+ public mln::internal::proxy_impl< F, glf<F> >,
+ private metal::or_< mlc_equal(F, float),
+ mlc_equal(F, double) >::check_t
+ {
+ public:
+
+ /// Encoding associated type.
+ typedef F encoding_t;
+
+ /// Constructor without argument.
+ glf()
+ {
+ }
+
+ /// Constructor from a floating value.
+ glf(F f)
+ {
+ mln_precondition(f >= def::minus_epsilon &&
+ f <= def::one_plus_epsilon);
+ v_ = f;
+ }
+
+ /// Assignment from a floating value.
+ glf& operator=(F f)
+ {
+ mln_precondition(f >= def::minus_epsilon &&
+ f <= def::one_plus_epsilon);
+ v_ = f;
+ return *this;
+ }
+
+
+ glf(const mln::literal::white_t&) { v_ = 1; }
+ glf& operator=(const mln::literal::white_t&) { v_ = 1; return *this; }
+
+ glf(const mln::literal::black_t&) { v_ = 0; }
+ glf& operator=(const mln::literal::black_t&) { v_ = 0; return *this; }
+
+
+ template <typename T>
+ glf(const internal::encoding<T>& e)
+ {
+ mlc_converts_to(T, F)::check();
+ v_ = e.value();
+ mln_postcondition(static_cast<T>(v_) == e.value());
+ }
+
+ F encoding() const
+ {
+ return v_;
+ }
+
+ glf& set_encoding(F f)
+ {
+ mln_precondition(f >= def::minus_epsilon &&
+ f <= def::one_plus_epsilon);
+ v_ = f;
+ return *this;
+ }
+
+
+ // As a proxy.
+ F subj_()
+ {
+ return v_;
+ }
+
+ protected:
+
+ F v_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // FIXME
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_GLF_HH
Index: theo/mln/walue/gl16.hh
--- theo/mln/walue/gl16.hh (revision 0)
+++ theo/mln/walue/gl16.hh (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_GL16_HH
+# define MLN_WALUE_GL16_HH
+
+/// \file
+///
+/// Define a 16-bit gray-level type.
+
+# include <mln/walue/gl.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ /// 16-bit gray-level type.
+ typedef gl<16> gl16;
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_GL16_HH
Index: theo/mln/walue/rgb.hh
--- theo/mln/walue/rgb.hh (revision 0)
+++ theo/mln/walue/rgb.hh (revision 0)
@@ -0,0 +1,86 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_RGB_HH
+# define MLN_WALUE_RGB_HH
+
+/// \file
+/// \brief Definition of the Rgb abstraction.
+///
+/// \todo Generalize op<< for vector-like value types.
+
+# include <mln/walue/color.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ /// \brief Rgb abstraction.
+ //
+ template <typename E>
+ struct Rgb : public Color<E>
+ {
+ protected:
+ Rgb();
+ };
+
+
+ template <typename E>
+ std::ostream&
+ operator<<(std::ostream& ostr, const Rgb<E>& c);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ inline
+ Rgb<E>::Rgb()
+ {
+ }
+
+ template <typename E>
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const Rgb<E>& c_)
+ {
+ const E& c = exact(c_);
+ return ostr << '('
+ << c.red() << ','
+ << c.green() << ','
+ << c.blue() << ')';
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_RGB_HH
Index: theo/mln/walue/rgb_3x8.hh
--- theo/mln/walue/rgb_3x8.hh (revision 0)
+++ theo/mln/walue/rgb_3x8.hh (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_RGB_3X8_HH
+# define MLN_WALUE_RGB_3X8_HH
+
+/// \file
+/// \brief FIXME
+
+# include <mln/walue/rgb_3xn.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+
+ /// Type alias.
+ typedef rgb_3xn<8> rgb_3x8;
+
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_RGB_3X8_HH
Index: theo/mln/walue/internal/rgb_base.hh
--- theo/mln/walue/internal/rgb_base.hh (revision 0)
+++ theo/mln/walue/internal/rgb_base.hh (revision 0)
@@ -0,0 +1,240 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_INTERNAL_RGB_BASE_HH
+# define MLN_WALUE_INTERNAL_RGB_BASE_HH
+
+/// \file
+/// \brief FIXME
+
+# include <mln/walue/rgb.hh>
+# include <mln/algebra/vec.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ namespace internal
+ {
+
+ /// \brief FIXME
+ //
+ template <typename R, typename G, typename B,
+ typename E>
+ class rgb_base : public Rgb< E >
+ {
+ public:
+
+ typedef R red_t;
+ R red() const;
+ R& red();
+
+ typedef G green_t;
+ G green() const;
+ G& green();
+
+ typedef B blue_t;
+ B blue() const;
+ B& blue();
+
+ protected:
+
+ rgb_base();
+ rgb_base(const R& r, const G& g, const B& b);
+
+ R r_;
+ G g_;
+ B b_;
+ };
+
+
+ /// \brief FIXME
+ //
+ template <typename T, typename E>
+ class rgb_base<T,T,T, E> : public Rgb< E >
+ {
+ public:
+
+ typedef T red_t;
+ T red() const;
+ T& red();
+
+ typedef T green_t;
+ T green() const;
+ T& green();
+
+ typedef T blue_t;
+ T blue() const;
+ T& blue();
+
+ const algebra::vec<3,T>& to_vec() const;
+
+ protected:
+
+ rgb_base();
+
+ // FIXME: Allow input with a type U different from T...
+ rgb_base(const T& r, const T& g, const T& b);
+
+ T v_[3];
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ rgb_base<R,G,B,E>::rgb_base()
+ {
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ rgb_base<R,G,B,E>::rgb_base(const R& r, const G& g, const B& b)
+ : r_(r), g_(g), b_(b)
+ {
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ R rgb_base<R,G,B,E>::red() const
+ {
+ return r_;
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ R& rgb_base<R,G,B,E>::red()
+ {
+ return r_;
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ G rgb_base<R,G,B,E>::green() const
+ {
+ return g_;
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ G& rgb_base<R,G,B,E>::green()
+ {
+ return g_;
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ B rgb_base<R,G,B,E>::blue() const
+ {
+ return b_;
+ }
+
+ template <typename R, typename G, typename B, typename E>
+ inline
+ B& rgb_base<R,G,B,E>::blue()
+ {
+ return b_;
+ }
+
+ // Specialization.
+
+ template <typename T, typename E>
+ inline rgb_base<T,T,T,E>::rgb_base()
+ {
+ }
+
+ template <typename T, typename E>
+ inline
+ rgb_base<T,T,T,E>::rgb_base(const T& r, const T& g, const T& b)
+ {
+ v_[0] = r;
+ v_[1] = g;
+ v_[2] = b;
+ }
+
+ template <typename T, typename E>
+ inline
+ T rgb_base<T,T,T,E>::red() const
+ {
+ return v_[0];
+ }
+
+ template <typename T, typename E>
+ inline
+ T& rgb_base<T,T,T,E>::red()
+ {
+ return v_[0];
+ }
+
+ template <typename T, typename E>
+ inline
+ T rgb_base<T,T,T,E>::green() const
+ {
+ return v_[1];
+ }
+
+ template <typename T, typename E>
+ inline
+ T& rgb_base<T,T,T,E>::green()
+ {
+ return v_[1];
+ }
+
+ template <typename T, typename E>
+ inline
+ T rgb_base<T,T,T,E>::blue() const
+ {
+ return v_[2];
+ }
+
+ template <typename T, typename E>
+ inline
+ T& rgb_base<T,T,T,E>::blue()
+ {
+ return v_[2];
+ }
+
+ template <typename T, typename E>
+ inline
+ const algebra::vec<3,T>&
+ rgb_base<T,T,T,E>::to_vec() const
+ {
+ return *(const algebra::vec<3,T>*)(v_);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue::internal
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_RGB_BASE_HH
Index: theo/mln/walue/color.hh
--- theo/mln/walue/color.hh (revision 0)
+++ theo/mln/walue/color.hh (revision 0)
@@ -0,0 +1,66 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_COLOR_HH
+# define MLN_WALUE_COLOR_HH
+
+/// \file
+/// \brief Definition of the Color abstraction.
+
+# include <mln/core/concept/walue.hh>
+
+
+namespace mln
+{
+
+ namespace walue
+ {
+
+ /// \brief Color abstraction.
+ //
+ template <typename E>
+ struct Color : public Walue<E>
+ {
+ protected:
+ Color();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ inline
+ Color<E>::Color()
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_COLOR_HH
Index: theo/mln/walue/int_u.hh
--- theo/mln/walue/int_u.hh (revision 0)
+++ theo/mln/walue/int_u.hh (revision 0)
@@ -0,0 +1,170 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#ifndef MLN_WALUE_INT_U_HH
+# define MLN_WALUE_INT_U_HH
+
+/// \file
+///
+/// Define a generic class for unsigned integers.
+
+# include <mln/core/concept/proxy.hh>
+# include <mln/walue/set_encoding.hh>
+
+
+
+namespace mln
+{
+
+ // Forward declarations.
+ namespace walue {
+ template <unsigned n> struct int_u;
+ }
+ namespace literal {
+ struct zero_t;
+ struct one_t;
+ }
+
+
+ namespace walue
+ {
+
+ /// Type aliases.
+ typedef int_u<8> int_u8;
+ typedef int_u<16> int_u16;
+
+
+ namespace internal
+ {
+ template <unsigned n> struct encoding_type_;
+
+ // FIXME: Revamp...
+
+ template <> struct encoding_type_<2> { typedef unsigned char ret; };
+ template <> struct encoding_type_<3> { typedef unsigned char ret; };
+ template <> struct encoding_type_<4> { typedef unsigned char ret; };
+ template <> struct encoding_type_<5> { typedef unsigned char ret; };
+ template <> struct encoding_type_<6> { typedef unsigned char ret; };
+ template <> struct encoding_type_<7> { typedef unsigned char ret; };
+ template <> struct encoding_type_<8> { typedef unsigned char ret; };
+
+ template <> struct encoding_type_<16> { typedef unsigned short ret; };
+
+ template <> struct encoding_type_<31> { typedef unsigned int ret; };
+ template <> struct encoding_type_<32> { typedef unsigned int ret; };
+
+ } // internal
+
+
+ /// Unsigned integer value class.
+ ///
+ /// The parameter is \c n the number of encoding bits.
+ //
+ template <unsigned n>
+ class int_u
+ : public Proxy< int_u<n> >,
+ public mln::internal::proxy_impl< unsigned, int_u<n> >
+ {
+ public:
+
+ /// Encoding associated type.
+ typedef typename internal::encoding_type_<n>::ret encoding_t;
+
+ /// Constructor without argument.
+ int_u()
+ {
+ }
+
+ /// Constructor from an integer.
+ int_u(int i)
+ {
+ mln_precondition(i >= 0);
+ // FIXME: mln_precondition(unsigned(i) <= mln_max(enc_));
+ v_ = static_cast<encoding_t>(i);
+ mln_postcondition(static_cast<int>(v_) == i);
+ }
+
+ /// Assignment from an integer.
+ int_u<n>& operator=(int i)
+ {
+ mln_precondition(i >= 0);
+ // FIXME: mln_precondition(unsigned(i) <= mln_max(enc_));
+ v_ = static_cast<encoding_t>(i);
+ mln_postcondition(static_cast<int>(v_) == i);
+ return *this;
+ }
+
+ /// Subject as a the proxy.
+ unsigned subj_()
+ {
+ return v_;
+ }
+
+
+ int_u(const mln::literal::one_t&) { v_ = 1; }
+ int_u& operator=(const mln::literal::one_t&) { v_ = 1; return *this; }
+
+ int_u(const mln::literal::zero_t&) { v_ = 0; }
+ int_u& operator=(const mln::literal::zero_t&) { v_ = 0; return *this; }
+
+
+ template <typename T>
+ int_u(const internal::encoding<T>& e)
+ {
+ mlc_converts_to(T, encoding_t)::check();
+ v_ = e.value();
+ mln_postcondition(static_cast<T>(v_) == e.value());
+ }
+
+ encoding_t encoding() const
+ {
+ return v_;
+ }
+
+ int_u& set_encoding(encoding_t v)
+ {
+ v_ = v;
+ return *this;
+ }
+
+ protected:
+
+ encoding_t v_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // FIXME
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::walue
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WALUE_INT_U_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Preparing a revamp of value types.
* mln/core/concept/proxy.hh (mln_def_binop_proxy): Add
operators to disambiguate the case of Proxy Op Literal.
(set_binary_): New overload for Proxy Op Literal.
* mln/core/concept/image.hh (~image): New check.
* mln/literal/black.hh,
* mln/literal/white.hh (operator float, operator double): New.
They are guarded by...
(MLN_NEW_VALUE_TYPES): ...this new variable.
* mln/value/rgb.hh (quant): Fix definition.
When n was low, say 3, then the quant was also set to low,
though there was no way to browse the set of values!
(rgb): New ctor overload for vec<3,float>; useful for
accu::mean.
core/concept/image.hh | 6 +++++-
core/concept/proxy.hh | 37 +++++++++++++++++++++++++++++++++++++
literal/black.hh | 31 +++++++++++++++++++++++++------
literal/white.hh | 31 +++++++++++++++++++++++++------
value/rgb.hh | 12 +++++++++++-
5 files changed, 103 insertions(+), 14 deletions(-)
Index: mln/core/concept/proxy.hh
--- mln/core/concept/proxy.hh (revision 4354)
+++ mln/core/concept/proxy.hh (working copy)
@@ -114,6 +114,22 @@
return exact(o) Symb exact(p).unproxy_(); \
} \
\
+ template <typename P, typename L> \
+ inline \
+ mln_trait_op_##Name(P, L) \
+ operator Symb (const Proxy<P>& p, const Literal<L>& l) \
+ { \
+ return exact(p).unproxy_() Symb exact(l); \
+ } \
+ \
+ template <typename L, typename P> \
+ inline \
+ mln_trait_op_##Name(L, P) \
+ operator Symb (const Literal<L>& l, const Proxy<P>& p) \
+ { \
+ return exact(l) Symb exact(p).unproxy_(); \
+ } \
+ \
struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_u_m_n
@@ -124,6 +140,8 @@
// Forward declarations.
template <typename E> struct Proxy;
+ template <typename E> struct Literal;
+
namespace convert
{
@@ -175,6 +193,25 @@
typedef mln_trait_binary(Op, O, S) ret;
};
+
+ // Disambiguate between (Proxy Op Object) and (Object Op Literal).
+
+ template < template <class, class> class Op,
+ typename P, typename L >
+ struct set_binary_< Op, mln::Proxy, P, mln::Literal, L >
+ {
+ typedef mlc_unqualif(mln_q_subject(P)) S;
+ typedef mln_trait_binary(Op, S, L) ret;
+ };
+
+ template < template <class, class> class Op,
+ typename L, typename P >
+ struct set_binary_< Op, mln::Literal, L, mln::Proxy, P >
+ {
+ typedef mlc_unqualif(mln_q_subject(P)) S;
+ typedef mln_trait_binary(Op, L, S) ret;
+ };
+
} // end of namespace mln::trait
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 4354)
+++ mln/core/concept/image.hh (working copy)
@@ -52,8 +52,10 @@
{
- // Forward declaration.
+ // Forward declarations.
template <typename E> struct Image;
+ template <typename E> struct Literal;
+
// Image category flag type.
template <>
@@ -239,6 +241,8 @@
typedef mln_rvalue(E) rvalue;
typedef mln_lvalue(E) lvalue;
+ mlc_is_not_a(value, Literal)::check();
+
// FIXME Doc
//typedef mln_vset(E) vset;
//const vset& (E::*m5)() const = & E::values;
Index: mln/literal/black.hh
--- mln/literal/black.hh (revision 4354)
+++ mln/literal/black.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -26,13 +27,12 @@
#ifndef MLN_LITERAL_BLACK_HH
# define MLN_LITERAL_BLACK_HH
-/*! \file
- * \brief Definition of the literal of mln::black.
- *
- */
+/// \file
+/// \brief Definition of the 'black' literal.
# include <mln/core/concept/literal.hh>
+
namespace mln
{
@@ -42,17 +42,36 @@
/// Type of literal black.
struct black_t : public Literal<black_t>
{
+# ifdef MLN_NEW_VALUE_TYPES
+ operator float() const;
+ operator double() const;
+# endif // MLN_NEW_VALUE_TYPES
};
/// Literal black.
extern const black_t& black;
+
# ifndef MLN_INCLUDE_ONLY
const black_t& black = black_t();
-# endif
+# ifdef MLN_NEW_VALUE_TYPES
+ inline
+ black_t::operator float() const
+ {
+ return 0.f;
+ }
+
+ inline
+ black_t::operator double() const
+ {
+ return 0.;
+ }
+# endif // MLN_NEW_VALUE_TYPES
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: mln/literal/white.hh
--- mln/literal/white.hh (revision 4354)
+++ mln/literal/white.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -26,13 +27,12 @@
#ifndef MLN_LITERAL_WHITE_HH
# define MLN_LITERAL_WHITE_HH
-/*! \file
- * \brief Definition of the literal of mln::white.
- *
- */
+/// \file
+/// \brief Definition of the 'white' literal.
# include <mln/core/concept/literal.hh>
+
namespace mln
{
@@ -42,17 +42,36 @@
/// Type of literal white.
struct white_t : public Literal<white_t>
{
+# ifdef MLN_NEW_VALUE_TYPES
+ operator float() const;
+ operator double() const;
+# endif // MLN_NEW_VALUE_TYPES
};
/// Literal white.
extern const white_t& white;
+
# ifndef MLN_INCLUDE_ONLY
const white_t& white = white_t();
-# endif
+# ifdef MLN_NEW_VALUE_TYPES
+ inline
+ white_t::operator float() const
+ {
+ return 1.f;
+ }
+
+ inline
+ white_t::operator double() const
+ {
+ return 1.;
+ }
+# endif // MLN_NEW_VALUE_TYPES
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: mln/value/rgb.hh
--- mln/value/rgb.hh (revision 4354)
+++ mln/value/rgb.hh (working copy)
@@ -205,7 +205,7 @@
typedef trait::value::nature::vectorial nature;
typedef trait::value::kind::color kind;
- typedef mln_value_quant_from_(card) quant;
+ typedef trait::value::quant::high /*mln_value_quant_from_(card)*/ quant;
typedef void comp;
typedef mln::value::int_u<n> comp_0;
@@ -275,6 +275,7 @@
rgb<n>(const algebra::vec<3, int>& rhs);
rgb<n>(const algebra::vec<3, unsigned>& rhs);
rgb<n>(const algebra::vec<3, int_u<n> >& rhs);
+ rgb<n>(const algebra::vec<3, float>& rhs);
// Conversion to the interoperation type.
operator algebra::vec<3, int>() const { return this->v_; }
@@ -436,6 +437,15 @@
template <unsigned n>
inline
+ rgb<n>::rgb(const algebra::vec<3, float>& v)
+ {
+ this->v_[0] = v[0];
+ this->v_[1] = v[1];
+ this->v_[2] = v[2];
+ }
+
+ template <unsigned n>
+ inline
rgb<n>::rgb(int r, int g, int b)
{
mln_precondition(r >= 0);
1
0