/// <summary> /// Creates instance from raw pointer T* /// </summary> /// <param name="ptr"></param> internal static new Feature2D FromRawPtr(IntPtr ptr) { if (ptr == IntPtr.Zero) throw new OpenCvSharpException("Invalid Feature2D pointer"); var detector = new Feature2D { detectorPtr = null, ptr = ptr }; return detector; }
/// <summary> /// Creates instance from cv::Ptr<T> . /// ptr is disposed when the wrapper disposes. /// </summary> /// <param name="ptr"></param> internal static new Feature2D FromPtr(IntPtr ptr) { if (ptr == IntPtr.Zero) throw new OpenCvSharpException("Invalid cv::Ptr<Feature2D> pointer"); var ptrObj = new Ptr<Feature2D>(ptr); var detector = new Feature2D { detectorPtr = ptrObj, ptr = ptrObj.Obj }; return detector; }
/// <summary> /// The constructor. /// </summary> /// <param name="dextractor">Descriptor extractor that is used to compute descriptors for an input image and its keypoints.</param> /// <param name="dmatcher">Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image.</param> public BOWImgDescriptorExtractor(Feature2D dextractor, DescriptorMatcher dmatcher) { if (dextractor == null) { throw new ArgumentNullException(nameof(dextractor)); } if (dmatcher == null) { throw new ArgumentNullException(nameof(dmatcher)); } ptr = NativeMethods.features2d_BOWImgDescriptorExtractor_new1( dextractor.PtrObj, dmatcher.PtrObj); }
/// <summary> /// Creates instance from raw pointer T* /// </summary> /// <param name="ptr"></param> internal static new Feature2D FromRawPtr(IntPtr ptr) { if (ptr == IntPtr.Zero) { throw new OpenCvSharpException("Invalid Feature2D pointer"); } var detector = new Feature2D { detectorPtr = null, ptr = ptr }; return(detector); }
/// <summary> /// Creates instance from cv::Ptr<T> . /// ptr is disposed when the wrapper disposes. /// </summary> /// <param name="ptr"></param> internal static new Feature2D FromPtr(IntPtr ptr) { if (ptr == IntPtr.Zero) { throw new OpenCvSharpException("Invalid cv::Ptr<Feature2D> pointer"); } var ptrObj = new Ptr <Feature2D>(ptr); var detector = new Feature2D { detectorPtr = ptrObj, ptr = ptrObj.Obj }; return(detector); }
/// <summary> /// Create feature detector by detector name. /// </summary> /// <param name="detectorType"></param> /// <returns></returns> public static new Feature2D Create(string detectorType) { if (String.IsNullOrEmpty(detectorType)) { throw new ArgumentNullException("detectorType"); } // gets cv::Ptr<Feature2D> IntPtr ptr = NativeMethods.features2d_Feature2D_create(detectorType); try { Feature2D detector = FromPtr(ptr); return(detector); } catch (OpenCvSharpException) { throw new OpenCvSharpException("Detector name '{0}' is not valid.", detectorType); } }