【问题标题】:How to extract specific feature in pattern recognition algorithm in image processing for object detection?如何在图像处理中提取模式识别算法中的特定特征以进行对象检测?
【发布时间】:2016-11-15 14:15:23
【问题描述】:

我想近距离检测物体(飞机门)。该算法应该非常稳健,因此可以在任何飞机(有许多不同的绘画、标志)和任何天气条件(太阳、雨天、白天和黑夜)下实现。

我在 OpenCV 中搜索并实现了其中一些特征提取算法,例如 SURF 、 SIFT 和 ORB ,但结果不是很好。

这里是使用 ORB 特征检测器的代码

#include "opencv2/opencv_modules.hpp"
#include <stdio.h>

#ifndef HAVE_OPENCV_NONFREE

int main(int, char**)
{
    printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
    return -1;
}

#else

#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdlib.h>

using namespace cv;
using namespace std;

static void help()
{
    printf("\nThis program demonstrates using features2d detector, descriptor extractor and simple matcher\n"
            "Using the SURF desriptor:\n"
            "\n"
            "Usage:\n matcher_simple <image1> <image2>\n");
}

Mat src;Mat src_gray;
int thresh = 5;
int max_thresh = 600;
RNG rng(12345);

void thresh_callback(int, void* );

int main(int argc, char** argv)
{


    Mat img1;
    Mat img2;
    img1= imread("a350_1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    resize(img1, img1, Size(700,500), 0, 0, INTER_CUBIC);
    img2= imread("a350_1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    resize(img2, img2, Size(680,480), 0, 0, INTER_CUBIC);

    Mat image;

    if(! img1.data || ! img1.data)
    {
       cout << "Could not open or find the image" << std::endl ;
        return -1;
    }


    // detecting keypoints
    OrbFeatureDetector detector(1500);
    vector<KeyPoint> keypoints1, keypoints2;
    detector.detect(img1, keypoints1);
    detector.detect(img2, keypoints2);

    // computing descriptors
    OrbDescriptorExtractor extractor;
    Mat descriptors1, descriptors2;
    extractor.compute(img1, keypoints1, descriptors1);
    extractor.compute(img2, keypoints2, descriptors2);

    // matching descriptors
    BFMatcher matcher(NORM_HAMMING);
    vector<DMatch> matches;
    matcher.match(descriptors1, descriptors2, matches);

    // drawing the results
    namedWindow("matches", CV_WINDOW_AUTOSIZE);
    Mat img_matches;
    drawMatches(img1, keypoints1, img2, keypoints2, matches, img_matches);
    imshow("matches", img_matches);
    waitKey(0);

    return 0;
    }

#endif

我想提高算法在特征正确匹配方面的鲁棒性。因此,更可靠的特征匹配以目标识别和检测为目的,更加鲁棒和可靠。例如,可以包括窗户和门框之间的距离(在每个飞机型号中都是固定的),然后是门框的厚度等。

我想提取一些海关特征,以便算法适用于任何带有任何绘画和标志的飞机。意味着该算法应该能够通过任何类型的飞机检测到门。某些航空公司的徽标和绘画等特征不应成为关键点/特征。

因此,我喜欢提取可以通用的特征,例如窗户和门框之间的距离(因为对于给定的飞机模型,此特征始终相同)。例如,空客 A350 的门框和最近的窗户之间的最小距离是 1m。所以我想在我的算法中使用这个特性。有什么建议如何提取这些特征?

在这种情况下,我是否应该使用模式识别和机器学习技术,例如深度神经网络或 KNN?

【问题讨论】:

  • 是的,这里使用 ORB 特征检测器添加代码。

标签: c++ opencv image-processing feature-extraction pattern-recognition


【解决方案1】:

如果您可以使用多种类型的对象(门)的数据集,您可以使用SIFT输出等功能进行培训SVM(在OpenCV中,您可以找到几个示例)。

【讨论】:

  • 是的,我可以制作数据集,但我喜欢使用窗口和门之间的距离等特征。如何检测该功能并在SVM中包含? span>
猜你喜欢
  • 2012-03-08
  • 1970-01-01
  • 2020-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多