github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/gapi/stereo.hpp (about)

     1  // This file is part of OpenCV project.
     2  // It is subject to the license terms in the LICENSE file found in the top-level directory
     3  // of this distereoibution and at http://opencv.org/license.html.
     4  //
     5  // Copyright (C) 2021 Intel Corporation
     6  
     7  #ifndef OPENCV_GAPI_STEREO_HPP
     8  #define OPENCV_GAPI_STEREO_HPP
     9  
    10  #include <opencv2/gapi/gmat.hpp>
    11  #include <opencv2/gapi/gscalar.hpp>
    12  #include <opencv2/gapi/gkernel.hpp>
    13  
    14  namespace cv {
    15  namespace gapi {
    16  
    17  /**
    18   * The enum specified format of result that you get from @ref cv::gapi::stereo.
    19   */
    20  enum class StereoOutputFormat {
    21      DEPTH_FLOAT16, ///< Floating point 16 bit value, CV_16FC1.
    22                     ///< This identifier is deprecated, use DEPTH_16F instead.
    23      DEPTH_FLOAT32, ///< Floating point 32 bit value, CV_32FC1
    24                     ///< This identifier is deprecated, use DEPTH_16F instead.
    25      DISPARITY_FIXED16_11_5, ///< 16 bit signed: first bit for sign,
    26                              ///< 10 bits for integer part,
    27                              ///< 5 bits for fractional part.
    28                              ///< This identifier is deprecated,
    29                              ///< use DISPARITY_16Q_10_5 instead.
    30      DISPARITY_FIXED16_12_4, ///< 16 bit signed: first bit for sign,
    31                              ///< 11 bits for integer part,
    32                              ///< 4 bits for fractional part.
    33                              ///< This identifier is deprecated,
    34                              ///< use DISPARITY_16Q_11_4 instead.
    35      DEPTH_16F = DEPTH_FLOAT16, ///< Same as DEPTH_FLOAT16
    36      DEPTH_32F = DEPTH_FLOAT32, ///< Same as DEPTH_FLOAT32
    37      DISPARITY_16Q_10_5 = DISPARITY_FIXED16_11_5, ///< Same as DISPARITY_FIXED16_11_5
    38      DISPARITY_16Q_11_4 = DISPARITY_FIXED16_12_4 ///< Same as DISPARITY_FIXED16_12_4
    39  };
    40  
    41  
    42  /**
    43   * @brief This namespace contains G-API Operation Types for Stereo and
    44   * related functionality.
    45   */
    46  namespace calib3d {
    47  
    48  G_TYPED_KERNEL(GStereo, <GMat(GMat, GMat, const StereoOutputFormat)>, "org.opencv.stereo") {
    49      static GMatDesc outMeta(const GMatDesc &left, const GMatDesc &right, const StereoOutputFormat of) {
    50          GAPI_Assert(left.chan == 1);
    51          GAPI_Assert(left.depth == CV_8U);
    52  
    53          GAPI_Assert(right.chan == 1);
    54          GAPI_Assert(right.depth == CV_8U);
    55  
    56          switch(of) {
    57              case StereoOutputFormat::DEPTH_FLOAT16:
    58                  return left.withDepth(CV_16FC1);
    59              case StereoOutputFormat::DEPTH_FLOAT32:
    60                  return left.withDepth(CV_32FC1);
    61              case StereoOutputFormat::DISPARITY_FIXED16_11_5:
    62              case StereoOutputFormat::DISPARITY_FIXED16_12_4:
    63                  return left.withDepth(CV_16SC1);
    64              default:
    65                  GAPI_Assert(false && "Unknown output format!");
    66          }
    67      }
    68  };
    69  
    70  } // namespace calib3d
    71  
    72  /** @brief Computes disparity/depth map for the specified stereo-pair.
    73  The function computes disparity or depth map depending on passed StereoOutputFormat argument.
    74  
    75  @param left 8-bit single-channel left image of @ref CV_8UC1 type.
    76  @param right 8-bit single-channel right image of @ref CV_8UC1 type.
    77  @param of enum to specified output kind: depth or disparity and corresponding type
    78  */
    79  GAPI_EXPORTS GMat stereo(const GMat& left,
    80                           const GMat& right,
    81                           const StereoOutputFormat of = StereoOutputFormat::DEPTH_FLOAT32);
    82  } // namespace gapi
    83  } // namespace cv
    84  
    85  #endif // OPENCV_GAPI_STEREO_HPP