Class: OpenCV::CvFeatureTree
- Inherits:
-
Object
- Object
- OpenCV::CvFeatureTree
- Defined in:
- ext/opencv/cvfeaturetree.cpp
Instance Method Summary collapse
-
#find_features(desc, k, emax) ⇒ Array
Find features from kd-tree.
-
#new(desc) ⇒ CvFeatureTree
constructor
Create a new kd-tree.
Constructor Details
#new(desc) ⇒ CvFeatureTree
Create a new kd-tree
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'ext/opencv/cvfeaturetree.cpp', line 58
VALUE
rb_initialize(VALUE self, VALUE desc)
{
CvMat* desc_mat = CVMAT_WITH_CHECK(desc);
CvFeatureTreeWrap* self_ptr = (CvFeatureTreeWrap*)DATA_PTR(self);
free(self_ptr);
self_ptr = ALLOC(CvFeatureTreeWrap);
try {
self_ptr->feature_tree = cvCreateKDTree(desc_mat);
}
catch (cv::Exception& e) {
raise_cverror(e);
}
self_ptr->desc = desc;
return self;
}
|
Instance Method Details
#find_features(desc, k, emax) ⇒ Array
Find features from kd-tree
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'ext/opencv/cvfeaturetree.cpp', line 86
VALUE
rb_find_features(VALUE self, VALUE desc, VALUE k, VALUE emax)
{
CvMat* desc_mat = CVMAT_WITH_CHECK(desc);
int _k = NUM2INT(k);
VALUE results = cCvMat::new_object(desc_mat->rows, _k, CV_32SC1);
VALUE dist = cCvMat::new_object(desc_mat->rows, _k, CV_64FC1);
try {
cvFindFeatures(CVFEATURETREE(self), desc_mat, CVMAT(results), CVMAT(dist), _k, NUM2INT(emax));
}
catch (cv::Exception& e) {
raise_cverror(e);
}
return rb_assoc_new(results, dist);
}
|