Ask Your Question

Revision history [back]

How do you change the settings of the FeatureDetector in Java?

Using the code below:

Mat img = Imgcodecs.imread(imageFilepath, Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);

MatOfKeyPoint points = new MatOfKeyPoint();

FeatureDetector featureDetector = FeatureDetector.create(FeatureDetector.FAST);
featureDetector.read("param.yaml");
featureDetector.write("test.yaml");
featureDetector.detect(img, points);

System.out.println("Detected " + points.size() + " points in the image");

Contents of param.yaml:

%YAML:1.0
thresholdStep: 10000.
minThreshold: 50.
maxThreshold: 220.
minRepeatability: 2
minDistBetweenBlobs: 10.
filterByColor: 1
blobColor: 0
filterByArea: 1
minArea: 25.
maxArea: 5000.
filterByCircularity: 0
minCircularity: 8.0000001192092896e-001
maxCircularity: 3.4028234663852886e+038
filterByInertia: 1
minInertiaRatio: 1.0000000149011612e-001
maxInertiaRatio: 3.4028234663852886e+038
filterByConvexity: 1
minConvexity: 9.4999998807907104e-001
maxConvexity: 3.4028234663852886e+038

Contents of test.yaml seems to be blank even after the read.

%YAML:1.0
---