Loading...
Searching...
No Matches
debayering.h
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*
*/
#pragma once
#include <pcl/cuda/point_cloud.h>
#include <pcl/io/openni_camera/openni_image.h>
namespace pcl
{
namespace cuda
{
struct downsampleIndices
{
downsampleIndices (int width, int height, int stride)
: width (width), height (height), stride (stride)
{}
int width, height, stride;
__host__ __device__
bool operator () (int i)
{
int xIdx = i % width;
int yIdx = i / width;
return ((xIdx % stride == 0) & (yIdx % stride == 0));
}
};
template <template <typename> class Storage>
struct DebayerBilinear
{
unsigned width;
unsigned height;
//static unsigned dataSize;
//static unsigned char* global_data; // has to be initialized only once!
//unsigned char* data;
unsigned char *data;
DebayerBilinear (unsigned char *bayer_image, unsigned width, unsigned height);
//DebayerBilinear (const openni_wrapper::Image::Ptr& bayer_image);
__inline__ __host__ __device__ OpenNIRGB operator () (int index) const;
};
/*
struct DebayerEdgeAware
{
unsigned width;
unsigned height;
static unsigned dataSize;
static unsigned char* global_data; // has to be initialized only once!
unsigned char* data;
DebayerEdgeAware (const openni_wrapper::Image::Ptr& bayer_image);
~DebayerEdgeAware ();
__inline__ __host__ __device__ OpenNIRGB operator () (int index) const;
};
*/
template<template <typename> class Storage>
class DebayeringDownsampling
{
public:
using RGBImageType = typename Storage<OpenNIRGB>::type;
void
compute (const openni_wrapper::Image::Ptr& bayer_image, RGBImageType& rgb_image) const;
};
template <template <typename> class Storage>
struct YUV2RGBKernel
{
unsigned width;
unsigned height;
unsigned char *data;
YUV2RGBKernel (unsigned char *yuv_image, unsigned width, unsigned height);
__inline__ __host__ __device__ OpenNIRGB operator () (int index) const;
};
template<template <typename> class Storage>
class YUV2RGB
{
public:
using RGBImageType = typename Storage<OpenNIRGB>::type;
void
compute (const openni_wrapper::Image::Ptr& yuv_image, RGBImageType& rgb_image) const;
};
template<template <typename> class Storage>
class Debayering
{
public:
using RGBImageType = typename Storage<OpenNIRGB>::type;
void
computeBilinear (const openni_wrapper::Image::Ptr& bayer_image, RGBImageType& rgb_image) const;
//void
//computeEdgeAware (const openni_wrapper::Image::Ptr& bayer_image, thrust::host_vector<OpenNIRGB>& rgb_image) const;
//void
//computeEdgeAware (const openni_wrapper::Image::Ptr& bayer_image, thrust::device_vector<OpenNIRGB>& rgb_image) const;
};
} // namespace
} // namespace
openni_wrapper::Image::Ptr
pcl::shared_ptr< Image > Ptr
Definition openni_image.h:61
pcl::cuda::DebayeringDownsampling
Definition debayering.h:96
pcl::cuda::DebayeringDownsampling::compute
void compute(const openni_wrapper::Image::Ptr &bayer_image, RGBImageType &rgb_image) const
pcl::cuda::DebayeringDownsampling::RGBImageType
typename Storage< OpenNIRGB >::type RGBImageType
Definition debayering.h:98
pcl::cuda::Debayering
Definition debayering.h:125
pcl::cuda::Debayering::RGBImageType
typename Storage< OpenNIRGB >::type RGBImageType
Definition debayering.h:127
pcl::cuda::Debayering::computeBilinear
void computeBilinear(const openni_wrapper::Image::Ptr &bayer_image, RGBImageType &rgb_image) const
pcl::cuda::YUV2RGB
Definition debayering.h:116
pcl::cuda::YUV2RGB::RGBImageType
typename Storage< OpenNIRGB >::type RGBImageType
Definition debayering.h:118
pcl::cuda::YUV2RGB::compute
void compute(const openni_wrapper::Image::Ptr &yuv_image, RGBImageType &rgb_image) const
pcl
Definition convolution.h:46
pcl::cuda::DebayerBilinear
Definition debayering.h:68
pcl::cuda::DebayerBilinear::width
unsigned width
Definition debayering.h:69
pcl::cuda::DebayerBilinear::DebayerBilinear
DebayerBilinear(unsigned char *bayer_image, unsigned width, unsigned height)
pcl::cuda::DebayerBilinear::data
unsigned char * data
Definition debayering.h:74
pcl::cuda::DebayerBilinear::height
unsigned height
Definition debayering.h:70
pcl::cuda::DebayerBilinear::operator()
__inline__ __host__ __device__ OpenNIRGB operator()(int index) const
pcl::cuda::OpenNIRGB
Simple structure holding RGB data.
Definition point_cloud.h:56
pcl::cuda::YUV2RGBKernel
Definition debayering.h:105
pcl::cuda::YUV2RGBKernel::height
unsigned height
Definition debayering.h:107
pcl::cuda::YUV2RGBKernel::data
unsigned char * data
Definition debayering.h:108
pcl::cuda::YUV2RGBKernel::YUV2RGBKernel
YUV2RGBKernel(unsigned char *yuv_image, unsigned width, unsigned height)
pcl::cuda::YUV2RGBKernel::width
unsigned width
Definition debayering.h:106
pcl::cuda::YUV2RGBKernel::operator()
__inline__ __host__ __device__ OpenNIRGB operator()(int index) const
pcl::cuda::downsampleIndices
Definition debayering.h:49
pcl::cuda::downsampleIndices::operator()
__host__ __device__ bool operator()(int i)
Definition debayering.h:57
pcl::cuda::downsampleIndices::height
int height
Definition debayering.h:54
pcl::cuda::downsampleIndices::width
int width
Definition debayering.h:54
pcl::cuda::downsampleIndices::downsampleIndices
downsampleIndices(int width, int height, int stride)
Definition debayering.h:50
pcl::cuda::downsampleIndices::stride
int stride
Definition debayering.h:54