-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
OpenCV2_Cookbook/src/test/java/opencv2_cookbook/SURFDetectorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2011-2014 Jarek Sacha. All Rights Reserved. | ||
* | ||
* Author's e-mail: jpsacha at gmail.com | ||
*/ | ||
|
||
package opencv2_cookbook; | ||
|
||
import org.bytedeco.javacpp.opencv_core; | ||
import org.junit.Test; | ||
|
||
import static org.bytedeco.javacpp.opencv_features2d.KeyPoint; | ||
import static org.bytedeco.javacpp.opencv_highgui.imread; | ||
import static org.bytedeco.javacpp.opencv_nonfree.SURF; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class SURFDetectorTest { | ||
|
||
@Test | ||
public void detect() { | ||
final opencv_core.Mat image = imread("data/church01.jpg"); | ||
final KeyPoint keyPoints = new KeyPoint(); | ||
final SURF surf = new SURF(2500, 4, 2, true, false); | ||
// JVM crashes when JavaCV native binaries and OpenCV binaries are build with different versions of VisualStudio | ||
// For instance, JavaCV is build with VC10 and OpenCV with VC11. | ||
|
||
surf.detect(image, keyPoints); | ||
assertEquals(320, keyPoints.capacity()); | ||
} | ||
} |