wip

parent a67100b8
......@@ -37,7 +37,7 @@ double duration;
{
t.restart();
cv::Mat image;
cam_ptr->GetImage(image);
cam_ptr->GetImageCV(image);
cv::imshow( WINDOW_NAME, image );
if(cv::waitKey(30) >= 0) break;
// std::cout << '\r' << "fps:" << 1.0/t.elapsed() << std::flush;
......
......@@ -195,7 +195,7 @@ void CMvbluefox3::GetImage(char **image)
}
#ifdef HAVE_OPENCV_H
void CMvbluefox3::GetImage(cv::Mat &image)
void CMvbluefox3::GetImageCV(cv::Mat &image)
{
char *image_raw=NULL;
GetImage(&image_raw);
......@@ -249,6 +249,16 @@ void CMvbluefox3::GetImageReqFormat(mvIMPACT::acquire::Request *request)
this->bytes_per_pixel_);
}
int CMvbluefox3::GetChDepth(void)
{
return this->depth_;
}
int CMvbluefox3::GetBytesXPixel(void)
{
return this->bytes_per_pixel_;
}
int CMvbluefox3::ReqExposeUs(void)
{
if (this->request_ == NULL || !this->request_->isOK())
......
......@@ -27,7 +27,7 @@ private:
void init(void)
{
// Image format
pixel_format = MONO8;
pixel_format = mono8;
width = 1280;
height = 960;
img_rot_angle = 0.0;
......@@ -406,7 +406,7 @@ class CMvbluefox3
*/
void GetImage(char **image);
#ifdef HAVE_OPENCV_H
void GetImage(cv::Mat &image);
void GetImageCV(cv::Mat &image);
#endif
/**
......@@ -429,6 +429,21 @@ class CMvbluefox3
* Get main camera parameters.
*/
CParams GetConfig(void);
/**
* \brief Get channel's depth
*
* Get channel's depth.
*/
int GetChDepth(void);
/**
* \brief Get bytes-pixel
*
* Get bytes-pixel.
*/
int GetBytesXPixel(void);
};
} // End of CMvbluefox3 namespace
......
......@@ -12,35 +12,34 @@ codings_t MVFormatToEncoding(const TImageDestinationPixelFormat& pixel_format)
switch (pixel_format)
{
case idpfAuto : coding = AUTO; break; //*
case idpfRaw: coding = RAW; break;
case idpfMono8: coding = MONO8; break;
case idpfMono10: coding = MONO10; break; //*
case idpfMono12: coding = MONO12; break; //*
case idpfMono12Packed_V1: coding = MONO12V1; break; //*
case idpfMono12Packed_V2: coding = MONO12V2; break; //*
case idpfMono14: coding = MONO14; break; //*
case idpfMono16: coding = MONO16; break;
case idpfBGR888Packed: coding = BGR8; break;
case idpfRGB888Planar: coding = RGB8P; break; //*
case idpfRGBx888Planar: coding = RGBA8P; break; //*
case idpfBGR101010Packed_V2: coding = BGR10V2; break; //*
case idpfRGB888Packed: coding = RGB8; break;
case idpfRGB101010Packed: coding = RGB10; break; //*
case idpfRGB121212Packed: coding = RGB12; break; //*
case idpfRGB141414Packed: coding = RGB14; break; //*
case idpfRGB161616Packed: coding = RGB16; break;
case idpfRGBx888Packed: coding = RGBA8; break;
case idpfYUV411_UYYVYY_Packed: coding = YUV411UYYVYY; break; //*
case idpfYUV422Packed: coding = YUV422; break;
case idpfYUV422Planar: coding = YUV422P; break; //*
case idpfYUV422_10Packed: coding = YUV42210; break; //*
case idpfYUV422_UYVYPacked: coding = YUV422UYVY; break; //*
case idpfYUV422_UYVY_10Packed: coding = YUV422UYVY10; break; //*
case idpfYUV444Packed: coding = YUV444; break; //*
case idpfYUV444_10Packed: coding = YUV44410P; break; //*
case idpfYUV444_UYVPacked: coding = YUV444UYV; break; //*
case idpfYUV444_UYV_10Packed: coding = YUV444UYV10; break; //*
case idpfAuto : coding = raw; break; //*
case idpfRaw: coding = raw; break;
case idpfMono8: coding = mono8; break;
case idpfMono10: coding = mono10; break; //*
case idpfMono12: coding = mono12; break; //*
case idpfMono12Packed_V1: coding = mono12v1; break; //*
case idpfMono12Packed_V2: coding = mono12v2; break; //*
case idpfMono14: coding = mono14; break; //*
case idpfMono16: coding = mono16; break;
case idpfBGR888Packed: coding = bgr8; break;
case idpfRGB888Planar: coding = rgb8p; break; //*
case idpfRGBx888Planar: coding = rgba8p; break; //*
case idpfRGB888Packed: coding = rgb8; break;
case idpfRGB101010Packed: coding = rgb10; break; //*
case idpfRGB121212Packed: coding = rgb12; break; //*
case idpfRGB141414Packed: coding = rgb14; break; //*
case idpfRGB161616Packed: coding = rgb16; break;
case idpfRGBx888Packed: coding = rgba8; break;
case idpfYUV411_UYYVYY_Packed: coding = yuv411uyyvyy; break; //*
case idpfYUV422Packed: coding = yuv422; break;
case idpfYUV422Planar: coding = yuv422p; break; //*
case idpfYUV422_10Packed: coding = yuv42210; break; //*
case idpfYUV422_UYVYPacked: coding = yuv422uyvy; break; //*
case idpfYUV422_UYVY_10Packed: coding = yuv422uyvy10; break; //*
case idpfYUV444Packed: coding = yuv444; break; //*
case idpfYUV444_10Packed: coding = yuv44410p; break; //*
case idpfYUV444_UYVPacked: coding = yuv444uyv; break; //*
case idpfYUV444_UYV_10Packed: coding = yuv444uyv10; break; //*
}
return coding;
}
......@@ -51,34 +50,34 @@ TImageDestinationPixelFormat EncodingToMVFormat(const codings_t& coding)
switch (coding)
{
default: idpf = idpfAuto; break; //*
case RAW: idpf = idpfRaw; break;
case MONO8: idpf = idpfMono8; break;
case MONO10: idpf = idpfMono10; break; //*
case MONO12: idpf = idpfMono12; break; //*
case MONO12V1: idpf = idpfMono12Packed_V1; break; //*
case MONO12V2: idpf = idpfMono12Packed_V2; break; //*
case MONO14: idpf = idpfMono14; break; //*
case MONO16: idpf = idpfMono16; break;
case BGR8: idpf = idpfBGR888Packed; break;
case RGB8P: idpf = idpfRGB888Planar; break; //*
case RGBA8P: idpf = idpfRGBx888Planar; break; //*
case BGR10V2: idpf = idpfBGR101010Packed_V2; break; //*
case RGB8: idpf = idpfRGB888Packed; break;
case RGB10: idpf = idpfRGB101010Packed; break; //*
case RGB12: idpf = idpfRGB121212Packed; break; //*
case RGB14: idpf = idpfRGB141414Packed; break; //*
case RGB16: idpf = idpfRGB161616Packed; break;
case RGBA8: idpf = idpfRGBx888Packed; break;
case YUV411UYYVYY: idpf = idpfYUV411_UYYVYY_Packed; break; //*
case YUV422: idpf = idpfYUV422Packed; break;
case YUV422P: idpf = idpfYUV422Planar; break; //*
case YUV42210: idpf = idpfYUV422_10Packed; break; //*
case YUV422UYVY: idpf = idpfYUV422_UYVYPacked; break; //*
case YUV422UYVY10: idpf = idpfYUV422_UYVY_10Packed; break; //*
case YUV444: idpf = idpfYUV444Packed; break; //*
case YUV44410P: idpf = idpfYUV444_10Packed; break; //*
case YUV444UYV: idpf = idpfYUV444_UYVPacked; break; //*
case YUV444UYV10: idpf = idpfYUV444_UYV_10Packed; break; //*
case raw: idpf = idpfRaw; break;
case mono8: idpf = idpfMono8; break;
case mono10: idpf = idpfMono10; break; //*
case mono12: idpf = idpfMono12; break; //*
case mono12v1: idpf = idpfMono12Packed_V1; break; //*
case mono12v2: idpf = idpfMono12Packed_V2; break; //*
case mono14: idpf = idpfMono14; break; //*
case mono16: idpf = idpfMono16; break;
case bgr8: idpf = idpfBGR888Packed; break;
case rgb8p: idpf = idpfRGB888Planar; break; //*
case rgba8p: idpf = idpfRGBx888Planar; break; //*
case bgr10v2: idpf = idpfBGR101010Packed_V2; break; //*
case rgb8: idpf = idpfRGB888Packed; break;
case rgb10: idpf = idpfRGB101010Packed; break; //*
case rgb12: idpf = idpfRGB121212Packed; break; //*
case rgb14: idpf = idpfRGB141414Packed; break; //*
case rgb16: idpf = idpfRGB161616Packed; break;
case rgba8: idpf = idpfRGBx888Packed; break;
case yuv411uyyvyy: idpf = idpfYUV411_UYYVYY_Packed; break; //*
case yuv422: idpf = idpfYUV422Packed; break;
case yuv422p: idpf = idpfYUV422Planar; break; //*
case yuv42210: idpf = idpfYUV422_10Packed; break; //*
case yuv422uyvy: idpf = idpfYUV422_UYVYPacked; break; //*
case yuv422uyvy10: idpf = idpfYUV422_UYVY_10Packed; break; //*
case yuv444: idpf = idpfYUV444Packed; break; //*
case yuv44410p: idpf = idpfYUV444_10Packed; break; //*
case yuv444uyv: idpf = idpfYUV444_UYVPacked; break; //*
case yuv444uyv10: idpf = idpfYUV444_UYV_10Packed; break; //*
}
return idpf;
}
......@@ -91,22 +90,22 @@ codings_t BayerPatternToEncoding(const TBayerMosaicParity& bayer_pattern,
{
switch (bayer_pattern)
{
case bmpRG: coding = BAYER_RGGB8; break;
case bmpGB: coding = BAYER_GBRG8; break;
case bmpGR: coding = BAYER_GRBG8; break;
case bmpBG: coding = BAYER_BGGR8; break;
default: coding = MONO8; break;
case bmpRG: coding = bayer_rggb8; break;
case bmpGB: coding = bayer_gbrg8; break;
case bmpGR: coding = bayer_grbg8; break;
case bmpBG: coding = bayer_bggr8; break;
default: coding = mono8; break;
}
}
else if (bytes_per_pixel == 2)
{
switch (bayer_pattern)
{
case bmpRG: coding = BAYER_RGGB16; break;
case bmpGB: coding = BAYER_GBRG16; break;
case bmpGR: coding = BAYER_GRBG16; break;
case bmpBG: coding = BAYER_BGGR16; break;
default: coding = MONO16; break;
case bmpRG: coding = bayer_rggb16; break;
case bmpGB: coding = bayer_gbrg16; break;
case bmpGR: coding = bayer_grbg16; break;
case bmpBG: coding = bayer_bggr16; break;
default: coding = mono16; break;
}
}
return coding;
......
......@@ -19,43 +19,42 @@ namespace CMvbluefox3 {
* codings_str[codings_t].
*/
#define FOREACH_ENCODING(ENCODING) \
ENCODING(AUTO) \
ENCODING(RAW) \
ENCODING(MONO8) \
ENCODING(MONO10) \
ENCODING(MONO12) \
ENCODING(MONO12V1) \
ENCODING(MONO12V2) \
ENCODING(MONO14) \
ENCODING(MONO16) \
ENCODING(RGB8) \
ENCODING(RGB8P) \
ENCODING(RGB10) \
ENCODING(RGB12) \
ENCODING(RGB14) \
ENCODING(RGB16) \
ENCODING(RGBA8) \
ENCODING(RGBA8P) \
ENCODING(BGR8) \
ENCODING(BGR10V2) \
ENCODING(YUV411UYYVYY) \
ENCODING(YUV422) \
ENCODING(YUV422P) \
ENCODING(YUV42210) \
ENCODING(YUV422UYVY) \
ENCODING(YUV422UYVY10) \
ENCODING(YUV444) \
ENCODING(YUV44410P) \
ENCODING(YUV444UYV) \
ENCODING(YUV444UYV10) \
ENCODING(BAYER_RGGB8) \
ENCODING(BAYER_GBRG8) \
ENCODING(BAYER_GRBG8) \
ENCODING(BAYER_BGGR8) \
ENCODING(BAYER_RGGB16) \
ENCODING(BAYER_GBRG16) \
ENCODING(BAYER_GRBG16) \
ENCODING(BAYER_BGGR16)
ENCODING(raw) \
ENCODING(mono8) \
ENCODING(mono10) \
ENCODING(mono12) \
ENCODING(mono12v1) \
ENCODING(mono12v2) \
ENCODING(mono14) \
ENCODING(mono16) \
ENCODING(rgb8) \
ENCODING(rgb8p) \
ENCODING(rgb10) \
ENCODING(rgb12) \
ENCODING(rgb14) \
ENCODING(rgb16) \
ENCODING(rgba8) \
ENCODING(rgba8p) \
ENCODING(bgr8) \
ENCODING(bgr10v2) \
ENCODING(yuv411uyyvyy) \
ENCODING(yuv422) \
ENCODING(yuv422p) \
ENCODING(yuv42210) \
ENCODING(yuv422uyvy) \
ENCODING(yuv422uyvy10) \
ENCODING(yuv444) \
ENCODING(yuv44410p) \
ENCODING(yuv444uyv) \
ENCODING(yuv444uyv10) \
ENCODING(bayer_rggb8) \
ENCODING(bayer_gbrg8) \
ENCODING(bayer_grbg8) \
ENCODING(bayer_bggr8) \
ENCODING(bayer_rggb16) \
ENCODING(bayer_gbrg16) \
ENCODING(bayer_grbg16) \
ENCODING(bayer_bggr16)
#define GENERATE_ENUM_ENC(ENUM) ENUM,
#define GENERATE_STRING_ENC(STRING) #STRING,
enum codings_t { FOREACH_ENCODING(GENERATE_ENUM_ENC) };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment