I cant find the correct way to extract the pixel or channel type from an image view. I'm looking to define pod_t below to be 'unsigned char' in the case of gray8_view_t. There is no simple ViewType::pixel_t. What is the proper definition of this type in function PixelFoo?
template<class ViewType>
void PixelFoo(ViewType v)
{
typedef typename ViewType::x_iterator::value_type::channel_t pod_t;
pod_t maxVal = channel_traits<pod_t>::max_value();
pod_t podVal = v(0, 0); //expect error with emptyView
}
void PixelBar()
{
gray8_view_t emptyView;
PixelFoo(emptyView);
}
ViewType::value_type
should be similar to what you expected to be ViewType::pixel_t
.
Then, for homogeneous pixel types, the channel_type<T>::type
from HomogeneousPixelBasedConcept should lead to the type you are looking for:
template<class ViewType>
void PixelFoo(ViewType v)
{
typedef typename boost::gil::channel_type<typename ViewType::value_type>::type pod_t;
pod_t maxVal = channel_traits<pod_t>::max_value();
pod_t podVal = v(0, 0); //expect error with emptyView
}