DMatch.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // DMatch.h
  3. //
  4. // Created by Giles Payne on 2019/12/25.
  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. NS_ASSUME_NONNULL_BEGIN
  14. /**
  15. * Structure for matching: query descriptor index, train descriptor index, train
  16. * image index and distance between descriptors.
  17. */
  18. CV_EXPORTS @interface DMatch : NSObject
  19. /**
  20. * Query descriptor index.
  21. */
  22. @property int queryIdx;
  23. /**
  24. * Train descriptor index.
  25. */
  26. @property int trainIdx;
  27. /**
  28. * Train image index.
  29. */
  30. @property int imgIdx;
  31. /**
  32. * Distance
  33. */
  34. @property float distance;
  35. #ifdef __cplusplus
  36. @property(readonly) cv::DMatch& nativeRef;
  37. #endif
  38. - (instancetype)init;
  39. - (instancetype)initWithQueryIdx:(int)queryIdx trainIdx:(int)trainIdx distance:(float)distance;
  40. - (instancetype)initWithQueryIdx:(int)queryIdx trainIdx:(int)trainIdx imgIdx:(int)imgIdx distance:(float)distance;
  41. #ifdef __cplusplus
  42. + (instancetype)fromNative:(cv::DMatch&)dMatch;
  43. #endif
  44. /**
  45. * Distance comparison
  46. * @param it DMatch object to compare
  47. */
  48. - (BOOL)lessThan:(DMatch*)it;
  49. /**
  50. * Clone object
  51. */
  52. - (DMatch*)clone;
  53. /**
  54. * Compare for equality
  55. * @param other Object to compare
  56. */
  57. - (BOOL)isEqual:(nullable id)other;
  58. /**
  59. * Calculate hash for this object
  60. */
  61. - (NSUInteger)hash;
  62. /**
  63. * Returns a string that describes the contents of the object
  64. */
  65. - (NSString*)description;
  66. @end
  67. NS_ASSUME_NONNULL_END