小编gus*_*a_w的帖子

如何将 OpenCV Keypoint 特征保存到数据库?

我的项目是使用 OpenCV 库识别 Android 上的叶子。我使用ORB检测来获取图像的关键点并使用ORB描述符来获取关键点的特征。这是我使用的代码:

bmp=BitmapFactory.decodeResource(getResources(),R.drawable.t1);
Utils.bitmapToMat(bmp, mat);
FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
detector.detect(mat, keypoints);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
extractor.compute(mat, keypoints, features);
Run Code Online (Sandbox Code Playgroud)

来源:http : //answers.opencv.org/question/6260/orb-features/

但是每次我输入相同的图像,该图像的关键点总是不同的。如果总是不同,我可以将关键点的特征保存到数据库吗?或者我应该保存图像以保存特征数据?如果可以保存到数据库,我该怎么做??

android opencv feature-extraction orb

4
推荐指数
1
解决办法
6605
查看次数

Android:将灰度转换为二进制图像

我完成了获得灰度值,但我不知道如何使用函数将灰度转换为二进制图像.请帮帮我,这里是我的功能代码:

public Bitmap toBinary(Bitmap bmpOriginal) {
    int width, height, threshold;
    height = bmpOriginal.getHeight();
    width = bmpOriginal.getWidth();
    threshold = 127;
    final Bitmap bmpBinary = null;

    for(int x = 0; x < width; ++x) {
        for(int y = 0; y < height; ++y) {
            // get one pixel color
            int pixel = bmpOriginal.getPixel(x, y);

            //get grayscale value
            int gray = (int)(pixel & 0xFF);

            //get binary value
            if(gray < threshold){
                bmpBinary.setPixel(x, y, 0);
            } else{
                bmpBinary.setPixel(x, y, 255);
            }

        }
    }
    return bmpBinary; …
Run Code Online (Sandbox Code Playgroud)

binary android bitmap grayscale

0
推荐指数
1
解决办法
6463
查看次数

将ORB功能与阈值匹配

我的项目是基于android的草药识别.我使用ORB来获取关键点,功能和匹配功能.

我想用这个算法:

  1. 我使用4参考图像,并将它们的特征image1匹配到图像1,1-2,1-3,1-4,2-3,3,4.
  2. 然后我将最小和最大距离存储到数据库作为阈值.(最小阈值=总最小值/ 6)
  3. 当我识别出新图像时,我将新的最小和最大距离与数据库进行比较.但我不知道该怎么做.

{

for (j=MinID; j<=MaxID; j++){
                        MatOfDMatch matches = DetectUtility.match(features, matFromJson(DB.GetORBFitur(j)));
                        List<DMatch> matchesList = matches.toList();
                        Double max_dist = 0.0;
                        Double min_dist = 100.0;
                        for (int i = 0; i < matchesList.size(); i++){
                            Double dist = (double) matchesList.get(i).distance;
                            if (dist < min_dist && dist != 0){
                                min_dist = dist;
                            }
                            if (dist > max_dist){
                                max_dist = dist;
                            }
                        }
Run Code Online (Sandbox Code Playgroud)

这个网站,我得到这个代码:

//-- Draw only "good" matches (i.e. whose distance is less than 3*min_dist )
std::vector< …
Run Code Online (Sandbox Code Playgroud)

android opencv matching threshold orb

0
推荐指数
1
解决办法
4783
查看次数