How to extract specific feature in pattern recognition algorithm in image processing for object detection?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
astronaut
Posts: 2
Joined: 2016-07-13T00:56:27-07:00
Authentication code: 1151

How to extract specific feature in pattern recognition algorithm in image processing for object detection?

Post by astronaut »

I would like to detect the object (airplane door) from short distance. The algorithm should be very robust so can be implemented by any plane (with lots of different paintings, logos ) and by any weather condition(sun, rain, day and night).

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 improve the algorithm’s robustness with respect to the correct matching of features. So, more reliable feature matching for the purpose of object recognition and detection to be more robust and reliable. Like for example, can include the distance between the window and door frame (which in every airplane model is fix), then the thickness of the door frame etc.

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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to extract specific feature in pattern recognition algorithm in image processing for object detection?

Post by snibgo »

astronaut wrote: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?
What visually distinguishes door frames and windows from anything else?
What is the boundary of your set of images? For example: perhaps the photos are always of just the part of the fuselage that has a door. Or perhaps they might contain the entire aircraft.
Some sample images would help.
snibgo's IM pages: im.snibgo.com
astronaut
Posts: 2
Joined: 2016-07-13T00:56:27-07:00
Authentication code: 1151

Re: How to extract specific feature in pattern recognition algorithm in image processing for object detection?

Post by astronaut »

Windows frame is much smaller then door frame. And is always located in specific position in airplane by given airplane model (let we say Airbus A320).Also to extract the distance between door frame and window no need to use only camera. I can use other LIDAR sensors like infrared or laser. The photos can contain the entire aircraft as can be taken while the aircraft is approaching the parking position.
Post Reply