Classes | |
struct | bound |
struct | cast |
struct | convoutput |
struct | force |
struct | f_nrgb_to_xyz |
struct | f_xyz_to_nrgb |
struct | f_rgb_to_hsi |
struct | f_hsi_to_rgb |
struct | f_rgb_to_hsl |
struct | f_hsl_to_rgb |
struct | f_rgb_to_hsv |
struct | f_hsv_to_rgb |
struct | f_rgb_to_nrgb |
struct | f_nrgb_to_rgb |
struct | f_rgb_to_xyz |
struct | f_xyz_to_rgb |
struct | f_rgb_to_yiq |
struct | f_yiq_to_rgb |
struct | f_rgb_to_yuv |
struct | f_yuv_to_rgb |
struct | stretch |
struct | value_to_point |
struct | value_to_point< ntg::color< 3, Qbits, S >, Exact > |
Namespaces | |
namespace | abstract |
Base classes for conversion. | |
namespace | internal |
Internal purpose only. | |
Functions | |
template<class C, class B, class UF> | |
internal::compconv1_< C, UF > | compconv1 (const abstract::conversion< C, B > &conv, const UF &func) |
template<class C, class B, class BF> | |
internal::compconv2_< C, BF > | compconv2 (const abstract::conversion< C, B > &conv, const BF &func) |
template<class C, class B, class I> | |
mute< I, typename convoutput< C, B, typename mlc::exact< I >::ret::value_type >::ret >::ret | apply (const abstract::conversion< C, B > &conv, const oln::abstract::image< I > &input) |
template<class N> | |
oln::abstract::neighborhood< N >::win_type | ng_to_se (const oln::abstract::neighborhood< N > &Ng) |
template<class N> | |
oln::abstract::neighborhood< N >::win_type | ng_to_cse (const oln::abstract::neighborhood< N > &Ng) |
bool | approx_eq (float x, float y) |
bool | approx_neq (float x, float y) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, xyz_traits > | nrgb_to_xyz (const color< 3, inbits, nrgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, nrgb_traits > | xyz_to_nrgb (const color< 3, inbits, xyz_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, hsi_traits > | rgb_to_hsi (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | hsi_to_rgb (const color< 3, inbits, hsi_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, inbits, hsl_traits > | rgb_to_hsl (const color< 3, outbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | hsl_to_rgb (const color< 3, inbits, hsl_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, hsv_traits > | rgb_to_hsv (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | hsv_to_rgb (const color< 3, inbits, hsv_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, nrgb_traits > | rgb_to_nrgb (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | nrgb_to_rgb (const color< 3, inbits, nrgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, xyz_traits > | rgb_to_xyz (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | xyz_to_rgb (const color< 3, outbits, xyz_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, yiq_traits > | rgb_to_yiq (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | yiq_to_rgb (const color< 3, inbits, yiq_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, yuv_traits > | rgb_to_yuv (const color< 3, inbits, rgb_traits > &v) |
template<unsigned inbits, unsigned outbits> | |
color< 3, outbits, rgb_traits > | yuv_to_rgb (const color< 3, inbits, yuv_traits > &v) |
template<class DestValue, class I> | |
mute< I, DestValue >::ret | stretch_balance (const oln::abstract::non_vectorial_image< I > &in, const typename mlc::exact< I >::ret::value_type &min_in=ntg::type_traits< typename mlc::exact< I >::ret::value_type >::min(), const typename mlc::exact< I >::ret::value_type &max_in=ntg::type_traits< typename mlc::exact< I >::ret::value_type >::max(), const DestValue &min_out=ntg::type_traits< DestValue >::min(), const DestValue &max_out=ntg::type_traits< DestValue >::max()) |
Variables | |
static const float | sqrt3_3 = sqrt(3) / 3 |
static const float | inv_sqrt6 = 1 / sqrt(6) |
static const float | inv_sqrt2 = 1 / sqrt(2) |
mute<I, typename convoutput<C, B, typename mlc::exact< I >::ret::value_type>::ret>::ret oln::convert::apply | ( | const abstract::conversion< C, B > & | conv, | |
const oln::abstract::image< I > & | input | |||
) | [inline] |
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.
Definition at line 141 of file conversion.hh.
References compconv1().
00142 { 00143 /* CONV can now be wrapped as an Adaptable Unary Function 00144 because we know the input type. Composing CONV with the 00145 identity for the input type will cause such wrapping to 00146 happen. */ 00147 return apply(compconv1(conv, f_identity<oln_value_type(I)>()), input); 00148 }
bool oln::convert::approx_eq | ( | float | x, | |
float | y | |||
) | [inline] |
An approximate equality function on float values, more reliable than a bare `==' operator.
Definition at line 41 of file float_cmp.hh.
Referenced by oln::convert::f_hsv_to_rgb< inbits, outbits >::doit(), oln::convert::f_rgb_to_hsv< inbits, outbits >::doit(), oln::convert::f_hsl_to_rgb< inbits, outbits >::doit(), and oln::convert::f_rgb_to_hsl< inbits, outbits >::doit().
bool oln::convert::approx_neq | ( | float | x, | |
float | y | |||
) | [inline] |
An approximate inequality function on float values, more reliable than a bare `!=' operator.
Definition at line 49 of file float_cmp.hh.
Referenced by oln::convert::f_rgb_to_hsv< inbits, outbits >::doit().
internal::compconv1_<C, UF> oln::convert::compconv1 | ( | const abstract::conversion< C, B > & | conv, | |
const UF & | func | |||
) |
Friendly procedure that build an internal::compconv1_ with type deduction.
Definition at line 119 of file conversion.hh.
References mlc_hierarchy::any< Exact >::exact().
Referenced by apply().
internal::compconv2_<C, BF> oln::convert::compconv2 | ( | const abstract::conversion< C, B > & | conv, | |
const BF & | func | |||
) |
Likewise for compconv2_.
Definition at line 127 of file conversion.hh.
References mlc_hierarchy::any< Exact >::exact().
color<3, outbits, rgb_traits> oln::convert::hsi_to_rgb | ( | const color< 3, inbits, hsi_traits > & | v | ) |
Conversion from HSI to RGB color space.
Definition at line 143 of file rgbhsi.hh.
color<3, outbits, rgb_traits> oln::convert::hsl_to_rgb | ( | const color< 3, inbits, hsl_traits > & | v | ) |
Conversion from HSL to RGB color space.
Definition at line 220 of file rgbhsl.hh.
color<3, outbits, rgb_traits> oln::convert::hsv_to_rgb | ( | const color< 3, inbits, hsv_traits > & | v | ) |
oln::abstract::neighborhood<N>::win_type oln::convert::ng_to_cse | ( | const oln::abstract::neighborhood< N > & | Ng | ) |
Convert a neighborhood to a window and add the center.
Definition at line 64 of file conversion_ng_se.hh.
References oln::abstract::neighborhood< Exact >::add().
Referenced by oln::morpho::sure::geodesic_dilation(), oln::morpho::geodesic_dilation(), oln::morpho::sure::geodesic_erosion(), oln::morpho::geodesic_erosion(), oln::morpho::hybrid::geodesic_reconstruction_dilation(), oln::morpho::sequential::geodesic_reconstruction_dilation(), oln::morpho::hybrid::geodesic_reconstruction_erosion(), and oln::morpho::sequential::geodesic_reconstruction_erosion().
00065 { 00066 typename oln::abstract::neighborhood<N>::win_type output; 00067 oln_iter_type(N) p(Ng); 00068 for_all(p) 00069 output.add(p); 00070 oln_dpoint_type(N) zero; 00071 for (unsigned size = 0; size < N::dim; ++size) 00072 zero.nth(size) = 0; 00073 output.add(zero); 00074 return output; 00075 }
oln::abstract::neighborhood<N>::win_type oln::convert::ng_to_se | ( | const oln::abstract::neighborhood< N > & | Ng | ) |
Convert a neighborhood to a window.
Definition at line 49 of file conversion_ng_se.hh.
References oln::abstract::neighborhood< Exact >::add().
Referenced by oln::level::connected_component().
00050 { 00051 typename oln::abstract::neighborhood<N>::win_type output; 00052 oln_iter_type(N) p(Ng); 00053 for_all(p) 00054 output.add(p); 00055 return output; 00056 }
color<3, outbits, rgb_traits> oln::convert::nrgb_to_rgb | ( | const color< 3, inbits, nrgb_traits > & | v | ) |
color<3, outbits, xyz_traits> oln::convert::nrgb_to_xyz | ( | const color< 3, inbits, nrgb_traits > & | v | ) |
Conversion from N-RGB to XYZ color space.
Definition at line 121 of file nrgbxyz.hh.
color<3, outbits, hsi_traits> oln::convert::rgb_to_hsi | ( | const color< 3, inbits, rgb_traits > & | v | ) |
Conversion from RGB to HSI color space.
Definition at line 98 of file rgbhsi.hh.
color<3, inbits, hsl_traits> oln::convert::rgb_to_hsl | ( | const color< 3, outbits, rgb_traits > & | v | ) |
Conversion from RGB to HSL color space.
Definition at line 145 of file rgbhsl.hh.
color<3, outbits, hsv_traits> oln::convert::rgb_to_hsv | ( | const color< 3, inbits, rgb_traits > & | v | ) |
color<3, outbits, nrgb_traits> oln::convert::rgb_to_nrgb | ( | const color< 3, inbits, rgb_traits > & | v | ) |
mute<I, DestValue>::ret oln::convert::stretch_balance | ( | const oln::abstract::non_vectorial_image< I > & | in, | |
const typename mlc::exact< I >::ret::value_type & | min_in = ntg::type_traits< typename mlc::exact< I >::ret::value_type >::min() , |
|||
const typename mlc::exact< I >::ret::value_type & | max_in = ntg::type_traits< typename mlc::exact< I >::ret::value_type >::max() , |
|||
const DestValue & | min_out = ntg::type_traits< DestValue >::min() , |
|||
const DestValue & | max_out = ntg::type_traits< DestValue >::max() | |||
) |
Stretch the value of an image.
This function stretches values between min_in and max_in of an image in, to a range that goes from min_out to max_out.
#include <oln/basics1d.hh> #include <oln/convert/stretch.hh> #include <ntg/all.hh> #include <iostream> int main() { oln::image1d<ntg::int_u<17> > im(4); im(0) = 0; im(1) = 2; im(2) = 5000; im(3) = 4000; // print "0 170 511 340" //(values of the *image* are dispatched on the range [0..2^9-1]) std::cout << oln::convert::stretch_balance<ntg::int_u<9> >(im) << std::endl; //print " 0 0 19 16" (19 is the result of 5000 * 2^9 / 2^17) //(values of *int_u<17>* are dispatched on the range [0..2^9-1]) std::cout << apply(oln::convert::stretch<ntg::int_u<9> >(), im) << std::endl; }
This function is useful to stretch images of label:
#include <oln/basics2d.hh> #include <oln/convert/stretch.hh> #include <oln/level/cc.hh> #include <ntg/all.hh> #include <iostream> int main() { oln::image2d<ntg::bin> light = oln::load(IMG_IN "face_se.pbm"); //Extraction of the connected components: unsigned card; oln::image2d<ntg::int_u8> cc = oln::level::frontp_connected_component<ntg::int_u8>(light, oln::neighb_c8(), card); oln::io::save(cc, IMG_OUT "oln_convert_stretch_dark.pgm"); oln::io::save(oln::convert::stretch_balance<ntg::int_u8>(cc), IMG_OUT "oln_convert_stretch_balance.pgm"); }
Definition at line 166 of file stretch.hh.
References oln::abstract::image< Exact >::size().
00173 { 00174 typedef typename 00175 ntg_is_a(DestValue, ntg::non_vectorial)::ensure_type ensure_type; 00176 00177 typename mute<I, DestValue>::ret out(in.size()); 00178 00179 //FIXME: I would like to remove the static_cast. 00180 std::vector<ntg_cumul_type(DestValue)> 00181 tab(static_cast<int>(max_in - min_in + 1)); 00182 typedef typename std::set<oln_value_type(I)> set_type; 00183 set_type s; 00184 oln_iter_type(I) it(in); 00185 00186 for_all(it) 00187 if (in[it] <= max_in && in[it] >= min_in) 00188 s.insert(in[it]); 00189 if (s.size() == 1) 00190 { 00191 for_all(it) 00192 out[it] = ntg_zero_val(DestValue); 00193 return out; 00194 } 00195 { 00196 unsigned cpt = 0; 00197 for (typename set_type::const_iterator it(s.begin()); 00198 it != s.end(); ++it, ++cpt) 00199 tab[*it - min_in] = cpt * (max_out - min_out) / (s.size() - 1); 00200 } 00201 for_all(it) 00202 if (min_in <= in[it]) 00203 { 00204 if (in[it] <= max_in) 00205 out[it] = tab[in[it] - min_in] + min_out; 00206 else 00207 out[it] = max_out; 00208 } 00209 else 00210 out[it] = min_out; 00211 return out; 00212 }
color<3, outbits, nrgb_traits> oln::convert::xyz_to_nrgb | ( | const color< 3, inbits, xyz_traits > & | v | ) |
Conversion from XYZ to N-RGB color space.
Definition at line 171 of file nrgbxyz.hh.