KeyPoint.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // KeyPoint.h
  3. //
  4. // Created by Giles Payne on 2019/10/08.
  5. //
  6. #pragma once
  7. #ifdef __cplusplus
  8. #import "opencv2/core.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. @class Point2f;
  14. NS_ASSUME_NONNULL_BEGIN
  15. /**
  16. * Object representing a point feature found by one of many available keypoint detectors, such as Harris corner detector, FAST, StarDetector, SURF, SIFT etc.
  17. */
  18. CV_EXPORTS @interface KeyPoint : NSObject
  19. #pragma mark - Properties
  20. /**
  21. * Coordinates of the keypoint.
  22. */
  23. @property Point2f* pt;
  24. /**
  25. * Diameter of the useful keypoint adjacent area.
  26. */
  27. @property float size;
  28. /**
  29. * Computed orientation of the keypoint (-1 if not applicable).
  30. */
  31. @property float angle;
  32. /**
  33. * The response, by which the strongest keypoints have been selected. Can
  34. * be used for further sorting or subsampling.
  35. */
  36. @property float response;
  37. /**
  38. * Octave (pyramid layer), from which the keypoint has been extracted.
  39. */
  40. @property int octave;
  41. /**
  42. * Object ID, that can be used to cluster keypoints by an object they
  43. * belong to.
  44. */
  45. @property int classId;
  46. #ifdef __cplusplus
  47. @property(readonly) cv::KeyPoint& nativeRef;
  48. #endif
  49. #pragma mark - Constructors
  50. - (instancetype)init;
  51. - (instancetype)initWithX:(float)x y:(float)y size:(float)size angle:(float)angle response:(float)response octave:(int)octave classId:(int)classId;
  52. - (instancetype)initWithX:(float)x y:(float)y size:(float)size angle:(float)angle response:(float)response octave:(int)octave;
  53. - (instancetype)initWithX:(float)x y:(float)y size:(float)size angle:(float)angle response:(float)response;
  54. - (instancetype)initWithX:(float)x y:(float)y size:(float)size angle:(float)angle;
  55. - (instancetype)initWithX:(float)x y:(float)y size:(float)size;
  56. #ifdef __cplusplus
  57. + (instancetype)fromNative:(cv::KeyPoint&)keyPoint;
  58. #endif
  59. #pragma mark - Common Methods
  60. /**
  61. * Clone object
  62. */
  63. - (KeyPoint*)clone;
  64. /**
  65. * Compare for equality
  66. * @param other Object to compare
  67. */
  68. - (BOOL)isEqual:(nullable id)other;
  69. /**
  70. * Calculate hash value for this object
  71. */
  72. - (NSUInteger)hash;
  73. /**
  74. * Returns a string that describes the contents of the object
  75. */
  76. - (NSString*)description;
  77. @end
  78. NS_ASSUME_NONNULL_END