I search in OpenCV and implemented some of them feature extracting algorithms such as SURF , SIFT and ORB but the results is not so good.
Here the code in C++ and OpenCV using ORB Feature Detector
Code: Select all
#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
I would like to extract some customs features so that the algorithm work for any planes with any paintings and logos. Means the algorithm should be robust to detect the door by any type of plane.Features like Logos of some airlines and paintings should not be keypoints/features.
So because of that I like to extract features that can be general like distance between the window and the door frame(as this feature is always the same for given airplane model). Like for example the minimal distance between the door frame and the nearest window in Airbus A350 is let we say 1m. So I would like to use this feature in my algorithm. Any advice how to extract such features?
Should I use in this case pattern recognition and machine learning techniques such and Deep Neural Networks or KNN?