ScanSegment.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/ximgproc.hpp"
  8. #import "opencv2/ximgproc/scansegment.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. #import "Algorithm.h"
  14. @class Mat;
  15. NS_ASSUME_NONNULL_BEGIN
  16. // C++: class ScanSegment
  17. /**
  18. * Class implementing the F-DBSCAN (Accelerated superpixel image segmentation with a parallelized DBSCAN algorithm) superpixels
  19. * algorithm by Loke SC, et al. CITE: loke2021accelerated for original paper.
  20. *
  21. * The algorithm uses a parallelised DBSCAN cluster search that is resistant to noise, competitive in segmentation quality, and faster than
  22. * existing superpixel segmentation methods. When tested on the Berkeley Segmentation Dataset, the average processing speed is 175 frames/s
  23. * with a Boundary Recall of 0.797 and an Achievable Segmentation Accuracy of 0.944. The computational complexity is quadratic O(n2) and
  24. * more suited to smaller images, but can still process a 2MP colour image faster than the SEEDS algorithm in OpenCV. The output is deterministic
  25. * when the number of processing threads is fixed, and requires the source image to be in Lab colour format.
  26. *
  27. * Member of `Ximgproc`
  28. */
  29. CV_EXPORTS @interface ScanSegment : Algorithm
  30. #ifdef __cplusplus
  31. @property(readonly)cv::Ptr<cv::ximgproc::ScanSegment> nativePtrScanSegment;
  32. #endif
  33. #ifdef __cplusplus
  34. - (instancetype)initWithNativePtr:(cv::Ptr<cv::ximgproc::ScanSegment>)nativePtr;
  35. + (instancetype)fromNative:(cv::Ptr<cv::ximgproc::ScanSegment>)nativePtr;
  36. #endif
  37. #pragma mark - Methods
  38. //
  39. // int cv::ximgproc::ScanSegment::getNumberOfSuperpixels()
  40. //
  41. /**
  42. * Returns the actual superpixel segmentation from the last image processed using iterate.
  43. *
  44. * Returns zero if no image has been processed.
  45. */
  46. - (int)getNumberOfSuperpixels NS_SWIFT_NAME(getNumberOfSuperpixels());
  47. //
  48. // void cv::ximgproc::ScanSegment::iterate(Mat img)
  49. //
  50. /**
  51. * Calculates the superpixel segmentation on a given image with the initialized
  52. * parameters in the ScanSegment object.
  53. *
  54. * This function can be called again for other images without the need of initializing the algorithm with createScanSegment().
  55. * This save the computational cost of allocating memory for all the structures of the algorithm.
  56. *
  57. * @param img Input image. Supported format: CV_8UC3. Image size must match with the initialized
  58. * image size with the function createScanSegment(). It MUST be in Lab color space.
  59. */
  60. - (void)iterate:(Mat*)img NS_SWIFT_NAME(iterate(img:));
  61. //
  62. // void cv::ximgproc::ScanSegment::getLabels(Mat& labels_out)
  63. //
  64. /**
  65. * Returns the segmentation labeling of the image.
  66. *
  67. * Each label represents a superpixel, and each pixel is assigned to one superpixel label.
  68. *
  69. * @param labels_out Return: A CV_32UC1 integer array containing the labels of the superpixel
  70. * segmentation. The labels are in the range [0, getNumberOfSuperpixels()].
  71. */
  72. - (void)getLabels:(Mat*)labels_out NS_SWIFT_NAME(getLabels(labels_out:));
  73. //
  74. // void cv::ximgproc::ScanSegment::getLabelContourMask(Mat& image, bool thick_line = false)
  75. //
  76. /**
  77. * Returns the mask of the superpixel segmentation stored in the ScanSegment object.
  78. *
  79. * The function return the boundaries of the superpixel segmentation.
  80. *
  81. * @param image Return: CV_8UC1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.
  82. * @param thick_line If false, the border is only one pixel wide, otherwise all pixels at the border are masked.
  83. */
  84. - (void)getLabelContourMask:(Mat*)image thick_line:(BOOL)thick_line NS_SWIFT_NAME(getLabelContourMask(image:thick_line:));
  85. /**
  86. * Returns the mask of the superpixel segmentation stored in the ScanSegment object.
  87. *
  88. * The function return the boundaries of the superpixel segmentation.
  89. *
  90. * @param image Return: CV_8UC1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.
  91. */
  92. - (void)getLabelContourMask:(Mat*)image NS_SWIFT_NAME(getLabelContourMask(image:));
  93. @end
  94. NS_ASSUME_NONNULL_END