1

如何将提取的特征点从图像帧中存储在 android 的 SQLlite 数据库中?我能够使用 C++ 在 NDK 中成功检测和提取特征点,现在我想存储这些特征点,然后将其用于与相机中检测到的特征点进行比较。

这是我计划处理的示例代码

JNIEXPORT void JNICALLJava_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)

{
Mat& mGr  = *(Mat*)addrGray;
Mat& mRgb = *(Mat*)addrRgba;
cv::Mat descriptor;

vector<KeyPoint> v;

cv::OrbFeatureDetector detector;
cv::OrbDescriptorExtractor extractor;
detector.detect(mGr, v);

extractor.compute(mGr,v,descriptor);

    {
    // code for storing the feature points
    }
    }
Java_org_opencv_samples_tutorial2_Tutorial2Activity_MatchFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{
Mat& mGr  = *(Mat*)addrGray;
Mat& mRgb = *(Mat*)addrRgba;
cv::Mat descriptor;

vector<KeyPoint> v1;

cv::OrbFeatureDetector detector1;
cv::OrbDescriptorExtractor extractor1;
detector1.detect(mGr, v1);

extractor1.compute(mGr,v1,descriptor1);
{
// code for fetching the feature points from database
}
    cv::BFMatcher matcher1;

    std::vector<cv::DMatch> matches;
matcher1.match({descriptor extracted from database},descriptor1,matches);

 // here comes code for finding good matches by ratio test  and Homograpgy 
}

有人可以解释如何在android中从数据库中存储和提取特征点。

4

0 回答 0