kernel.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2012-, Open Perception, 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 the copyright holder(s) 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.
*
*/
#ifndef PCL_2D_KERNEL_H_
#define PCL_2D_KERNEL_H_
#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
namespace pcl
{
template<typename PointT>
class kernel
{
public:
/**
* enumerates the different types of kernels available.
*/
enum KERNEL_ENUM
{
SOBEL_X, //!< SOBEL_X
SOBEL_Y, //!< SOBEL_Y
PREWITT_X, //!< PREWITT_X
PREWITT_Y, //!< PREWITT_Y
ROBERTS_X, //!< ROBERTS_X
ROBERTS_Y, //!< ROBERTS_Y
LOG, //!< LOG
DERIVATIVE_CENTRAL_X, //!< DERIVATIVE_CENTRAL_X
DERIVATIVE_FORWARD_X, //!< DERIVATIVE_FORWARD_X
DERIVATIVE_BACKWARD_X,//!< DERIVATIVE_BACKWARD_X
DERIVATIVE_CENTRAL_Y, //!< DERIVATIVE_CENTRAL_Y
DERIVATIVE_FORWARD_Y, //!< DERIVATIVE_FORWARD_Y
DERIVATIVE_BACKWARD_Y,//!< DERIVATIVE_BACKWARD_Y
GAUSSIAN //!< GAUSSIAN
};
int kernel_size_;
float sigma_;
KERNEL_ENUM kernel_type_;
kernel () :
kernel_size_ (3),
sigma_ (1.0),
kernel_type_ (GAUSSIAN)
{
}
/**
*
* @param kernel Kernel point cloud passed by reference
*
* Helper function which returns the kernel selected by the kernel_type_ enum
*/
void fetchKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_
*/
void gaussianKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* Laplacian of Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_
*/
void loGKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 3x3 Sobel kernel in the X direction
*/
void sobelKernelX (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 3x3 Prewitt kernel in the X direction
*/
void prewittKernelX (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 2x2 Roberts kernel in the X direction
*/
void robertsKernelX (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 3x3 Sobel kernel in the Y direction
*/
void sobelKernelY (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 3x3 Prewitt kernel in the Y direction
*/
void prewittKernelY (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* 2x2 Roberts kernel in the Y direction
*/
void robertsKernelY (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [-1 0 1]
*/
void derivativeXCentralKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [-1 0 1]'
*/
void derivativeYCentralKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [0 -1 1]
*/
void derivativeXForwardKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [0 -1 1]'
*/
void derivativeYForwardKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [-1 1 0]
*/
void derivativeXBackwardKernel (pcl::PointCloud<PointT> &kernel);
/**
*
* @param kernel Kernel point cloud passed by reference
*
* kernel [-1 1 0]'
*/
void derivativeYBackwardKernel (PointCloud<PointT> &kernel);
/**
*
* @param kernel_type enum indicating the kernel type wanted
*
* select the kernel type.
*/
void setKernelType (KERNEL_ENUM kernel_type);
/**
*
* @param kernel_size kernel of size kernel_size x kernel_size is created(LoG and Gaussian only)
*
* Setter function for kernel_size_
*/
void setKernelSize (int kernel_size);
/**
*
* @param kernel_sigma variance of the Gaussian or LoG kernels.
*
* Setter function for kernel_sigma_
*/
void setKernelSigma (float kernel_sigma);
};
}
#include <pcl/2d/impl/kernel.hpp>
#endif // PCL_2D_KERNEL_H_
pcl::kernel::setKernelType
void setKernelType(KERNEL_ENUM kernel_type)
Definition: kernel.hpp:308
pcl::kernel::prewittKernelY
void prewittKernelY(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:225
pcl::kernel::LOG
LOG.
Definition: kernel.h:60
pcl::kernel::kernel_type_
KERNEL_ENUM kernel_type_
Definition: kernel.h:72
pcl::kernel::DERIVATIVE_CENTRAL_X
DERIVATIVE_CENTRAL_X.
Definition: kernel.h:61
pcl
Definition: convolution.h:45
pcl::kernel::PREWITT_X
PREWITT_X.
Definition: kernel.h:56
pcl::kernel
Definition: kernel.h:45
pcl::kernel::sigma_
float sigma_
Definition: kernel.h:71
pcl::kernel::DERIVATIVE_FORWARD_Y
DERIVATIVE_FORWARD_Y.
Definition: kernel.h:65
pcl::kernel::prewittKernelX
void prewittKernelX(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:190
pcl::kernel::robertsKernelX
void robertsKernelX(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:202
pcl::kernel::derivativeYForwardKernel
void derivativeYForwardKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:287
pcl::kernel::sobelKernelX
void sobelKernelX(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:178
pcl::kernel::derivativeYBackwardKernel
void derivativeYBackwardKernel(PointCloud< PointT > &kernel)
Definition: kernel.hpp:297
pcl::kernel::SOBEL_Y
SOBEL_Y.
Definition: kernel.h:55
pcl::kernel::DERIVATIVE_CENTRAL_Y
DERIVATIVE_CENTRAL_Y.
Definition: kernel.h:64
pcl::kernel::DERIVATIVE_BACKWARD_Y
DERIVATIVE_BACKWARD_Y.
Definition: kernel.h:66
pcl::kernel::sobelKernelY
void sobelKernelY(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:213
point_types.h
Defines all the PCL implemented PointT point type structures.
pcl::kernel::kernel_size_
int kernel_size_
Definition: kernel.h:70
pcl::kernel::loGKernel
void loGKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:149
pcl::kernel::DERIVATIVE_BACKWARD_X
DERIVATIVE_BACKWARD_X.
Definition: kernel.h:63
pcl::kernel::setKernelSigma
void setKernelSigma(float kernel_sigma)
Definition: kernel.hpp:322
pcl::kernel::KERNEL_ENUM
KERNEL_ENUM
enumerates the different types of kernels available.
Definition: kernel.h:52
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Definition: projection_matrix.h:53
pcl::kernel::ROBERTS_X
ROBERTS_X.
Definition: kernel.h:58
pcl::kernel::kernel
kernel()
Definition: kernel.h:74
pcl::kernel::ROBERTS_Y
ROBERTS_Y.
Definition: kernel.h:59
pcl::kernel::fetchKernel
void fetchKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:43
pcl::kernel::gaussianKernel
void gaussianKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:122
pcl::kernel::derivativeXForwardKernel
void derivativeXForwardKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:257
pcl::kernel::derivativeYCentralKernel
void derivativeYCentralKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:277
pcl::kernel::DERIVATIVE_FORWARD_X
DERIVATIVE_FORWARD_X.
Definition: kernel.h:62
pcl::kernel::derivativeXCentralKernel
void derivativeXCentralKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:247
pcl::kernel::SOBEL_X
SOBEL_X.
Definition: kernel.h:54
pcl::kernel::derivativeXBackwardKernel
void derivativeXBackwardKernel(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:267
pcl::kernel::robertsKernelY
void robertsKernelY(pcl::PointCloud< PointT > &kernel)
Definition: kernel.hpp:236
pcl::kernel::PREWITT_Y
PREWITT_Y.
Definition: kernel.h:57
pcl::kernel::setKernelSize
void setKernelSize(int kernel_size)
Definition: kernel.hpp:315
pcl::kernel::GAUSSIAN
GAUSSIAN.
Definition: kernel.h:67