вариант пиксельного буфера к вектору с помощью boost :: apply_visitor

Я пытаюсь преобразовать variablepixelbuffer.vbuffer () в вектор двойных значений, используя apply_visitor в boost.

Я пришел с этим фрагментом кода до сих пор:

struct GetVector : public boost::static_visitor<std::vector<double>>
{
//values will be returned in a pair.  double is
// used since it can contain the value for any pixel type
typedef std::vector<double> result_type;
template<typename T
void myfunction (const T& i) {  // function:
result_type.push_back(static_cast<double>(*i));
}

template<typename T>
result_type
operator() (const T& v)
{
typedef typename T::element_type::value_type value_type;
std::for_each (v->data(), v->data() + v->num_elements(), myfunction);
return result_type;
}
};
/* pixel-example-start */
void
readPixelData(const FormatReader& reader,
std::ostream&       stream,int x,int y,int w,int h)
{
// Change the current series to this index
reader.setSeries(0);
// Get total number of planes (for this image index)
dimension_size_type pc = reader.getImageCount();
// Pixel buffer
VariantPixelBuffer buf;
dimension_size_type xd = x;
dimension_size_type yd = y;
dimension_size_type wd = w;
dimension_size_type hd = h;
// Loop over planes (for this image index)
for (dimension_size_type p = 0 ; p < pc; p++)
{
// Read the entire plane into the pixel buffer.
reader.openBytes(p, buf,xd,yd,wd,hd);
}
GetVector visitor;
GetVector::result_type result = boost::apply_visitor(visitor, buf.vbuffer());
}

Но я получаю некоторые длинные ошибки, и некоторые из них

/usr/include/boost/variant/detail/apply_visitor_unary.hpp:60:43:
требуется от ‘typename Visitor :: result_type
повышение :: apply_visitor (Visitor&В гостях&) [с посетителем =
MinMaxVisitor; Visitable =
Boost :: вариант>,
boost :: mpl :: v_item>,
повышение :: MPL :: v_item

, boost :: mpl :: v_item>,
boost :: mpl :: v_item>,
boost :: mpl :: v_item>,
повышение :: MPL :: v_item
, повысить :: mpl :: v_item
, повысить :: mpl :: v_item
, повысить :: mpl :: v_item

, повышение :: MPL :: v_item
, boost :: mpl :: vector0, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>, boost :: detail :: variable :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: деталь :: вариант :: void_, Boost :: деталь :: вариант :: void_,
Boost :: Detail :: Вариант :: void_, Boost :: Detail :: Вариант :: Void_>;
typename Visitor :: result_type = std :: vector>] ’read_subimage.C: 82: 85: требуется отсюда
/usr/include/c++/4.8/bits/stl_algo.h:4417:14: ошибка: необходимо использовать ‘.‘ или же
«->
Для вызова функции указателя на член в «__f (…)», например «(…
-> * __f) (…) ’

Как я могу восстановить это, мне нужно, чтобы получить данные буфера пикселей в вектор.

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector