Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
io
openni_camera
openni_image_bayer_grbg.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2011, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
*/
38
39
#pragma once
40
41
#include <pcl/pcl_config.h>
42
#include <
pcl/memory.h
>
43
#ifdef HAVE_OPENNI
44
45
#include <
pcl/pcl_macros.h
>
46
#include "openni_image.h"
47
48
namespace
openni_wrapper
49
{
50
/** \brief This class provides methods to fill a RGB or Grayscale image buffer from underlying Bayer pattern image.
51
* \author Suat Gedikli <gedikli@willowgarage.com>
52
* \ingroup io
53
*/
54
class
PCL_EXPORTS
ImageBayerGRBG
:
public
Image
55
{
56
public
:
57
enum
DebayeringMethod
58
{
59
Bilinear
= 0,
60
EdgeAware
,
61
EdgeAwareWeighted
62
};
63
64
ImageBayerGRBG
(pcl::shared_ptr<xn::ImageMetaData> image_meta_data,
DebayeringMethod
method)
noexcept
;
65
~ImageBayerGRBG
() noexcept override;
66
67
inline
Encoding
68
getEncoding
()
const override
69
{
70
return
(
BAYER_GRBG
);
71
}
72
73
void
fillRGB
(
unsigned
width,
unsigned
height,
unsigned
char
* rgb_buffer,
unsigned
rgb_line_step = 0)
const override
;
74
void
fillGrayscale
(
unsigned
width,
unsigned
height,
unsigned
char
* gray_buffer,
unsigned
gray_line_step = 0)
const override
;
75
bool
isResizingSupported
(
unsigned
input_width,
unsigned
input_height,
unsigned
output_width,
unsigned
output_height)
const override
;
76
inline
void
setDebayeringMethod
(
const
DebayeringMethod
& method)
noexcept
;
77
inline
DebayeringMethod
getDebayeringMethod
() const noexcept;
78
inline static
bool
resizingSupported
(
unsigned
input_width,
unsigned
input_height,
unsigned
output_width,
unsigned
output_height);
79
80
81
protected:
82
DebayeringMethod
debayering_method_
;
83
};
84
85
void
86
ImageBayerGRBG
::
setDebayeringMethod
(const
ImageBayerGRBG
::
DebayeringMethod
& method) noexcept
87
{
88
debayering_method_
= method;
89
}
90
91
ImageBayerGRBG::DebayeringMethod
92
ImageBayerGRBG::getDebayeringMethod
() const noexcept
93
{
94
return
debayering_method_
;
95
}
96
97
bool
98
ImageBayerGRBG::resizingSupported
(
unsigned
input_width,
unsigned
input_height,
unsigned
output_width,
unsigned
output_height)
99
{
100
return
(output_width <= input_width && output_height <= input_height && input_width % output_width == 0 && input_height % output_height == 0 );
101
}
102
}
// namespace
103
104
#endif
openni_wrapper::ImageBayerGRBG::ImageBayerGRBG
ImageBayerGRBG(pcl::shared_ptr< xn::ImageMetaData > image_meta_data, DebayeringMethod method) noexcept
openni_wrapper::ImageBayerGRBG::resizingSupported
static bool resizingSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height)
Definition
openni_image_bayer_grbg.h:98
openni_wrapper::ImageBayerGRBG::getDebayeringMethod
DebayeringMethod getDebayeringMethod() const noexcept
Definition
openni_image_bayer_grbg.h:92
openni_wrapper::ImageBayerGRBG::fillRGB
void fillRGB(unsigned width, unsigned height, unsigned char *rgb_buffer, unsigned rgb_line_step=0) const override
fills a user given buffer with the RGB values, with an optional nearest-neighbor down sampling and an...
openni_wrapper::ImageBayerGRBG::setDebayeringMethod
void setDebayeringMethod(const DebayeringMethod &method) noexcept
Definition
openni_image_bayer_grbg.h:86
openni_wrapper::ImageBayerGRBG::isResizingSupported
bool isResizingSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const override
openni_wrapper::ImageBayerGRBG::getEncoding
Encoding getEncoding() const override
returns the encoding of the native data.
Definition
openni_image_bayer_grbg.h:68
openni_wrapper::ImageBayerGRBG::DebayeringMethod
DebayeringMethod
Definition
openni_image_bayer_grbg.h:58
openni_wrapper::ImageBayerGRBG::Bilinear
@ Bilinear
Definition
openni_image_bayer_grbg.h:59
openni_wrapper::ImageBayerGRBG::EdgeAwareWeighted
@ EdgeAwareWeighted
Definition
openni_image_bayer_grbg.h:61
openni_wrapper::ImageBayerGRBG::EdgeAware
@ EdgeAware
Definition
openni_image_bayer_grbg.h:60
openni_wrapper::ImageBayerGRBG::fillGrayscale
void fillGrayscale(unsigned width, unsigned height, unsigned char *gray_buffer, unsigned gray_line_step=0) const override
fills a user given buffer with the gray values, with an optional nearest-neighbor down sampling and a...
openni_wrapper::ImageBayerGRBG::debayering_method_
DebayeringMethod debayering_method_
Definition
openni_image_bayer_grbg.h:82
openni_wrapper::ImageBayerGRBG::~ImageBayerGRBG
~ImageBayerGRBG() noexcept override
openni_wrapper::Image::Image
Image(pcl::shared_ptr< xn::ImageMetaData > image_meta_data) noexcept
Constructor.
Definition
openni_image.h:171
openni_wrapper::Image::Encoding
Encoding
Definition
openni_image.h:65
openni_wrapper::Image::BAYER_GRBG
@ BAYER_GRBG
Definition
openni_image.h:66
memory.h
Defines functions, macros and traits for allocating and using memory.
openni_wrapper
Definition
openni_depth_image.h:52
pcl_macros.h
Defines all the PCL and non-PCL macros used.