Commit decbdeb9 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Fix dilation-like canvas implementation for rectangular SE. For vertical

SE, the image is now transposed before the process to speed up. Also,
the incremental computation of the inf/supremum has been extended to
16-bits.

 	*  mln/morpho/canvas/dilation_like.spe.hpp: Fixed.
	*  mln/accu/accumulators/h_infsup.hpp,
	*  mln/morpho/structural/dilate.hpp,
	*  mln/morpho/structural/erode.hpp: Optimization extended to 16bits.
parent fd5f4506
......@@ -60,7 +60,7 @@ namespace mln
template <typename E, typename T, typename F>
struct h_infsup_base<E, T, F, typename std::enable_if<
std::is_integral<T>::value and
value_traits<T>::quant <= 8>::type>
value_traits<T>::quant <= 16>::type>
: accumulator_base<E, T, T, F>
{
typedef T argument_type;
......
......@@ -23,21 +23,28 @@ namespace mln
template <class I, class Compare, class J, class OpTraits>
typename
std::enable_if<std::is_same<typename I::domain_type, box2d>::value>::type
dilation_like(const Image<I>& ima,
dilation_like(const Image<I>& ima_,
const rect2d& nbh,
Compare cmp,
Image<J>& output,
OpTraits __op__)
{
box2d r = nbh.dpoints;
const I& ima = exact(ima_);
if (r.shape()[0] == 1 or r.shape()[1] == 1) {
impl::dilate_like_0(exact(ima),
if (r.shape()[0] == 1) {
impl::dilate_like_0(ima,
nbh,
cmp,
exact(output),
__op__,
typename image_has_extension<I>::type ());
} else if (r.shape()[1] == 1) {
rect2d h0 { box2d {{0, r.pmin[0]}, {1, r.pmax[0]}} };
mln_concrete(I) tmp = transpose(ima);
mln_concrete(I) out = imconcretize(tmp);
morpho::canvas::dilation_like(tmp, h0, cmp, out, __op__);
transpose(out, output);
} else {
rect2d h0 { box2d {{0, r.pmin[0]}, {1, r.pmax[0]}} };
......@@ -45,13 +52,13 @@ namespace mln
image2d<mln_value(I)> f;
{
mln_concrete(I) tmp = imconcretize(exact(ima));
morpho::canvas::dilation_like(exact(ima), h1, cmp, tmp, __op__);
mln_concrete(I) tmp = imconcretize(ima);
morpho::canvas::dilation_like(ima, h1, cmp, tmp, __op__);
f = transpose(tmp);
}
{
mln_concrete(I) tmp = imconcretize(exact(f));
mln_concrete(I) tmp = imconcretize(f);
morpho::canvas::dilation_like(f, h0, cmp, tmp, __op__);
transpose(tmp, output);
}
......
......@@ -49,7 +49,7 @@ namespace mln
bool,
std::is_integral<mln_value(I)>::value and
std::is_same<Compare, productorder_less<mln_value(I)> >::value and
(value_traits<mln_value(I)>::quant <= 8)
(value_traits<mln_value(I)>::quant <= 16)
>;
using aggregate_type = accu::accumulators::sup<mln_value(I), Compare>;
......
......@@ -49,7 +49,7 @@ namespace mln
bool,
std::is_integral<mln_value(I)>::value and
std::is_same<Compare, productorder_less<mln_value(I)> >::value and
(value_traits<mln_value(I)>::quant <= 8)
(value_traits<mln_value(I)>::quant <= 16)
>;
using aggregate_type = accu::accumulators::inf<mln_value(I), Compare>;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment