Loading...
Searching...
No Matches
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.
*
*/
#pragma once
#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
namespace pcl {
template <typename PointT>
class kernel {
public:
/// 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_{3};
float sigma_{1.0};
KERNEL_ENUM kernel_type_;
kernel() : 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);
};
} // namespace pcl
#include <pcl/2d/impl/kernel.hpp>
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition point_cloud.h:173
pcl::kernel
Definition kernel.h:46
pcl::kernel::prewittKernelY
void prewittKernelY(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:216
pcl::kernel::derivativeXBackwardKernel
void derivativeXBackwardKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:271
pcl::kernel::derivativeYBackwardKernel
void derivativeYBackwardKernel(PointCloud< PointT > &kernel)
Definition kernel.hpp:307
pcl::kernel::prewittKernelX
void prewittKernelX(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:167
pcl::kernel::loGKernel
void loGKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:122
pcl::kernel::setKernelSize
void setKernelSize(int kernel_size)
Definition kernel.hpp:326
pcl::kernel::sobelKernelX
void sobelKernelX(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:149
pcl::kernel::setKernelSigma
void setKernelSigma(float kernel_sigma)
Definition kernel.hpp:333
pcl::kernel::derivativeXCentralKernel
void derivativeXCentralKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:247
pcl::kernel::robertsKernelY
void robertsKernelY(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:234
pcl::kernel::KERNEL_ENUM
KERNEL_ENUM
Different types of kernels available.
Definition kernel.h:49
pcl::kernel::ROBERTS_Y
@ ROBERTS_Y
ROBERTS_Y.
Definition kernel.h:55
pcl::kernel::DERIVATIVE_BACKWARD_Y
@ DERIVATIVE_BACKWARD_Y
DERIVATIVE_BACKWARD_Y.
Definition kernel.h:62
pcl::kernel::SOBEL_X
@ SOBEL_X
SOBEL_X.
Definition kernel.h:50
pcl::kernel::SOBEL_Y
@ SOBEL_Y
SOBEL_Y.
Definition kernel.h:51
pcl::kernel::ROBERTS_X
@ ROBERTS_X
ROBERTS_X.
Definition kernel.h:54
pcl::kernel::GAUSSIAN
@ GAUSSIAN
GAUSSIAN.
Definition kernel.h:63
pcl::kernel::DERIVATIVE_FORWARD_X
@ DERIVATIVE_FORWARD_X
DERIVATIVE_FORWARD_X.
Definition kernel.h:58
pcl::kernel::DERIVATIVE_BACKWARD_X
@ DERIVATIVE_BACKWARD_X
DERIVATIVE_BACKWARD_X.
Definition kernel.h:59
pcl::kernel::PREWITT_Y
@ PREWITT_Y
PREWITT_Y.
Definition kernel.h:53
pcl::kernel::DERIVATIVE_FORWARD_Y
@ DERIVATIVE_FORWARD_Y
DERIVATIVE_FORWARD_Y.
Definition kernel.h:61
pcl::kernel::LOG
@ LOG
LOG.
Definition kernel.h:56
pcl::kernel::DERIVATIVE_CENTRAL_Y
@ DERIVATIVE_CENTRAL_Y
DERIVATIVE_CENTRAL_Y.
Definition kernel.h:60
pcl::kernel::DERIVATIVE_CENTRAL_X
@ DERIVATIVE_CENTRAL_X
DERIVATIVE_CENTRAL_X.
Definition kernel.h:57
pcl::kernel::PREWITT_X
@ PREWITT_X
PREWITT_X.
Definition kernel.h:52
pcl::kernel::setKernelType
void setKernelType(KERNEL_ENUM kernel_type)
Definition kernel.hpp:319
pcl::kernel::kernel_type_
KERNEL_ENUM kernel_type_
Definition kernel.h:68
pcl::kernel::sigma_
float sigma_
Definition kernel.h:67
pcl::kernel::kernel_size_
int kernel_size_
Definition kernel.h:66
pcl::kernel::gaussianKernel
void gaussianKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:96
pcl::kernel::sobelKernelY
void sobelKernelY(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:198
pcl::kernel::fetchKernel
void fetchKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:46
pcl::kernel::kernel
kernel()
Definition kernel.h:70
pcl::kernel::derivativeXForwardKernel
void derivativeXForwardKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:259
pcl::kernel::derivativeYForwardKernel
void derivativeYForwardKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:295
pcl::kernel::robertsKernelX
void robertsKernelX(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:185
pcl::kernel::derivativeYCentralKernel
void derivativeYCentralKernel(pcl::PointCloud< PointT > &kernel)
Definition kernel.hpp:283
point_types.h
Defines all the PCL implemented PointT point type structures.
pcl
Definition convolution.h:46