Pixel.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //-----------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2011-2021 Basler AG
  4. // http://www.baslerweb.com
  5. //-----------------------------------------------------------------------------
  6. /*!
  7. \file
  8. \brief Contains structs describing pixel layouts.
  9. */
  10. #ifndef INCLUDED_PIXEL_H_9632837
  11. #define INCLUDED_PIXEL_H_9632837
  12. #include <pylon/Platform.h>
  13. #ifdef _MSC_VER
  14. # pragma pack(push, PYLON_PACKING)
  15. #endif /* _MSC_VER */
  16. #include <pylon/PylonBase.h>
  17. namespace Pylon
  18. {
  19. /** \addtogroup Pylon_ImageHandlingSupport
  20. * @{
  21. */
  22. #pragma pack(push, 1)
  23. //-----------------------------------------------------------------------
  24. // Structs needed for BGR and RGB formats
  25. //-----------------------------------------------------------------------
  26. /// Describes the memory layout of a BGRA8 pixel. This pixel is used in Windows bitmaps.
  27. struct SBGRA8Pixel
  28. {
  29. uint8_t B; ///< Blue
  30. uint8_t G; ///< Green
  31. uint8_t R; ///< Red
  32. uint8_t A; ///< Transparency
  33. };
  34. /// Describes the memory layout of a BGR8 pixel. This pixel is used in Windows bitmaps.
  35. struct SBGR8Pixel
  36. {
  37. uint8_t B; ///< Blue
  38. uint8_t G; ///< Green
  39. uint8_t R; ///< Red
  40. };
  41. /// Describes the memory layout of a RGB8 pixel.
  42. struct SRGB8Pixel
  43. {
  44. uint8_t R; ///< Red
  45. uint8_t G; ///< Green
  46. uint8_t B; ///< Blue
  47. };
  48. /// Describes the memory layout of a RGB16 pixel.
  49. struct SRGB16Pixel
  50. {
  51. uint16_t R; ///< Red
  52. uint16_t G; ///< Green
  53. uint16_t B; ///< Blue
  54. };
  55. //-----------------------------------------------------------------------
  56. // Structs needed for variants of YUV422 formats
  57. //-----------------------------------------------------------------------
  58. /// Describes the memory layout of a YUV422_UYVY pixel with information about brightness and chroma for two pixels.
  59. struct SYUV422_UYVY // DCAM Variant
  60. {
  61. uint8_t U; ///< chroma U (both pixels)
  62. uint8_t Y1; ///< brightness Pixel 1
  63. uint8_t V; ///< chroma V (both pixels)
  64. uint8_t Y2; ///< brightness Pixel 2
  65. typedef uint8_t value_type;
  66. };
  67. /// Describes the memory layout of a YUV422_YUYV pixel with information about brightness and chroma for two pixels.
  68. struct SYUV422_YUYV // Microsoft preferred variant
  69. {
  70. uint8_t Y1; ///< brightness Pixel 1
  71. uint8_t U; ///< chroma U (both pixels)
  72. uint8_t Y2; ///< brightness Pixel 2
  73. uint8_t V; ///< chroma V (both pixels)
  74. typedef uint8_t value_type;
  75. };
  76. #pragma pack(pop)
  77. /**
  78. * @}
  79. */
  80. }
  81. #ifdef _MSC_VER
  82. # pragma pack(pop)
  83. #endif /* _MSC_VER */
  84. #endif /* INCLUDED_PIXEL_H_9632837 */