Commit 3d9cb082 authored by Andrey Pavlenko's avatar Andrey Pavlenko

making CV data type to be int

parent 8378ba75
...@@ -122,7 +122,7 @@ public class OpenCVTestCase extends TestCase { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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();
......
...@@ -2,129 +2,110 @@ package org.opencv.core; ...@@ -2,129 +2,110 @@ package org.opencv.core;
public final class CvType { public final class CvType {
// predefined type constants // type depth constants
public static final CvType public static final int CV_8U = 0, CV_8S = 1,
CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4), CV_16U = 2, CV_16S = 3,
CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4), CV_32S = 4,
CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4), CV_32F = 5,
CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4), CV_64F = 6,
CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4), CV_USRTYPE1=7;
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); // predefined type constants
public static final int
// type depth constants CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
public static final int CV_8U = 0, CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
CV_8S = 1, CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
CV_16U = 2, CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
CV_16S = 3, CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
CV_32S = 4, CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
CV_32F = 5, CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4);
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); public static final int makeType(int depth, int channels) {
if(channels<=0 || channels>=CV_CN_MAX) {
private final int value; throw new java.lang.UnsupportedOperationException(
"Channels count should be 1.." + (CV_CN_MAX-1) );
protected CvType(int depth, int channels) { }
if(channels<=0 || channels>=CV_CN_MAX) { if(depth<0 || depth>=CV_DEPTH_MAX) {
throw new java.lang.UnsupportedOperationException( throw new java.lang.UnsupportedOperationException(
"Channels count should be 1.." + (CV_CN_MAX-1) ); "Data type depth should be 0.." + (CV_DEPTH_MAX-1) );
} }
if(depth<0 || depth>=CV_DEPTH_MAX) { return (depth & (CV_DEPTH_MAX-1)) + ((channels-1) << CV_CN_SHIFT);
throw new java.lang.UnsupportedOperationException( }
"Data type depth should be 0.." + (CV_DEPTH_MAX-1) );
}
value = (depth & (CV_DEPTH_MAX-1)) + ((channels-1) << CV_CN_SHIFT); public static final int CV_8UC(int ch) { return makeType(CV_8U, ch); }
}
public static final int CV_8SC(int ch) { return makeType(CV_8S, ch); }
protected CvType(int val) { value = val; }
public static final int CV_16UC(int ch) { return makeType(CV_16U, ch); }
public static final CvType CV_8UC(int ch) { return new CvType(CV_8U, ch); }
public static final int CV_16SC(int ch) { return makeType(CV_16S, ch); }
public static final CvType CV_8SC(int ch) { return new CvType(CV_8S, ch); }
public static final int CV_32SC(int ch) { return makeType(CV_32S, ch); }
public static final CvType CV_16UC(int ch) { return new CvType(CV_16U, ch); }
public static final int CV_32FC(int ch) { return makeType(CV_32F, ch); }
public static final CvType CV_16SC(int ch) { return new CvType(CV_16S, ch); }
public static final int CV_64FC(int ch) { return makeType(CV_64F, ch); }
public static final CvType CV_32SC(int ch) { return new CvType(CV_32S, ch); }
public static final int channels(int type) { return (type >> CV_CN_SHIFT) + 1; }
public static final CvType CV_32FC(int ch) { return new CvType(CV_32F, ch); }
public static final int depth(int type) { return type & (CV_DEPTH_MAX-1); }
public static final CvType CV_64FC(int ch) { return new CvType(CV_64F, ch); }
public static final boolean isInteger(int type) { return depth(type) < CV_32F; }
public final int toInt() { return value; }
public static final int ELEM_SIZE(int type) {
public final int channels() { return (value >> CV_CN_SHIFT) + 1; } switch (depth(type)) {
case CV_8U:
public final int depth() { return value & (CV_DEPTH_MAX-1); } case CV_8S:
return channels(type);
public final boolean isInteger() { return depth() < CV_32F; } case CV_16U:
case CV_16S:
public final int CV_ELEM_SIZE() { return 2 * channels(type);
switch (depth()) { case CV_32S:
case CV_8U: case CV_32F:
case CV_8S: return 4 * channels(type);
return channels(); case CV_64F:
case CV_16U: return 8 * channels(type);
case CV_16S: default:
return 2 * channels(); throw new java.lang.UnsupportedOperationException(
case CV_32S: "Unsupported CvType value: " + type );
case CV_32F: }
return 4 * channels(); }
case CV_64F:
return 8 * channels(); public static final String typeToString(int type) {
default: String s;
throw new java.lang.UnsupportedOperationException( switch (depth(type)) {
"Unsupported CvType value: " + value ); case CV_8U:
} s = "CV_8U";
} break;
case CV_8S:
@Override s = "CV_8S";
public final String toString() { break;
String s; case CV_16U:
switch (depth()) { s = "CV_16U";
case CV_8U: break;
s = "CV_8U"; case CV_16S:
break; s = "CV_16S";
case CV_8S: break;
s = "CV_8S"; case CV_32S:
break; s = "CV_32S";
case CV_16U: break;
s = "CV_16U"; case CV_32F:
break; s = "CV_32F";
case CV_16S: break;
s = "CV_16S"; case CV_64F:
break; s = "CV_64F";
case CV_32S: break;
s = "CV_32S"; default:
break; s = "CV_USRTYPE1";
case CV_32F: }
s = "CV_32F";
break; int ch = channels(type);
case CV_64F: if(ch<=4) return s + "C" + ch;
s = "CV_64F"; else return s + "C(" + ch + ")";
break; }
default:
s = "CV_USRTYPE1";
}
int ch = channels();
if(ch<=4) 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 { ...@@ -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)
public Mat(int rows, int cols, int depth, Scalar s) {
this( rows, cols, new CvType(depth, 1), s );
} }
//javadoc:Mat::dispose() //javadoc:Mat::release()
public void dispose() { public void release() {
nRelease(nativeObj); nRelease(nativeObj);
} }
...@@ -52,7 +42,7 @@ public class Mat { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment