source: pacpussensors/trunk/Vislab/lib3dv/image.h@ 137

Last change on this file since 137 was 136, checked in by ldecherf, 8 years ago

Doc

File size: 3.7 KB
Line 
1#ifndef LIB3DV_IMAGE_H
2#define LIB3DV_IMAGE_H
3
4/* lib3dv/image.h
5 *
6 * Copyright (C) 2013 VisLab
7 *
8 * This file is part of lib3dv; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <boost/date_time/posix_time/posix_time.hpp>
23
24#include <stdint.h>
25#include <vector>
26
27namespace lib3dv
28{
29 /**
30 * @brief An image received from the device.
31 *
32 */
33 struct image
34 {
35 /**
36 * @brief Supported image formats.
37 **/
38 struct format
39 {
40 enum types
41 {
42 NONE = 0,
43 MONO8, ///< Monochrome 8 bits.
44 MONO16, ///< Monochrome 16 bits.
45 RGB24, ///< RGB, 8 bits per channel.
46 RGB48, ///< RGB, 16 bits per channel.
47 BAYER8_BGGR, ///< BGGR Bayer pattern, 8 bits per channel.
48 BAYER8_GRBG, ///< GRBG Bayer pattern, 8 bits per channel.
49 BAYER8_RGGB, ///< RGGB Bayer pattern, 8 bits per channel.
50 BAYER8_GBRG, ///< GBRG Bayer pattern, 8 bits per channel.
51 BAYER16_BGGR, ///< BGGR Bayer pattern, 16 bits per channel.
52 BAYER16_GRBG, ///< GRBG Bayer pattern, 16 bits per channel.
53 BAYER16_RGGB, ///< RGGB Bayer pattern, 16 bits per channel.
54 BAYER16_GBRG, ///< GBRG Bayer pattern, 16 bits per channel.
55 FLOAT32, ///< Single channel 32 bits floating point.
56 FLOAT64, ///< Single channel 64 bits floating point.
57 NUM
58 };
59 };
60
61 /**
62 * @brief Supported image types.
63 * @note DSI image values are encoded as 16-bit little-endian fixed-point integers, so that the actual disparity value can be computed as
64 *
65 @code
66 std::vector<float> disparities(dsi->m_width * dsi->m_height);
67
68 for(unsigned int d = 0; d < dsi->m_width * dsi->m_height; ++d)
69 disparities[d] = static_cast<const uint16_t*>(dsi->m_buffer.data())[d] / 255.0f
70 @endcode
71 **/
72 struct type
73 {
74 enum types
75 {
76 NONE = 0,
77 LEFT_RECTIFIED, ///< Left rectified image.
78 RIGHT_RECTIFIED, ///< Right rectified image.
79 LEFT_RAW, ///< Left raw image.
80 RIGHT_RAW, ///< Right raw image.
81 DSI, ///< Depth map
82 NUM
83 };
84 };
85
86 uint16_t m_width; ///< Image width [px].
87 uint16_t m_height; ///< Image height [px].
88 uint8_t m_channels; ///< Image channels.
89 uint8_t m_bpp; ///< Image bits per pixel [bpp].
90 type::types m_type; ///< Image type. @see lib3dv::image::type
91 format::types m_format; ///< Image format. @see lib3dv::image::format
92 boost::posix_time::ptime m_timestamp; ///< Image timestamp.
93 std::vector<uint8_t> m_buffer; ///< Image data buffer.
94 };
95}
96
97#endif
Note: See TracBrowser for help on using the repository browser.