Loading [MathJax]/extensions/TeX/AMSmath.js
Open3D (C++ API)  0.14.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IPPImage.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 #pragma once
27 
28 #ifdef WITH_IPPICV
29 #define IPP_CALL(ipp_function, ...) ipp_function(__VA_ARGS__);
30 
31 // Required by IPPICV headers, defined here to keep other compile commands clean
32 #define ICV_BASE
33 #define IW_BUILD
34 #include <iw++/iw_core.hpp>
35 
36 #include "open3d/core/Dtype.h"
37 #include "open3d/core/Tensor.h"
39 
40 namespace open3d {
41 namespace t {
42 namespace geometry {
43 namespace ipp {
44 
45 inline ::ipp::IppDataType ToIppDataType(core::Dtype dtype) {
46  if (dtype == core::UInt8 || dtype == core::Bool) {
47  return ipp8u;
48  } else if (dtype == core::UInt16) {
49  return ipp16u;
50  } else if (dtype == core::Int16) {
51  return ipp16s;
52  } else if (dtype == core::Int32) {
53  return ipp32s;
54  } else if (dtype == core::Int64) {
55  return ipp64s;
56  } else if (dtype == core::Float32) {
57  return ipp32f;
58  } else if (dtype == core::Float64) {
59  return ipp64f;
60  } else {
61  return ippUndef;
62  }
63 }
64 
65 void To(const core::Tensor &src_im,
66  core::Tensor &dst_im,
67  double scale,
68  double offset);
69 
70 void RGBToGray(const core::Tensor &src_im, core::Tensor &dst_im);
71 
72 void Dilate(const open3d::core::Tensor &srcim,
73  open3d::core::Tensor &dstim,
74  int kernel_size);
75 
76 void Resize(const open3d::core::Tensor &srcim,
77  open3d::core::Tensor &dstim,
78  t::geometry::Image::InterpType interp_type);
79 
80 void Filter(const open3d::core::Tensor &srcim,
81  open3d::core::Tensor &dstim,
82  const open3d::core::Tensor &kernel);
83 
84 void FilterBilateral(const open3d::core::Tensor &srcim,
85  open3d::core::Tensor &dstim,
86  int kernel_size,
87  float value_sigma,
88  float distance_sigma);
89 
90 void FilterGaussian(const open3d::core::Tensor &srcim,
91  open3d::core::Tensor &dstim,
92  int kernel_size,
93  float sigma);
94 
95 void FilterSobel(const open3d::core::Tensor &srcim,
96  open3d::core::Tensor &dstim_dx,
97  open3d::core::Tensor &dstim_dy,
98  int kernel_size);
99 } // namespace ipp
100 } // namespace geometry
101 } // namespace t
102 } // namespace open3d
103 
104 #else
105 #define IPP_CALL(ipp_function, ...) \
106  utility::LogError("Not built with IPP-IW, cannot call " #ipp_function);
107 #endif // WITH_IPPICV
const Dtype UInt8
Definition: Dtype.cpp:67
const Dtype Bool
Definition: Dtype.cpp:71
const Dtype Int64
Definition: Dtype.cpp:66
void FilterGaussian(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size, float sigma)
Definition: IPPImage.cpp:237
const Dtype Float32
Definition: Dtype.cpp:61
void Filter(const open3d::core::Tensor &src_im, open3d::core::Tensor &dst_im, const open3d::core::Tensor &kernel)
Definition: IPPImage.cpp:174
void RGBToGray(const core::Tensor &src_im, core::Tensor &dst_im)
Definition: IPPImage.cpp:75
const Dtype Int32
Definition: Dtype.cpp:65
const Dtype UInt16
Definition: Dtype.cpp:68
void FilterSobel(const core::Tensor &src_im, core::Tensor &dst_im_dx, core::Tensor &dst_im_dy, int kernel_size)
Definition: IPPImage.cpp:265
int offset
Definition: FilePCD.cpp:64
InterpType
Image interpolation algorithms.
Definition: Image.h:191
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:50
const Dtype Int16
Definition: Dtype.cpp:64
void To(const core::Tensor &src_im, core::Tensor &dst_im, double scale, double offset)
Definition: IPPImage.cpp:46
void Dilate(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size)
Definition: IPPImage.cpp:137
const Dtype Float64
Definition: Dtype.cpp:62
void Resize(const open3d::core::Tensor &src_im, open3d::core::Tensor &dst_im, t::geometry::Image::InterpType interp_type)
Definition: IPPImage.cpp:98
void FilterBilateral(const core::Tensor &src_im, core::Tensor &dst_im, int kernel_size, float value_sigma, float distance_sigma)
Definition: IPPImage.cpp:206