making CV data type to be int
This commit is contained in:
parent
8378ba7554
commit
3d9cb082c9
@ -122,7 +122,7 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
//OpenCVTestRunner.Log(m1.toString());
|
//OpenCVTestRunner.Log(m1.toString());
|
||||||
//OpenCVTestRunner.Log(m2.toString());
|
//OpenCVTestRunner.Log(m2.toString());
|
||||||
|
|
||||||
if (!m1.type().equals(m2.type()) ||
|
if (m1.type() != m2.type() ||
|
||||||
m1.cols() != m2.cols() || m1.rows() != m2.rows()) {
|
m1.cols() != m2.cols() || m1.rows() != m2.rows()) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class Converters {
|
|||||||
if(pts == null)
|
if(pts == null)
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
if(!CvType.CV_32SC2.equals(m.type()) || m.rows()!=1 )
|
if(CvType.CV_32SC2 != m.type() || m.rows()!=1 )
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
|
|
||||||
pts.clear();
|
pts.clear();
|
||||||
@ -65,7 +65,7 @@ public class Converters {
|
|||||||
if(mats == null)
|
if(mats == null)
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
if(!CvType.CV_32SC2.equals(m.type()) || m.rows()!=1 )
|
if(CvType.CV_32SC2 != m.type() || m.rows()!=1 )
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
|
|
||||||
mats.clear();
|
mats.clear();
|
||||||
@ -102,7 +102,7 @@ public class Converters {
|
|||||||
if(fs == null)
|
if(fs == null)
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
if(!CvType.CV_32FC1.equals(m.type()) || m.rows()!=1 )
|
if(CvType.CV_32FC1 != m.type() || m.rows()!=1 )
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
|
|
||||||
fs.clear();
|
fs.clear();
|
||||||
@ -151,7 +151,7 @@ public class Converters {
|
|||||||
if(is == null)
|
if(is == null)
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
if(!CvType.CV_32SC1.equals(m.type()) || m.rows()!=1 )
|
if(CvType.CV_32SC1 != m.type() || m.rows()!=1 )
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
|
|
||||||
is.clear();
|
is.clear();
|
||||||
@ -186,7 +186,7 @@ public class Converters {
|
|||||||
if(rs == null)
|
if(rs == null)
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
if(!CvType.CV_32SC4.equals(m.type()) || m.rows()!=1 )
|
if(CvType.CV_32SC4 != m.type() || m.rows()!=1 )
|
||||||
throw new java.lang.IllegalArgumentException();
|
throw new java.lang.IllegalArgumentException();
|
||||||
|
|
||||||
rs.clear();
|
rs.clear();
|
||||||
|
@ -3,8 +3,16 @@ package org.opencv.core;
|
|||||||
|
|
||||||
public final class CvType {
|
public final class CvType {
|
||||||
|
|
||||||
|
// type depth constants
|
||||||
|
public static final int CV_8U = 0, CV_8S = 1,
|
||||||
|
CV_16U = 2, CV_16S = 3,
|
||||||
|
CV_32S = 4,
|
||||||
|
CV_32F = 5,
|
||||||
|
CV_64F = 6,
|
||||||
|
CV_USRTYPE1=7;
|
||||||
|
|
||||||
// predefined type constants
|
// predefined type constants
|
||||||
public static final CvType
|
public static final int
|
||||||
CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
|
CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
|
||||||
CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
|
CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
|
||||||
CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
|
CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
|
||||||
@ -13,21 +21,9 @@ public final class CvType {
|
|||||||
CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
|
CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
|
||||||
CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4);
|
CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4);
|
||||||
|
|
||||||
// type depth constants
|
|
||||||
public static final int CV_8U = 0,
|
|
||||||
CV_8S = 1,
|
|
||||||
CV_16U = 2,
|
|
||||||
CV_16S = 3,
|
|
||||||
CV_32S = 4,
|
|
||||||
CV_32F = 5,
|
|
||||||
CV_64F = 6,
|
|
||||||
CV_USRTYPE1=7;
|
|
||||||
|
|
||||||
private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
|
private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
|
||||||
|
|
||||||
private final int value;
|
public static final int makeType(int depth, int channels) {
|
||||||
|
|
||||||
protected CvType(int depth, int channels) {
|
|
||||||
if(channels<=0 || channels>=CV_CN_MAX) {
|
if(channels<=0 || channels>=CV_CN_MAX) {
|
||||||
throw new java.lang.UnsupportedOperationException(
|
throw new java.lang.UnsupportedOperationException(
|
||||||
"Channels count should be 1.." + (CV_CN_MAX-1) );
|
"Channels count should be 1.." + (CV_CN_MAX-1) );
|
||||||
@ -36,56 +32,52 @@ public final class CvType {
|
|||||||
throw new java.lang.UnsupportedOperationException(
|
throw new java.lang.UnsupportedOperationException(
|
||||||
"Data type depth should be 0.." + (CV_DEPTH_MAX-1) );
|
"Data type depth should be 0.." + (CV_DEPTH_MAX-1) );
|
||||||
}
|
}
|
||||||
value = (depth & (CV_DEPTH_MAX-1)) + ((channels-1) << CV_CN_SHIFT);
|
return (depth & (CV_DEPTH_MAX-1)) + ((channels-1) << CV_CN_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CvType(int val) { value = val; }
|
|
||||||
|
|
||||||
public static final CvType CV_8UC(int ch) { return new CvType(CV_8U, ch); }
|
public static final int CV_8UC(int ch) { return makeType(CV_8U, ch); }
|
||||||
|
|
||||||
public static final CvType CV_8SC(int ch) { return new CvType(CV_8S, ch); }
|
public static final int CV_8SC(int ch) { return makeType(CV_8S, ch); }
|
||||||
|
|
||||||
public static final CvType CV_16UC(int ch) { return new CvType(CV_16U, ch); }
|
public static final int CV_16UC(int ch) { return makeType(CV_16U, ch); }
|
||||||
|
|
||||||
public static final CvType CV_16SC(int ch) { return new CvType(CV_16S, ch); }
|
public static final int CV_16SC(int ch) { return makeType(CV_16S, ch); }
|
||||||
|
|
||||||
public static final CvType CV_32SC(int ch) { return new CvType(CV_32S, ch); }
|
public static final int CV_32SC(int ch) { return makeType(CV_32S, ch); }
|
||||||
|
|
||||||
public static final CvType CV_32FC(int ch) { return new CvType(CV_32F, ch); }
|
public static final int CV_32FC(int ch) { return makeType(CV_32F, ch); }
|
||||||
|
|
||||||
public static final CvType CV_64FC(int ch) { return new CvType(CV_64F, ch); }
|
public static final int CV_64FC(int ch) { return makeType(CV_64F, ch); }
|
||||||
|
|
||||||
public final int toInt() { return value; }
|
public static final int channels(int type) { return (type >> CV_CN_SHIFT) + 1; }
|
||||||
|
|
||||||
public final int channels() { return (value >> CV_CN_SHIFT) + 1; }
|
public static final int depth(int type) { return type & (CV_DEPTH_MAX-1); }
|
||||||
|
|
||||||
public final int depth() { return value & (CV_DEPTH_MAX-1); }
|
public static final boolean isInteger(int type) { return depth(type) < CV_32F; }
|
||||||
|
|
||||||
public final boolean isInteger() { return depth() < CV_32F; }
|
public static final int ELEM_SIZE(int type) {
|
||||||
|
switch (depth(type)) {
|
||||||
public final int CV_ELEM_SIZE() {
|
|
||||||
switch (depth()) {
|
|
||||||
case CV_8U:
|
case CV_8U:
|
||||||
case CV_8S:
|
case CV_8S:
|
||||||
return channels();
|
return channels(type);
|
||||||
case CV_16U:
|
case CV_16U:
|
||||||
case CV_16S:
|
case CV_16S:
|
||||||
return 2 * channels();
|
return 2 * channels(type);
|
||||||
case CV_32S:
|
case CV_32S:
|
||||||
case CV_32F:
|
case CV_32F:
|
||||||
return 4 * channels();
|
return 4 * channels(type);
|
||||||
case CV_64F:
|
case CV_64F:
|
||||||
return 8 * channels();
|
return 8 * channels(type);
|
||||||
default:
|
default:
|
||||||
throw new java.lang.UnsupportedOperationException(
|
throw new java.lang.UnsupportedOperationException(
|
||||||
"Unsupported CvType value: " + value );
|
"Unsupported CvType value: " + type );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static final String typeToString(int type) {
|
||||||
public final String toString() {
|
|
||||||
String s;
|
String s;
|
||||||
switch (depth()) {
|
switch (depth(type)) {
|
||||||
case CV_8U:
|
case CV_8U:
|
||||||
s = "CV_8U";
|
s = "CV_8U";
|
||||||
break;
|
break;
|
||||||
@ -111,20 +103,9 @@ public final class CvType {
|
|||||||
s = "CV_USRTYPE1";
|
s = "CV_USRTYPE1";
|
||||||
}
|
}
|
||||||
|
|
||||||
int ch = channels();
|
int ch = channels(type);
|
||||||
if(ch<=4) return s + "C" + ch;
|
if(ch<=4) return s + "C" + ch;
|
||||||
else return s + "C(" + ch + ")";
|
else return s + "C(" + ch + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
// hashCode() has to be overridden if equals() is
|
|
||||||
@Override
|
|
||||||
public final int hashCode() { return value; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if ( !(obj instanceof CvType) ) return false;
|
|
||||||
CvType other = (CvType) obj;
|
|
||||||
return value == other.value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,27 +16,17 @@ public class Mat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::Mat(rows,cols,type)
|
//javadoc:Mat::Mat(rows,cols,type)
|
||||||
public Mat(int rows, int cols, CvType type) {
|
public Mat(int rows, int cols, int type) {
|
||||||
this( nCreateMat(rows, cols, type.toInt()) );
|
this( nCreateMat(rows, cols, type) );
|
||||||
}
|
|
||||||
|
|
||||||
//javadoc:Mat::Mat(rows,cols,depth)
|
|
||||||
public Mat(int rows, int cols, int depth) {
|
|
||||||
this( rows, cols, new CvType(depth, 1) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::Mat(rows,cols,type,s)
|
//javadoc:Mat::Mat(rows,cols,type,s)
|
||||||
public Mat(int rows, int cols, CvType type, Scalar s) {
|
public Mat(int rows, int cols, int type, Scalar s) {
|
||||||
this( nCreateMat(rows, cols, type.toInt(), s.val[0], s.val[1], s.val[2], s.val[3]) );
|
this( nCreateMat(rows, cols, type, s.val[0], s.val[1], s.val[2], s.val[3]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::Mat(rows,cols,depth,s)
|
//javadoc:Mat::release()
|
||||||
public Mat(int rows, int cols, int depth, Scalar s) {
|
public void release() {
|
||||||
this( rows, cols, new CvType(depth, 1), s );
|
|
||||||
}
|
|
||||||
|
|
||||||
//javadoc:Mat::dispose()
|
|
||||||
public void dispose() {
|
|
||||||
nRelease(nativeObj);
|
nRelease(nativeObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +42,7 @@ public class Mat {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
if(nativeObj == 0) return "Mat [ nativeObj=NULL ]";
|
if(nativeObj == 0) return "Mat [ nativeObj=NULL ]";
|
||||||
return "Mat [ " +
|
return "Mat [ " +
|
||||||
rows() + "*" + cols() + "*" + type() +
|
rows() + "*" + cols() + "*" + CvType.typeToString(type()) +
|
||||||
", isCont=" + isContinuous() + ", isSubmat=" + isSubmatrix() +
|
", isCont=" + isContinuous() + ", isSubmat=" + isSubmatrix() +
|
||||||
", nativeObj=0x" + Long.toHexString(nativeObj) +
|
", nativeObj=0x" + Long.toHexString(nativeObj) +
|
||||||
", dataAddr=0x" + Long.toHexString(dataAddr()) +
|
", dataAddr=0x" + Long.toHexString(dataAddr()) +
|
||||||
@ -82,19 +72,19 @@ public class Mat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::type()
|
//javadoc:Mat::type()
|
||||||
public CvType type() {
|
public int type() {
|
||||||
checkNull();
|
checkNull();
|
||||||
return new CvType( nType(nativeObj) );
|
return nType(nativeObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::depth()
|
//javadoc:Mat::depth()
|
||||||
public int depth() { return type().depth(); }
|
public int depth() { return CvType.depth(type()); }
|
||||||
|
|
||||||
//javadoc:Mat::channels()
|
//javadoc:Mat::channels()
|
||||||
public int channels() { return type().channels(); }
|
public int channels() { return CvType.channels(type()); }
|
||||||
|
|
||||||
//javadoc:Mat::elemSize()
|
//javadoc:Mat::elemSize()
|
||||||
public int elemSize() { return type().CV_ELEM_SIZE(); }
|
public int elemSize() { return CvType.ELEM_SIZE(type()); }
|
||||||
|
|
||||||
//javadoc:Mat::rows()
|
//javadoc:Mat::rows()
|
||||||
public int rows() {
|
public int rows() {
|
||||||
@ -177,8 +167,8 @@ public class Mat {
|
|||||||
public int put(int row, int col, float[] data) {
|
public int put(int row, int col, float[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_32F) {
|
if(CvType.depth(t) == CvType.CV_32F) {
|
||||||
return nPutF(nativeObj, row, col, data.length, data);
|
return nPutF(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -189,8 +179,8 @@ public class Mat {
|
|||||||
public int put(int row, int col, int[] data) {
|
public int put(int row, int col, int[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_32S) {
|
if(CvType.depth(t) == CvType.CV_32S) {
|
||||||
return nPutI(nativeObj, row, col, data.length, data);
|
return nPutI(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -201,8 +191,8 @@ public class Mat {
|
|||||||
public int put(int row, int col, short[] data) {
|
public int put(int row, int col, short[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_16U || t.depth() == CvType.CV_16S) {
|
if(CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
|
||||||
return nPutS(nativeObj, row, col, data.length, data);
|
return nPutS(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -213,8 +203,8 @@ public class Mat {
|
|||||||
public int put(int row, int col, byte[] data) {
|
public int put(int row, int col, byte[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_8U || t.depth() == CvType.CV_8S) {
|
if(CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
|
||||||
return nPutB(nativeObj, row, col, data.length, data);
|
return nPutB(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -224,8 +214,8 @@ public class Mat {
|
|||||||
//javadoc:Mat::get(row,col,data)
|
//javadoc:Mat::get(row,col,data)
|
||||||
public int get(int row, int col, byte[] data) {
|
public int get(int row, int col, byte[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_8U || t.depth() == CvType.CV_8S) {
|
if(CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
|
||||||
return nGetB(nativeObj, row, col, data.length, data);
|
return nGetB(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -234,8 +224,8 @@ public class Mat {
|
|||||||
//javadoc:Mat::get(row,col,data)
|
//javadoc:Mat::get(row,col,data)
|
||||||
public int get(int row, int col, short[] data) {
|
public int get(int row, int col, short[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_16U || t.depth() == CvType.CV_16S) {
|
if(CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
|
||||||
return nGetS(nativeObj, row, col, data.length, data);
|
return nGetS(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -244,8 +234,8 @@ public class Mat {
|
|||||||
//javadoc:Mat::get(row,col,data)
|
//javadoc:Mat::get(row,col,data)
|
||||||
public int get(int row, int col, int[] data) {
|
public int get(int row, int col, int[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_32S) {
|
if(CvType.depth(t) == CvType.CV_32S) {
|
||||||
return nGetI(nativeObj, row, col, data.length, data);
|
return nGetI(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -254,8 +244,8 @@ public class Mat {
|
|||||||
//javadoc:Mat::get(row,col,data)
|
//javadoc:Mat::get(row,col,data)
|
||||||
public int get(int row, int col, float[] data) {
|
public int get(int row, int col, float[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_32F) {
|
if(CvType.depth(t) == CvType.CV_32F) {
|
||||||
return nGetF(nativeObj, row, col, data.length, data);
|
return nGetF(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -264,8 +254,8 @@ public class Mat {
|
|||||||
//javadoc:Mat::get(row,col,data)
|
//javadoc:Mat::get(row,col,data)
|
||||||
public int get(int row, int col, double[] data) {
|
public int get(int row, int col, double[] data) {
|
||||||
checkNull();
|
checkNull();
|
||||||
CvType t = type();
|
int t = type();
|
||||||
if(t.depth() == CvType.CV_64F) {
|
if(CvType.depth(t) == CvType.CV_64F) {
|
||||||
return nGetD(nativeObj, row, col, data.length, data);
|
return nGetD(nativeObj, row, col, data.length, data);
|
||||||
}
|
}
|
||||||
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
|
||||||
@ -320,8 +310,8 @@ public class Mat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//javadoc:Mat::eye(rows,cols,type)
|
//javadoc:Mat::eye(rows,cols,type)
|
||||||
static public Mat eye(int rows, int cols, CvType type) {
|
static public Mat eye(int rows, int cols, int type) {
|
||||||
return new Mat( nEye(rows, cols, type.toInt()) );
|
return new Mat( nEye(rows, cols, type) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// native stuff
|
// native stuff
|
||||||
|
@ -159,16 +159,16 @@ public class puzzle15View extends SampleCvViewBase implements OnTouchListener {
|
|||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mCells != null) {
|
if (mCells != null) {
|
||||||
for (Mat m : mCells)
|
for (Mat m : mCells)
|
||||||
m.dispose();
|
m.release();
|
||||||
}
|
}
|
||||||
if (mCells15 != null) {
|
if (mCells15 != null) {
|
||||||
for (Mat m : mCells15)
|
for (Mat m : mCells15)
|
||||||
m.dispose();
|
m.release();
|
||||||
}
|
}
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mRgba15 != null)
|
if (mRgba15 != null)
|
||||||
mRgba15.dispose();
|
mRgba15.release();
|
||||||
|
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
mRgba15 = null;
|
mRgba15 = null;
|
||||||
|
@ -105,9 +105,9 @@ class FdView extends SampleCvViewBase {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mGray != null)
|
if (mGray != null)
|
||||||
mGray.dispose();
|
mGray.release();
|
||||||
|
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
mGray = null;
|
mGray = null;
|
||||||
|
@ -149,21 +149,21 @@ class ImageManipulationsView extends SampleCvViewBase {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mZoomWindow != null)
|
if (mZoomWindow != null)
|
||||||
mZoomWindow.dispose();
|
mZoomWindow.release();
|
||||||
if (mZoomCorner != null)
|
if (mZoomCorner != null)
|
||||||
mZoomCorner.dispose();
|
mZoomCorner.release();
|
||||||
if (mBlurWindow != null)
|
if (mBlurWindow != null)
|
||||||
mBlurWindow.dispose();
|
mBlurWindow.release();
|
||||||
if (mGrayInnerWindow != null)
|
if (mGrayInnerWindow != null)
|
||||||
mGrayInnerWindow.dispose();
|
mGrayInnerWindow.release();
|
||||||
if (mRgbaInnerWindow != null)
|
if (mRgbaInnerWindow != null)
|
||||||
mRgbaInnerWindow.dispose();
|
mRgbaInnerWindow.release();
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mGray != null)
|
if (mGray != null)
|
||||||
mGray.dispose();
|
mGray.release();
|
||||||
if (mIntermediateMat != null)
|
if (mIntermediateMat != null)
|
||||||
mIntermediateMat.dispose();
|
mIntermediateMat.release();
|
||||||
|
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
mGray = null;
|
mGray = null;
|
||||||
|
@ -70,13 +70,13 @@ class Sample1View extends SampleViewBase {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mYuv != null)
|
if (mYuv != null)
|
||||||
mYuv.dispose();
|
mYuv.release();
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mGraySubmat != null)
|
if (mGraySubmat != null)
|
||||||
mGraySubmat.dispose();
|
mGraySubmat.release();
|
||||||
if (mIntermediateMat != null)
|
if (mIntermediateMat != null)
|
||||||
mIntermediateMat.dispose();
|
mIntermediateMat.release();
|
||||||
|
|
||||||
mYuv = null;
|
mYuv = null;
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
|
@ -68,11 +68,11 @@ class Sample2View extends SampleCvViewBase {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mGray != null)
|
if (mGray != null)
|
||||||
mGray.dispose();
|
mGray.release();
|
||||||
if (mIntermediateMat != null)
|
if (mIntermediateMat != null)
|
||||||
mIntermediateMat.dispose();
|
mIntermediateMat.release();
|
||||||
|
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
mGray = null;
|
mGray = null;
|
||||||
|
@ -70,13 +70,13 @@ class Sample4View extends SampleViewBase {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Explicitly deallocate Mats
|
// Explicitly deallocate Mats
|
||||||
if (mYuv != null)
|
if (mYuv != null)
|
||||||
mYuv.dispose();
|
mYuv.release();
|
||||||
if (mRgba != null)
|
if (mRgba != null)
|
||||||
mRgba.dispose();
|
mRgba.release();
|
||||||
if (mGraySubmat != null)
|
if (mGraySubmat != null)
|
||||||
mGraySubmat.dispose();
|
mGraySubmat.release();
|
||||||
if (mIntermediateMat != null)
|
if (mIntermediateMat != null)
|
||||||
mIntermediateMat.dispose();
|
mIntermediateMat.release();
|
||||||
|
|
||||||
mYuv = null;
|
mYuv = null;
|
||||||
mRgba = null;
|
mRgba = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user