ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NPPImage.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 #pragma once
8 
9 #ifdef BUILD_CUDA_MODULE
10 #include "cloudViewer/core/Dtype.h"
13 
14 namespace cloudViewer {
15 namespace t {
16 namespace geometry {
17 namespace npp {
18 
19 void RGBToGray(const core::Tensor &src_im, core::Tensor &dst_im);
20 
21 void Dilate(const cloudViewer::core::Tensor &srcim,
23  int kernel_size);
24 
25 void Resize(const cloudViewer::core::Tensor &srcim,
27  t::geometry::Image::InterpType interp_type);
28 
29 void Filter(const cloudViewer::core::Tensor &srcim,
31  const cloudViewer::core::Tensor &kernel);
32 
35  int kernel_size,
36  float value_sigma,
37  float distance_sigma);
38 
41  int kernel_size,
42  float sigma);
43 
44 void FilterSobel(const cloudViewer::core::Tensor &srcim,
45  cloudViewer::core::Tensor &dstim_dx,
46  cloudViewer::core::Tensor &dstim_dy,
47  int kernel_size);
48 } // namespace npp
49 } // namespace geometry
50 } // namespace t
51 } // namespace cloudViewer
52 
53 #endif // BUILD_CUDA_MODULE
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::Ones
static Tensor Ones(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with ones.
Definition: Tensor.cpp:412
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
ShapeUtil.h
cloudViewer::core::UInt16
const Dtype UInt16
Definition: Dtype.cpp:49
cloudViewer::t::geometry::Image::InterpType::Nearest
@ Nearest
Nearest neighbors interpolation.
CUDAUtils.h
Common CUDA utilities.
cloudViewer::t::geometry::npp::FilterBilateral
void FilterBilateral(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size, float value_sigma, float distance_sigma)
Definition: NPPImage.cpp:319
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
core::Tensor
cloudViewer::core::Tensor::Neg_
Tensor Neg_()
Element-wise negation of a tensor, in-place.
Definition: Tensor.cpp:1335
cloudViewer::core::Tensor::Reverse
Tensor Reverse() const
Reverse a Tensor's elements by viewing the tensor as a 1D array.
Definition: Tensor.cpp:465
cloudViewer::t::geometry::npp::Filter
void Filter(const cloudViewer::core::Tensor &src_im, cloudViewer::core::Tensor &dst_im, const cloudViewer::core::Tensor &kernel)
Definition: NPPImage.cpp:246
NPPImage.h
NPP_ARGS_DY
#define NPP_ARGS_DY
cloudViewer::core::Tensor
Definition: Tensor.h:32
cloudViewer::core::Tensor::View
Tensor View(const SizeVector &dst_shape) const
Definition: Tensor.cpp:721
CLOUDVIEWER_CUDA_CHECK
#define CLOUDVIEWER_CUDA_CHECK(err)
Definition: CUDAUtils.h:47
cloudViewer::core::Device::ToString
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
Definition: Device.cpp:89
context
ImGuiContext * context
Definition: Window.cpp:76
cloudViewer::core::Tensor::Arange
static Tensor Arange(const Scalar start, const Scalar stop, const Scalar step=1, const Dtype dtype=core::Int64, const Device &device=core::Device("CPU:0"))
Create a 1D tensor with evenly spaced values in the given interval.
Definition: Tensor.cpp:436
cloudViewer::t::geometry::npp::Resize
void Resize(const cloudViewer::core::Tensor &src_im, cloudViewer::core::Tensor &dst_im, t::geometry::Image::InterpType interp_type)
Definition: NPPImage.cpp:97
cloudViewer::t::geometry::Image::InterpType
InterpType
Image interpolation algorithms.
Definition: Image.h:178
cloudViewer::t::geometry::Image::InterpType::Lanczos
@ Lanczos
Lanczos filter interpolation.
cloudViewer::core::Tensor::T
Tensor T() const
Expects input to be <= 2-D Tensor by swapping dimension 0 and 1.
Definition: Tensor.cpp:1079
cloudViewer::t::geometry::npp::Dilate
void Dilate(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size)
Definition: NPPImage.cpp:178
cloudViewer::core::Tensor::Exp
Tensor Exp() const
Element-wise exponential of a tensor, returning a new tensor.
Definition: Tensor.cpp:1340
cloudViewer::core::UInt8
const Dtype UInt8
Definition: Dtype.cpp:48
NPP_ARGS
#define NPP_ARGS
cloudViewer::core::Bool
const Dtype Bool
Definition: Dtype.cpp:52
cloudViewer::t::geometry::npp::RGBToGray
void RGBToGray(const core::Tensor &src_im, core::Tensor &dst_im)
Definition: NPPImage.cpp:63
cloudViewer::core::Tensor::Matmul
Tensor Matmul(const Tensor &rhs) const
Definition: Tensor.cpp:1919
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::CUDAScopedDevice
When CUDA is not enabled, this is a dummy class.
Definition: CUDAUtils.h:214
cloudViewer::core::Float32
const Dtype Float32
Definition: Dtype.cpp:42
cloudViewer::t::geometry::npp::FilterSobel
void FilterSobel(const core::Tensor &src_im, core::Tensor &dst_im_dx, core::Tensor &dst_im_dy, int kernel_size)
Definition: NPPImage.cpp:406
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
LogError
#define LogError(...)
Definition: Logging.h:60
cloudViewer::t::geometry::Image::InterpType::Cubic
@ Cubic
Bicubic interpolation.
cloudViewer::t::geometry::npp::FilterGaussian
void FilterGaussian(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size, float sigma)
Definition: NPPImage.cpp:378
Image.h
Tensor.h
cloudViewer::core::Tensor::Sum
Tensor Sum(const SizeVector &dims, bool keepdim=false) const
Definition: Tensor.cpp:1240
cloudViewer::t::geometry::Image::InterpType::Super
@ Super
Super sampling interpolation (only downsample).
cloudViewer::t::geometry::Image::InterpType::Linear
@ Linear
Bilinear interpolation.
Dtype.h
cloudViewer::t::geometry::npp::MakeNPPContext
static NppStreamContext MakeNPPContext()
Definition: NPPImage.cpp:24
cloudViewer::core::Tensor::GetDataPtr
T * GetDataPtr()
Definition: Tensor.h:1144
NPP_ARGS_DX
#define NPP_ARGS_DX