user1393500
user1393500

Reputation: 199

Convert List<KeyPoint> to MatofKeypoints

So I am working on image recognition with Java and OpenCV, but I am stuck trying to convert the Arraylist back into a MatOfKeyPoint.

List<KeyPoint> newList = new ArrayList<KeyPoint>(points.subList(0, 500));

So I need to convert the newList back to a MatofKeyPoint. Any ideas?

Upvotes: 2

Views: 1207

Answers (1)

JustDanyul
JustDanyul

Reputation: 14044

MatOfKeyPoint has a fromList method

MatOfKeyPoint kp = new MatOfKeyPoint();
kp.fromList(newList);

for stuff like this, be sure to have a peek at the relevant javadocs :)

Upvotes: 2

Related Questions