Boost logo

Boost Users :

Subject: [Boost-users] Template class and any_image_view
From: tatta (raffaele.bratta_at_[hidden])
Date: 2009-10-14 11:13:27


Hello, I'm in trouble using dynamic images into a template class.

I have an abstract class Filter of this form:

template <typename TView1, typename TView2>
class Filter
{
public:
    virtual ~Filter();
    virtual void setParameter(uint8 id, float16 value);
    virtual void apply(const any_image_view<TView1>& source, const
any_image_view<TView2>& destination) = 0;

protected:
    Filter();
};

which is subclassed by other concrete classes like this one:

template <typename TView1, typename TView2>
class BlurGaussSelective :
    public Filter<TView1,TView2>
{
public:
    BlurGaussSelective();
    virtual ~BlurGaussSelective();
    void setParameter(uint8 id, float16 value);
    void apply(const any_image_view<TView1>& source, const
any_image_view<TView2>& destination);
};

As you can see I need to use a template class because the "apply" method
(where concrete filters implements own logic) is virtual.

But when I instantiate a BlurGaussSelective object I don't know which
template types pass to it. I tried this:

typedef vector<rgb8_image_t,gray8_image_t> ImageType;
typedef vector<rgb8_view_t,gray8_view_t> ViewType;

any_image<ImageType> source;
any_image<ImageType> dest;
jpeg_read_image("input.jpg", source);
jpeg_read_image("input.jpg", dest);
BlurGaussSelective<ViewType,ViewType> filter;
filter.apply(const_view(source),const_view(dest));

But the compiler gives me this error:

../src/RotoscoperApplication.cpp: In member function ‘void
Rotoscoper::Application::rotoscope()’:
../src/RotoscoperApplication.cpp:73: error: no matching function for call to
‘Rotoscoper::BlurGaussSelective<boost::mpl::vector<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*>
> >,
boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::gray8_pixel_t*>
> >, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
boost::mpl::vector<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*>
> >,
boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::gray8_pixel_t*>
> >, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>
>::apply(boost::gil::any_image_view<boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<const
boost::gil::gray8c_pixel_t*> > >,
boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<const
boost::gil::rgb8c_pixel_t*> > >,
boost::mpl::vector0<mpl_::na>, 0>, 0> >,
boost::gil::any_image_view<boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<const
boost::gil::gray8c_pixel_t*> > >,
boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<const
boost::gil::rgb8c_pixel_t*> > >,
boost::mpl::vector0<mpl_::na>, 0>, 0> >)’
../src/RotoscoperBlurGaussSelective.hpp:119: note: candidates are: void
Rotoscoper::BlurGaussSelective<TImage1, TImage2>::apply(const
boost::gil::any_image_view<IVTypes>&, const
boost::gil::any_image_view<Types2>&) [with TImage1 =
boost::mpl::vector<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*>
> >,
boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::gray8_pixel_t*>
> >, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, TImage2 =
boost::mpl::vector<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*>
> >,
boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::gray8_pixel_t*>
> >, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>]
make: *** [src/RotoscoperApplication.o] Error 1

Which template type I should use when I instantiate the
BlurGaussSelectiveClass?

Thanks in advance. Greetings, Raffaele

-- 
View this message in context: http://www.nabble.com/Template-class-and-any_image_view-tp25891719p25891719.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net