Java: fixed Mats comparison; added resahpe mathod to core.Mat; fixed test resources extraction.
This commit is contained in:
parent
3f5089411a
commit
954f3c1eb9
@ -915,7 +915,7 @@ Reprojects a disparity image to 3D space.
|
|||||||
.. ocv:cfunction:: void cvReprojectImageTo3D( const CvArr* disparity, CvArr* _3dImage, const CvMat* Q, int handleMissingValues=0)
|
.. ocv:cfunction:: void cvReprojectImageTo3D( const CvArr* disparity, CvArr* _3dImage, const CvMat* Q, int handleMissingValues=0)
|
||||||
.. ocv:pyoldfunction:: cv.ReprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues=0) -> None
|
.. ocv:pyoldfunction:: cv.ReprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues=0) -> None
|
||||||
|
|
||||||
:param disparity: Input single-channel 16-bit signed or 32-bit floating-point disparity image.
|
:param disparity: Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image.
|
||||||
|
|
||||||
:param _3dImage: Output 3-channel floating-point image of the same size as ``disparity`` . Each element of ``_3dImage(x,y)`` contains 3D coordinates of the point ``(x,y)`` computed from the disparity map.
|
:param _3dImage: Output 3-channel floating-point image of the same size as ``disparity`` . Each element of ``_3dImage(x,y)`` contains 3D coordinates of the point ``(x,y)`` computed from the disparity map.
|
||||||
|
|
||||||
|
@ -115,6 +115,44 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
v1.put(0, 0, 1.0, 3.0, 2.0);
|
v1.put(0, 0, 1.0, 3.0, 2.0);
|
||||||
v2 = new Mat(1, 3, CvType.CV_32F);
|
v2 = new Mat(1, 3, CvType.CV_32F);
|
||||||
v2.put(0, 0, 2.0, 1.0, 3.0);
|
v2.put(0, 0, 2.0, 1.0, 3.0);
|
||||||
|
|
||||||
|
low.release();
|
||||||
|
high.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
|
||||||
|
gray0.release();
|
||||||
|
gray1.release();
|
||||||
|
gray2.release();
|
||||||
|
gray3.release();
|
||||||
|
gray9.release();
|
||||||
|
gray127.release();
|
||||||
|
gray128.release();
|
||||||
|
gray255.release();
|
||||||
|
gray_16u_256.release();
|
||||||
|
gray_16s_1024.release();
|
||||||
|
grayRnd.release();
|
||||||
|
gray0_32f.release();
|
||||||
|
gray1_32f.release();
|
||||||
|
gray3_32f.release();
|
||||||
|
gray9_32f.release();
|
||||||
|
gray255_32f.release();
|
||||||
|
grayE_32f.release();
|
||||||
|
grayE_32f.release();
|
||||||
|
grayRnd_32f.release();
|
||||||
|
gray0_32f_1d.release();
|
||||||
|
gray0_64f.release();
|
||||||
|
gray0_64f_1d.release();
|
||||||
|
rgba0.release();
|
||||||
|
rgba128.release();
|
||||||
|
rgbLena.release();
|
||||||
|
grayChess.release();
|
||||||
|
v1.release();
|
||||||
|
v2.release();
|
||||||
|
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertMatEqual(Mat m1, Mat m2) {
|
public static void assertMatEqual(Mat m1, Mat m2) {
|
||||||
@ -133,30 +171,31 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
compareMats(expected, actual, eps, false);
|
compareMats(expected, actual, eps, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private void compareMats(Mat m1, Mat m2, boolean isEqualityMeasured) {
|
static private void compareMats(Mat expected, Mat actual, boolean isEqualityMeasured) {
|
||||||
// OpenCVTestRunner.Log(m1.toString());
|
if (expected.type() != actual.type() || expected.cols() != actual.cols()
|
||||||
// OpenCVTestRunner.Log(m2.toString());
|
|| expected.rows() != actual.rows()) {
|
||||||
|
|
||||||
if (m1.type() != m2.type() || m1.cols() != m2.cols()
|
|
||||||
|| m1.rows() != m2.rows()) {
|
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
} else if (m1.channels() == 1) {
|
|
||||||
if (isEqualityMeasured) {
|
|
||||||
assertTrue(CalcPercentageOfDifference(m1, m2) == 0.0);
|
|
||||||
} else {
|
|
||||||
assertTrue(CalcPercentageOfDifference(m1, m2) != 0.0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int coi = 0; coi < m1.channels(); coi++) {
|
|
||||||
Mat m1c = getCOI(m1, coi);
|
|
||||||
Mat m2c = getCOI(m2, coi);
|
|
||||||
if (isEqualityMeasured) {
|
|
||||||
assertTrue(CalcPercentageOfDifference(m1c, m2c) == 0.0);
|
|
||||||
} else {
|
|
||||||
assertTrue(CalcPercentageOfDifference(m1c, m2c) != 0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expected.depth() == CvType.CV_32F || expected.depth() == CvType.CV_64F){
|
||||||
|
if (isEqualityMeasured)
|
||||||
|
throw new UnsupportedOperationException("Floating-point Mats must not be checked for exact match. Use assertMatEqual(Mat expected, Mat actual, double eps) instead.");
|
||||||
|
else
|
||||||
|
throw new UnsupportedOperationException("Floating-point Mats must not be checked for exact match. Use assertMatNotEqual(Mat expected, Mat actual, double eps) instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Mat diff = new Mat();
|
||||||
|
Core.absdiff(expected, actual, diff);
|
||||||
|
Mat reshaped = diff.reshape(1);
|
||||||
|
int mistakes = Core.countNonZero(reshaped);
|
||||||
|
|
||||||
|
reshaped.release();
|
||||||
|
diff.release();
|
||||||
|
|
||||||
|
if(isEqualityMeasured)
|
||||||
|
assertTrue("Mats are different in " + mistakes + " points", 0 == mistakes);
|
||||||
|
else
|
||||||
|
assertFalse("Mats are equal", 0 == mistakes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private void compareMats(Mat expected, Mat actual, double eps, boolean isEqualityMeasured) {
|
static private void compareMats(Mat expected, Mat actual, double eps, boolean isEqualityMeasured) {
|
||||||
@ -167,34 +206,13 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
Mat diff = new Mat();
|
Mat diff = new Mat();
|
||||||
Core.absdiff(expected, actual, diff);
|
Core.absdiff(expected, actual, diff);
|
||||||
if(isEqualityMeasured)
|
if(isEqualityMeasured)
|
||||||
assertTrue("Max difference between expected and actiual values is bigger than " + eps,
|
assertTrue("Max difference between expected and actiual Mats is bigger than " + eps,
|
||||||
Core.checkRange(diff, true, new Point(), 0.0, eps));
|
Core.checkRange(diff, true, new Point(), 0.0, eps));
|
||||||
else
|
else
|
||||||
assertFalse("Max difference between expected and actiual values is less than " + eps,
|
assertFalse("Max difference between expected and actiual Mats is less than " + eps,
|
||||||
Core.checkRange(diff, true, new Point(), 0.0, eps));
|
Core.checkRange(diff, true, new Point(), 0.0, eps));
|
||||||
}
|
}
|
||||||
|
|
||||||
static private Mat getCOI(Mat m, int coi) {
|
|
||||||
Mat ch = new Mat(m.rows(), m.cols(), m.depth());
|
|
||||||
|
|
||||||
for (int i = 0; i < m.rows(); i++)
|
|
||||||
for (int j = 0; j < m.cols(); j++) {
|
|
||||||
double pixel[] = m.get(i, j);
|
|
||||||
ch.put(i, j, pixel[coi]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
static private double CalcPercentageOfDifference(Mat m1, Mat m2) {
|
|
||||||
Mat cmp = new Mat(0, 0, CvType.CV_8U);
|
|
||||||
Core.compare(m1, m2, cmp, Core.CMP_EQ);
|
|
||||||
double difference = 100.0 * (1.0 - Double.valueOf(Core
|
|
||||||
.countNonZero(cmp)) / Double.valueOf(cmp.rows() * cmp.cols()));
|
|
||||||
|
|
||||||
return difference;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test_1(String label) {
|
public void test_1(String label) {
|
||||||
OpenCVTestRunner
|
OpenCVTestRunner
|
||||||
.Log("================================================");
|
.Log("================================================");
|
||||||
|
@ -1,64 +1,78 @@
|
|||||||
package org.opencv.test;
|
package org.opencv.test;
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.Bitmap.CompressFormat;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.test.AndroidTestRunner;
|
import android.test.AndroidTestRunner;
|
||||||
import android.test.InstrumentationTestRunner;
|
import android.test.InstrumentationTestRunner;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
import java.io.File;
|
||||||
* This only class is Android specific.
|
import java.io.FileOutputStream;
|
||||||
* The original idea about test order randomization is from marek.defecinski blog.
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This only class is Android specific. The original idea about test order
|
||||||
|
* randomization is from marek.defecinski blog.
|
||||||
*
|
*
|
||||||
* @see <a href="http://opencv.itseez.com">OpenCV</a>
|
* @see <a href="http://opencv.itseez.com">OpenCV</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class OpenCVTestRunner extends InstrumentationTestRunner {
|
public class OpenCVTestRunner extends InstrumentationTestRunner {
|
||||||
|
|
||||||
public static String LENA_PATH = "/data/data/org.opencv.test/files/lena.jpg";
|
public static String LENA_PATH;
|
||||||
public static String CHESS_PATH = "/data/data/org.opencv.test/files/chessboard.jpg";
|
public static String CHESS_PATH;
|
||||||
public static String LBPCASCADE_FRONTALFACE_PATH = "/mnt/sdcard/lbpcascade_frontalface.xml";
|
public static String LBPCASCADE_FRONTALFACE_PATH;
|
||||||
|
|
||||||
|
private AndroidTestRunner androidTestRunner;
|
||||||
|
private static String TAG = "opencv_test_java";
|
||||||
|
|
||||||
|
static public void Log(String message) {
|
||||||
|
Log.e(TAG, message);
|
||||||
|
}
|
||||||
|
|
||||||
private AndroidTestRunner androidTestRunner;
|
@Override
|
||||||
private static String TAG = "opencv_test_java";
|
|
||||||
|
|
||||||
static public void Log(String message) {
|
|
||||||
Log.e(TAG, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
ExportResourceImage("lena.jpg", R.drawable.lena);
|
LENA_PATH = ExportResource(R.drawable.lena);
|
||||||
ExportResourceImage("chessboard.jpg", R.drawable.chessboard);
|
CHESS_PATH = ExportResource(R.drawable.chessboard);
|
||||||
|
LBPCASCADE_FRONTALFACE_PATH = ExportResource(R.raw.lbpcascade_frontalface);
|
||||||
//FIXME: implement export of the cascade
|
|
||||||
|
// List<TestCase> testCases = androidTestRunner.getTestCases();
|
||||||
//List<TestCase> testCases = androidTestRunner.getTestCases();
|
// Collections.shuffle(testCases); //shuffle the tests order
|
||||||
//Collections.shuffle(testCases); //shuffle the tests order
|
|
||||||
|
|
||||||
super.onStart();
|
super.onStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AndroidTestRunner getAndroidTestRunner() {
|
protected AndroidTestRunner getAndroidTestRunner() {
|
||||||
androidTestRunner = super.getAndroidTestRunner();
|
androidTestRunner = super.getAndroidTestRunner();
|
||||||
return androidTestRunner;
|
return androidTestRunner;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String ExportResource(int resourceId) {
|
||||||
|
String fullname = getContext().getResources().getString(resourceId);
|
||||||
|
String resName = fullname.substring(fullname.lastIndexOf("/") + 1);
|
||||||
|
try {
|
||||||
|
InputStream is = getContext().getResources().openRawResource(
|
||||||
|
resourceId);
|
||||||
|
File resDir = getContext().getDir("testdata", Context.MODE_PRIVATE);
|
||||||
|
File resFile = new File(resDir, resName);
|
||||||
|
|
||||||
|
FileOutputStream os = new FileOutputStream(resFile);
|
||||||
|
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = is.read(buffer)) != -1) {
|
||||||
|
os.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
is.close();
|
||||||
|
os.close();
|
||||||
|
|
||||||
|
return resFile.getAbsolutePath();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log("Failed to export resource " + resName + ". Exception thrown: "
|
||||||
|
+ e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExportResourceImage(String image, int rId) {
|
|
||||||
try {
|
|
||||||
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), rId);
|
|
||||||
FileOutputStream fos = this.getContext().openFileOutput(image, Context.MODE_WORLD_READABLE);
|
|
||||||
mBitmap.compress(CompressFormat.JPEG, 100, fos);
|
|
||||||
fos.flush();
|
|
||||||
fos.close();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
Log("Tried to write " + image + ", but: " + e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ public class calib3dTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
|
Calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
|
||||||
|
|
||||||
assertMatEqual(outRvec, rvec3);
|
assertMatEqual(outRvec, rvec3, EPS);
|
||||||
assertMatEqual(outTvec, tvec3);
|
assertMatEqual(outTvec, tvec3, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testComposeRTMatMatMatMatMatMatMat() {
|
public void testComposeRTMatMatMatMatMatMatMat() {
|
||||||
@ -367,15 +367,122 @@ public class calib3dTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testReprojectImageTo3DMatMatMat() {
|
public void testReprojectImageTo3DMatMatMat() {
|
||||||
fail("Not yet implemented");
|
Mat transformMatrix = new Mat(4,4,CvType.CV_64F);
|
||||||
|
transformMatrix.put(0, 0,
|
||||||
|
0, 1, 0, 0,
|
||||||
|
1, 0, 0, 0,
|
||||||
|
0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1);
|
||||||
|
|
||||||
|
Mat disparity = new Mat(matSize,matSize,CvType.CV_32F);
|
||||||
|
|
||||||
|
float[] disp = new float[matSize * matSize];
|
||||||
|
for (int i = 0; i < matSize; i++)
|
||||||
|
for(int j = 0; j < matSize; j++)
|
||||||
|
disp[i * matSize + j] = i - j;
|
||||||
|
disparity.put(0, 0, disp);
|
||||||
|
|
||||||
|
Mat _3dPoints = new Mat();
|
||||||
|
|
||||||
|
Calib3d.reprojectImageTo3D(disparity, _3dPoints, transformMatrix);
|
||||||
|
|
||||||
|
assertEquals(CvType.CV_32FC3, _3dPoints.type());
|
||||||
|
assertEquals(matSize, _3dPoints.rows());
|
||||||
|
assertEquals(matSize, _3dPoints.cols());
|
||||||
|
|
||||||
|
truth = new Mat(matSize,matSize,CvType.CV_32FC3);
|
||||||
|
|
||||||
|
float[] _truth = new float[matSize * matSize * 3];
|
||||||
|
for (int i = 0; i < matSize; i++)
|
||||||
|
for(int j = 0; j < matSize; j++)
|
||||||
|
{
|
||||||
|
_truth[(i * matSize + j) * 3 + 0] = i;
|
||||||
|
_truth[(i * matSize + j) * 3 + 1] = j;
|
||||||
|
_truth[(i * matSize + j) * 3 + 2] = i-j;
|
||||||
|
}
|
||||||
|
truth.put(0, 0, _truth);
|
||||||
|
|
||||||
|
assertMatEqual(truth, _3dPoints, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReprojectImageTo3DMatMatMatBoolean() {
|
public void testReprojectImageTo3DMatMatMatBoolean() {
|
||||||
fail("Not yet implemented");
|
Mat transformMatrix = new Mat(4,4,CvType.CV_64F);
|
||||||
|
transformMatrix.put(0, 0,
|
||||||
|
0, 1, 0, 0,
|
||||||
|
1, 0, 0, 0,
|
||||||
|
0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1);
|
||||||
|
|
||||||
|
Mat disparity = new Mat(matSize,matSize,CvType.CV_32F);
|
||||||
|
|
||||||
|
float[] disp = new float[matSize * matSize];
|
||||||
|
for (int i = 0; i < matSize; i++)
|
||||||
|
for(int j = 0; j < matSize; j++)
|
||||||
|
disp[i * matSize + j] = i - j;
|
||||||
|
disp[0] = -Float.MAX_VALUE;
|
||||||
|
disparity.put(0, 0, disp);
|
||||||
|
|
||||||
|
Mat _3dPoints = new Mat();
|
||||||
|
|
||||||
|
Calib3d.reprojectImageTo3D(disparity, _3dPoints, transformMatrix, true);
|
||||||
|
|
||||||
|
assertEquals(CvType.CV_32FC3, _3dPoints.type());
|
||||||
|
assertEquals(matSize, _3dPoints.rows());
|
||||||
|
assertEquals(matSize, _3dPoints.cols());
|
||||||
|
|
||||||
|
truth = new Mat(matSize,matSize,CvType.CV_32FC3);
|
||||||
|
|
||||||
|
float[] _truth = new float[matSize * matSize * 3];
|
||||||
|
for (int i = 0; i < matSize; i++)
|
||||||
|
for(int j = 0; j < matSize; j++)
|
||||||
|
{
|
||||||
|
_truth[(i * matSize + j) * 3 + 0] = i;
|
||||||
|
_truth[(i * matSize + j) * 3 + 1] = j;
|
||||||
|
_truth[(i * matSize + j) * 3 + 2] = i-j;
|
||||||
|
}
|
||||||
|
_truth[2] = 10000;
|
||||||
|
truth.put(0, 0, _truth);
|
||||||
|
|
||||||
|
assertMatEqual(truth, _3dPoints, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReprojectImageTo3DMatMatMatBooleanInt() {
|
public void testReprojectImageTo3DMatMatMatBooleanInt() {
|
||||||
fail("Not yet implemented");
|
Mat transformMatrix = new Mat(4,4,CvType.CV_64F);
|
||||||
|
transformMatrix.put(0, 0,
|
||||||
|
0, 1, 0, 0,
|
||||||
|
1, 0, 0, 0,
|
||||||
|
0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1);
|
||||||
|
|
||||||
|
Mat disparity = new Mat(matSize,matSize,CvType.CV_32F);
|
||||||
|
|
||||||
|
float[] disp = new float[matSize * matSize];
|
||||||
|
for (int i = 0; i < matSize; i++)
|
||||||
|
for(int j = 0; j < matSize; j++)
|
||||||
|
disp[i * matSize + j] = i - j;
|
||||||
|
disparity.put(0, 0, disp);
|
||||||
|
|
||||||
|
Mat _3dPoints = new Mat();
|
||||||
|
|
||||||
|
Calib3d.reprojectImageTo3D(disparity, _3dPoints, transformMatrix, false, CvType.CV_16S);
|
||||||
|
|
||||||
|
assertEquals(CvType.CV_16SC3, _3dPoints.type());
|
||||||
|
assertEquals(matSize, _3dPoints.rows());
|
||||||
|
assertEquals(matSize, _3dPoints.cols());
|
||||||
|
|
||||||
|
truth = new Mat(matSize,matSize,CvType.CV_16SC3);
|
||||||
|
|
||||||
|
short[] _truth = new short[matSize * matSize * 3];
|
||||||
|
for (short i = 0; i < matSize; i++)
|
||||||
|
for(short j = 0; j < matSize; j++)
|
||||||
|
{
|
||||||
|
_truth[(i * matSize + j) * 3 + 0] = i;
|
||||||
|
_truth[(i * matSize + j) * 3 + 1] = j;
|
||||||
|
_truth[(i * matSize + j) * 3 + 2] = (short) (i-j);
|
||||||
|
}
|
||||||
|
truth.put(0, 0, _truth);
|
||||||
|
|
||||||
|
assertMatEqual(truth, _3dPoints, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRodriguesMatMat() {
|
public void testRodriguesMatMat() {
|
||||||
|
@ -6,253 +6,257 @@ import org.opencv.core.Scalar;
|
|||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
|
||||||
public class MatTest extends OpenCVTestCase {
|
public class MatTest extends OpenCVTestCase {
|
||||||
|
|
||||||
public void test_1() {
|
|
||||||
super.test_1("Mat");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testChannels() {
|
public void test_1() {
|
||||||
assertEquals(1, gray0.channels());
|
super.test_1("Mat");
|
||||||
assertEquals(3, rgbLena.channels());
|
}
|
||||||
assertEquals(4, rgba0.channels());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testClone() {
|
public void testChannels() {
|
||||||
dst = gray0.clone();
|
assertEquals(1, gray0.channels());
|
||||||
assertMatEqual(gray0, dst);
|
assertEquals(3, rgbLena.channels());
|
||||||
}
|
assertEquals(4, rgba0.channels());
|
||||||
|
}
|
||||||
|
|
||||||
public void testCol() {
|
public void testClone() {
|
||||||
Mat col = gray0.col(0);
|
dst = gray0.clone();
|
||||||
assertEquals(1, col.cols());
|
assertMatEqual(gray0, dst);
|
||||||
assertEquals(gray0.rows(), col.rows());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testColRange() {
|
public void testCol() {
|
||||||
Mat cols = gray0.colRange(0, gray0.cols()/2);
|
Mat col = gray0.col(0);
|
||||||
assertEquals(gray0.cols()/2, cols.cols());
|
assertEquals(1, col.cols());
|
||||||
assertEquals(gray0.rows(), cols.rows());
|
assertEquals(gray0.rows(), col.rows());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCols() {
|
public void testColRange() {
|
||||||
assertEquals(matSize, gray0.rows());
|
Mat cols = gray0.colRange(0, gray0.cols() / 2);
|
||||||
}
|
assertEquals(gray0.cols() / 2, cols.cols());
|
||||||
|
assertEquals(gray0.rows(), cols.rows());
|
||||||
|
}
|
||||||
|
|
||||||
public void testCopyTo() {
|
public void testCols() {
|
||||||
rgbLena.copyTo(dst);
|
assertEquals(matSize, gray0.rows());
|
||||||
assertMatEqual(rgbLena, dst);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testCross() {
|
public void testCopyTo() {
|
||||||
Mat answer = new Mat(1, 3, CvType.CV_32F);
|
rgbLena.copyTo(dst);
|
||||||
answer.put(0, 0, 7.0, 1.0, -5.0);
|
assertMatEqual(rgbLena, dst);
|
||||||
|
}
|
||||||
Mat cross = v1.cross(v2);
|
|
||||||
assertMatEqual(answer, cross);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDataAddr() {
|
public void testCross() {
|
||||||
assertTrue(0 != gray0.dataAddr());
|
Mat answer = new Mat(1, 3, CvType.CV_32F);
|
||||||
}
|
answer.put(0, 0, 7.0, 1.0, -5.0);
|
||||||
|
|
||||||
public void testDepth() {
|
Mat cross = v1.cross(v2);
|
||||||
assertEquals(CvType.CV_8U, gray0.depth());
|
assertMatEqual(answer, cross, EPS);
|
||||||
assertEquals(CvType.CV_32F, gray0_32f.depth());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testRelease() {
|
public void testDataAddr() {
|
||||||
assertTrue( gray0.empty() == false );
|
assertTrue(0 != gray0.dataAddr());
|
||||||
assertTrue( gray0.rows() > 0 );
|
}
|
||||||
gray0.release();
|
|
||||||
assertTrue( gray0.empty() == true );
|
|
||||||
assertTrue( gray0.rows() == 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDot() {
|
public void testDepth() {
|
||||||
double s = v1.dot(v2);
|
assertEquals(CvType.CV_8U, gray0.depth());
|
||||||
assertEquals(11.0, s);
|
assertEquals(CvType.CV_32F, gray0_32f.depth());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDump() {
|
|
||||||
assertEquals("[1, 3, 2]", v1.dump());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testElemSize() {
|
public void testRelease() {
|
||||||
assertEquals(1, gray0.elemSize());
|
assertTrue(gray0.empty() == false);
|
||||||
assertEquals(4, gray0_32f.elemSize());
|
assertTrue(gray0.rows() > 0);
|
||||||
assertEquals(3, rgbLena.elemSize());
|
gray0.release();
|
||||||
}
|
assertTrue(gray0.empty() == true);
|
||||||
|
assertTrue(gray0.rows() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
public void testEmpty() {
|
public void testDot() {
|
||||||
assertTrue(dst.empty());
|
double s = v1.dot(v2);
|
||||||
assertTrue(!gray0.empty());
|
assertEquals(11.0, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEye() {
|
|
||||||
Mat eye = Mat.eye(3, 3, CvType.CV_32FC1);
|
|
||||||
assertMatEqual(eye, eye.inv());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetIntInt() {
|
public void testDump() {
|
||||||
fail("Not yet implemented");
|
assertEquals("[1, 3, 2]", v1.dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntByteArray() {
|
public void testElemSize() {
|
||||||
fail("Not yet implemented");
|
assertEquals(1, gray0.elemSize());
|
||||||
}
|
assertEquals(4, gray0_32f.elemSize());
|
||||||
|
assertEquals(3, rgbLena.elemSize());
|
||||||
|
}
|
||||||
|
|
||||||
public void testGetIntIntDoubleArray() {
|
public void testEmpty() {
|
||||||
fail("Not yet implemented");
|
assertTrue(dst.empty());
|
||||||
}
|
assertTrue(!gray0.empty());
|
||||||
|
}
|
||||||
|
|
||||||
public void testGetIntIntFloatArray() {
|
public void testEye() {
|
||||||
fail("Not yet implemented");
|
Mat eye = Mat.eye(3, 3, CvType.CV_32FC1);
|
||||||
}
|
assertMatEqual(eye, eye.inv(), EPS);
|
||||||
|
}
|
||||||
|
|
||||||
public void testGetIntIntIntArray() {
|
public void testGetIntInt() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetIntIntShortArray() {
|
public void testGetIntIntByteArray() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetNativeObjAddr() {
|
public void testGetIntIntDoubleArray() {
|
||||||
assertTrue(0 != gray0.getNativeObjAddr());
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHeight() {
|
public void testGetIntIntFloatArray() {
|
||||||
assertEquals(gray0.rows(), gray0.height());
|
fail("Not yet implemented");
|
||||||
assertEquals(rgbLena.rows(), rgbLena.height());
|
}
|
||||||
assertEquals(rgba128.rows(), rgba128.height());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testInv() {
|
public void testGetIntIntIntArray() {
|
||||||
dst = grayE_32f.inv();
|
fail("Not yet implemented");
|
||||||
assertMatEqual(grayE_32f, dst);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testIsContinuous() {
|
public void testGetIntIntShortArray() {
|
||||||
assertTrue(gray0.isContinuous());
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
Mat subMat = gray0.submat(0, 0, gray0.rows()/2, gray0.cols()/2);
|
|
||||||
assertFalse(subMat.isContinuous());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testIsSubmatrix() {
|
public void testGetNativeObjAddr() {
|
||||||
assertFalse(gray0.isSubmatrix());
|
assertTrue(0 != gray0.getNativeObjAddr());
|
||||||
Mat subMat = gray0.submat(0, 0, gray0.rows()/2, gray0.cols()/2);
|
}
|
||||||
assertTrue(subMat.isSubmatrix());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMat() {
|
|
||||||
Mat m = new Mat();
|
|
||||||
assertTrue(null != m);
|
|
||||||
assertTrue(m.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMatIntIntCvType() {
|
public void testHeight() {
|
||||||
Mat gray = new Mat(1, 1, CvType.CV_8UC1);
|
assertEquals(gray0.rows(), gray0.height());
|
||||||
assertFalse(gray.empty());
|
assertEquals(rgbLena.rows(), rgbLena.height());
|
||||||
|
assertEquals(rgba128.rows(), rgba128.height());
|
||||||
Mat rgb = new Mat(1, 1, CvType.CV_8UC3);
|
}
|
||||||
assertFalse(rgb.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMatIntIntCvTypeScalar() {
|
public void testInv() {
|
||||||
dst = new Mat(gray127.rows(), gray127.cols(), CvType.CV_8U, new Scalar(127));
|
dst = grayE_32f.inv();
|
||||||
assertFalse(dst.empty());
|
assertMatEqual(grayE_32f, dst, EPS);
|
||||||
assertMatEqual(dst, gray127);
|
}
|
||||||
|
|
||||||
dst = new Mat(rgba128.rows(), rgba128.cols(), CvType.CV_8UC4, Scalar.all(128));
|
|
||||||
assertFalse(dst.empty());
|
|
||||||
assertMatEqual(dst, rgba128);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMatIntIntInt() {
|
public void testIsContinuous() {
|
||||||
Mat gray = new Mat(1, 1, CvType.CV_8U);
|
assertTrue(gray0.isContinuous());
|
||||||
assertFalse(gray.empty());
|
|
||||||
|
|
||||||
Mat rgb = new Mat(1, 1, CvType.CV_8U);
|
|
||||||
assertFalse(rgb.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMatIntIntIntScalar() {
|
Mat subMat = gray0.submat(0, 0, gray0.rows() / 2, gray0.cols() / 2);
|
||||||
Mat m1 = new Mat(gray127.rows(), gray127.cols(), CvType.CV_8U, new Scalar(127));
|
assertFalse(subMat.isContinuous());
|
||||||
assertFalse(m1.empty());
|
}
|
||||||
assertMatEqual(m1, gray127);
|
|
||||||
|
|
||||||
Mat m2 = new Mat(gray0_32f.rows(), gray0_32f.cols(), CvType.CV_32F, new Scalar(0));
|
|
||||||
assertFalse(m2.empty());
|
|
||||||
assertMatEqual(m2, gray0_32f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPutIntIntByteArray() {
|
public void testIsSubmatrix() {
|
||||||
fail("Not yet implemented");
|
assertFalse(gray0.isSubmatrix());
|
||||||
}
|
Mat subMat = gray0.submat(0, 0, gray0.rows() / 2, gray0.cols() / 2);
|
||||||
|
assertTrue(subMat.isSubmatrix());
|
||||||
|
}
|
||||||
|
|
||||||
public void testPutIntIntDoubleArray() {
|
public void testMat() {
|
||||||
fail("Not yet implemented");
|
Mat m = new Mat();
|
||||||
}
|
assertTrue(null != m);
|
||||||
|
assertTrue(m.empty());
|
||||||
|
}
|
||||||
|
|
||||||
public void testPutIntIntFloatArray() {
|
public void testMatIntIntCvType() {
|
||||||
fail("Not yet implemented");
|
Mat gray = new Mat(1, 1, CvType.CV_8UC1);
|
||||||
}
|
assertFalse(gray.empty());
|
||||||
|
|
||||||
public void testPutIntIntIntArray() {
|
Mat rgb = new Mat(1, 1, CvType.CV_8UC3);
|
||||||
fail("Not yet implemented");
|
assertFalse(rgb.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPutIntIntShortArray() {
|
public void testMatIntIntCvTypeScalar() {
|
||||||
fail("Not yet implemented");
|
dst = new Mat(gray127.rows(), gray127.cols(), CvType.CV_8U, new Scalar(
|
||||||
}
|
127));
|
||||||
|
assertFalse(dst.empty());
|
||||||
|
assertMatEqual(dst, gray127);
|
||||||
|
|
||||||
public void testRow() {
|
dst = new Mat(rgba128.rows(), rgba128.cols(), CvType.CV_8UC4,
|
||||||
Mat row = gray0.row(0);
|
Scalar.all(128));
|
||||||
assertEquals(1, row.rows());
|
assertFalse(dst.empty());
|
||||||
assertEquals(gray0.cols(), row.cols());
|
assertMatEqual(dst, rgba128);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRowRange() {
|
public void testMatIntIntInt() {
|
||||||
Mat rows = gray0.rowRange(0, gray0.rows()/2);
|
Mat gray = new Mat(1, 1, CvType.CV_8U);
|
||||||
assertEquals(gray0.rows()/2, rows.rows());
|
assertFalse(gray.empty());
|
||||||
assertEquals(gray0.cols(), rows.cols());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testRows() {
|
Mat rgb = new Mat(1, 1, CvType.CV_8U);
|
||||||
assertEquals(matSize, gray0.rows());
|
assertFalse(rgb.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetTo() {
|
public void testMatIntIntIntScalar() {
|
||||||
gray0.setTo(new Scalar(127));
|
Mat m1 = new Mat(gray127.rows(), gray127.cols(), CvType.CV_8U,
|
||||||
assertMatEqual(gray127, gray0);
|
new Scalar(127));
|
||||||
}
|
assertFalse(m1.empty());
|
||||||
|
assertMatEqual(m1, gray127);
|
||||||
|
|
||||||
public void testSubmat() {
|
Mat m2 = new Mat(gray0_32f.rows(), gray0_32f.cols(), CvType.CV_32F,
|
||||||
Mat submat = gray0.submat(0, gray0.rows()/2, 0, gray0.cols()/2);
|
new Scalar(0));
|
||||||
assertEquals(gray0.rows()/2, submat.rows());
|
assertFalse(m2.empty());
|
||||||
assertEquals(gray0.cols()/2, submat.cols());
|
assertMatEqual(m2, gray0_32f, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToString() {
|
public void testPutIntIntByteArray() {
|
||||||
assertTrue(null != gray0.toString());
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTotal() {
|
public void testPutIntIntDoubleArray() {
|
||||||
int nElements = gray0.rows() * gray0.cols();
|
fail("Not yet implemented");
|
||||||
assertEquals(nElements, gray0.total());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testType() {
|
public void testPutIntIntFloatArray() {
|
||||||
assertEquals(CvType.CV_8UC1, gray0.type());
|
fail("Not yet implemented");
|
||||||
assertEquals(CvType.CV_32FC1, gray0_32f.type());
|
}
|
||||||
assertEquals(CvType.CV_8UC3, rgbLena.type());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testWidth() {
|
public void testPutIntIntIntArray() {
|
||||||
assertEquals(gray0.cols(), gray0.width());
|
fail("Not yet implemented");
|
||||||
assertEquals(rgbLena.cols(), rgbLena.width());
|
}
|
||||||
assertEquals(rgba128.cols(), rgba128.width());
|
|
||||||
}
|
public void testPutIntIntShortArray() {
|
||||||
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRow() {
|
||||||
|
Mat row = gray0.row(0);
|
||||||
|
assertEquals(1, row.rows());
|
||||||
|
assertEquals(gray0.cols(), row.cols());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRowRange() {
|
||||||
|
Mat rows = gray0.rowRange(0, gray0.rows() / 2);
|
||||||
|
assertEquals(gray0.rows() / 2, rows.rows());
|
||||||
|
assertEquals(gray0.cols(), rows.cols());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRows() {
|
||||||
|
assertEquals(matSize, gray0.rows());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSetTo() {
|
||||||
|
gray0.setTo(new Scalar(127));
|
||||||
|
assertMatEqual(gray127, gray0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSubmat() {
|
||||||
|
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
|
||||||
|
assertEquals(gray0.rows() / 2, submat.rows());
|
||||||
|
assertEquals(gray0.cols() / 2, submat.cols());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testToString() {
|
||||||
|
assertTrue(null != gray0.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTotal() {
|
||||||
|
int nElements = gray0.rows() * gray0.cols();
|
||||||
|
assertEquals(nElements, gray0.total());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testType() {
|
||||||
|
assertEquals(CvType.CV_8UC1, gray0.type());
|
||||||
|
assertEquals(CvType.CV_32FC1, gray0_32f.type());
|
||||||
|
assertEquals(CvType.CV_8UC3, rgbLena.type());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testWidth() {
|
||||||
|
assertEquals(gray0.cols(), gray0.width());
|
||||||
|
assertEquals(rgbLena.cols(), rgbLena.width());
|
||||||
|
assertEquals(rgba128.cols(), rgba128.width());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
public void testAddMatMatMatMatInt() {
|
public void testAddMatMatMatMatInt() {
|
||||||
Core.add(gray0, gray1, dst, gray1, CvType.CV_32F);
|
Core.add(gray0, gray1, dst, gray1, CvType.CV_32F);
|
||||||
assertTrue(CvType.CV_32F == dst.depth());
|
assertTrue(CvType.CV_32F == dst.depth());
|
||||||
assertMatEqual(gray1_32f, dst);
|
assertMatEqual(gray1_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
|
public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
|
||||||
@ -50,7 +50,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
|
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
|
||||||
Core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, CvType.CV_32F);
|
Core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, CvType.CV_32F);
|
||||||
assertTrue(CvType.CV_32F == dst.depth());
|
assertTrue(CvType.CV_32F == dst.depth());
|
||||||
assertMatEqual(gray255_32f, dst);
|
assertMatEqual(gray255_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBitwise_andMatMatMat() {
|
public void testBitwise_andMatMatMat() {
|
||||||
@ -101,8 +101,8 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
* TODO:
|
* TODO:
|
||||||
* CV_COVAR_NORMAL
|
* CV_COVAR_NORMAL
|
||||||
*/);
|
*/);
|
||||||
assertMatEqual(gray0_64f, covar);
|
assertMatEqual(gray0_64f, covar, EPS);
|
||||||
assertMatEqual(gray0_64f_1d, mean);
|
assertMatEqual(gray0_64f_1d, mean, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCalcCovarMatrixMatMatMatIntInt() {
|
public void testCalcCovarMatrixMatMatMatIntInt() {
|
||||||
@ -113,8 +113,8 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
* TODO:
|
* TODO:
|
||||||
* CV_COVAR_NORMAL
|
* CV_COVAR_NORMAL
|
||||||
*/, CvType.CV_32F);
|
*/, CvType.CV_32F);
|
||||||
assertMatEqual(gray0_32f, covar);
|
assertMatEqual(gray0_32f, covar, EPS);
|
||||||
assertMatEqual(gray0_32f_1d, mean);
|
assertMatEqual(gray0_32f_1d, mean, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCartToPolarMatMatMatMat() {
|
public void testCartToPolarMatMatMatMat() {
|
||||||
@ -130,8 +130,8 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Mat dst_angle = new Mat();
|
Mat dst_angle = new Mat();
|
||||||
Core.cartToPolar(x, y, dst, dst_angle);
|
Core.cartToPolar(x, y, dst, dst_angle);
|
||||||
assertMatEqual(magnitude, dst);
|
assertMatEqual(magnitude, dst, EPS);
|
||||||
assertMatEqual(angle, dst_angle);
|
assertMatEqual(angle, dst_angle, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCartToPolarMatMatMatMatBoolean() {
|
public void testCartToPolarMatMatMatMatBoolean() {
|
||||||
@ -148,8 +148,8 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Mat dst_angle = new Mat();
|
Mat dst_angle = new Mat();
|
||||||
Core.cartToPolar(x, y, dst, dst_angle, false);
|
Core.cartToPolar(x, y, dst, dst_angle, false);
|
||||||
assertMatEqual(magnitude, dst);
|
assertMatEqual(magnitude, dst, EPS);
|
||||||
assertMatEqual(angle, dst_angle);
|
assertMatEqual(angle, dst_angle, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckRangeMat() {
|
public void testCheckRangeMat() {
|
||||||
@ -278,21 +278,21 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
public void testCompleteSymmMat() {
|
public void testCompleteSymmMat() {
|
||||||
Core.completeSymm(grayRnd_32f);
|
Core.completeSymm(grayRnd_32f);
|
||||||
Core.transpose(grayRnd_32f, dst);
|
Core.transpose(grayRnd_32f, dst);
|
||||||
assertMatEqual(grayRnd_32f, dst);
|
assertMatEqual(grayRnd_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCompleteSymmMatBoolean() {
|
public void testCompleteSymmMatBoolean() {
|
||||||
Core.completeSymm(grayRnd_32f, true);
|
Core.completeSymm(grayRnd_32f, true);
|
||||||
Core.transpose(grayRnd_32f, dst);
|
Core.transpose(grayRnd_32f, dst);
|
||||||
assertMatEqual(grayRnd_32f, dst);
|
assertMatEqual(grayRnd_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvertScaleAbsMatMat() {
|
public void testConvertScaleAbsMatMat() {
|
||||||
Core.convertScaleAbs(gray0, dst);
|
Core.convertScaleAbs(gray0, dst);
|
||||||
assertMatEqual(gray0, dst);
|
assertMatEqual(gray0, dst, EPS);
|
||||||
|
|
||||||
Core.convertScaleAbs(gray_16u_256, dst);
|
Core.convertScaleAbs(gray_16u_256, dst);
|
||||||
assertMatEqual(gray255, dst);
|
assertMatEqual(gray255, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvertScaleAbsMatMatDouble() {
|
public void testConvertScaleAbsMatMatDouble() {
|
||||||
@ -322,7 +322,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testDctMatMat() {
|
public void testDctMatMat() {
|
||||||
Core.dct(gray0_32f_1d, dst);
|
Core.dct(gray0_32f_1d, dst);
|
||||||
assertMatEqual(gray0_32f_1d, dst);
|
assertMatEqual(gray0_32f_1d, dst, EPS);
|
||||||
|
|
||||||
Mat in = new Mat(1, 4, CvType.CV_32F);
|
Mat in = new Mat(1, 4, CvType.CV_32F);
|
||||||
in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682);
|
in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682);
|
||||||
@ -331,12 +331,12 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477);
|
truth.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477);
|
||||||
|
|
||||||
Core.dct(in, dst);
|
Core.dct(in, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDctMatMatInt() {
|
public void testDctMatMatInt() {
|
||||||
Core.dct(gray0_32f_1d, dst);
|
Core.dct(gray0_32f_1d, dst);
|
||||||
assertMatEqual(gray0_32f_1d, dst);
|
assertMatEqual(gray0_32f_1d, dst, EPS);
|
||||||
|
|
||||||
Mat in = new Mat(1, 8, CvType.CV_32F);
|
Mat in = new Mat(1, 8, CvType.CV_32F);
|
||||||
in.put(0, 0, 0.203056, 0.980407, 0.35312, -0.106651, 0.0399382,
|
in.put(0, 0, 0.203056, 0.980407, 0.35312, -0.106651, 0.0399382,
|
||||||
@ -347,7 +347,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
-0.32499927, -0.99302113, 0.55979407, -0.6251272);
|
-0.32499927, -0.99302113, 0.55979407, -0.6251272);
|
||||||
|
|
||||||
Core.dct(in, dst);
|
Core.dct(in, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeterminant() {
|
public void testDeterminant() {
|
||||||
@ -368,7 +368,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(1, 4, CvType.CV_32F);
|
truth = new Mat(1, 4, CvType.CV_32F);
|
||||||
truth.put(0, 0, 0, 0, 0, 0);
|
truth.put(0, 0, 0, 0, 0, 0);
|
||||||
Core.dft(src, dst);
|
Core.dft(src, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDftMatMatInt() {
|
public void testDftMatMatInt() {
|
||||||
@ -378,11 +378,11 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
src.put(0, 0, 1, 2, 3, 4);
|
src.put(0, 0, 1, 2, 3, 4);
|
||||||
truth.put(0, 0, 10, -2, 2, -2);
|
truth.put(0, 0, 10, -2, 2, -2);
|
||||||
Core.dft(src, dst, Core.DFT_REAL_OUTPUT);
|
Core.dft(src, dst, Core.DFT_REAL_OUTPUT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
Core.dft(src, dst, Core.DFT_INVERSE);
|
Core.dft(src, dst, Core.DFT_INVERSE);
|
||||||
truth.put(0, 0, 9, -9, 1, 3);
|
truth.put(0, 0, 9, -9, 1, 3);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDftMatMatIntInt() {
|
public void testDftMatMatIntInt() {
|
||||||
@ -392,7 +392,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(1, 4, CvType.CV_32F);
|
truth = new Mat(1, 4, CvType.CV_32F);
|
||||||
truth.put(0, 0, 10, -2, 2, -2);
|
truth.put(0, 0, 10, -2, 2, -2);
|
||||||
Core.dft(src, dst, Core.DFT_REAL_OUTPUT, 1);
|
Core.dft(src, dst, Core.DFT_REAL_OUTPUT, 1);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDivideDoubleMatMat() {
|
public void testDivideDoubleMatMat() {
|
||||||
@ -460,7 +460,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
Mat destination = new Mat(matSize, matSize, CvType.CV_32F);
|
Mat destination = new Mat(matSize, matSize, CvType.CV_32F);
|
||||||
destination.setTo(new Scalar(0.0));
|
destination.setTo(new Scalar(0.0));
|
||||||
Core.exp(gray0_32f, destination);
|
Core.exp(gray0_32f, destination);
|
||||||
assertMatEqual(gray1_32f, destination);
|
assertMatEqual(gray1_32f, destination, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtractChannel() {
|
public void testExtractChannel() {
|
||||||
@ -518,7 +518,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
des_f0.put(1, 0, 1.0);
|
des_f0.put(1, 0, 1.0);
|
||||||
des_f0.put(1, 1, 2.0);
|
des_f0.put(1, 1, 2.0);
|
||||||
Core.flip(src, dst, 0);
|
Core.flip(src, dst, 0);
|
||||||
assertMatEqual(des_f0, dst);
|
assertMatEqual(des_f0, dst, EPS);
|
||||||
|
|
||||||
Mat des_f1 = new Mat(2, 2, CvType.CV_32F);
|
Mat des_f1 = new Mat(2, 2, CvType.CV_32F);
|
||||||
des_f1.put(0, 0, 2.0);
|
des_f1.put(0, 0, 2.0);
|
||||||
@ -526,7 +526,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
des_f1.put(1, 0, 4.0);
|
des_f1.put(1, 0, 4.0);
|
||||||
des_f1.put(1, 1, 3.0);
|
des_f1.put(1, 1, 3.0);
|
||||||
Core.flip(src, dst, 1);
|
Core.flip(src, dst, 1);
|
||||||
assertMatEqual(des_f1, dst);
|
assertMatEqual(des_f1, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGemmMatMatDoubleMatDoubleMat() {
|
public void testGemmMatMatDoubleMatDoubleMat() {
|
||||||
@ -548,7 +548,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
desired.put(1, 0, 1.001, 0.001);
|
desired.put(1, 0, 1.001, 0.001);
|
||||||
|
|
||||||
Core.gemm(m1, m2, 1.0, dmatrix, 1.0, dst);
|
Core.gemm(m1, m2, 1.0, dmatrix, 1.0, dst);
|
||||||
assertMatEqual(desired, dst);
|
assertMatEqual(desired, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGemmMatMatDoubleMatDoubleMatInt() {
|
public void testGemmMatMatDoubleMatDoubleMatInt() {
|
||||||
@ -570,7 +570,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
desired.put(1, 0, 0.001, 0.001);
|
desired.put(1, 0, 0.001, 0.001);
|
||||||
|
|
||||||
Core.gemm(m1, m2, 1.0, dmatrix, 1.0, dst, Core.GEMM_1_T);
|
Core.gemm(m1, m2, 1.0, dmatrix, 1.0, dst, Core.GEMM_1_T);
|
||||||
assertMatEqual(desired, dst);
|
assertMatEqual(desired, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetCPUTickCount() {
|
public void testGetCPUTickCount() {
|
||||||
@ -619,7 +619,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
-0.86502546, 0.028082132, -0.7673766, 0.10917115);
|
-0.86502546, 0.028082132, -0.7673766, 0.10917115);
|
||||||
|
|
||||||
Core.idct(in, dst);
|
Core.idct(in, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIdctMatMatInt() {
|
public void testIdctMatMatInt() {
|
||||||
@ -631,7 +631,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
-0.86502546, 0.028082132, -0.7673766, 0.10917115);
|
-0.86502546, 0.028082132, -0.7673766, 0.10917115);
|
||||||
|
|
||||||
Core.idct(in, dst, Core.DCT_ROWS);
|
Core.idct(in, dst, Core.DCT_ROWS);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIdftMatMat() {
|
public void testIdftMatMat() {
|
||||||
@ -642,7 +642,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth.put(0, 0, 9, -9, 1, 3);
|
truth.put(0, 0, 9, -9, 1, 3);
|
||||||
|
|
||||||
Core.idft(in, dst);
|
Core.idft(in, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIdftMatMatInt() {
|
public void testIdftMatMatInt() {
|
||||||
@ -652,7 +652,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(1, 4, CvType.CV_32F);
|
truth = new Mat(1, 4, CvType.CV_32F);
|
||||||
truth.put(0, 0, 9, -9, 1, 3);
|
truth.put(0, 0, 9, -9, 1, 3);
|
||||||
Core.idft(in, dst, Core.DFT_REAL_OUTPUT);
|
Core.idft(in, dst, Core.DFT_REAL_OUTPUT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIdftMatMatIntInt() {
|
public void testIdftMatMatIntInt() {
|
||||||
@ -662,7 +662,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(1, 4, CvType.CV_32F);
|
truth = new Mat(1, 4, CvType.CV_32F);
|
||||||
truth.put(0, 0, 9, -9, 1, 3);
|
truth.put(0, 0, 9, -9, 1, 3);
|
||||||
Core.idft(in, dst, Core.DFT_REAL_OUTPUT, 1);
|
Core.idft(in, dst, Core.DFT_REAL_OUTPUT, 1);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInRange() {
|
public void testInRange() {
|
||||||
@ -692,7 +692,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 1, 1.0);
|
truth.put(1, 1, 1.0);
|
||||||
|
|
||||||
Core.invert(src, dst);
|
Core.invert(src, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
// TODO: needs epsilon comparison
|
// TODO: needs epsilon comparison
|
||||||
// Mat m = grayRnd_32f.clone();
|
// Mat m = grayRnd_32f.clone();
|
||||||
@ -707,7 +707,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth = Mat.eye(3, 3, CvType.CV_32FC1);
|
truth = Mat.eye(3, 3, CvType.CV_32FC1);
|
||||||
|
|
||||||
Core.invert(src, dst, Core.DECOMP_CHOLESKY);
|
Core.invert(src, dst, Core.DECOMP_CHOLESKY);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
Core.invert(src, dst, Core.DECOMP_LU);
|
Core.invert(src, dst, Core.DECOMP_LU);
|
||||||
double det = Core.determinant(src);
|
double det = Core.determinant(src);
|
||||||
@ -761,7 +761,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
desired.put(0, 0, 0, 2.3025851, 4.6051702, 6.9077554);
|
desired.put(0, 0, 0, 2.3025851, 4.6051702, 6.9077554);
|
||||||
|
|
||||||
Core.log(in, dst);
|
Core.log(in, dst);
|
||||||
assertMatEqual(desired, dst);
|
assertMatEqual(desired, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLUTMatMatMat() {
|
public void testLUTMatMatMat() {
|
||||||
@ -793,10 +793,10 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
out.put(0, 0, 5.0, 13.0, 41.0, 10.0);
|
out.put(0, 0, 5.0, 13.0, 41.0, 10.0);
|
||||||
|
|
||||||
Core.magnitude(x, y, dst);
|
Core.magnitude(x, y, dst);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
|
|
||||||
Core.magnitude(gray0_32f, gray255_32f, dst);
|
Core.magnitude(gray0_32f, gray255_32f, dst);
|
||||||
assertMatEqual(gray255_32f, dst);
|
assertMatEqual(gray255_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMahalanobis() {
|
public void testMahalanobis() {
|
||||||
@ -830,7 +830,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
y.put(0, 0, 4.0);
|
y.put(0, 0, 4.0);
|
||||||
dst.put(0, 0, 23.0);
|
dst.put(0, 0, 23.0);
|
||||||
Core.max(x, y, dst);
|
Core.max(x, y, dst);
|
||||||
assertMatEqual(dst, dst);
|
assertMatEqual(dst, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMeanMat() {
|
public void testMeanMat() {
|
||||||
@ -871,7 +871,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Core.meanStdDev(grayRnd, mean, stddev, mask);
|
Core.meanStdDev(grayRnd, mean, stddev, mask);
|
||||||
Mat desiredMean = new Mat(1, 1, CvType.CV_64F, new Scalar(33));
|
Mat desiredMean = new Mat(1, 1, CvType.CV_64F, new Scalar(33));
|
||||||
assertMatEqual(desiredMean, mean);
|
assertMatEqual(desiredMean, mean, EPS);
|
||||||
assertEquals(0, Core.countNonZero(stddev));
|
assertEquals(0, Core.countNonZero(stddev));
|
||||||
|
|
||||||
Core.meanStdDev(grayRnd, mean, stddev, gray1);
|
Core.meanStdDev(grayRnd, mean, stddev, gray1);
|
||||||
@ -924,7 +924,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
src2.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
src2.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
||||||
out.put(0, 0, 1, -5, 12, 16);
|
out.put(0, 0, 1, -5, 12, 16);
|
||||||
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS);
|
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulSpectrumsMatMatMatIntBoolean() {
|
public void testMulSpectrumsMatMatMatIntBoolean() {
|
||||||
@ -935,7 +935,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
src2.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
src2.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
||||||
out.put(0, 0, 1, 13, 0, 16);
|
out.put(0, 0, 1, 13, 0, 16);
|
||||||
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS, true);
|
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS, true);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMultiplyMatMatMat() {
|
public void testMultiplyMatMatMat() {
|
||||||
@ -956,24 +956,24 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testMulTransposedMatMatBoolean() {
|
public void testMulTransposedMatMatBoolean() {
|
||||||
Core.mulTransposed(grayE_32f, dst, true);
|
Core.mulTransposed(grayE_32f, dst, true);
|
||||||
assertMatEqual(grayE_32f, dst);
|
assertMatEqual(grayE_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulTransposedMatMatBooleanMat() {
|
public void testMulTransposedMatMatBooleanMat() {
|
||||||
Core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
|
Core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
|
||||||
assertMatEqual(gray0_32f, dst);
|
assertMatEqual(gray0_32f, dst, EPS);
|
||||||
|
|
||||||
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
|
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
|
||||||
grayDelta.setTo(new Scalar(0.0));
|
grayDelta.setTo(new Scalar(0.0));
|
||||||
Core.mulTransposed(grayE_32f, dst, true, grayDelta);
|
Core.mulTransposed(grayE_32f, dst, true, grayDelta);
|
||||||
assertMatEqual(grayE_32f, dst);
|
assertMatEqual(grayE_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulTransposedMatMatBooleanMatDouble() {
|
public void testMulTransposedMatMatBooleanMatDouble() {
|
||||||
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
|
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
|
||||||
grayDelta.setTo(new Scalar(0.0));
|
grayDelta.setTo(new Scalar(0.0));
|
||||||
Core.mulTransposed(grayE_32f, dst, true, grayDelta, 1);
|
Core.mulTransposed(grayE_32f, dst, true, grayDelta, 1);
|
||||||
assertMatEqual(grayE_32f, dst);
|
assertMatEqual(grayE_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMulTransposedMatMatBooleanMatDoubleInt() {
|
public void testMulTransposedMatMatBooleanMatDoubleInt() {
|
||||||
@ -989,7 +989,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
res.put(2, 0, 3, 3, 3);
|
res.put(2, 0, 3, 3, 3);
|
||||||
|
|
||||||
Core.mulTransposed(a, dst, true, grayDelta, 1.0, 1);
|
Core.mulTransposed(a, dst, true, grayDelta, 1.0, 1);
|
||||||
assertMatEqual(res, dst);
|
assertMatEqual(res, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNormalizeMatMat() {
|
public void testNormalizeMatMat() {
|
||||||
@ -1013,7 +1013,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
src.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
src.put(0, 0, 1.0, 2.0, 3.0, 4.0);
|
||||||
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
||||||
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF);
|
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNormalizeMatMatDoubleDoubleIntInt() {
|
public void testNormalizeMatMatDoubleDoubleIntInt() {
|
||||||
@ -1024,7 +1024,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
||||||
|
|
||||||
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF, -1);
|
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF, -1);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNormalizeMatMatDoubleDoubleIntIntMat() {
|
public void testNormalizeMatMatDoubleDoubleIntIntMat() {
|
||||||
@ -1036,7 +1036,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
out.put(0, 0, 0.25, 0.5, 0.75, 1);
|
||||||
|
|
||||||
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF, -1, mask);
|
Core.normalize(src, dst, 1.0, 2.0, Core.NORM_INF, -1, mask);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNormMat() {
|
public void testNormMat() {
|
||||||
@ -1124,7 +1124,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
res.put(0, 0, 1.1071469, 0.98280007, 0.78539175, 1.3258134);
|
res.put(0, 0, 1.1071469, 0.98280007, 0.78539175, 1.3258134);
|
||||||
|
|
||||||
Core.phase(x, y, dst);
|
Core.phase(x, y, dst);
|
||||||
assertMatEqual(res, dst);
|
assertMatEqual(res, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhaseMatMatMatBoolean() {
|
public void testPhaseMatMatMatBoolean() {
|
||||||
@ -1160,7 +1160,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
// TODO: needs epsilon comparison
|
// TODO: needs epsilon comparison
|
||||||
Core.polarToCart(magnitude, angle, xCoordinate, yCoordinate);
|
Core.polarToCart(magnitude, angle, xCoordinate, yCoordinate);
|
||||||
assertMatEqual(x, xCoordinate);
|
assertMatEqual(x, xCoordinate, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPolarToCartMatMatMatMatBoolean() {
|
public void testPolarToCartMatMatMatMatBoolean() {
|
||||||
@ -1279,7 +1279,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
out.put(0, 0, 1, 0);
|
out.put(0, 0, 1, 0);
|
||||||
|
|
||||||
Core.reduce(src, dst, 0, 2);
|
Core.reduce(src, dst, 0, 2);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReduceMatMatIntIntInt() {
|
public void testReduceMatMatIntIntInt() {
|
||||||
@ -1291,7 +1291,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
out.put(0, 0, 1, 0);
|
out.put(0, 0, 1, 0);
|
||||||
|
|
||||||
Core.reduce(src, dst, 0, 2, -1);
|
Core.reduce(src, dst, 0, 2, -1);
|
||||||
assertMatEqual(out, dst);
|
assertMatEqual(out, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRepeat() {
|
public void testRepeat() {
|
||||||
@ -1304,9 +1304,9 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
des2.put(0, 0, 1, 2, 3, 1, 2, 3);
|
des2.put(0, 0, 1, 2, 3, 1, 2, 3);
|
||||||
|
|
||||||
Core.repeat(src, 1, 1, dst);
|
Core.repeat(src, 1, 1, dst);
|
||||||
assertMatEqual(des1, dst);
|
assertMatEqual(des1, dst, EPS);
|
||||||
Core.repeat(src, 1, 2, dst);
|
Core.repeat(src, 1, 2, dst);
|
||||||
assertMatEqual(des2, dst);
|
assertMatEqual(des2, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScaleAdd() {
|
public void testScaleAdd() {
|
||||||
@ -1316,13 +1316,13 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testSetIdentityMat() {
|
public void testSetIdentityMat() {
|
||||||
Core.setIdentity(gray0_32f);
|
Core.setIdentity(gray0_32f);
|
||||||
assertMatEqual(grayE_32f, gray0_32f);
|
assertMatEqual(grayE_32f, gray0_32f, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetIdentityMatScalar() {
|
public void testSetIdentityMatScalar() {
|
||||||
Core.gemm(grayE_32f, grayE_32f, 5.0, new Mat(), 0.0, dst);
|
Core.gemm(grayE_32f, grayE_32f, 5.0, new Mat(), 0.0, dst);
|
||||||
Core.setIdentity(gray0_32f, new Scalar(5));
|
Core.setIdentity(gray0_32f, new Scalar(5));
|
||||||
assertMatEqual(dst, gray0_32f);
|
assertMatEqual(dst, gray0_32f, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSolveCubic() {
|
public void testSolveCubic() {
|
||||||
@ -1331,7 +1331,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
coeffs.put(0, 0, 1, 6, 11, 6);
|
coeffs.put(0, 0, 1, 6, 11, 6);
|
||||||
roots.put(0, 0, -3, -1, -2);
|
roots.put(0, 0, -3, -1, -2);
|
||||||
Core.solveCubic(coeffs, dst);
|
Core.solveCubic(coeffs, dst);
|
||||||
assertMatEqual(roots, dst);
|
assertMatEqual(roots, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSolveMatMatMat() {
|
public void testSolveMatMatMat() {
|
||||||
@ -1346,7 +1346,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
res.put(0, 0, -12, 2, 10);
|
res.put(0, 0, -12, 2, 10);
|
||||||
|
|
||||||
Core.solve(a, b, dst);
|
Core.solve(a, b, dst);
|
||||||
assertMatEqual(res, dst);
|
assertMatEqual(res, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSolveMatMatMatInt() {
|
public void testSolveMatMatMatInt() {
|
||||||
@ -1362,7 +1362,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
res.put(0, 0, -12, 2, 10);
|
res.put(0, 0, -12, 2, 10);
|
||||||
|
|
||||||
Core.solve(a, b, dst, 3);
|
Core.solve(a, b, dst, 3);
|
||||||
assertMatEqual(res, dst);
|
assertMatEqual(res, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSolvePolyMatMat() {
|
public void testSolvePolyMatMat() {
|
||||||
@ -1375,7 +1375,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth.put(0, 0, 1, 0, 2, 0, 3, 0);
|
truth.put(0, 0, 1, 0, 2, 0, 3, 0);
|
||||||
|
|
||||||
Core.solvePoly(coeffs, roots);
|
Core.solvePoly(coeffs, roots);
|
||||||
assertMatEqual(truth, roots);
|
assertMatEqual(truth, roots, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSolvePolyMatMatInt() {
|
public void testSolvePolyMatMatInt() {
|
||||||
@ -1388,7 +1388,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
truth.put(0, 0, 1, 0, -1, 2, -2, 12);
|
truth.put(0, 0, 1, 0, -1, 2, -2, 12);
|
||||||
|
|
||||||
Core.solvePoly(coeffs, roots, 1);
|
Core.solvePoly(coeffs, roots, 1);
|
||||||
assertMatEqual(truth, roots);
|
assertMatEqual(truth, roots, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSort() {
|
public void testSort() {
|
||||||
@ -1427,7 +1427,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testSqrt() {
|
public void testSqrt() {
|
||||||
Core.sqrt(gray9_32f, dst);
|
Core.sqrt(gray9_32f, dst);
|
||||||
assertMatEqual(gray3_32f, dst);
|
assertMatEqual(gray3_32f, dst, EPS);
|
||||||
|
|
||||||
Mat rgba144 = new Mat(matSize, matSize, CvType.CV_32FC4);
|
Mat rgba144 = new Mat(matSize, matSize, CvType.CV_32FC4);
|
||||||
Mat rgba12 = new Mat(matSize, matSize, CvType.CV_32FC4);
|
Mat rgba12 = new Mat(matSize, matSize, CvType.CV_32FC4);
|
||||||
@ -1435,7 +1435,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
rgba12.setTo(Scalar.all(12));
|
rgba12.setTo(Scalar.all(12));
|
||||||
|
|
||||||
Core.sqrt(rgba144, dst);
|
Core.sqrt(rgba144, dst);
|
||||||
assertMatEqual(rgba12, dst);
|
assertMatEqual(rgba12, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSubtractMatMatMat() {
|
public void testSubtractMatMatMat() {
|
||||||
@ -1456,7 +1456,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
public void testSubtractMatMatMatMatInt() {
|
public void testSubtractMatMatMatMatInt() {
|
||||||
Core.subtract(gray3, gray2, dst, gray1, CvType.CV_32F);
|
Core.subtract(gray3, gray2, dst, gray1, CvType.CV_32F);
|
||||||
assertTrue(CvType.CV_32F == dst.depth());
|
assertTrue(CvType.CV_32F == dst.depth());
|
||||||
assertMatEqual(gray1_32f, dst);
|
assertMatEqual(gray1_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSumElems() {
|
public void testSumElems() {
|
||||||
@ -1485,7 +1485,7 @@ public class coreTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Core.transform(src, dst, m);
|
Core.transform(src, dst, m);
|
||||||
truth = new Mat(2, 2, CvType.CV_32FC2, new Scalar(55, 1));
|
truth = new Mat(2, 2, CvType.CV_32FC2, new Scalar(55, 1));
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTranspose() {
|
public void testTranspose() {
|
||||||
|
@ -43,18 +43,18 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
public void testAccumulateMatMat() {
|
public void testAccumulateMatMat() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
||||||
Imgproc.accumulate(gray_64f_2, dst64F);
|
Imgproc.accumulate(gray_64f_2, dst64F);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
|
|
||||||
dst = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
|
dst = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
|
||||||
Imgproc.accumulate(gray1_32f, dst);
|
Imgproc.accumulate(gray1_32f, dst);
|
||||||
assertMatEqual(gray1_32f, dst);
|
assertMatEqual(gray1_32f, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateMatMatMat() {
|
public void testAccumulateMatMatMat() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(2));
|
||||||
|
|
||||||
Imgproc.accumulate(gray_64f_2, dst64F, mask); // TODO: use better mask
|
Imgproc.accumulate(gray_64f_2, dst64F, mask); // TODO: use better mask
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateProductMatMatMat() {
|
public void testAccumulateProductMatMatMat() {
|
||||||
@ -71,7 +71,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
Mat dstImage = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(
|
Mat dstImage = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(
|
||||||
0));
|
0));
|
||||||
Imgproc.accumulateProduct(src1, src2, dstImage);
|
Imgproc.accumulateProduct(src1, src2, dstImage);
|
||||||
assertMatEqual(truth, dstImage);
|
assertMatEqual(truth, dstImage, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateProductMatMatMatMat() {
|
public void testAccumulateProductMatMatMatMat() {
|
||||||
@ -88,34 +88,34 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 0, 2);
|
truth.put(1, 0, 0, 2);
|
||||||
|
|
||||||
Imgproc.accumulateProduct(src1, src2, dst64F, mask);
|
Imgproc.accumulateProduct(src1, src2, dst64F, mask);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateSquareMatMat() {
|
public void testAccumulateSquareMatMat() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
||||||
|
|
||||||
Imgproc.accumulateSquare(gray_64f_2, dst64F);
|
Imgproc.accumulateSquare(gray_64f_2, dst64F);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateSquareMatMatMat() {
|
public void testAccumulateSquareMatMatMat() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
||||||
|
|
||||||
Imgproc.accumulateSquare(gray_64f_2, dst64F, mask);
|
Imgproc.accumulateSquare(gray_64f_2, dst64F, mask);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateWeightedMatMatDouble() {
|
public void testAccumulateWeightedMatMatDouble() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(4));
|
||||||
|
|
||||||
Imgproc.accumulateWeighted(gray_64f_2, dst64F, 2.0);
|
Imgproc.accumulateWeighted(gray_64f_2, dst64F, 2.0);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccumulateWeightedMatMatDoubleMat() {
|
public void testAccumulateWeightedMatMatDoubleMat() {
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(8));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_64F, new Scalar(8));
|
||||||
Imgproc.accumulateWeighted(gray_64f_2, dst64F, 4.0, mask);
|
Imgproc.accumulateWeighted(gray_64f_2, dst64F, 4.0, mask);
|
||||||
assertMatEqual(truth, dst64F);
|
assertMatEqual(truth, dst64F, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAdaptiveThreshold() {
|
public void testAdaptiveThreshold() {
|
||||||
@ -132,7 +132,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
approxCurve.put(0, 0, 1.0, 3.0, 3.0, 5.0, 5.0, 3.0);
|
approxCurve.put(0, 0, 1.0, 3.0, 3.0, 5.0, 5.0, 3.0);
|
||||||
|
|
||||||
Imgproc.approxPolyDP(curve, dst, EPS, true);
|
Imgproc.approxPolyDP(curve, dst, EPS, true);
|
||||||
assertMatEqual(approxCurve, dst);
|
assertMatEqual(approxCurve, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testArcLength() {
|
public void testArcLength() {
|
||||||
@ -255,7 +255,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Mat hist = new Mat();
|
Mat hist = new Mat();
|
||||||
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
|
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
|
||||||
assertMatEqual(truth, hist);
|
assertMatEqual(truth, hist, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloat2d() {
|
public void testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloat2d() {
|
||||||
@ -283,7 +283,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Mat hist = new Mat();
|
Mat hist = new Mat();
|
||||||
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
|
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
|
||||||
assertMatEqual(truth, hist);
|
assertMatEqual(truth, hist, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloatBoolean() {
|
public void testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloatBoolean() {
|
||||||
@ -311,7 +311,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(9, 5, 100.0);
|
truth.put(9, 5, 100.0);
|
||||||
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges,
|
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges,
|
||||||
true);
|
true);
|
||||||
assertMatEqual(truth, hist);
|
assertMatEqual(truth, hist, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCannyMatMatDoubleDouble() {
|
public void testCannyMatMatDoubleDouble() {
|
||||||
@ -380,7 +380,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expHull.put(0, 0, 4, 0, 3, 2, 0, 2, 2, 0);
|
expHull.put(0, 0, 4, 0, 3, 2, 0, 2, 2, 0);
|
||||||
|
|
||||||
Imgproc.convexHull(points, dst);
|
Imgproc.convexHull(points, dst);
|
||||||
assertMatEqual(expHull, dst);
|
assertMatEqual(expHull, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvexHullMatMatBoolean() {
|
public void testConvexHullMatMatBoolean() {
|
||||||
@ -392,7 +392,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
||||||
|
|
||||||
Imgproc.convexHull(points, dst, true);
|
Imgproc.convexHull(points, dst, true);
|
||||||
assertMatEqual(expHull, dst);
|
assertMatEqual(expHull, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConvexHullMatMatBooleanBoolean() {
|
public void testConvexHullMatMatBooleanBoolean() {
|
||||||
@ -404,7 +404,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
expHull.put(0, 0, 0, 2, 3, 2, 4, 0, 2, 0);
|
||||||
|
|
||||||
Imgproc.convexHull(points, dst, true, true);
|
Imgproc.convexHull(points, dst, true, true);
|
||||||
assertMatEqual(expHull, dst);
|
assertMatEqual(expHull, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopyMakeBorderMatMatIntIntIntIntInt() {
|
public void testCopyMakeBorderMatMatIntIntIntIntInt() {
|
||||||
@ -414,7 +414,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
||||||
Imgproc.BORDER_REPLICATE);
|
Imgproc.BORDER_REPLICATE);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopyMakeBorderMatMatIntIntIntIntIntScalar() {
|
public void testCopyMakeBorderMatMatIntIntIntIntIntScalar() {
|
||||||
@ -426,7 +426,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
Imgproc.copyMakeBorder(src, dst, border, border, border, border,
|
||||||
Imgproc.BORDER_REPLICATE, value);
|
Imgproc.BORDER_REPLICATE, value);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerEigenValsAndVecsMatMatIntInt() {
|
public void testCornerEigenValsAndVecsMatMatIntInt() {
|
||||||
@ -440,7 +440,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
// TODO: eigen vals and vectors returned = 0 for most src matrices
|
// TODO: eigen vals and vectors returned = 0 for most src matrices
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC(6), new Scalar(0));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC(6), new Scalar(0));
|
||||||
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize);
|
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerEigenValsAndVecsMatMatIntIntInt() {
|
public void testCornerEigenValsAndVecsMatMatIntIntInt() {
|
||||||
@ -453,7 +453,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize,
|
Imgproc.cornerEigenValsAndVecs(src, dst, blockSize, ksize,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerHarrisMatMatIntIntDouble() {
|
public void testCornerHarrisMatMatIntIntDouble() {
|
||||||
@ -462,7 +462,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
int ksize = 7;
|
int ksize = 7;
|
||||||
double k = 0.1;
|
double k = 0.1;
|
||||||
Imgproc.cornerHarris(gray128, dst, blockSize, ksize, k);
|
Imgproc.cornerHarris(gray128, dst, blockSize, ksize, k);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerHarrisMatMatIntIntDoubleInt() {
|
public void testCornerHarrisMatMatIntIntDoubleInt() {
|
||||||
@ -472,7 +472,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
double k = 0.1;
|
double k = 0.1;
|
||||||
Imgproc.cornerHarris(gray255, dst, blockSize, ksize, k,
|
Imgproc.cornerHarris(gray255, dst, blockSize, ksize, k,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerMinEigenValMatMatInt() {
|
public void testCornerMinEigenValMatMatInt() {
|
||||||
@ -484,11 +484,11 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(0));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32FC1, new Scalar(0));
|
||||||
Imgproc.cornerMinEigenVal(src, dst, blockSize);
|
Imgproc.cornerMinEigenVal(src, dst, blockSize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
Mat truth1 = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
|
Mat truth1 = new Mat(matSize, matSize, CvType.CV_32FC1, new Scalar(0));
|
||||||
Imgproc.cornerMinEigenVal(gray255, dst, blockSize);
|
Imgproc.cornerMinEigenVal(gray255, dst, blockSize);
|
||||||
assertMatEqual(truth1, dst);
|
assertMatEqual(truth1, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerMinEigenValMatMatIntInt() {
|
public void testCornerMinEigenValMatMatIntInt() {
|
||||||
@ -503,7 +503,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0.055555549, 0.027777772, 0.055555549);
|
truth.put(2, 0, 0.055555549, 0.027777772, 0.055555549);
|
||||||
|
|
||||||
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize);
|
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerMinEigenValMatMatIntIntInt() {
|
public void testCornerMinEigenValMatMatIntIntInt() {
|
||||||
@ -519,7 +519,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize,
|
Imgproc.cornerMinEigenVal(src, dst, blockSize, ksize,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCornerSubPix() {
|
public void testCornerSubPix() {
|
||||||
@ -583,7 +583,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Mat labels = new Mat();
|
Mat labels = new Mat();
|
||||||
Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3);
|
Imgproc.distanceTransform(gray128, dst, labels, Imgproc.CV_DIST_L2, 3);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
assertMatEqual(dstLables, labels);
|
assertMatEqual(dstLables, labels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(3, 0, 0, 0, 1, 2);
|
truth.put(3, 0, 0, 0, 1, 2);
|
||||||
|
|
||||||
Imgproc.filter2D(src, dst, -1, kernel);
|
Imgproc.filter2D(src, dst, -1, kernel);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFilter2DMatMatIntMatPoint() {
|
public void testFilter2DMatMatIntMatPoint() {
|
||||||
@ -770,7 +770,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
linePoints.put(0, 0, 0.53196341, 0.84676737, 2.496531, 3.7467217);
|
linePoints.put(0, 0, 0.53196341, 0.84676737, 2.496531, 3.7467217);
|
||||||
|
|
||||||
Imgproc.fitLine(points, dst, Imgproc.CV_DIST_L12, 0, 0.01, 0.01);
|
Imgproc.fitLine(points, dst, Imgproc.CV_DIST_L12, 0, 0.01, 0.01);
|
||||||
assertMatEqual(linePoints, dst);
|
assertMatEqual(linePoints, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFloodFillMatMatPointScalar() {
|
public void testFloodFillMatMatPointScalar() {
|
||||||
@ -872,8 +872,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expKy.put(0, 0, 1, -2, 1);
|
expKy.put(0, 0, 1, -2, 1);
|
||||||
|
|
||||||
Imgproc.getDerivKernels(kx, ky, 2, 2, 3);
|
Imgproc.getDerivKernels(kx, ky, 2, 2, 3);
|
||||||
assertMatEqual(expKx, kx);
|
assertMatEqual(expKx, kx, EPS);
|
||||||
assertMatEqual(expKy, ky);
|
assertMatEqual(expKy, ky, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDerivKernelsMatMatIntIntIntBoolean() {
|
public void testGetDerivKernelsMatMatIntIntIntBoolean() {
|
||||||
@ -892,8 +892,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expKy.put(0, 0, 1, -2, 1);
|
expKy.put(0, 0, 1, -2, 1);
|
||||||
|
|
||||||
Imgproc.getDerivKernels(kx, ky, 2, 2, 3, true);
|
Imgproc.getDerivKernels(kx, ky, 2, 2, 3, true);
|
||||||
assertMatEqual(expKx, kx);
|
assertMatEqual(expKx, kx, EPS);
|
||||||
assertMatEqual(expKy, ky);
|
assertMatEqual(expKy, ky, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDerivKernelsMatMatIntIntIntBooleanInt() {
|
public void testGetDerivKernelsMatMatIntIntIntBooleanInt() {
|
||||||
@ -912,15 +912,15 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expKy.put(0, 0, 1, -2, 1);
|
expKy.put(0, 0, 1, -2, 1);
|
||||||
|
|
||||||
Imgproc.getDerivKernels(kx, ky, 2, 2, 3, true, CvType.CV_32F);
|
Imgproc.getDerivKernels(kx, ky, 2, 2, 3, true, CvType.CV_32F);
|
||||||
assertMatEqual(expKx, kx);
|
assertMatEqual(expKx, kx, EPS);
|
||||||
assertMatEqual(expKy, ky);
|
assertMatEqual(expKy, ky, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetGaussianKernelIntDouble() {
|
public void testGetGaussianKernelIntDouble() {
|
||||||
truth = new Mat(1, 1, CvType.CV_64FC1, new Scalar(1.0));
|
truth = new Mat(1, 1, CvType.CV_64FC1, new Scalar(1.0));
|
||||||
|
|
||||||
dst = Imgproc.getGaussianKernel(1, 0.5);
|
dst = Imgproc.getGaussianKernel(1, 0.5);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetGaussianKernelIntDoubleInt() {
|
public void testGetGaussianKernelIntDoubleInt() {
|
||||||
@ -928,7 +928,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(0, 0, 0.23899426, 0.52201146, 0.23899426);
|
truth.put(0, 0, 0.23899426, 0.52201146, 0.23899426);
|
||||||
|
|
||||||
dst = Imgproc.getGaussianKernel(3, 0.8, CvType.CV_32F);
|
dst = Imgproc.getGaussianKernel(3, 0.8, CvType.CV_32F);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetRectSubPixMatSizePointMat() {
|
public void testGetRectSubPixMatSizePointMat() {
|
||||||
@ -947,7 +947,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
Point center = new Point(src.cols() / 2, src.rows() / 2);
|
Point center = new Point(src.cols() / 2, src.rows() / 2);
|
||||||
|
|
||||||
Imgproc.getRectSubPix(src, patchSize, center, dst);
|
Imgproc.getRectSubPix(src, patchSize, center, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetRotationMatrix2D() {
|
public void testGetRotationMatrix2D() {
|
||||||
@ -956,7 +956,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 0, 1, 0);
|
truth.put(1, 0, 0, 1, 0);
|
||||||
Point center = new Point(0, 0);
|
Point center = new Point(0, 0);
|
||||||
dst = Imgproc.getRotationMatrix2D(center, 0.0, 1.0);
|
dst = Imgproc.getRotationMatrix2D(center, 0.0, 1.0);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetStructuringElementIntSize() {
|
public void testGetStructuringElementIntSize() {
|
||||||
@ -1135,8 +1135,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expSqsum.put(3, 0, 0, 27, 54, 81);
|
expSqsum.put(3, 0, 0, 27, 54, 81);
|
||||||
|
|
||||||
Imgproc.integral2(src, sum, sqsum);
|
Imgproc.integral2(src, sum, sqsum);
|
||||||
assertMatEqual(expSum, sum);
|
assertMatEqual(expSum, sum, EPS);
|
||||||
assertMatEqual(expSqsum, sqsum);
|
assertMatEqual(expSqsum, sqsum, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIntegral2MatMatMatInt() {
|
public void testIntegral2MatMatMatInt() {
|
||||||
@ -1157,8 +1157,8 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expSqsum.put(3, 0, 0, 27, 54, 81);
|
expSqsum.put(3, 0, 0, 27, 54, 81);
|
||||||
|
|
||||||
Imgproc.integral2(src, sum, sqsum, CvType.CV_64F);
|
Imgproc.integral2(src, sum, sqsum, CvType.CV_64F);
|
||||||
assertMatEqual(expSum, sum);
|
assertMatEqual(expSum, sum, EPS);
|
||||||
assertMatEqual(expSqsum, sqsum);
|
assertMatEqual(expSqsum, sqsum, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIntegral3MatMatMatMat() {
|
public void testIntegral3MatMatMatMat() {
|
||||||
@ -1180,9 +1180,9 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expTilted.put(1, 0, 0, 1);
|
expTilted.put(1, 0, 0, 1);
|
||||||
|
|
||||||
Imgproc.integral3(src, sum, sqsum, tilted);
|
Imgproc.integral3(src, sum, sqsum, tilted);
|
||||||
assertMatEqual(expSum, sum);
|
assertMatEqual(expSum, sum, EPS);
|
||||||
assertMatEqual(expSqsum, sqsum);
|
assertMatEqual(expSqsum, sqsum, EPS);
|
||||||
assertMatEqual(expTilted, tilted);
|
assertMatEqual(expTilted, tilted, EPS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,9 +1205,9 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
expTilted.put(1, 0, 0, 1);
|
expTilted.put(1, 0, 0, 1);
|
||||||
|
|
||||||
Imgproc.integral3(src, sum, sqsum, tilted, CvType.CV_64F);
|
Imgproc.integral3(src, sum, sqsum, tilted, CvType.CV_64F);
|
||||||
assertMatEqual(expSum, sum);
|
assertMatEqual(expSum, sum, EPS);
|
||||||
assertMatEqual(expSqsum, sqsum);
|
assertMatEqual(expSqsum, sqsum, EPS);
|
||||||
assertMatEqual(expTilted, tilted);
|
assertMatEqual(expTilted, tilted, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIntegralMatMat() {
|
public void testIntegralMatMat() {
|
||||||
@ -1219,7 +1219,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0, 4, 8);
|
truth.put(2, 0, 0, 4, 8);
|
||||||
|
|
||||||
Imgproc.integral(src, dst);
|
Imgproc.integral(src, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1232,7 +1232,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0, 4, 8);
|
truth.put(2, 0, 0, 4, 8);
|
||||||
|
|
||||||
Imgproc.integral(src, dst, CvType.CV_64F);
|
Imgproc.integral(src, dst, CvType.CV_64F);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInvertAffineTransform() {
|
public void testInvertAffineTransform() {
|
||||||
@ -1240,7 +1240,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(2, 3, CvType.CV_64F, new Scalar(0));
|
truth = new Mat(2, 3, CvType.CV_64F, new Scalar(0));
|
||||||
|
|
||||||
Imgproc.invertAffineTransform(src, dst);
|
Imgproc.invertAffineTransform(src, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsContourConvex() {
|
public void testIsContourConvex() {
|
||||||
@ -1263,7 +1263,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(0.0));
|
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(0.0));
|
||||||
|
|
||||||
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1);
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLaplacianMatMatIntIntDouble() {
|
public void testLaplacianMatMatIntIntDouble() {
|
||||||
@ -1275,7 +1275,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 8, -8);
|
truth.put(1, 0, 8, -8);
|
||||||
|
|
||||||
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0);
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLaplacianMatMatIntIntDoubleDouble() {
|
public void testLaplacianMatMatIntIntDoubleDouble() {
|
||||||
@ -1287,7 +1287,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 8.0009995, -7.9990001);
|
truth.put(1, 0, 8.0009995, -7.9990001);
|
||||||
|
|
||||||
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS);
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLaplacianMatMatIntIntDoubleDoubleInt() {
|
public void testLaplacianMatMatIntIntDoubleDoubleInt() {
|
||||||
@ -1296,7 +1296,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS,
|
Imgproc.Laplacian(src, dst, CvType.CV_32F, 1, 2.0, EPS,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatchShapes() {
|
public void testMatchShapes() {
|
||||||
@ -1322,11 +1322,11 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
truth = new Mat(1, 1, CvType.CV_32F, new Scalar(70));
|
truth = new Mat(1, 1, CvType.CV_32F, new Scalar(70));
|
||||||
Imgproc.matchTemplate(image, templ, dst, Imgproc.TM_CCORR);
|
Imgproc.matchTemplate(image, templ, dst, Imgproc.TM_CCORR);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
truth = new Mat(1, 1, CvType.CV_32F, new Scalar(0));
|
truth = new Mat(1, 1, CvType.CV_32F, new Scalar(0));
|
||||||
Imgproc.matchTemplate(gray255, gray0, dst, Imgproc.TM_CCORR);
|
Imgproc.matchTemplate(gray255, gray0, dst, Imgproc.TM_CCORR);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMedianBlur() {
|
public void testMedianBlur() {
|
||||||
@ -1451,7 +1451,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
int ksize = 3;
|
int ksize = 3;
|
||||||
|
|
||||||
Imgproc.preCornerDetect(src, dst, ksize);
|
Imgproc.preCornerDetect(src, dst, ksize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPreCornerDetectMatMatIntInt() {
|
public void testPreCornerDetectMatMatIntInt() {
|
||||||
@ -1460,7 +1460,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
int ksize = 3;
|
int ksize = 3;
|
||||||
|
|
||||||
Imgproc.preCornerDetect(src, dst, ksize, Imgproc.BORDER_REFLECT);
|
Imgproc.preCornerDetect(src, dst, ksize, Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPyrDownMatMat() {
|
public void testPyrDownMatMat() {
|
||||||
@ -1475,7 +1475,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F);
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F);
|
||||||
truth.put(0, 0, 2.78125, 4.609375);
|
truth.put(0, 0, 2.78125, 4.609375);
|
||||||
truth.put(1, 0, 8.546875, 8.8515625);
|
truth.put(1, 0, 8.546875, 8.8515625);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPyrDownMatMatSize() {
|
public void testPyrDownMatMatSize() {
|
||||||
@ -1492,7 +1492,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 8.546875, 8.8515625);
|
truth.put(1, 0, 8.546875, 8.8515625);
|
||||||
|
|
||||||
Imgproc.pyrDown(src, dst, dstSize);
|
Imgproc.pyrDown(src, dst, dstSize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPyrMeanShiftFilteringMatMatDoubleDouble() {
|
public void testPyrMeanShiftFilteringMatMatDoubleDouble() {
|
||||||
@ -1522,7 +1522,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(3, 0, 2.25, 2, 1.625, 1.5);
|
truth.put(3, 0, 2.25, 2, 1.625, 1.5);
|
||||||
|
|
||||||
Imgproc.pyrUp(src, dst);
|
Imgproc.pyrUp(src, dst);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPyrUpMatMatSize() {
|
public void testPyrUpMatMatSize() {
|
||||||
@ -1538,7 +1538,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(3, 0, 2.25, 2, 1.625, 1.5);
|
truth.put(3, 0, 2.25, 2, 1.625, 1.5);
|
||||||
|
|
||||||
Imgproc.pyrUp(src, dst, dstSize);
|
Imgproc.pyrUp(src, dst, dstSize);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemapMatMatMatMatInt() {
|
public void testRemapMatMatMatMatInt() {
|
||||||
@ -1552,7 +1552,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(1, 3, CvType.CV_32F, new Scalar(0));
|
truth = new Mat(1, 3, CvType.CV_32F, new Scalar(0));
|
||||||
|
|
||||||
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR);
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemapMatMatMatMatIntInt() {
|
public void testRemapMatMatMatMatIntInt() {
|
||||||
@ -1567,7 +1567,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemapMatMatMatMatIntIntScalar() {
|
public void testRemapMatMatMatMatIntIntScalar() {
|
||||||
@ -1584,7 +1584,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
Imgproc.remap(src, dst, map1, map2, Imgproc.INTER_LINEAR,
|
||||||
Imgproc.BORDER_REFLECT, sc);
|
Imgproc.BORDER_REFLECT, sc);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testResizeMatMatSize() {
|
public void testResizeMatMatSize() {
|
||||||
@ -1625,7 +1625,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0));
|
||||||
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0);
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScharrMatMatIntIntIntDouble() {
|
public void testScharrMatMatIntIntIntDouble() {
|
||||||
@ -1633,7 +1633,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0));
|
||||||
Imgproc.Scharr(src, dst, CvType.CV_32F, 0, 1, 1.5);
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 0, 1, 1.5);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScharrMatMatIntIntIntDoubleDouble() {
|
public void testScharrMatMatIntIntIntDoubleDouble() {
|
||||||
@ -1641,7 +1641,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0.001));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(0.001));
|
||||||
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.001);
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.001);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScharrMatMatIntIntIntDoubleDoubleInt() {
|
public void testScharrMatMatIntIntIntDoubleDoubleInt() {
|
||||||
@ -1654,7 +1654,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.0,
|
Imgproc.Scharr(src, dst, CvType.CV_32F, 1, 0, 1.5, 0.0,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSepFilter2DMatMatIntMatMat() {
|
public void testSepFilter2DMatMatIntMatMat() {
|
||||||
@ -1667,7 +1667,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
kernelY.put(0, 0, 9.0, 4.0, 2.0);
|
kernelY.put(0, 0, 9.0, 4.0, 2.0);
|
||||||
|
|
||||||
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY);
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSepFilter2DMatMatIntMatMatPoint() {
|
public void testSepFilter2DMatMatIntMatMatPoint() {
|
||||||
@ -1682,7 +1682,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
||||||
anchorPoint);
|
anchorPoint);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSepFilter2DMatMatIntMatMatPointDouble() {
|
public void testSepFilter2DMatMatIntMatMatPointDouble() {
|
||||||
@ -1698,7 +1698,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(36.001));
|
truth = new Mat(imgprocSz, imgprocSz, CvType.CV_32F, new Scalar(36.001));
|
||||||
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
Imgproc.sepFilter2D(src, dst, CvType.CV_32F, kernelX, kernelY,
|
||||||
anchorPoint, EPS);
|
anchorPoint, EPS);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSepFilter2DMatMatIntMatMatPointDoubleInt() {
|
public void testSepFilter2DMatMatIntMatMatPointDoubleInt() {
|
||||||
@ -1711,7 +1711,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(10, 10, CvType.CV_32F, new Scalar(0.001));
|
truth = new Mat(10, 10, CvType.CV_32F, new Scalar(0.001));
|
||||||
Imgproc.sepFilter2D(gray0, dst, CvType.CV_32F, kernelX, kernelY,
|
Imgproc.sepFilter2D(gray0, dst, CvType.CV_32F, kernelX, kernelY,
|
||||||
anchorPoint, EPS, Imgproc.BORDER_REFLECT);
|
anchorPoint, EPS, Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSobelMatMatIntIntInt() {
|
public void testSobelMatMatIntIntInt() {
|
||||||
@ -1736,8 +1736,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0, -24, 0);
|
truth.put(2, 0, 0, -24, 0);
|
||||||
|
|
||||||
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0);
|
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSobelMatMatIntIntIntIntDoubleDouble() {
|
public void testSobelMatMatIntIntIntIntDoubleDouble() {
|
||||||
@ -1758,7 +1757,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0, 0.0,
|
Imgproc.Sobel(src, dst, CvType.CV_32F, 1, 0, 3, 2.0, 0.0,
|
||||||
Imgproc.BORDER_REPLICATE);
|
Imgproc.BORDER_REPLICATE);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testThreshold() {
|
public void testThreshold() {
|
||||||
@ -1790,7 +1789,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0, 3, 0);
|
truth.put(2, 0, 0, 3, 0);
|
||||||
|
|
||||||
Imgproc.undistort(src, dst, cameraMatrix, distCoeffs);
|
Imgproc.undistort(src, dst, cameraMatrix, distCoeffs);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUndistortMatMatMatMatMat() {
|
public void testUndistortMatMatMatMatMat() {
|
||||||
@ -1809,7 +1808,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(3));
|
truth = new Mat(3, 3, CvType.CV_32F, new Scalar(3));
|
||||||
|
|
||||||
Imgproc.undistort(src, dst, cameraMatrix, distCoeffs, newCameraMatrix);
|
Imgproc.undistort(src, dst, cameraMatrix, distCoeffs, newCameraMatrix);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpAffineMatMatMatSize() {
|
public void testWarpAffineMatMatMatSize() {
|
||||||
@ -1830,7 +1829,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
M.put(1, 0, 0, 1, 1);
|
M.put(1, 0, 0, 1, 1);
|
||||||
|
|
||||||
Imgproc.warpAffine(src, dst, M, size);
|
Imgproc.warpAffine(src, dst, M, size);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpAffineMatMatMatSizeInt() {
|
public void testWarpAffineMatMatMatSizeInt() {
|
||||||
@ -1850,7 +1849,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
M.put(1, 0, 0, 0, 1);
|
M.put(1, 0, 0, 0, 1);
|
||||||
|
|
||||||
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP);
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpAffineMatMatMatSizeIntInt() {
|
public void testWarpAffineMatMatMatSizeIntInt() {
|
||||||
@ -1869,7 +1868,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
||||||
Imgproc.BORDER_TRANSPARENT);
|
Imgproc.BORDER_TRANSPARENT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpAffineMatMatMatSizeIntIntScalar() {
|
public void testWarpAffineMatMatMatSizeIntIntScalar() {
|
||||||
@ -1891,7 +1890,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
Imgproc.warpAffine(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
||||||
Imgproc.BORDER_CONSTANT, sc);
|
Imgproc.BORDER_CONSTANT, sc);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpPerspectiveMatMatMatSize() {
|
public void testWarpPerspectiveMatMatMatSize() {
|
||||||
@ -1912,7 +1911,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(2, 0, 0, 0, 4);
|
truth.put(2, 0, 0, 0, 4);
|
||||||
|
|
||||||
Imgproc.warpPerspective(src, dst, M, size);
|
Imgproc.warpPerspective(src, dst, M, size);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpPerspectiveMatMatMatSizeInt() {
|
public void testWarpPerspectiveMatMatMatSizeInt() {
|
||||||
@ -1932,8 +1931,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
truth.put(1, 0, 6, 4);
|
truth.put(1, 0, 6, 4);
|
||||||
|
|
||||||
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP);
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpPerspectiveMatMatMatSizeIntInt() {
|
public void testWarpPerspectiveMatMatMatSizeIntInt() {
|
||||||
@ -1954,7 +1952,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
||||||
Imgproc.BORDER_REFLECT);
|
Imgproc.BORDER_REFLECT);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWarpPerspectiveMatMatMatSizeIntIntScalar() {
|
public void testWarpPerspectiveMatMatMatSizeIntIntScalar() {
|
||||||
@ -1973,7 +1971,7 @@ public class imgprocTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
Imgproc.warpPerspective(src, dst, M, dsize, Imgproc.WARP_INVERSE_MAP,
|
||||||
Imgproc.BORDER_REFLECT, sc);
|
Imgproc.BORDER_REFLECT, sc);
|
||||||
assertMatEqual(truth, dst);
|
assertMatEqual(truth, dst, EPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWatershed() {
|
public void testWatershed() {
|
||||||
|
@ -13,42 +13,42 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nType
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nType
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->type( );
|
return me->type( );
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nRows
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nRows
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->rows;
|
return me->rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nCols
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nCols
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->cols;
|
return me->cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nData
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nData
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return (jlong) me->data;
|
return (jlong) me->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsEmpty
|
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsEmpty
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->empty();
|
return me->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize
|
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -58,8 +58,8 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize
|
|||||||
cv::Size _retval_ = me->size();
|
cv::Size _retval_ = me->size();
|
||||||
|
|
||||||
jdoubleArray _da_retval_ = env->NewDoubleArray(2);
|
jdoubleArray _da_retval_ = env->NewDoubleArray(2);
|
||||||
jdouble _tmp_retval_[4] = {_retval_.width, _retval_.height};
|
jdouble _tmp_retval_[4] = {_retval_.width, _retval_.height};
|
||||||
env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
|
env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
|
||||||
return _da_retval_;
|
return _da_retval_;
|
||||||
} catch(cv::Exception e) {
|
} catch(cv::Exception e) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -80,32 +80,32 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsCont
|
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsCont
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->isContinuous();
|
return me->isContinuous();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsSubmat
|
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsSubmat
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return me->isSubmatrix();
|
return me->isSubmatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nSubmat
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nSubmat
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint r1, jint r2, jint c1, jint c2)
|
(JNIEnv* env, jclass cls, jlong self, jint r1, jint r2, jint c1, jint c2)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return (jlong) new cv::Mat(*me, cv::Range(r1, r2>0 ? r2 : me->rows), cv::Range(c1, c2>0 ? c2 : me->cols));
|
return (jlong) new cv::Mat(*me, cv::Range(r1, r2>0 ? r2 : me->rows), cv::Range(c1, c2>0 ? c2 : me->cols));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nClone
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nClone
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
cv::Mat* it = new cv::Mat();
|
cv::Mat* it = new cv::Mat();
|
||||||
me->copyTo(*it);
|
me->copyTo(*it);
|
||||||
return (jlong) it;
|
return (jlong) it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,47 +113,47 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nClone
|
|||||||
#define PUT_ITEM(T, R, C) { T*dst = (T*)me->ptr(R, C); for(int ch=0; ch<me->channels() && count>0; count--,ch++,src++,dst++) *dst = cv::saturate_cast<T>(*src); }
|
#define PUT_ITEM(T, R, C) { T*dst = (T*)me->ptr(R, C); for(int ch=0; ch<me->channels() && count>0; count--,ch++,src++,dst++) *dst = cv::saturate_cast<T>(*src); }
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(!me || !me->data) return 0; // no native object behind
|
if(!me || !me->data) return 0; // no native object behind
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
int rest = ((me->rows - row) * me->cols - col) * me->channels();
|
int rest = ((me->rows - row) * me->cols - col) * me->channels();
|
||||||
if(count>rest) count = rest;
|
if(count>rest) count = rest;
|
||||||
int res = count;
|
int res = count;
|
||||||
double* values = (double*)env->GetPrimitiveArrayCritical(vals, 0);
|
double* values = (double*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
double* src = values;
|
double* src = values;
|
||||||
int r, c;
|
int r, c;
|
||||||
for(c=col; c<me->cols && count>0; c++)
|
for(c=col; c<me->cols && count>0; c++)
|
||||||
{
|
{
|
||||||
switch(me->depth()) {
|
switch(me->depth()) {
|
||||||
case CV_8U: PUT_ITEM(uchar, row, c); break;
|
case CV_8U: PUT_ITEM(uchar, row, c); break;
|
||||||
case CV_8S: PUT_ITEM(schar, row, c); break;
|
case CV_8S: PUT_ITEM(schar, row, c); break;
|
||||||
case CV_16U: PUT_ITEM(ushort, row, c); break;
|
case CV_16U: PUT_ITEM(ushort, row, c); break;
|
||||||
case CV_16S: PUT_ITEM(short, row, c); break;
|
case CV_16S: PUT_ITEM(short, row, c); break;
|
||||||
case CV_32S: PUT_ITEM(int, row, c); break;
|
case CV_32S: PUT_ITEM(int, row, c); break;
|
||||||
case CV_32F: PUT_ITEM(float, row, c); break;
|
case CV_32F: PUT_ITEM(float, row, c); break;
|
||||||
case CV_64F: PUT_ITEM(double, row, c); break;
|
case CV_64F: PUT_ITEM(double, row, c); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(r=row+1; r<me->rows && count>0; r++)
|
for(r=row+1; r<me->rows && count>0; r++)
|
||||||
for(c=0; c<me->cols && count>0; c++)
|
for(c=0; c<me->cols && count>0; c++)
|
||||||
{
|
{
|
||||||
switch(me->depth()) {
|
switch(me->depth()) {
|
||||||
case CV_8U: PUT_ITEM(uchar, r, c); break;
|
case CV_8U: PUT_ITEM(uchar, r, c); break;
|
||||||
case CV_8S: PUT_ITEM(schar, r, c); break;
|
case CV_8S: PUT_ITEM(schar, r, c); break;
|
||||||
case CV_16U: PUT_ITEM(ushort, r, c); break;
|
case CV_16U: PUT_ITEM(ushort, r, c); break;
|
||||||
case CV_16S: PUT_ITEM(short, r, c); break;
|
case CV_16S: PUT_ITEM(short, r, c); break;
|
||||||
case CV_32S: PUT_ITEM(int, r, c); break;
|
case CV_32S: PUT_ITEM(int, r, c); break;
|
||||||
case CV_32F: PUT_ITEM(float, r, c); break;
|
case CV_32F: PUT_ITEM(float, r, c); break;
|
||||||
case CV_64F: PUT_ITEM(double, r, c); break;
|
case CV_64F: PUT_ITEM(double, r, c); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,32 +163,32 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
|
|||||||
|
|
||||||
template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count, char* buff)
|
template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count, char* buff)
|
||||||
{
|
{
|
||||||
if(! m) return 0;
|
if(! m) return 0;
|
||||||
if(! buff) return 0;
|
if(! buff) return 0;
|
||||||
|
|
||||||
count *= sizeof(T);
|
count *= sizeof(T);
|
||||||
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);
|
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);
|
||||||
if(count>rest) count = rest;
|
if(count>rest) count = rest;
|
||||||
int res = count;
|
int res = count;
|
||||||
|
|
||||||
if( m->isContinuous() )
|
if( m->isContinuous() )
|
||||||
{
|
{
|
||||||
memcpy(m->ptr(row, col), buff, count);
|
memcpy(m->ptr(row, col), buff, count);
|
||||||
} else {
|
} else {
|
||||||
// row by row
|
// row by row
|
||||||
int num = (m->cols - col - 1) * m->channels() * sizeof(T); // 1st partial row
|
int num = (m->cols - col - 1) * m->channels() * sizeof(T); // 1st partial row
|
||||||
if(count<num) num = count;
|
if(count<num) num = count;
|
||||||
uchar* data = m->ptr(row++, col);
|
uchar* data = m->ptr(row++, col);
|
||||||
while(count>0){
|
while(count>0){
|
||||||
memcpy(data, buff, num);
|
memcpy(data, buff, num);
|
||||||
count -= num;
|
count -= num;
|
||||||
buff += num;
|
buff += num;
|
||||||
num = m->cols * m->channels() * sizeof(T);
|
num = m->cols * m->channels() * sizeof(T);
|
||||||
if(count<num) num = count;
|
if(count<num) num = count;
|
||||||
data = m->ptr(row++, 0);
|
data = m->ptr(row++, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -197,59 +197,59 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type
|
if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_put<char>(me, row, col, count, values);
|
int res = mat_put<char>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_16U && me->depth() != CV_16S) return 0; // incompatible type
|
if(me->depth() != CV_16U && me->depth() != CV_16S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_put<short>(me, row, col, count, values);
|
int res = mat_put<short>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_32S) return 0; // incompatible type
|
if(me->depth() != CV_32S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_put<int>(me, row, col, count, values);
|
int res = mat_put<int>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_32F) return 0; // incompatible type
|
if(me->depth() != CV_32F) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_put<float>(me, row, col, count, values);
|
int res = mat_put<float>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -260,32 +260,32 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
|||||||
|
|
||||||
template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char* buff)
|
template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char* buff)
|
||||||
{
|
{
|
||||||
if(! m) return 0;
|
if(! m) return 0;
|
||||||
if(! buff) return 0;
|
if(! buff) return 0;
|
||||||
|
|
||||||
count *= sizeof(T);
|
count *= sizeof(T);
|
||||||
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);
|
int rest = ((m->rows - row) * m->cols - col) * m->channels() * sizeof(T);
|
||||||
if(count>rest) count = rest;
|
if(count>rest) count = rest;
|
||||||
int res = count;
|
int res = count;
|
||||||
|
|
||||||
if( m->isContinuous() )
|
if( m->isContinuous() )
|
||||||
{
|
{
|
||||||
memcpy(buff, m->ptr(row, col), count);
|
memcpy(buff, m->ptr(row, col), count);
|
||||||
} else {
|
} else {
|
||||||
// row by row
|
// row by row
|
||||||
int num = (m->cols - col - 1) * m->channels() * sizeof(T); // 1st partial row
|
int num = (m->cols - col - 1) * m->channels() * sizeof(T); // 1st partial row
|
||||||
if(count<num) num = count;
|
if(count<num) num = count;
|
||||||
uchar* data = m->ptr(row++, col);
|
uchar* data = m->ptr(row++, col);
|
||||||
while(count>0){//TODO: recheck this cycle for the case col!=0
|
while(count>0){//TODO: recheck this cycle for the case col!=0
|
||||||
memcpy(buff, data, num);
|
memcpy(buff, data, num);
|
||||||
count -= num;
|
count -= num;
|
||||||
buff += num;
|
buff += num;
|
||||||
num = m->cols * m->channels() * sizeof(T);
|
num = m->cols * m->channels() * sizeof(T);
|
||||||
if(count<num) num = count;
|
if(count<num) num = count;
|
||||||
data = m->ptr(row++, 0);
|
data = m->ptr(row++, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -294,98 +294,98 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type
|
if(me->depth() != CV_8U && me->depth() != CV_8S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_get<char>(me, row, col, count, values);
|
int res = mat_get<char>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_16U && me->depth() != CV_16S) return 0; // incompatible type
|
if(me->depth() != CV_16U && me->depth() != CV_16S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_get<short>(me, row, col, count, values);
|
int res = mat_get<short>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_32S) return 0; // incompatible type
|
if(me->depth() != CV_32S) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_get<int>(me, row, col, count, values);
|
int res = mat_get<int>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_32F) return 0; // incompatible type
|
if(me->depth() != CV_32F) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_get<float>(me, row, col, count, values);
|
int res = mat_get<float>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
|
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->depth() != CV_64F) return 0; // incompatible type
|
if(me->depth() != CV_64F) return 0; // incompatible type
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
char* values = (char*)env->GetPrimitiveArrayCritical(vals, 0);
|
||||||
int res = mat_get<double>(me, row, col, count, values);
|
int res = mat_get<double>(me, row, col, count, values);
|
||||||
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
env->ReleasePrimitiveArrayCritical(vals, values, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
||||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count)
|
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self;
|
cv::Mat* me = (cv::Mat*) self;
|
||||||
if(! self) return 0; // no native object behind
|
if(! self) return 0; // no native object behind
|
||||||
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
if(me->rows<=row || me->cols<=col) return 0; // indexes out of range
|
||||||
|
|
||||||
jdoubleArray res = env->NewDoubleArray(me->channels());
|
jdoubleArray res = env->NewDoubleArray(me->channels());
|
||||||
if(res){
|
if(res){
|
||||||
jdouble buff[me->channels()];
|
jdouble buff[me->channels()];
|
||||||
int i;
|
int i;
|
||||||
switch(me->depth()){
|
switch(me->depth()){
|
||||||
case CV_8U: for(i=0; i<me->channels(); i++) buff[i] = *((unsigned char*) me->ptr(row, col) + i); break;
|
case CV_8U: for(i=0; i<me->channels(); i++) buff[i] = *((unsigned char*) me->ptr(row, col) + i); break;
|
||||||
case CV_8S: for(i=0; i<me->channels(); i++) buff[i] = *((signed char*) me->ptr(row, col) + i); break;
|
case CV_8S: for(i=0; i<me->channels(); i++) buff[i] = *((signed char*) me->ptr(row, col) + i); break;
|
||||||
case CV_16U: for(i=0; i<me->channels(); i++) buff[i] = *((unsigned short*)me->ptr(row, col) + i); break;
|
case CV_16U: for(i=0; i<me->channels(); i++) buff[i] = *((unsigned short*)me->ptr(row, col) + i); break;
|
||||||
case CV_16S: for(i=0; i<me->channels(); i++) buff[i] = *((signed short*) me->ptr(row, col) + i); break;
|
case CV_16S: for(i=0; i<me->channels(); i++) buff[i] = *((signed short*) me->ptr(row, col) + i); break;
|
||||||
case CV_32S: for(i=0; i<me->channels(); i++) buff[i] = *((int*) me->ptr(row, col) + i); break;
|
case CV_32S: for(i=0; i<me->channels(); i++) buff[i] = *((int*) me->ptr(row, col) + i); break;
|
||||||
case CV_32F: for(i=0; i<me->channels(); i++) buff[i] = *((float*) me->ptr(row, col) + i); break;
|
case CV_32F: for(i=0; i<me->channels(); i++) buff[i] = *((float*) me->ptr(row, col) + i); break;
|
||||||
case CV_64F: for(i=0; i<me->channels(); i++) buff[i] = *((double*) me->ptr(row, col) + i); break;
|
case CV_64F: for(i=0; i<me->channels(); i++) buff[i] = *((double*) me->ptr(row, col) + i); break;
|
||||||
}
|
}
|
||||||
env->SetDoubleArrayRegion(res, 0, me->channels(), buff);
|
env->SetDoubleArrayRegion(res, 0, me->channels(), buff);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nSetTo
|
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nSetTo
|
||||||
@ -412,7 +412,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_nDot
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCross
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCross
|
||||||
(JNIEnv* env, jclass cls, jlong self, jlong m)
|
(JNIEnv* env, jclass cls, jlong self, jlong m)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
cv::Mat* _m = (cv::Mat*) m; //TODO: check for NULL
|
cv::Mat* _m = (cv::Mat*) m; //TODO: check for NULL
|
||||||
@ -420,10 +420,17 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCross
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nInv
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nInv
|
||||||
(JNIEnv* env, jclass cls, jlong self)
|
(JNIEnv* env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
return (jlong) new cv::Mat(me->inv());
|
return (jlong) new cv::Mat(me->inv());
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nReshape
|
||||||
|
(JNIEnv* env, jclass cls, jlong self, jint cn, jint rows)
|
||||||
|
{
|
||||||
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
|
return (jlong) new cv::Mat(me->reshape(cn, rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__
|
||||||
@ -441,10 +448,10 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nEye
|
|||||||
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
||||||
(JNIEnv *env, jclass cls, jlong self)
|
(JNIEnv *env, jclass cls, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << *me;
|
s << *me;
|
||||||
return env->NewStringUTF(s.str().c_str());
|
return env->NewStringUTF(s.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__III
|
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__III
|
||||||
|
@ -275,6 +275,16 @@ public class Mat {
|
|||||||
public Mat inv() {
|
public Mat inv() {
|
||||||
return new Mat( nInv(nativeObj) );
|
return new Mat( nInv(nativeObj) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//javadoc:Mat::reshape(cn)
|
||||||
|
public Mat reshape(int cn) {
|
||||||
|
return new Mat( nReshape(nativeObj, cn, 0) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//javadoc:Mat::reshape(cn, rows)
|
||||||
|
public Mat reshape(int cn, int rows) {
|
||||||
|
return new Mat( nReshape(nativeObj, cn, rows) );
|
||||||
|
}
|
||||||
|
|
||||||
//javadoc:Mat::getNativeObjAddr()
|
//javadoc:Mat::getNativeObjAddr()
|
||||||
public long getNativeObjAddr() {
|
public long getNativeObjAddr() {
|
||||||
@ -315,6 +325,7 @@ public class Mat {
|
|||||||
private static native double nDot(long self, long mat);
|
private static native double nDot(long self, long mat);
|
||||||
private static native long nCross(long self, long mat);
|
private static native long nCross(long self, long mat);
|
||||||
private static native long nInv(long self);
|
private static native long nInv(long self);
|
||||||
|
private static native long nReshape(long self, int cn, int rows);
|
||||||
private static native long nEye(int rows, int cols, int type);
|
private static native long nEye(int rows, int cols, int type);
|
||||||
private static native String nDump(long self);
|
private static native String nDump(long self);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user