image.h
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_api package.
3  *
4  * Copyright (c) 2017 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef RC_GENICAM_API_IMAGE
37 #define RC_GENICAM_API_IMAGE
38 
39 #include "buffer.h"
40 
41 #include <memory>
42 
43 namespace rcg
44 {
45 
55 class Image
56 {
57  public:
58 
66  Image(const Buffer *buffer, std::uint32_t part);
67 
74  const uint8_t *getPixels() const { return pixel.get(); }
75 
76  uint64_t getTimestampNS() const { return timestamp; }
77 
78  size_t getWidth() const { return width; }
79  size_t getHeight() const { return height; }
80  size_t getXOffset() const { return xoffset; }
81  size_t getYOffset() const { return yoffset; }
82  size_t getXPadding() const { return xpadding; }
83  size_t getYPadding() const { return ypadding; }
84  uint64_t getFrameID() const { return frameid; }
85  uint64_t getPixelFormat() const { return pixelformat; }
86  bool isBigEndian() const { return bigendian; }
87 
88  private:
89 
90  Image(class Image &); // forbidden
91  Image &operator=(const Image &); // forbidden
92 
93  std::unique_ptr<uint8_t []> pixel;
94 
95  uint64_t timestamp;
96  size_t width;
97  size_t height;
98  size_t xoffset;
99  size_t yoffset;
100  size_t xpadding;
101  size_t ypadding;
102  uint64_t frameid;
103  uint64_t pixelformat;
104  bool bigendian;
105 };
106 
116 void convYCbCr411toRGB(uint8_t rgb[3], const uint8_t *row, int i);
117 
129 void convYCbCr411toQuadRGB(uint8_t rgb[12], const uint8_t *row, int i);
130 
143 void getColor(uint8_t rgb[3], const std::shared_ptr<const rcg::Image> &img,
144  uint32_t ds, uint32_t i, uint32_t k);
145 
146 }
147 
148 #endif
size_t ypadding
Definition: image.h:101
The image class encapsulates image information.
Definition: image.h:55
size_t getWidth() const
Definition: image.h:78
size_t getYPadding() const
Definition: image.h:83
size_t getHeight() const
Definition: image.h:79
uint64_t getFrameID() const
Definition: image.h:84
uint64_t getPixelFormat() const
Definition: image.h:85
void convYCbCr411toRGB(uint8_t rgb[3], const uint8_t *row, int i)
Conversion of one pixel from YCbCr411 format (6 bytes for four pixels) to RGB.
Definition: image.cc:89
bool bigendian
Definition: image.h:104
size_t width
Definition: image.h:96
Image & operator=(const Image &)
void convYCbCr411toQuadRGB(uint8_t rgb[12], const uint8_t *row, int i)
Conversion of a group of four pixels from YCbCr411 format (6 bytes for four pixels) to RGB...
Definition: image.cc:112
bool isBigEndian() const
Definition: image.h:86
The buffer class encapsulates a Genicam buffer that is provided by a stream.
Definition: buffer.h:115
uint64_t timestamp
Definition: image.h:95
size_t xpadding
Definition: image.h:100
Image(const Buffer *buffer, std::uint32_t part)
Copies the image information of the buffer.
Definition: image.cc:46
const uint8_t * getPixels() const
Pointer to pixel information of the image.
Definition: image.h:74
size_t getXPadding() const
Definition: image.h:82
size_t xoffset
Definition: image.h:98
void getColor(uint8_t rgb[3], const std::shared_ptr< const rcg::Image > &img, uint32_t ds, uint32_t i, uint32_t k)
Expects an image in Mono8 or YCbCr411_8 format and returns the color as RGB value at the given pixel ...
Definition: image.cc:132
size_t getXOffset() const
Definition: image.h:80
size_t yoffset
Definition: image.h:99
uint64_t getTimestampNS() const
Definition: image.h:76
Definition: buffer.cc:42
size_t getYOffset() const
Definition: image.h:81
size_t height
Definition: image.h:97
std::unique_ptr< uint8_t[]> pixel
Definition: image.h:93
uint64_t frameid
Definition: image.h:102
uint64_t pixelformat
Definition: image.h:103


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54