Java equivalent for Vec and Matx?
Hi,
I'm doing a project with OpenCV 2.4.4 Java wrappers and I need to know what is the equivalent for Vec and Matx classes. Thanks in advance.
Regards.
Hi,
I'm doing a project with OpenCV 2.4.4 Java wrappers and I need to know what is the equivalent for Vec and Matx classes. Thanks in advance.
Regards.
Vec and Mat are just for small vector/matrix where the size is known at compile time. You could use Point/Point2f/Point3f/Scalar depending on the needed size.
But you should probably used Mat for other size, I've seen nothing in Java doc, maybe because this class are template for the compilation, therefore not binded in Java... Or you can create your templated class in Java for usual size (2x2,3x3,4x4,...).
It that means I can replace them with native Java arrays? Like for instance:
Vec2i -> int[2]
Vec6d -> double[6]
Matx31f -> float[3][1]
Matx66d -> double[6][6]
Or it's better to create a generic class for each one, like:
public class Vec<T> {
private int size;
private Object[] data;
public Vec(int size) {
this.size = size;
this.data = new Object[size];
}
// other methods
}
so Vec2i could be represented like: Vec<Integer> v = new Vec<Integer>(2) ?
Asked: 2013-03-14 22:23:57 -0600
Seen: 848 times
Last updated: Mar 15 '13
Unresolved inclusion in OpenCV+Android tutorial
How to convert Floating point image to 32-bit single-channel?
How to translate this to Java?
android: how to put a column into Mat
OpenCV Tutorial 1 - Add OpenCV on API 8
Running the OpenCV4Android application on my PC
Using OpenCV as a stress detector