Opencv4android extracting feature point descriptors (Feature descriptor)
After the keypoints is obtained (refer to the front), the descriptors at the key points can be calculated by using the corresponding featuredescriptor.
Native Code:
void JNICALL Java_com_example_test_NativeUtil_computeDescripors( JNIEnv *env, jclass thiz, jlong mGrayAddr, jlong mRgbaAddr, jlong mOutputAddr) { Mat* pMatGr=(Mat*)mGrayAddr; Mat* pMatRgb=(Mat*)mRgbaAddr; Mat* pMatDesc=(Mat*)mOutputAddr; vector<KeyPoint> v; //OrbFeatureDetector detector(50); OrbFeatureDetector detector; OrbDescriptorExtractor extractor; detector.detect(*pMatGr, v); extractor.compute(*pMatGr, v, *pMatDesc);}
Operating effect:
The result is true, because the resulting descriptor is a matrix, and each key corresponds to a vector. Information about this vector can be seen through the Logcat log.
06-17 13:25:32.339:i/feature descriptor::activity (2689): row:490,col:32,channels:1
Note that 490 feature points are extracted, the descriptors corresponding to the feature points are 32 dimensions (this is the orb, if it is sift, the dimensions are different)
the error encountered
Error 1:
06-17 12:53:05.021:e/androidruntime (1532): caused By:java.lang.ClassCastException:android.widget.ImageView cannot Be cast to Android.widget.Button
Sometimes inexplicable false report the wrong, by removing R.java to solve.
Reference:
Common Interfaces of Descriptor Extractors
Opencv4android extracting feature point descriptors (Feature descriptor)