mirror of
https://github.com/opencv/opencv.git
synced 2024-12-12 15:19:11 +08:00
b14ea19466
core: persistence: output reals as human-friendly expression. #25351 Close #25073 Related https://github.com/opencv/opencv/pull/25087 This patch is need to merge same time with https://github.com/opencv/opencv_contrib/pull/3714 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
68 lines
2.2 KiB
Java
68 lines
2.2 KiB
Java
package org.opencv.test.features2d;
|
|
|
|
import org.opencv.test.OpenCVTestCase;
|
|
import org.opencv.test.OpenCVTestRunner;
|
|
import org.opencv.features2d.AKAZE;
|
|
|
|
public class AKAZEDescriptorExtractorTest extends OpenCVTestCase {
|
|
|
|
AKAZE extractor;
|
|
|
|
@Override
|
|
protected void setUp() throws Exception {
|
|
super.setUp();
|
|
extractor = AKAZE.create(); // default (5,0,3,0.001f,4,4,1)
|
|
}
|
|
|
|
public void testCreate() {
|
|
assertNotNull(extractor);
|
|
}
|
|
|
|
public void testDetectListOfMatListOfListOfKeyPoint() {
|
|
fail("Not yet implemented");
|
|
}
|
|
|
|
public void testDetectListOfMatListOfListOfKeyPointListOfMat() {
|
|
fail("Not yet implemented");
|
|
}
|
|
|
|
public void testDetectMatListOfKeyPoint() {
|
|
fail("Not yet implemented");
|
|
}
|
|
|
|
public void testDetectMatListOfKeyPointMat() {
|
|
fail("Not yet implemented");
|
|
}
|
|
|
|
public void testEmpty() {
|
|
fail("Not yet implemented");
|
|
}
|
|
|
|
public void testReadYml() {
|
|
String filename = OpenCVTestRunner.getTempFileName("yml");
|
|
writeFile(filename, "%YAML:1.0\n---\nformat: 3\nname: \"Feature2D.AKAZE\"\ndescriptor: 4\ndescriptor_channels: 2\ndescriptor_size: 32\nthreshold: 0.125\noctaves: 3\nsublevels: 5\ndiffusivity: 2\n");
|
|
|
|
extractor.read(filename);
|
|
|
|
assertEquals(4, extractor.getDescriptorType());
|
|
assertEquals(2, extractor.getDescriptorChannels());
|
|
assertEquals(32, extractor.getDescriptorSize());
|
|
assertEquals(0.125, extractor.getThreshold());
|
|
assertEquals(3, extractor.getNOctaves());
|
|
assertEquals(5, extractor.getNOctaveLayers());
|
|
assertEquals(2, extractor.getDiffusivity());
|
|
}
|
|
|
|
public void testWriteYml() {
|
|
String filename = OpenCVTestRunner.getTempFileName("yml");
|
|
|
|
extractor.write(filename);
|
|
|
|
String truth = "%YAML:1.0\n---\nformat: 3\nname: \"Feature2D.AKAZE\"\ndescriptor: 5\ndescriptor_channels: 3\ndescriptor_size: 0\nthreshold: 0.0010000000474974513\noctaves: 4\nsublevels: 4\ndiffusivity: 1\nmax_points: -1\n";
|
|
String actual = readFile(filename);
|
|
actual = actual.replaceAll("e([+-])0(\\d\\d)", "e$1$2"); // NOTE: workaround for different platforms double representation
|
|
assertEquals(truth, actual);
|
|
}
|
|
|
|
}
|