Class: OpenCV::CvSURFPoint
- Inherits:
-
Object
- Object
- OpenCV::CvSURFPoint
- Defined in:
- ext/opencv/cvsurfpoint.cpp,
ext/opencv/cvsurfpoint.cpp
Overview
C structure is here. typedef struct CvSURFPoint { CvPoint2D32f pt; // position of the feature within the image int laplacian; // -1, 0 or +1. sign of the laplacian at the point. // can be used to speedup feature comparison // (normally features with laplacians of different // signs can not match) int size; // size of the feature float dir; // orientation of the feature: 0..360 degrees float hessian; // value of the hessian (can be used to // approximately estimate the feature strengths) } CvSURFPoint;
Class Method Summary collapse
Instance Method Summary collapse
-
#dir ⇒ Number
Return orientation of the feature: 0..360 degrees.
-
#dir=(value) ⇒ Object
Set orientation of the feature: 0..360 degrees.
-
#hessian ⇒ Number
Return value of the hessian.
-
#hessian=(value) ⇒ Object
Set value of the hessian.
-
#new(pt, laplacian, size, dir, hessian) ⇒ CvSURFPoint
constructor
Create a CvSURFPoint.
-
#laplacian ⇒ Integer
Return sign of the laplacian at the point (-1, 0 or +1).
-
#laplacian=(value) ⇒ Object
Set sign of the laplacian at the point.
-
#pt ⇒ CvPoint2D32f
Return position of the feature as CvPoint2D32f.
-
#pt=(value) ⇒ Object
Set position of the feature.
-
#size ⇒ Integer
Returns size of feature.
-
#size=(value) ⇒ Object
Return size of feature.
Constructor Details
#new(pt, laplacian, size, dir, hessian) ⇒ CvSURFPoint
Create a CvSURFPoint
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'ext/opencv/cvsurfpoint.cpp', line 59 VALUE rb_initialize(VALUE self, VALUE pt, VALUE laplacian, VALUE size, VALUE dir, VALUE hessian) { CvSURFPoint *self_ptr = CVSURFPOINT(self); self_ptr->pt = VALUE_TO_CVPOINT2D32F(pt); self_ptr->laplacian = NUM2INT(laplacian); self_ptr->size = NUM2INT(size); self_ptr->dir = (float)NUM2DBL(dir); self_ptr->hessian = (float)NUM2DBL(hessian); return self; } |
Class Method Details
.flann(objectDesc, imageDesc) ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'ext/opencv/cvsurfpoint.cpp', line 204 VALUE rb_flann(VALUE klass, VALUE objectDesc, VALUE imageDesc) { const cv::Mat m_object(CVMAT(objectDesc)); const cv::Mat m_image(CVMAT(imageDesc)); cv::Mat m_indices(m_object.rows, 2, CV_32S); cv::Mat m_dists(m_object.rows, 2, CV_32F); cv::flann::Index flann_index(m_image, cv::flann::KDTreeIndexParams(4)); // using 4 randomized kdtrees flann_index.knnSearch(m_object, m_indices, m_dists, 2, cv::flann::SearchParams(64)); // maximum number of leafs checked VALUE ptpairs = rb_ary_new(); int* indices_ptr = m_indices.ptr<int>(0); float* dists_ptr = m_dists.ptr<float>(0); for (int i = 0; i < m_indices.rows; ++i) { if (dists_ptr[2 * i] < 0.6 * dists_ptr[2 * i + 1]) { rb_ary_push(ptpairs, rb_int_new(i)); rb_ary_push(ptpairs, rb_int_new(indices_ptr[2 * i])); } } return ptpairs; } |
Instance Method Details
#dir ⇒ Number
Return orientation of the feature: 0..360 degrees
154 155 156 157 158 |
# File 'ext/opencv/cvsurfpoint.cpp', line 154 VALUE rb_get_dir(VALUE self) { return DBL2NUM((double)(CVSURFPOINT(self)->dir)); } |
#dir=(value) ⇒ Object
Set orientation of the feature: 0..360 degrees.
166 167 168 169 170 171 |
# File 'ext/opencv/cvsurfpoint.cpp', line 166 VALUE rb_set_dir(VALUE self, VALUE value) { CVSURFPOINT(self)->dir = (float)NUM2DBL(value); return self; } |
#hessian ⇒ Number
Return value of the hessian
179 180 181 182 183 |
# File 'ext/opencv/cvsurfpoint.cpp', line 179 VALUE rb_get_hessian(VALUE self) { return DBL2NUM((double)(CVSURFPOINT(self)->hessian)); } |
#hessian=(value) ⇒ Object
Set value of the hessian
191 192 193 194 195 196 |
# File 'ext/opencv/cvsurfpoint.cpp', line 191 VALUE rb_set_hessian(VALUE self, VALUE value) { CVSURFPOINT(self)->hessian = (float)NUM2DBL(value); return self; } |
#laplacian ⇒ Integer
Return sign of the laplacian at the point (-1, 0 or +1)
103 104 105 106 107 |
# File 'ext/opencv/cvsurfpoint.cpp', line 103 VALUE rb_get_laplacian(VALUE self) { return INT2NUM(CVSURFPOINT(self)->laplacian); } |
#laplacian=(value) ⇒ Object
Set sign of the laplacian at the point
115 116 117 118 119 120 121 |
# File 'ext/opencv/cvsurfpoint.cpp', line 115 VALUE rb_set_laplacian(VALUE self, VALUE value) { int val = NUM2INT(value); CVSURFPOINT(self)->laplacian = (val > 0) ? 1 : (val < 0) ? -1 : 0; return self; } |
#pt ⇒ CvPoint2D32f
Return position of the feature as CvPoint2D32f.
78 79 80 81 82 |
# File 'ext/opencv/cvsurfpoint.cpp', line 78 VALUE rb_get_pt(VALUE self) { return REFER_OBJECT(cCvPoint2D32f::rb_class(), &CVSURFPOINT(self)->pt, self); } |
#pt=(value) ⇒ Object
Set position of the feature.
90 91 92 93 94 95 |
# File 'ext/opencv/cvsurfpoint.cpp', line 90 VALUE rb_set_pt(VALUE self, VALUE value) { CVSURFPOINT(self)->pt = VALUE_TO_CVPOINT2D32F(value); return self; } |
#size ⇒ Integer
Returns size of feature.
129 130 131 132 133 |
# File 'ext/opencv/cvsurfpoint.cpp', line 129 VALUE rb_get_size(VALUE self) { return INT2NUM(CVSURFPOINT(self)->size); } |
#size=(value) ⇒ Object
Return size of feature
141 142 143 144 145 146 |
# File 'ext/opencv/cvsurfpoint.cpp', line 141 VALUE rb_set_size(VALUE self, VALUE value) { CVSURFPOINT(self)->size = NUM2INT(value); return self; } |