-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathEx3GoodFeaturesToTrack.scala
42 lines (35 loc) · 1.17 KB
/
Ex3GoodFeaturesToTrack.scala
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
/*
* Copyright (c) 2011-2019 Jarek Sacha. All Rights Reserved.
*
* Author's e-mail: jpsacha at gmail.com
*/
package opencv_cookbook.chapter08
import java.io.File
import opencv_cookbook.OpenCVUtils._
import org.bytedeco.opencv.global.opencv_features2d._
import org.bytedeco.opencv.opencv_core._
import org.bytedeco.opencv.opencv_features2d._
/**
* Example of using the Good Features to Track detector.
*
* The third example for section "Detecting Harris corners" in Chapter 8, page 202.
*/
object Ex3GoodFeaturesToTrack extends App {
// Read input image
val image = loadAndShowOrExit(new File("data/church01.jpg"))
// Compute good features to track
val gftt = GFTTDetector.create(
500 /* maximum number of corners to be returned */ ,
0.01 /* quality level*/ ,
10.0 /* minimum allowed distance between points*/ ,
3 /* block size*/ ,
false /* use Harris detector*/ ,
0.04 /* Harris parameter */
)
val keyPoints = new KeyPointVector()
gftt.detect(image, keyPoints)
// Draw keyPoints
val canvas = new Mat()
drawKeypoints(image, keyPoints, canvas, new Scalar(255, 255, 255, 0), DEFAULT)
show(canvas, "Good Features to Track Detector")
}