Convert a MatOfPoint to an array or Points or to a List<Point>.

asked 2013-09-30 09:13:24 -0500

Rui Marques gravatar image

updated 2013-09-30 13:31:33 -0500

berak gravatar image

Some of android's opencv functions return or have a MatOfPoint (or MatOf*) parameter. If somehow you have to manipulate those point's you have to convert it to a List or array.

MatOfPoint mop = new MatOfPoint();

List<point> lp = mop.toList();

Point[] pArray = mop.toArray();

Intuition will say that the array method is probably faster but what are your experiences with this, have you tried both in real-world applications?

Reading this stackoverflow thread you might get to the conclusion that the performance advantage of using arrays is not worth it. But I am not sure of the impact of (toList & fromList) Vs. (toArray & fromArray).

edit retag flag offensive close merge delete