我有3个defcfuns,用于OpenCV函数(C ++)已经包含在C中(已包含C和C +++函数定义),前2,%brisk
和surf0
都可以用作底部(self feature-detector)
中的%feat-detect-detect
参数self
。如果前两个的输出和feat-detect-detect
的{{1}}参数只是:指针,但我需要将它们的所有三种类型定义为与页面底部的类型相似,这样我才能使用终结者。这三个的所有终结器和类型都是相同的,只需在页面底部的四个函数中替换brisk
和surf
feature-detector
,您就会知道每个看起来是什么喜欢。我应该只调用brisk
和surf
的输出类型以及feat-detect-detect
的输入类型,并使它们全部使用相同的4函数类型/终结器组合页面的底部,或者有更好的方法。
;; BRISK::BRISK(int thresh=30, int octaves=3, float patternScale=1.0f)
;; BRISK* cv_create_BRISK(int thresh, int octaves, float patternScale)
(defcfun ("cv_create_BRISK" %brisk) brisk
(thresh :int)
(octaves :int)
(pattern-scale :float))
;; SURF::SURF()
;; SURF* cv_create_SURF()
(defcfun ("cv_create_SURF" surf0) surf)
;; void FeatureDetector::detect(const Mat& image, vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const
;; void cv_FeatureDetector_detect3(FeatureDetector* self, Mat* image, vector_KeyPoint* keypoints, Mat* mask)
(defcfun ("cv_FeatureDetector_detect3" %feat-detector-detect) :void
(self feature-detector)
(image mat)
(keypoints (:pointer vector-keypoint))
(mask mat))
(define-foreign-type feature-detector ()
((garbage-collect :reader garbage-collect :initform nil :initarg
:garbage-collect))
(:actual-type :pointer)
(:simple-parser feature-detector))
(defclass cv-feature-detector ()
((c-pointer :reader c-pointer :initarg :c-pointer)))
(defmethod translate-to-foreign ((lisp-value cv-feature-detector) (c-type feature-detector))
(c-pointer lisp-value))
(defmethod translate-from-foreign (c-pointer (c-type feature-detector))
(let ((feature-detector (make-instance 'cv-feature-detector :c-pointer c-pointer)))
(when (garbage-collect c-type)
(tg:finalize feature-detector (lambda () (del-feature-detector c-pointer))))
feature-detector))
ound matches of keypoints from two images."
(%draw-matches img1 keypoints1 img2 keypoints2 matches1to2 outimg match-color single-point-color matches-mask flags))