File: DMatchTest.java

package info (click to toggle)
opencv 3.2.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 238,480 kB
  • sloc: xml: 901,650; cpp: 703,419; lisp: 20,142; java: 17,843; python: 17,641; ansic: 603; cs: 601; sh: 516; perl: 494; makefile: 117
file content (44 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.opencv.test.core;

import org.opencv.core.DMatch;

import junit.framework.TestCase;

public class DMatchTest extends TestCase {
    public void testDMatch() {
        new DMatch();
    }

    public void testDMatchIntIntFloat() {
        DMatch dm1 = new DMatch(1, 4, 4.0f);

        assertEquals(1, dm1.queryIdx);
        assertEquals(4, dm1.trainIdx);
        assertEquals(4.0f, dm1.distance);
    }

    public void testDMatchIntIntIntFloat() {
        DMatch dm2 = new DMatch(2, 6, -1, 8.0f);

        assertEquals(2, dm2.queryIdx);
        assertEquals(6, dm2.trainIdx);
        assertEquals(-1, dm2.imgIdx);
        assertEquals(8.0f, dm2.distance);
    }

    public void testLessThan() {
        DMatch dm1 = new DMatch(1, 4, 4.0f);
        DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
        assertTrue(dm1.lessThan(dm2));
    }

    public void testToString() {
        DMatch dm2 = new DMatch(2, 6, -1, 8.0f);

        String actual = dm2.toString();

        String expected = "DMatch [queryIdx=2, trainIdx=6, imgIdx=-1, distance=8.0]";
        assertEquals(expected, actual);
    }

}