SuperpixelSLIC.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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/slic.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 SuperpixelSLIC
  17. /**
  18. * Class implementing the SLIC (Simple Linear Iterative Clustering) superpixels
  19. * algorithm described in CITE: Achanta2012.
  20. *
  21. * SLIC (Simple Linear Iterative Clustering) clusters pixels using pixel channels and image plane space
  22. * to efficiently generate compact, nearly uniform superpixels. The simplicity of approach makes it
  23. * extremely easy to use a lone parameter specifies the number of superpixels and the efficiency of
  24. * the algorithm makes it very practical.
  25. * Several optimizations are available for SLIC class:
  26. * SLICO stands for "Zero parameter SLIC" and it is an optimization of baseline SLIC described in CITE: Achanta2012.
  27. * MSLIC stands for "Manifold SLIC" and it is an optimization of baseline SLIC described in CITE: Liu_2017_IEEE.
  28. *
  29. * Member of `Ximgproc`
  30. */
  31. CV_EXPORTS @interface SuperpixelSLIC : Algorithm
  32. #ifdef __cplusplus
  33. @property(readonly)cv::Ptr<cv::ximgproc::SuperpixelSLIC> nativePtrSuperpixelSLIC;
  34. #endif
  35. #ifdef __cplusplus
  36. - (instancetype)initWithNativePtr:(cv::Ptr<cv::ximgproc::SuperpixelSLIC>)nativePtr;
  37. + (instancetype)fromNative:(cv::Ptr<cv::ximgproc::SuperpixelSLIC>)nativePtr;
  38. #endif
  39. #pragma mark - Methods
  40. //
  41. // int cv::ximgproc::SuperpixelSLIC::getNumberOfSuperpixels()
  42. //
  43. /**
  44. * Calculates the actual amount of superpixels on a given segmentation computed
  45. * and stored in SuperpixelSLIC object.
  46. */
  47. - (int)getNumberOfSuperpixels NS_SWIFT_NAME(getNumberOfSuperpixels());
  48. //
  49. // void cv::ximgproc::SuperpixelSLIC::iterate(int num_iterations = 10)
  50. //
  51. /**
  52. * Calculates the superpixel segmentation on a given image with the initialized
  53. * parameters in the SuperpixelSLIC object.
  54. *
  55. * This function can be called again without the need of initializing the algorithm with
  56. * createSuperpixelSLIC(). This save the computational cost of allocating memory for all the
  57. * structures of the algorithm.
  58. *
  59. * @param num_iterations Number of iterations. Higher number improves the result.
  60. *
  61. * The function computes the superpixels segmentation of an image with the parameters initialized
  62. * with the function createSuperpixelSLIC(). The algorithms starts from a grid of superpixels and
  63. * then refines the boundaries by proposing updates of edges boundaries.
  64. */
  65. - (void)iterate:(int)num_iterations NS_SWIFT_NAME(iterate(num_iterations:));
  66. /**
  67. * Calculates the superpixel segmentation on a given image with the initialized
  68. * parameters in the SuperpixelSLIC object.
  69. *
  70. * This function can be called again without the need of initializing the algorithm with
  71. * createSuperpixelSLIC(). This save the computational cost of allocating memory for all the
  72. * structures of the algorithm.
  73. *
  74. *
  75. * The function computes the superpixels segmentation of an image with the parameters initialized
  76. * with the function createSuperpixelSLIC(). The algorithms starts from a grid of superpixels and
  77. * then refines the boundaries by proposing updates of edges boundaries.
  78. */
  79. - (void)iterate NS_SWIFT_NAME(iterate());
  80. //
  81. // void cv::ximgproc::SuperpixelSLIC::getLabels(Mat& labels_out)
  82. //
  83. /**
  84. * Returns the segmentation labeling of the image.
  85. *
  86. * Each label represents a superpixel, and each pixel is assigned to one superpixel label.
  87. *
  88. * @param labels_out Return: A CV_32SC1 integer array containing the labels of the superpixel
  89. * segmentation. The labels are in the range [0, getNumberOfSuperpixels()].
  90. *
  91. * The function returns an image with the labels of the superpixel segmentation. The labels are in
  92. * the range [0, getNumberOfSuperpixels()].
  93. */
  94. - (void)getLabels:(Mat*)labels_out NS_SWIFT_NAME(getLabels(labels_out:));
  95. //
  96. // void cv::ximgproc::SuperpixelSLIC::getLabelContourMask(Mat& image, bool thick_line = true)
  97. //
  98. /**
  99. * Returns the mask of the superpixel segmentation stored in SuperpixelSLIC object.
  100. *
  101. * @param image Return: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border,
  102. * and 0 otherwise.
  103. *
  104. * @param thick_line If false, the border is only one pixel wide, otherwise all pixels at the border
  105. * are masked.
  106. *
  107. * The function return the boundaries of the superpixel segmentation.
  108. */
  109. - (void)getLabelContourMask:(Mat*)image thick_line:(BOOL)thick_line NS_SWIFT_NAME(getLabelContourMask(image:thick_line:));
  110. /**
  111. * Returns the mask of the superpixel segmentation stored in SuperpixelSLIC object.
  112. *
  113. * @param image Return: CV_8U1 image mask where -1 indicates that the pixel is a superpixel border,
  114. * and 0 otherwise.
  115. *
  116. * are masked.
  117. *
  118. * The function return the boundaries of the superpixel segmentation.
  119. */
  120. - (void)getLabelContourMask:(Mat*)image NS_SWIFT_NAME(getLabelContourMask(image:));
  121. //
  122. // void cv::ximgproc::SuperpixelSLIC::enforceLabelConnectivity(int min_element_size = 25)
  123. //
  124. /**
  125. * Enforce label connectivity.
  126. *
  127. * @param min_element_size The minimum element size in percents that should be absorbed into a bigger
  128. * superpixel. Given resulted average superpixel size valid value should be in 0-100 range, 25 means
  129. * that less then a quarter sized superpixel should be absorbed, this is default.
  130. *
  131. * The function merge component that is too small, assigning the previously found adjacent label
  132. * to this component. Calling this function may change the final number of superpixels.
  133. */
  134. - (void)enforceLabelConnectivity:(int)min_element_size NS_SWIFT_NAME(enforceLabelConnectivity(min_element_size:));
  135. /**
  136. * Enforce label connectivity.
  137. *
  138. * superpixel. Given resulted average superpixel size valid value should be in 0-100 range, 25 means
  139. * that less then a quarter sized superpixel should be absorbed, this is default.
  140. *
  141. * The function merge component that is too small, assigning the previously found adjacent label
  142. * to this component. Calling this function may change the final number of superpixels.
  143. */
  144. - (void)enforceLabelConnectivity NS_SWIFT_NAME(enforceLabelConnectivity());
  145. @end
  146. NS_ASSUME_NONNULL_END