Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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?

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

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).

click to hide/show revision 3
retagged

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

berak gravatar image

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

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).