Descriptors/Features of non-textured parts

asked 2017-06-12 04:10:57 -0500

Franz Kaiser gravatar image

updated 2017-06-15 09:55:55 -0500

I would like to find a non-textured target in an image like in this question. The answer in this link recommends an feature/descriptor approach. I like to give this a try, but to be honest, I don't have any experiences about the different Features2D in openCV.

I hope this question isn't too general, but does anybody have an idea what would be an good feature/descriptor combination for untextured objects?

I tried the feature-matching approach with this two pictures: Query Template Unfortunately taking the logo as a template-Image is not an option.

edit retag flag offensive close merge delete

Comments

what exactly are you trying to find there ? the whole tool ? the logo ?

berak gravatar imageberak ( 2017-06-12 05:35:48 -0500 )edit
1

I am trying to find the whole tool, respectively the shape of the "blades"

Franz Kaiser gravatar imageFranz Kaiser ( 2017-06-12 05:43:13 -0500 )edit

in the image there area a caliber .... case (1): you want detect a caliber in any situation (light, place, colour background, more than one caliber etc etc...) or , case (2):, you want know if in a box there are a caliber? case (1) -> cascade classifier .... In these day i try to work with it for first time in my life on opencv3 ... with some trouble, because the opencv_traincascade seems not work well (for sure I make something wrong). case (2) -> the best way and faster is threshold the image with these code:

cvtColor(dest_image, imgHSV, CV_RGB2HSV);
dest_image.copyTo(cdst);
inRange(imgHSV, Scalar(a,b,c), Scalar(a1,b1,c1), imgThresh); /* a,b,c is int from 0 to 255 rgb colour... a1,b1,c1 is int from 0 to 255 hsv var or light condition*/ 

then using find contour

gfx gravatar imagegfx ( 2017-07-12 01:54:39 -0500 )edit

..... then using find contour for find all contour in your image .... the metal of caliber it must be white, so you can find the long rectangle contour result from it, for these you can use drawboundingrect. You can filter the contour by the lenght of side of your boundingrect that you can find. As I can see only one long boundingrect there are on the image ....

the shape of blades is more difficult in these way ... but with a good threshold operation you can obtain the good quality of blades shape .... you can use bitwise operation to compare a "sample" shape with yours threshold shape ... for rotation you can use the long bounging rect previously obtained ... so you can rotate correctly your "red sample shape" using bitwise_and and control if there are more "red" then white

regards gf

gfx gravatar imagegfx ( 2017-07-12 01:59:46 -0500 )edit

Thank you @gfx for your help. The question was you described as case(1). The box doesn't need to be in the image. Training a classifier for finding the same tool with nearly no perspective changes seems to be a overkill, doesn't it? But thanks again for your help.

Franz Kaiser gravatar imageFranz Kaiser ( 2017-07-12 04:56:12 -0500 )edit

case(1) prospective changing is request for sure .... but is not but it is not compulsory to use it. So your case is for multiple detection? (More than one caliber one partially superimposed over each other?). If not considet to use a thresolded image as i suggest you. At last the mechanism is the same for all algorithm ... To find pixels of a certain color, close to pixels of another color with a certain pattern ....

gfx gravatar imagegfx ( 2017-07-12 05:06:10 -0500 )edit

int main() {
    int cornerCount = 100;
    double qualityLevel = 0.01;
    double minDistance = 5;
    int blockSize = 20;
    int useHarris = false;

gfx gravatar imagegfx ( 2017-07-12 10:10:39 -0500 )edit


VideoCapture capture("input.avi");
    string window_name = "result";
    namedWindow(window_name, CV_WINDOW_AUTOSIZE);
    Mat frame;
    for (;;) {
        vector<point2f> corners;
        capture >> frame;
        if (frame.empty())
            break;
        cvtColor(frame,frame,CV_RGB2GRAY);
        goodFeaturesToTrack(frame, corners, cornerCount, qualityLevel,
                            minDistance, noArray(), blockSize,
                            useHarris);
        for (int i = 0; i < cornerCount; i++){
            float x = corners[i].x;
            float y = corners[i].y;
            circle(frame,Point(x,y),5,Scalar(255, 0, 0, 0),2,8,0);
        }
        imshow("result", frame);
        waitKey(10);
    }
    return 0;
}

gfx gravatar imagegfx ( 2017-07-12 10:12:03 -0500 )edit