Java Code Examples for org.opencv.core.CvType#typeToString()
The following examples show how to use
org.opencv.core.CvType#typeToString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 5 votes |
/** * The corresponding Java primitive array type depends on the Mat type: * CV_8U and CV_8S -> byte[] * CV_16U and CV_16S -> short[] * CV_32S -> int[] * CV_32F -> float[] * CV_64F-> double[] */ static byte[] getByteArray(final Mat mat){ if(CvType.CV_8UC1 != mat.type()) throw new IllegalArgumentException("Expected type is CV_8UC1, we found: " + CvType.typeToString(mat.type())); final int size = (int) (mat.total() * mat.channels()); if(_byteBuff.length != size){ _byteBuff = new byte[size]; } mat.get(0, 0, _byteBuff); // 0 for row and col means the WHOLE Matrix return _byteBuff; }
Example 2
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 5 votes |
static int[] getIntArray(final Mat mat){ if(CvType.CV_32SC1 != mat.type()) throw new IllegalArgumentException("Expected type is CV_32SC1, we found: " + CvType.typeToString(mat.type())); final int size = (int) (mat.total() * mat.channels()); if(_intBuff.length != size){ _intBuff = new int[size]; } mat.get(0, 0, _intBuff); // 0 for row and col means the WHOLE Matrix return _intBuff; }
Example 3
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 5 votes |
static float[] getFloatArray(final Mat mat){ if(CvType.CV_32FC1 != mat.type()) throw new IllegalArgumentException("Expected type is CV_32FC1, we found: " + CvType.typeToString(mat.type())); final int size = (int) (mat.total() * mat.channels()); if(_floatBuff.length != size){ _floatBuff = new float[size]; } mat.get(0, 0, _floatBuff); // 0 for row and col means the WHOLE Matrix return _floatBuff; }
Example 4
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 5 votes |
static double[] getDoubleArray(final Mat mat){ if(CvType.CV_64F != mat.type()) throw new IllegalArgumentException("Expected type is CV_64F, we found: " + CvType.typeToString(mat.type())); final int size = (int) (mat.total() * mat.channels()); if(_doubleBuff.length != size){ _doubleBuff = new double[size]; } mat.get(0, 0, _doubleBuff); // 0 for row and col means the WHOLE Matrix return _doubleBuff; }
Example 5
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 4 votes |
static byte getByte(final int row, final int col, final Mat mat){ if(CvType.CV_8UC1 != mat.type()) throw new IllegalArgumentException("Expected type is CV_8UC1, we found: " + CvType.typeToString(mat.type())); mat.get(row, col, _byteBuff1); return _byteBuff1[0]; }
Example 6
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 4 votes |
static int getInt(final int row, final int col, final Mat mat){ if(CvType.CV_32SC1 != mat.type()) throw new IllegalArgumentException("Expected type is CV_32SC1, we found: " + CvType.typeToString(mat.type())); mat.get(row, col, _intBuff1); return _intBuff1[0]; }
Example 7
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 4 votes |
static float getFloat(final int row, final int col, final Mat mat){ if(CvType.CV_32F != mat.type()) throw new IllegalArgumentException("Expected type is CV_32F, we found: " + CvType.typeToString(mat.type())); mat.get(row, col, _floatBuff1); return _floatBuff1[0]; }
Example 8
Source File: Util.java From OpenTLDAndroid with Apache License 2.0 | 4 votes |
static double getDouble(final int row, final int col, final Mat mat){ if(CvType.CV_64F != mat.type()) throw new IllegalArgumentException("Expected type is CV_64F, we found: " + CvType.typeToString(mat.type())); mat.get(row, col, _doubleBuff1); return _doubleBuff1[0]; }