cleanup-2008 2408: Fix interpolated and tr_image.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Fix interpolated and tr_image. * mln/core/image/tr_image.hh (operator()): Fix. Fix trait. * mln/convert/from_to.hh (from_to): Move (vec -> rgb)... * mln/value/rgb.hh: ...here. convert/from_to.hh | 15 --------------- core/image/tr_image.hh | 10 +++++----- value/rgb.hh | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 20 deletions(-) Index: mln/core/image/tr_image.hh --- mln/core/image/tr_image.hh (revision 2407) +++ mln/core/image/tr_image.hh (working copy) @@ -73,6 +73,7 @@ { // ...these changes. typedef trait::image::value_io::read_only value_io; + typedef mln_internal_trait_image_speed_from(I) speed; // Un-fastest. }; } // end of namespace mln::trait @@ -97,10 +98,10 @@ typedef mln_value(I) value; /// Return type of read-write access. - typedef mln_lvalue(I) lvalue; // FIXME: Depends on lvalue presence in I. + typedef mln_value(I) lvalue; // FIXME: Depends on lvalue presence in I. /// Return type of read-only access. - typedef mln_rvalue(I) rvalue; + typedef mln_value(I) rvalue; /// Skeleton. typedef tr_image< S, tag::image_<I>, T> skeleton; @@ -130,10 +131,10 @@ /// Read-only access of pixel value at point site \p p. /// Mutable access is only OK for reading (not writing). - using super_::operator(); + //using super_::operator(); - mln_value(I) operator()(const psite& p); mln_value(I) operator()(const psite& p) const; + mln_value(I) operator()(const psite& p); void set_tr(T& tr); }; @@ -205,7 +206,6 @@ mln_value(I) tr_image<S,I,T>::operator()(const psite& p) const { - std::cout << "yay" << std::endl; algebra::vec<I::psite::dim, float> v = p; return this->data_->ima_(this->data_->tr_.inv()(v)); } Index: mln/value/rgb.hh --- mln/value/rgb.hh (revision 2407) +++ mln/value/rgb.hh (working copy) @@ -283,6 +283,7 @@ operator/(const rgb<n>& lhs, const mln::value::scalar_<S>& s); /// \} + # ifndef MLN_INCLUDE_ONLY /*---------------. @@ -496,6 +497,26 @@ } // end of namespace mln::value + + namespace convert + { + + // algebra::vec -> rgb. + template <typename T, unsigned m> + inline + void + from_to(const algebra::vec<3,T>& from, value::rgb<m>& to_) + { + value::rgb<m>& to = exact(to_); + algebra::vec<3, unsigned> tmp; + for (unsigned i = 0; i < 3; ++i) + tmp[i] = static_cast<unsigned>(from[i]); // FIXME: Use from_to instead of cast. + + to = value::rgb<m>(tmp); + } + + } // end of namespace mln::convert + } // end of namespace mln Index: mln/convert/from_to.hh --- mln/convert/from_to.hh (revision 2407) +++ mln/convert/from_to.hh (working copy) @@ -42,7 +42,6 @@ # include <mln/core/concept/object.hh> # include <mln/core/concept/gpoint.hh> # include <mln/value/concept/all.hh> -# include <mln/value/rgb.hh> # include <mln/convert/impl/all.hh> @@ -115,20 +114,6 @@ to[i] = static_cast< typename P::coord >(from[i]); } - // algebra::vec -> rgb. - template <typename T, unsigned m> - inline - void - from_to(const algebra::vec<3,T>& from, value::rgb<m>& to_) - { - value::rgb<m>& to = exact(to_); - algebra::vec<3, unsigned> tmp; - for (unsigned i = 0; i < 3; ++i) - tmp[i] = static_cast<unsigned>(from[i]); - - to = value::rgb<m>(tmp); - } - // Value -> Value template <typename F, typename T> inline
participants (1)
-
Ugo Jardonnet