CでラップされたOpenCV関数(C ++)(CおよびC++関数定義が含まれています)用の3つのdefcfunがあり、上部の2%brisk
つは下部のパラメーターsurf0
として使用できます。上の 2 つの出力とパラメーターが単なる : pointerの場合、ただし、ファイナライザーを使用できるように、ページの下部にあるものと同様に 3 つのタイプをすべて定義する必要があります。3 つのファイナライザーと型はすべて同じです。ページの下部にある 4 つの関数で inとforを置き換えるだけで、それぞれがどのように見えるかがわかります。の出力と入力の型の型を呼び出すだけでよいでしょうか(self feature-detector)
%feat-detect-detect
self
feat-detect-detect
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))