File: KeyPointTest.swift

package info (click to toggle)
opencv 4.10.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 282,092 kB
  • sloc: cpp: 1,178,079; xml: 682,621; python: 49,092; lisp: 31,150; java: 25,469; ansic: 11,039; javascript: 6,085; sh: 1,214; cs: 601; perl: 494; objc: 210; makefile: 173
file content (59 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
//  KeyPointTest.swift
//
//  Created by Giles Payne on 2020/01/31.
//

import XCTest
import OpenCV

class KeyPointTest: OpenCVTestCase {

    let angle:Float = 30
    let classId:Int32 = 1
    let octave:Int32 = 1
    let response:Float = 2.0
    let size:Float = 3.0
    let x:Float = 1.0
    let y:Float = 2.0

    func testKeyPoint() {
        let keyPoint = KeyPoint()
        assertPoint2fEquals(Point2f(x: 0, y: 0), keyPoint.pt, OpenCVTestCase.FEPS)
    }

    func testKeyPointFloatFloatFloat() {
        let keyPoint = KeyPoint(x: x, y: y, size: size)
        assertPoint2fEquals(Point2f(x: 1, y: 2), keyPoint.pt, OpenCVTestCase.FEPS)
    }

    func testKeyPointFloatFloatFloatFloat() {
        let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 10.0)
        XCTAssertEqual(10.0, keyPoint.angle);
    }

    func testKeyPointFloatFloatFloatFloatFloat() {
        let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0)
        XCTAssertEqual(1.0, keyPoint.response)
    }

    func testKeyPointFloatFloatFloatFloatFloatInt() {
        let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0, octave: 1)
        XCTAssertEqual(1, keyPoint.octave)
    }

    func testKeyPointFloatFloatFloatFloatFloatIntInt() {
        let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0, octave: 1, classId: 1)
        XCTAssertEqual(1, keyPoint.classId)
    }

    func testToString() {
        let keyPoint = KeyPoint(x: x, y: y, size: size, angle: angle, response: response, octave: octave, classId: classId)

        let actual = "\(keyPoint)"

        let expected = "KeyPoint { pt: Point2f {1.000000,2.000000}, size: 3.000000, angle: 30.000000, response: 2.000000, octave: 1, classId: 1}"
        XCTAssertEqual(expected, actual)
    }

}