If you think the Android project android-opencv-template listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package org.opencv.core;
//fromwww.java2s.comimport java.util.Arrays;
import java.util.List;
publicclass MatOfFloat6 extends Mat {
// 32FC6
privatestaticfinalint _depth = CvType.CV_32F;
privatestaticfinalint _channels = 6;
public MatOfFloat6() {
super();
}
protected MatOfFloat6(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
thrownew IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
publicstatic MatOfFloat6 fromNativeAddr(long addr) {
returnnew MatOfFloat6(addr);
}
public MatOfFloat6(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
thrownew IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
public MatOfFloat6(float...a) {
super();
fromArray(a);
}
publicvoid alloc(int elemNumber) {
if(elemNumber>0)
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
}
publicvoid fromArray(float...a) {
if(a==null || a.length==0)
return;
int num = a.length / _channels;
alloc(num);
put(0, 0, a); //TODO: check ret val!
}
publicfloat[] toArray() {
int num = checkVector(_channels, _depth);
if(num < 0)
thrownew RuntimeException("Native Mat has unexpected type or size: " + toString());
float[] a = newfloat[num * _channels];
if(num == 0)
return a;
get(0, 0, a); //TODO: check ret val!
return a;
}
publicvoid fromList(List<Float> lb) {
if(lb==null || lb.size()==0)
return;
Float ab[] = lb.toArray(new Float[0]);
float a[] = newfloat[ab.length];
for(int i=0; i<ab.length; i++)
a[i] = ab[i];
fromArray(a);
}
public List<Float> toList() {
float[] a = toArray();
Float ab[] = new Float[a.length];
for(int i=0; i<a.length; i++)
ab[i] = a[i];
return Arrays.asList(ab);
}
}