Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

feature2d_manual.hpp modifications don't take effect

I am trying to use BRIEF descriptor in OpenCV 3.1 for andoid. In order to achieve that OpenCV has to be built from source with _contrib. So I compiled it without errors and could also see BRIEF.cpp.o beeing built in the command window.

When I try to use it, my android app crashes throwing

OpenCV Error: Bad argument (Specified descriptor extractor type is not supported.) in static cv::javaDescriptorExtractor* cv::javaDescriptorExtractor::create(int), file /home/maksim/workspace/android-pack/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp, line 374

So I checked features2d_manual.hpp. Line 374 is the default expression of a switch case block:

CV_WRAP static javaDescriptorExtractor* create( int extractorType )
{
    //String name;

    if (extractorType > OPPONENTEXTRACTOR)
    {
        //name = "Opponent";
        extractorType -= OPPONENTEXTRACTOR;
    }

    Ptr<DescriptorExtractor> de;
    switch(extractorType)
    {
    //case SIFT:
    //    name = name + "SIFT";
    //    break;
    //case SURF:
    //    name = name + "SURF";
    //    break;
    case ORB:
        de = ORB::create();
        break;
    //case BRIEF:
    //    name = name + "BRIEF";
    //    break;
    case BRISK:
        de = BRISK::create();
        break;
    //case FREAK:
    //    name = name + "FREAK";
    //    break;
    case AKAZE:
        de = AKAZE::create();
        break;
    default: //**this is line 374**
        CV_Error( Error::StsBadArg, "Specified descriptor extractor type is not supported." );
        break;
    }

    return new javaDescriptorExtractor(de);

Clearly the error comes up, because case BRIEF is commented. I modified it like that:

#include "opencv2/xfeatures2d.hpp"

. . .

case BRIEF:
    de = xfeatures2d::BriefDescriptorExtractor::create();
    break;

. . .

default:
            CV_Error( Error::StsBadArg, "---TEST--- Specified descriptor extractor type is not supported." );
            break;
        }

After rebuiling in a fresh directory and using the new build, the exact same error is persistent. Not even "---TEST---" is included with the message.

Now I am wondering why my changes do not have any effect.

I am also wondering why the file path is:

/home/maksim/workspace/android-pack/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp

This dirctory doesn't even exist on my system and googling it showed, that /home/maksim/ is part of a lot of different error messages on android.

The actual path before building is:

C:\Users\JJG-CD\Desktop\Build_Workspace\opencv-3.1.0\modules\features2d\misc\java\src\cpp\features2d_manual.hpp

I hope somebody can explain to me what the problem is and eventually give me a hint how to solve it.