2014-03-31 17:36:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration of the possible pixel formats the grabber can be set to
|
|
|
|
*/
|
|
|
|
enum PixelFormat {
|
|
|
|
PIXELFORMAT_YUYV,
|
|
|
|
PIXELFORMAT_UYVY,
|
2015-01-24 23:42:22 +01:00
|
|
|
PIXELFORMAT_BGR16,
|
|
|
|
PIXELFORMAT_BGR24,
|
2016-05-26 23:44:27 +02:00
|
|
|
PIXELFORMAT_RGB32,
|
|
|
|
PIXELFORMAT_BGR32,
|
|
|
|
PIXELFORMAT_NO_CHANGE
|
2014-03-31 17:36:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline PixelFormat parsePixelFormat(std::string pixelFormat)
|
|
|
|
{
|
|
|
|
// convert to lower case
|
|
|
|
std::transform(pixelFormat.begin(), pixelFormat.end(), pixelFormat.begin(), ::tolower);
|
|
|
|
|
|
|
|
if (pixelFormat == "yuyv")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_YUYV;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "uyvy")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_UYVY;
|
|
|
|
}
|
2016-05-26 23:44:27 +02:00
|
|
|
else if (pixelFormat == "bgr16")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR16;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "bgr24")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR24;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "rgb32")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_RGB32;
|
|
|
|
}
|
|
|
|
else if (pixelFormat == "bgr32")
|
|
|
|
{
|
|
|
|
return PIXELFORMAT_BGR32;
|
|
|
|
}
|
2014-03-31 17:36:36 +02:00
|
|
|
|
|
|
|
// return the default NO_CHANGE
|
|
|
|
return PIXELFORMAT_NO_CHANGE;
|
|
|
|
}
|