DlibImage🔗
#include <DlibImage.h>
-
template<class
T
, classImageType
>
structVisionAppster
::
DlibImage
🔗 Attaches pixel type to a
va_image*
orconst va_image*
.T = pixel type, e.g.
unsigned char
ordlib::bgr32_pixel
ImageType =
va_image*
orconst va_image*
-
namespace
VisionAppster
🔗 Functions
-
template<class
T
, classImageType
>
DlibImage<T, ImageType>dlibImage
(ImageType &img)🔗 Wraps img into a DlibImage with the given pixel type.
The caller must ensure that
img->type
and T match.
-
template<template<class> class
Function
, class ...Args
>
static intdlibCall
(va_image_type imageType, Args&&... args)🔗 Creates an instance of the callable template Function and calls it with args.
As a template argument to Function, passes the data type that corresponds to imageType.
The general pattern of wrapping a Dlib function is to create a functor template that handles all possible pixel types. This function can then be used to resolve the actual pixel type.
- Return
Returns the return value of the function template. If imageType is not supported, returns
VA_ERR_INVALID_PARAMETER
. If the function throwsstd::bad_alloc
, returnsVA_ERR_OUT_OF_MEMORY
.- Parameters
imageType
: Image type. Will be used to find out the correct template parameter T with which Function can be instantiated. If imageType is one of the recognized types (gray8, gray16, gray32, rgb32, argb32 or argb32premul), Function will instantiated asFunction<T>
, whereT
corresponds to imageType. (E.g.unsigned char
for gray8)args
: The args to be passed to the function template once instantiated.
template <class PixelType> struct MyOperation { int operator()(const va_image* in, va_image* out) const { dlib::some_image_processing_function( dlibImage<PixelType>(in), // const argument dlibImage<PixelType>(out).ref()); // non-const argument return VA_SUCCESS; } }; // ... later in code ... dlibCall<MyOperation>(inputImage->type, inputImage, outputImage);
-
template<class