Commit 6b789dd2 authored by Kirill Kornyakov's avatar Kirill Kornyakov

java tests: adopted for the new package structure

parent dfdb15be
......@@ -2,11 +2,11 @@ package org.opencv.test;
import junit.framework.TestCase;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Scalar;
import org.opencv.core;
import org.opencv.highgui;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.core.Core;
import org.opencv.highgui.Highgui;
public class OpenCVTestCase extends TestCase {
......@@ -85,7 +85,7 @@ public class OpenCVTestCase extends TestCase {
Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256));
grayRnd = new Mat(matSize, matSize, CvType.CV_8U); core.randu(grayRnd, low, high);
grayRnd = new Mat(matSize, matSize, CvType.CV_8U); Core.randu(grayRnd, low, high);
gray0_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(0.0));
gray1_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(1.0));
......@@ -93,7 +93,7 @@ public class OpenCVTestCase extends TestCase {
gray9_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(9.0));
gray255_32f = new Mat(matSize, matSize, CvType.CV_32F, new Scalar(255.0));
grayE_32f = new Mat(matSize, matSize, CvType.CV_32F); grayE_32f = Mat.eye(matSize, matSize, CvType.CV_32FC1);
grayRnd_32f = new Mat(matSize, matSize, CvType.CV_32F); core.randu(grayRnd_32f, low, high);
grayRnd_32f = new Mat(matSize, matSize, CvType.CV_32F); Core.randu(grayRnd_32f, low, high);
gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F, new Scalar(0.0));
......@@ -103,8 +103,8 @@ public class OpenCVTestCase extends TestCase {
rgba0 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(0));
rgba128 = new Mat(matSize, matSize, CvType.CV_8UC4, Scalar.all(128));
rgbLena = highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = highgui.imread(OpenCVTestRunner.CHESS_PATH);
rgbLena = Highgui.imread(OpenCVTestRunner.LENA_PATH);
grayChess = Highgui.imread(OpenCVTestRunner.CHESS_PATH);
v1 = new Mat(1, 3, CvType.CV_32F); v1.put(0, 0, 1.0, 3.0, 2.0);
v2 = new Mat(1, 3, CvType.CV_32F); v2.put(0, 0, 2.0, 1.0, 3.0);
......@@ -163,9 +163,9 @@ public class OpenCVTestCase extends TestCase {
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);
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()));
(1.0 - Double.valueOf(Core.countNonZero(cmp)) / Double.valueOf(cmp.rows() * cmp.cols()));
return difference;
}
......
package org.opencv.test.calib3d;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Point;
import org.opencv.Scalar;
import org.opencv.Size;
import org.opencv.calib3d;
import org.opencv.core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.calib3d.Calib3d;
import org.opencv.core.Core;
import org.opencv.test.OpenCVTestCase;
public class calib3dTest extends OpenCVTestCase {
......@@ -27,7 +27,7 @@ public class calib3dTest extends OpenCVTestCase {
Mat outRvec = new Mat(3, 1, CvType.CV_32F); outRvec.put(0, 0, 1.418641, 0.88665926, 0.56020796);
Mat outTvec = new Mat(3, 1, CvType.CV_32F); outTvec.put(0, 0, 1.4560841, 1.0680628, 0.81598103);
calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
Calib3d.composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3);
assertMatEqual(outRvec, rvec3);
assertMatEqual(outTvec, tvec3);
......@@ -145,10 +145,10 @@ public class calib3dTest extends OpenCVTestCase {
public void testFilterSpecklesMatDoubleIntDouble() {
gray_16s_1024.copyTo(dst);
Point center = new Point(gray_16s_1024.rows()/2., gray_16s_1024.cols()/2.);
core.circle(dst, center, 1, Scalar.all(4096));
Core.circle(dst, center, 1, Scalar.all(4096));
assertMatNotEqual(gray_16s_1024, dst);
calib3d.filterSpeckles(dst, 1024.0, 100, 0.);
Calib3d.filterSpeckles(dst, 1024.0, 100, 0.);
assertMatEqual(gray_16s_1024, dst);
}
......@@ -158,14 +158,14 @@ public class calib3dTest extends OpenCVTestCase {
public void testFindChessboardCornersMatSizeMat() {
Size patternSize = new Size(9, 6);
calib3d.findChessboardCorners(grayChess, patternSize, dst);
Calib3d.findChessboardCorners(grayChess, patternSize, dst);
assertTrue(!dst.empty());
}
public void testFindChessboardCornersMatSizeMatInt() {
Size patternSize = new Size(9, 6);
calib3d.findChessboardCorners(grayChess, patternSize, dst,
calib3d.CALIB_CB_ADAPTIVE_THRESH + calib3d.CALIB_CB_NORMALIZE_IMAGE + calib3d.CALIB_CB_FAST_CHECK);
Calib3d.findChessboardCorners(grayChess, patternSize, dst,
Calib3d.CALIB_CB_ADAPTIVE_THRESH + Calib3d.CALIB_CB_NORMALIZE_IMAGE + Calib3d.CALIB_CB_FAST_CHECK);
assertTrue(!dst.empty());
}
......
package org.opencv.test.core;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Scalar;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.test.OpenCVTestCase;
public class MatTest extends OpenCVTestCase {
......
package org.opencv.test.core;
import org.opencv.Point;
import org.opencv.Rect;
import org.opencv.RotatedRect;
import org.opencv.Size;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.RotatedRect;
import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase;
public class RotatedRectTest extends OpenCVTestCase {
......
......@@ -2,12 +2,12 @@ package org.opencv.test.core;
import java.util.ArrayList;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Point;
import org.opencv.Rect;
import org.opencv.Scalar;
import org.opencv.core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Core;
import org.opencv.test.OpenCVTestCase;
public class coreTest extends OpenCVTestCase {
......@@ -17,78 +17,78 @@ public class coreTest extends OpenCVTestCase {
}
public void testAbsdiff() {
core.absdiff(gray128, gray255, dst);
Core.absdiff(gray128, gray255, dst);
assertMatEqual(gray127, dst);
}
public void testAddMatMatMat() {
core.add(gray128, gray128, dst);
Core.add(gray128, gray128, dst);
assertMatEqual(gray255, dst);
}
public void testAddMatMatMatMat() {
core.add(gray0, gray1, dst, gray1);
Core.add(gray0, gray1, dst, gray1);
assertMatEqual(gray1, dst);
dst.setTo(new Scalar(127));
core.add(gray0, gray1, dst, gray0);
Core.add(gray0, gray1, dst, gray0);
assertMatEqual(gray127, dst);
}
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());
assertMatEqual(gray1_32f, dst);
}
public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst);
Core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst);
assertMatEqual(gray255, dst);
}
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());
assertMatEqual(gray255_32f, dst);
}
public void testBitwise_andMatMatMat() {
core.bitwise_and(gray3, gray2, dst);
Core.bitwise_and(gray3, gray2, dst);
assertMatEqual(gray2, dst);
}
public void testBitwise_andMatMatMatMat() {
core.bitwise_and(gray0, gray1, dst, gray255);
Core.bitwise_and(gray0, gray1, dst, gray255);
assertMatEqual(gray0, dst);
}
public void testBitwise_notMatMat() {
core.bitwise_not(gray255, dst);
Core.bitwise_not(gray255, dst);
assertMatEqual(gray0, dst);
}
public void testBitwise_notMatMatMat() {
core.bitwise_not(gray255, dst, gray255);
Core.bitwise_not(gray255, dst, gray255);
assertMatEqual(gray0, dst);
}
public void testBitwise_orMatMatMat() {
core.bitwise_or(gray3, gray2, dst);
Core.bitwise_or(gray3, gray2, dst);
assertMatEqual(gray3, dst);
}
public void testBitwise_orMatMatMatMat() {
core.bitwise_or(gray127, gray128, dst, gray255);
Core.bitwise_or(gray127, gray128, dst, gray255);
assertMatEqual(gray255, dst);
}
public void testBitwise_xorMatMatMat() {
core.bitwise_xor(gray3, gray2, dst);
Core.bitwise_xor(gray3, gray2, dst);
assertMatEqual(gray1, dst);
}
public void testBitwise_xorMatMatMatMat() {
core.bitwise_or(gray127, gray128, dst, gray255);
Core.bitwise_or(gray127, gray128, dst, gray255);
assertMatEqual(gray255, dst);
}
......@@ -96,7 +96,7 @@ public class coreTest extends OpenCVTestCase {
Mat covar = new Mat(matSize, matSize, CvType.CV_64FC1);
Mat mean = new Mat(1, matSize, CvType.CV_64FC1);
core.calcCovarMatrix(gray0_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/);
Core.calcCovarMatrix(gray0_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/);
assertMatEqual(gray0_64f, covar);
assertMatEqual(gray0_64f_1d, mean);
}
......@@ -105,7 +105,7 @@ public class coreTest extends OpenCVTestCase {
Mat covar = new Mat(matSize, matSize, CvType.CV_32F);
Mat mean = new Mat(1, matSize, CvType.CV_32F);
core.calcCovarMatrix(gray0_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/, CvType.CV_32F);
Core.calcCovarMatrix(gray0_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/, CvType.CV_32F);
assertMatEqual(gray0_32f, covar);
assertMatEqual(gray0_32f_1d, mean);
}
......@@ -122,7 +122,7 @@ public class coreTest extends OpenCVTestCase {
angle.put(0, 0, 0.92729962, 0.92729962, 1.1759995);
Mat dst_angle = new Mat();
core.cartToPolar(x, y, dst, dst_angle);
Core.cartToPolar(x, y, dst, dst_angle);
assertMatEqual(magnitude, dst);
assertMatEqual(angle, dst_angle);
}
......@@ -140,7 +140,7 @@ public class coreTest extends OpenCVTestCase {
angle.put(0 ,0, 0.92729962, 0.92729962, 1.1759995);
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(angle, dst_angle);
}
......@@ -150,9 +150,9 @@ public class coreTest extends OpenCVTestCase {
int radius = Math.min(gray0.cols()/4, gray0.rows()/4);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.circle(gray0, center, radius, color);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.circle(gray0, center, radius, color);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testCircleMatPointIntScalarInt() {
......@@ -160,9 +160,9 @@ public class coreTest extends OpenCVTestCase {
int radius = Math.min(gray0.cols()/4, gray0.rows()/4);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.circle(gray0, center, radius, color, -1);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.circle(gray0, center, radius, color, -1);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testCircleMatPointIntScalarIntInt() {
......@@ -182,7 +182,7 @@ public class coreTest extends OpenCVTestCase {
Point pt1Clipped = new Point(10.0, 15.0);
Point pt2Clipped = new Point(19.0, 15.0);
boolean res = core.clipLine(r, pt1, pt2);
boolean res = Core.clipLine(r, pt1, pt2);
assertEquals(true, res);
assertEquals(pt1Clipped, pt1);
assertEquals(pt2Clipped, pt2);
......@@ -192,72 +192,72 @@ public class coreTest extends OpenCVTestCase {
pt1Clipped = new Point(5.0, 5.0);
pt2Clipped = new Point(25.0, 5.0);
res = core.clipLine(r, pt1, pt2);
res = Core.clipLine(r, pt1, pt2);
assertEquals(false, res);
assertEquals(pt1Clipped, pt1);
assertEquals(pt2Clipped, pt2);
}
public void testCompare() {
core.compare(gray0, gray0, dst, core.CMP_EQ);
Core.compare(gray0, gray0, dst, Core.CMP_EQ);
assertMatEqual(dst, gray255);
core.compare(gray0, gray1, dst, core.CMP_EQ);
Core.compare(gray0, gray1, dst, Core.CMP_EQ);
assertMatEqual(dst, gray0);
core.compare(gray0, grayRnd, dst, core.CMP_EQ);
double nBlackPixels = core.countNonZero(dst);
double nNonBlackpixels = core.countNonZero(grayRnd);
Core.compare(gray0, grayRnd, dst, Core.CMP_EQ);
double nBlackPixels = Core.countNonZero(dst);
double nNonBlackpixels = Core.countNonZero(grayRnd);
assertTrue((nBlackPixels + nNonBlackpixels) == grayRnd.total());
}
public void testCompleteSymmMat() {
core.completeSymm(grayRnd_32f);
core.transpose(grayRnd_32f, dst);
Core.completeSymm(grayRnd_32f);
Core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst);
}
public void testCompleteSymmMatBoolean() {
core.completeSymm(grayRnd_32f, true);
core.transpose(grayRnd_32f, dst);
Core.completeSymm(grayRnd_32f, true);
Core.transpose(grayRnd_32f, dst);
assertMatEqual(grayRnd_32f, dst);
}
public void testConvertScaleAbsMatMat() {
core.convertScaleAbs(gray0, dst);
Core.convertScaleAbs(gray0, dst);
assertMatEqual(gray0, dst);
core.convertScaleAbs(gray_16u_256, dst);
Core.convertScaleAbs(gray_16u_256, dst);
assertMatEqual(gray255, dst);
}
public void testConvertScaleAbsMatMatDouble() {
core.convertScaleAbs(gray0, dst, 2);
Core.convertScaleAbs(gray0, dst, 2);
assertMatEqual(gray0, dst);
core.convertScaleAbs(gray_16u_256, dst, 1);
Core.convertScaleAbs(gray_16u_256, dst, 1);
assertMatEqual(gray255, dst);
}
public void testConvertScaleAbsMatMatDoubleDouble() {
core.convertScaleAbs(gray_16u_256, dst, 2, 2);
Core.convertScaleAbs(gray_16u_256, dst, 2, 2);
assertMatEqual(gray255, dst);
}
public void testCountNonZero() {
assertEquals(0, core.countNonZero(gray0));
assertEquals(0, Core.countNonZero(gray0));
gray0.put(0, 0, 255);
gray0.put(gray0.rows() - 1, gray0.cols() - 1, 255);
assertEquals(2, core.countNonZero(gray0));
assertEquals(2, Core.countNonZero(gray0));
}
public void testCubeRoot() {
float res = core.cubeRoot(27.0f);
float res = Core.cubeRoot(27.0f);
assertEquals(3.0f,res);
}
public void testDctMatMat() {
core.dct(gray0_32f_1d, dst);
Core.dct(gray0_32f_1d, dst);
assertMatEqual(gray0_32f_1d, dst);
Mat in = new Mat(1, 4, CvType.CV_32F);
......@@ -265,12 +265,12 @@ public class coreTest extends OpenCVTestCase {
Mat out = new Mat(1, 4, CvType.CV_32F);
out.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477);
core.dct(in, dst);
Core.dct(in, dst);
assertMatEqual(out, dst);
}
public void testDctMatMatInt() {
core.dct(gray0_32f_1d, dst);
Core.dct(gray0_32f_1d, dst);
assertMatEqual(gray0_32f_1d, dst);
Mat in = new Mat(1, 8, CvType.CV_32F);
......@@ -279,7 +279,7 @@ public class coreTest extends OpenCVTestCase {
truth = new Mat(1, 8, CvType.CV_32F);
truth.put(0, 0, 0.77571625, 0.37270021, 0.18529896, 0.012146413, -0.32499927, -0.99302113, 0.55979407, -0.6251272);
core.dct(in, dst);
Core.dct(in, dst);
assertMatEqual(truth, dst);
}
......@@ -290,7 +290,7 @@ public class coreTest extends OpenCVTestCase {
mat.put(1, 0, 4.0);
mat.put(1, 1, 4.0);
double det = core.determinant(mat);
double det = Core.determinant(mat);
assertEquals(8.0, det);
}
......@@ -300,7 +300,7 @@ public class coreTest extends OpenCVTestCase {
truth = new Mat(1, 4, CvType.CV_32F);
truth.put(0, 0, 0, 0, 0, 0);
core.dft(src, dst);
Core.dft(src, dst);
assertMatEqual(truth, dst);
}
......@@ -311,10 +311,10 @@ public class coreTest extends OpenCVTestCase {
src.put(0, 0, 1, 2, 3, 4);
out.put(0, 0, 10, -2, 2, -2);
core.dft(src, dst, core.DFT_REAL_OUTPUT);
Core.dft(src, dst, Core.DFT_REAL_OUTPUT);
assertMatEqual(out, dst);
core.dft(src, dst, core.DFT_INVERSE);
Core.dft(src, dst, Core.DFT_INVERSE);
out2.put(0, 0, 9, -9, 1, 3);
assertMatEqual(out2, dst);
}
......@@ -325,32 +325,32 @@ public class coreTest extends OpenCVTestCase {
src.put(0, 0, 1, 2, 3, 4);
out.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(out, dst);
}
public void testDivideDoubleMatMat() {
core.divide(4.0, gray2, dst);
Core.divide(4.0, gray2, dst);
assertMatEqual(gray2, dst);
}
public void testDivideDoubleMatMatInt() {
core.divide(9.0, gray3, dst, -1);
Core.divide(9.0, gray3, dst, -1);
assertMatEqual(gray3, dst);
}
public void testDivideMatMatMat() {
core.divide(gray2, gray1, dst);
Core.divide(gray2, gray1, dst);
assertMatEqual(gray2, dst);
}
public void testDivideMatMatMatDouble() {
core.divide(gray2, gray2, dst, 2.0);
Core.divide(gray2, gray2, dst, 2.0);
assertMatEqual(gray2, dst);
}
public void testDivideMatMatMatDoubleInt() {
core.divide(gray3, gray2, dst, 2.0, gray3.depth());
Core.divide(gray3, gray2, dst, 2.0, gray3.depth());
assertMatEqual(gray3, dst);
}
......@@ -388,21 +388,21 @@ public class coreTest extends OpenCVTestCase {
public void testExp() {
Mat destination = new Mat(matSize, matSize, CvType.CV_32F); destination.setTo(new Scalar(0.0));
core.exp(gray0_32f, destination);
Core.exp(gray0_32f, destination);
assertMatEqual(gray1_32f, destination);
}
public void testExtractChannel() {
core.extractChannel(rgba128, dst, 0);
Core.extractChannel(rgba128, dst, 0);
assertMatEqual(gray128, dst);
}
public void testFastAtan2() {
double delta = 0.01;
float res = core.fastAtan2(50, 50);
float res = Core.fastAtan2(50, 50);
assertEquals(45,res,delta);
float res2 = core.fastAtan2(80, 20);
float res2 = Core.fastAtan2(80, 20);
assertEquals(75.96, res2, delta);
}
......@@ -418,7 +418,7 @@ public class coreTest extends OpenCVTestCase {
des_f0.put(0, 1, 4.0);
des_f0.put(1, 0, 1.0);
des_f0.put(1, 1, 2.0);
core.flip(src, dst, 0);
Core.flip(src, dst, 0);
assertMatEqual(des_f0, dst);
Mat des_f1 = new Mat(2, 2, CvType.CV_32F);
......@@ -426,7 +426,7 @@ public class coreTest extends OpenCVTestCase {
des_f1.put(0, 1, 1.0);
des_f1.put(1, 0, 4.0);
des_f1.put(1, 1, 3.0);
core.flip(src, dst, 1);
Core.flip(src, dst, 1);
assertMatEqual(des_f1, dst);
}
......@@ -448,7 +448,7 @@ public class coreTest extends OpenCVTestCase {
desired.put(0, 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);
}
......@@ -470,17 +470,17 @@ public class coreTest extends OpenCVTestCase {
desired.put(0, 0, 2.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);
}
public void testGetOptimalDFTSize() {
int vecsize = core.getOptimalDFTSize(0);
int vecsize = Core.getOptimalDFTSize(0);
assertEquals(1, vecsize);
int largeVecSize = core.getOptimalDFTSize(133);
int largeVecSize = Core.getOptimalDFTSize(133);
assertEquals(135, largeVecSize);
largeVecSize = core.getOptimalDFTSize(13);
largeVecSize = Core.getOptimalDFTSize(13);
assertEquals(15, largeVecSize);
}
......@@ -490,7 +490,7 @@ public class coreTest extends OpenCVTestCase {
public void testGetTickFrequency() {
double freq = 0.0;
freq = core.getTickFrequency();
freq = Core.getTickFrequency();
assertTrue(0.0 != freq);
}
......@@ -499,7 +499,7 @@ public class coreTest extends OpenCVTestCase {
Mat eConcat = new Mat(1, 9, CvType.CV_8UC1);
eConcat.put(0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
core.hconcat(e, dst);
Core.hconcat(e, dst);
assertMatEqual(eConcat, dst);
}
......@@ -509,7 +509,7 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0, 3.0, 1.0);
out.put(0, 0, 3.3769724, -1.6215782, 2.3608727, 0.20730907, -0.86502546, 0.028082132, -0.7673766, 0.10917115);
core.idct(in, dst);
Core.idct(in, dst);
assertMatEqual(out, dst);
}
......@@ -520,7 +520,7 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0, 3.0, 1.0);
out.put(0, 0, 3.3769724, -1.6215782, 2.3608727, 0.20730907, -0.86502546, 0.028082132, -0.7673766, 0.10917115);
core.idct(in, dst, core.DCT_ROWS);
Core.idct(in, dst, Core.DCT_ROWS);
assertMatEqual(out, dst);
}
......@@ -531,7 +531,7 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 2.0, 3.0, 4.0);
out.put(0, 0, 9, -9, 1, 3);
core.idft(in, dst);
Core.idft(in, dst);
assertMatEqual(out, dst);
}
......@@ -541,7 +541,7 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 2.0, 3.0, 4.0);
out.put(0, 0, 9, -9, 1, 3);
core.idft(in, dst, core.DFT_REAL_OUTPUT);
Core.idft(in, dst, Core.DFT_REAL_OUTPUT);
assertMatEqual(out, dst);
}
......@@ -551,20 +551,20 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 2.0, 3.0, 4.0);
out.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(out, dst);
}
public void testInRange() {
core.inRange(gray0, gray0, gray1, dst);
Core.inRange(gray0, gray0, gray1, dst);
assertMatEqual(gray255, dst);
}
public void testInsertChannel() {
core.insertChannel(gray0, rgba128, 0);
core.insertChannel(gray0, rgba128, 1);
core.insertChannel(gray0, rgba128, 2);
core.insertChannel(gray0, rgba128, 3);
Core.insertChannel(gray0, rgba128, 0);
Core.insertChannel(gray0, rgba128, 1);
Core.insertChannel(gray0, rgba128, 2);
Core.insertChannel(gray0, rgba128, 3);
assertMatEqual(rgba0, rgba128);
}
......@@ -581,13 +581,13 @@ public class coreTest extends OpenCVTestCase {
answer.put(1, 0, -1.5);
answer.put(1, 1, 1.0);
core.invert(src, dst);
Core.invert(src, dst);
assertMatEqual(answer, dst);
//TODO: needs epsilon comparison
// Mat m = grayRnd_32f.clone();
// Mat inv = m.inv();
// core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
// Core.gemm(m, inv, 1.0, new Mat(), 0.0, dst);
// assertMatEqual(grayE_32f, dst);
}
......@@ -602,11 +602,11 @@ public class coreTest extends OpenCVTestCase {
out.put(1, 0, 0, 1, 0);
out.put(2, 0, 0, 0, 1);
core.invert(src, dst,core.DECOMP_CHOLESKY);
Core.invert(src, dst,Core.DECOMP_CHOLESKY);
assertMatEqual(out, dst);
core.invert(src, dst,core.DECOMP_LU);
double det = core.determinant(src);
Core.invert(src, dst,Core.DECOMP_LU);
double det = Core.determinant(src);
assertTrue(det > 0.0);
}
......@@ -625,9 +625,9 @@ public class coreTest extends OpenCVTestCase {
Point point2 = new Point(nPoints, nPoints);
Scalar color = new Scalar(255);
assertTrue(0 == core.countNonZero(gray0));
core.line(gray0, point1, point2, color);
assertTrue(nPoints == core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.line(gray0, point1, point2, color);
assertTrue(nPoints == Core.countNonZero(gray0));
}
public void testLineMatPointPointScalarInt() {
......@@ -637,9 +637,9 @@ public class coreTest extends OpenCVTestCase {
Point point2 = new Point(nPoints, nPoints);
Scalar color = new Scalar(255);
assertTrue(0 == core.countNonZero(gray0));
core.line(gray0, point1, point2, color, 0);
assertTrue(nPoints == core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.line(gray0, point1, point2, color, 0);
assertTrue(nPoints == Core.countNonZero(gray0));
}
public void testLineMatPointPointScalarIntInt() {
......@@ -657,7 +657,7 @@ public class coreTest extends OpenCVTestCase {
in.put(0, 0, 1.0, 10.0, 100.0, 1000.0);
desired.put(0, 0, 0, 2.3025851, 4.6051702, 6.9077554);
core.log(in, dst);
Core.log(in, dst);
assertMatEqual(desired, dst);
}
......@@ -665,18 +665,18 @@ public class coreTest extends OpenCVTestCase {
Mat lut = new Mat(1, 256, CvType.CV_8UC1);
lut.setTo(new Scalar(0));
core.LUT(grayRnd, lut, dst);
Core.LUT(grayRnd, lut, dst);
assertMatEqual(gray0, dst);
lut.setTo(new Scalar(255));
core.LUT(grayRnd, lut, dst);
Core.LUT(grayRnd, lut, dst);
assertMatEqual(gray255, dst);
}
public void testLUTMatMatMatInt() {
Mat lut = new Mat(1, 256, CvType.CV_8UC1);
lut.setTo(new Scalar(255));
core.LUT(grayRnd, lut, dst, 0);
Core.LUT(grayRnd, lut, dst, 0);
assertMatEqual(gray255, dst);
}
......@@ -689,32 +689,32 @@ public class coreTest extends OpenCVTestCase {
y.put(0, 0, 4.0, 12.0, 40.0, 8.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);
core.magnitude(gray0_32f, gray255_32f, dst);
Core.magnitude(gray0_32f, gray255_32f, dst);
assertMatEqual(gray255_32f, dst);
}
public void testMahalanobis() {
Mat covar = new Mat(matSize, matSize, CvType.CV_32F);
Mat mean = new Mat(1, matSize, CvType.CV_32F);
core.calcCovarMatrix(grayRnd_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/, CvType.CV_32F);
Core.calcCovarMatrix(grayRnd_32f, covar, mean, 8|1/*TODO: CV_COVAR_NORMAL*/, CvType.CV_32F);
covar.inv();
Mat line1 = grayRnd_32f.submat(0, 1, 0, grayRnd_32f.cols());
Mat line2 = grayRnd_32f.submat(1, 2, 0, grayRnd_32f.cols());
double d = 0.0;
d = core.Mahalanobis(line1, line1, covar);
d = Core.Mahalanobis(line1, line1, covar);
assertEquals(0.0, d);
d = core.Mahalanobis(line1, line2, covar);
d = Core.Mahalanobis(line1, line2, covar);
assertTrue(d > 0.0);
}
public void testMax() {
core.min(gray0, gray255, dst);
Core.min(gray0, gray255, dst);
assertMatEqual(gray0, dst);
Mat x = new Mat(1, 1, CvType.CV_32F);
......@@ -723,14 +723,14 @@ public class coreTest extends OpenCVTestCase {
x.put(0, 0, 23.0);
y.put(0, 0, 4.0);
dst.put(0, 0, 23.0);
core.max(x, y, dst);
Core.max(x, y, dst);
assertMatEqual(dst, dst);
}
public void testMeanMat() {
Scalar mean = null;
mean = core.mean(gray128);
mean = Core.mean(gray128);
assertEquals(new Scalar(128), mean);
}
......@@ -742,18 +742,18 @@ public class coreTest extends OpenCVTestCase {
Mat mean = new Mat();
Mat stddev = new Mat();
core.meanStdDev(rgba0, mean, stddev);
assertEquals(0, core.countNonZero(mean));
assertEquals(0, core.countNonZero(stddev));
Core.meanStdDev(rgba0, mean, stddev);
assertEquals(0, Core.countNonZero(mean));
assertEquals(0, Core.countNonZero(stddev));
}
public void testMeanStdDevMatMatMatMat() {
Mat mean = new Mat();
Mat stddev = new Mat();
core.meanStdDev(rgba0, mean, stddev, gray255);
assertEquals(0, core.countNonZero(mean));
assertEquals(0, core.countNonZero(stddev));
Core.meanStdDev(rgba0, mean, stddev, gray255);
assertEquals(0, Core.countNonZero(mean));
assertEquals(0, Core.countNonZero(stddev));
Mat submat = grayRnd.submat(0, grayRnd.rows()/2, 0, grayRnd.cols()/2);
submat.setTo(new Scalar(33));
......@@ -762,14 +762,14 @@ public class coreTest extends OpenCVTestCase {
submat = mask.submat(0, mask.rows()/2, 0, mask.cols()/2);
submat.setTo(new Scalar(1));
core.meanStdDev(grayRnd, mean, stddev, mask);
Core.meanStdDev(grayRnd, mean, stddev, mask);
Mat desiredMean = new Mat(1, 1, CvType.CV_64F, new Scalar(33));
assertMatEqual(desiredMean, mean);
assertEquals(0, core.countNonZero(stddev));
assertEquals(0, Core.countNonZero(stddev));
core.meanStdDev(grayRnd, mean, stddev, gray1);
assertTrue(0 != core.countNonZero(mean));
assertTrue(0 != core.countNonZero(stddev));
Core.meanStdDev(grayRnd, mean, stddev, gray1);
assertTrue(0 != Core.countNonZero(mean));
assertTrue(0 != Core.countNonZero(stddev));
}
public void testMerge() {
......@@ -777,7 +777,7 @@ public class coreTest extends OpenCVTestCase {
}
public void testMin() {
core.min(gray0, gray255, dst);
Core.min(gray0, gray255, dst);
assertMatEqual(gray0, dst);
}
......@@ -789,7 +789,7 @@ public class coreTest extends OpenCVTestCase {
gray3.put((int)minLoc.y, (int)minLoc.x, minVal);
gray3.put((int)maxLoc.y, (int)maxLoc.x, maxVal);
core.MinMaxLocResult mmres = core.minMaxLoc(gray3);
Core.MinMaxLocResult mmres = Core.minMaxLoc(gray3);
assertTrue(mmres.minVal == minVal);
assertTrue(mmres.maxVal == maxVal);
......@@ -812,7 +812,7 @@ public class coreTest extends OpenCVTestCase {
src1.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);
core.mulSpectrums(src1, src2, dst, core.DFT_ROWS);
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS);
assertMatEqual(out, dst);
}
......@@ -823,45 +823,45 @@ public class coreTest extends OpenCVTestCase {
src1.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);
core.mulSpectrums(src1, src2, dst, core.DFT_ROWS, true);
Core.mulSpectrums(src1, src2, dst, Core.DFT_ROWS, true);
assertMatEqual(out, dst);
}
public void testMultiplyMatMatMat() {
core.multiply(gray0, gray255, dst);
Core.multiply(gray0, gray255, dst);
assertMatEqual(gray0, dst);
}
public void testMultiplyMatMatMatDouble() {
core.multiply(gray1, gray0, dst, 2.0);
Core.multiply(gray1, gray0, dst, 2.0);
assertMatEqual(gray0, dst);
}
public void testMultiplyMatMatMatDoubleInt() {
core.multiply(gray1, gray0, dst, 2.0, -1);
Core.multiply(gray1, gray0, dst, 2.0, -1);
assertMatEqual(gray0, dst);
}
public void testMulTransposedMatMatBoolean() {
core.mulTransposed(grayE_32f, dst, true);
Core.mulTransposed(grayE_32f, dst, true);
assertMatEqual(grayE_32f, dst);
}
public void testMulTransposedMatMatBooleanMat() {
core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
Core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
assertMatEqual(gray0_32f, dst);
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
grayDelta.setTo(new Scalar(0.0));
core.mulTransposed(grayE_32f, dst, true, grayDelta);
Core.mulTransposed(grayE_32f, dst, true, grayDelta);
assertMatEqual(grayE_32f, dst);
}
public void testMulTransposedMatMatBooleanMatDouble() {
Mat grayDelta = new Mat(matSize, matSize, CvType.CV_32F);
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);
}
......@@ -877,22 +877,22 @@ public class coreTest extends OpenCVTestCase {
res.put(1, 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);
}
public void testNormalizeMatMat() {
core.normalize(gray0, dst);
Core.normalize(gray0, dst);
assertMatEqual(gray0, dst);
}
public void testNormalizeMatMatDouble() {
core.normalize(gray0, dst, 0.0);
Core.normalize(gray0, dst, 0.0);
assertMatEqual(gray0, dst);
}
public void testNormalizeMatMatDoubleDouble() {
core.normalize(gray0, dst, 0.0, 1.0);
Core.normalize(gray0, dst, 0.0, 1.0);
assertMatEqual(gray0, dst);
}
......@@ -901,7 +901,7 @@ public class coreTest extends OpenCVTestCase {
Mat out = new Mat(1, 4, CvType.CV_32F);
src.put(0, 0, 1.0, 2.0, 3.0, 4.0);
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);
}
......@@ -912,7 +912,7 @@ public class coreTest extends OpenCVTestCase {
src.put(0, 0, 1.0, 2.0, 3.0, 4.0);
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);
}
......@@ -924,37 +924,37 @@ public class coreTest extends OpenCVTestCase {
src.put(0, 0, 1.0, 2.0, 3.0, 4.0);
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);
}
public void testNormMat() {
double n = core.norm(gray0);
double n = Core.norm(gray0);
assertTrue(0.0 == n);
}
public void testNormMatInt() {
double n = core.norm(gray127, core.NORM_INF);
double n = Core.norm(gray127, Core.NORM_INF);
assertTrue(127 == n);
}
public void testNormMatIntMat() {
double n = core.norm(gray3, core.NORM_L1, gray0);
double n = Core.norm(gray3, Core.NORM_L1, gray0);
assertEquals(0.0, n);
}
public void testNormMatMat() {
double n = core.norm(gray255, gray255);
double n = Core.norm(gray255, gray255);
assertEquals(0.0, n);
}
public void testNormMatMatInt() {
double n = core.norm(gray127, gray0, core.NORM_INF);
double n = Core.norm(gray127, gray0, Core.NORM_INF);
assertEquals(127.0, n);
}
public void testNormMatMatIntMat() {
double n = core.norm(gray3, gray0, core.NORM_L1, gray0);
double n = Core.norm(gray3, gray0, Core.NORM_L1, gray0);
assertEquals(0.0, n);
}
......@@ -972,7 +972,7 @@ public class coreTest extends OpenCVTestCase {
y.put(0, 0, 20.0, 15.0, 20.0, 20.0);
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);
}
......@@ -985,7 +985,7 @@ public class coreTest extends OpenCVTestCase {
y.put(0, 0, 20.0, 15.0, 20.0, 20.0);
res.put(0, 0, 63.434, 56.310, 44.999, 75.963);
core.phase(x, y, dst, true);
Core.phase(x, y, dst, true);
}
public void testPolarToCartMatMatMatMat() {
......@@ -1008,7 +1008,7 @@ public class coreTest extends OpenCVTestCase {
y.put(0, 0, 4.0, 8.0, 12.0);
//TODO: needs epsilon comparison
core.polarToCart(magnitude, angle, xCoordinate, yCoordinate);
Core.polarToCart(magnitude, angle, xCoordinate, yCoordinate);
assertMatEqual(x, xCoordinate);
}
......@@ -1017,7 +1017,7 @@ public class coreTest extends OpenCVTestCase {
}
public void testPow() {
core.pow(gray3, 2.0, dst);
Core.pow(gray3, 2.0, dst);
assertMatEqual(gray9, dst);
}
......@@ -1041,18 +1041,18 @@ public class coreTest extends OpenCVTestCase {
Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256));
assertTrue(0 == core.countNonZero(gray0));
core.randn(gray0, low, high);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.randn(gray0, low, high);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testRandu() {
Mat low = new Mat(1, 1, CvType.CV_16UC1, new Scalar(0));
Mat high = new Mat(1, 1, CvType.CV_16UC1, new Scalar(256));
assertTrue(0 == core.countNonZero(gray0));
core.randu(gray0, low, high);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.randu(gray0, low, high);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testRectangleMatPointPointScalar() {
......@@ -1060,9 +1060,9 @@ public class coreTest extends OpenCVTestCase {
Point origin = new Point(0,0);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.rectangle(gray0, center, origin, color);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.rectangle(gray0, center, origin, color);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testRectangleMatPointPointScalarInt() {
......@@ -1070,9 +1070,9 @@ public class coreTest extends OpenCVTestCase {
Point origin = new Point(0,0);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.rectangle(gray0, center, origin, color, 2);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.rectangle(gray0, center, origin, color, 2);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testRectangleMatPointPointScalarIntInt() {
......@@ -1080,9 +1080,9 @@ public class coreTest extends OpenCVTestCase {
Point origin = new Point(0,0);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.rectangle(gray0, center, origin, color, 2, 8);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.rectangle(gray0, center, origin, color, 2, 8);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testRectangleMatPointPointScalarIntIntInt() {
......@@ -1090,9 +1090,9 @@ public class coreTest extends OpenCVTestCase {
Point origin = new Point(0,0);
Scalar color = new Scalar(128);
assertTrue(0 == core.countNonZero(gray0));
core.rectangle(gray0, center, origin, color, 2, 4, 2);
assertTrue(0 != core.countNonZero(gray0));
assertTrue(0 == Core.countNonZero(gray0));
Core.rectangle(gray0, center, origin, color, 2, 4, 2);
assertTrue(0 != Core.countNonZero(gray0));
}
public void testReduceMatMatIntInt() {
......@@ -1103,7 +1103,7 @@ public class coreTest extends OpenCVTestCase {
out.put(0 , 0, 1, 0);
core.reduce(src, dst, 0, 2);
Core.reduce(src, dst, 0, 2);
assertMatEqual(out, dst);
}
......@@ -1115,7 +1115,7 @@ public class coreTest extends OpenCVTestCase {
out.put(0 , 0, 1, 0);
core.reduce(src, dst, 0, 2, -1);
Core.reduce(src, dst, 0, 2, -1);
assertMatEqual(out, dst);
}
......@@ -1128,25 +1128,25 @@ public class coreTest extends OpenCVTestCase {
des1.put(0, 0, 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);
core.repeat(src, 1, 2, dst);
Core.repeat(src, 1, 2, dst);
assertMatEqual(des2, dst);
}
public void testScaleAdd() {
core.scaleAdd(gray3, 2.0, gray3, dst);
Core.scaleAdd(gray3, 2.0, gray3, dst);
assertMatEqual(dst, gray9);
}
public void testSetIdentityMat() {
core.setIdentity(gray0_32f);
Core.setIdentity(gray0_32f);
assertMatEqual(grayE_32f, gray0_32f);
}
public void testSetIdentityMatScalar() {
core.gemm(grayE_32f, grayE_32f, 5.0, new Mat(), 0.0, dst);
core.setIdentity(gray0_32f, new Scalar(5));
Core.gemm(grayE_32f, grayE_32f, 5.0, new Mat(), 0.0, dst);
Core.setIdentity(gray0_32f, new Scalar(5));
assertMatEqual(dst, gray0_32f);
}
......@@ -1155,7 +1155,7 @@ public class coreTest extends OpenCVTestCase {
Mat roots = new Mat(3, 1, CvType.CV_32F);
coeffs.put(0, 0, 1, 6, 11, 6);
roots.put(0, 0, -3, -1, -2);
core.solveCubic(coeffs, dst);
Core.solveCubic(coeffs, dst);
assertMatEqual(roots, dst);
}
......@@ -1170,7 +1170,7 @@ public class coreTest extends OpenCVTestCase {
b.put(0, 0, 0, 4, 2);
res.put(0, 0, -12, 2, 10);
core.solve(a, b, dst);
Core.solve(a, b, dst);
assertMatEqual(res, dst);
}
......@@ -1186,7 +1186,7 @@ public class coreTest extends OpenCVTestCase {
b.put(0, 0, 0, 4, 2);
res.put(0, 0, -12, 2, 10);
core.solve(a, b, dst, 3);
Core.solve(a, b, dst, 3);
assertMatEqual(res, dst);
}
......@@ -1199,7 +1199,7 @@ public class coreTest extends OpenCVTestCase {
Mat answer = new Mat(3, 1, CvType.CV_32FC2);
answer.put(0, 0, 1, 0, 2, 0, 3, 0);
core.solvePoly(coeffs, roots);
Core.solvePoly(coeffs, roots);
assertMatEqual(answer, roots);
}
......@@ -1212,7 +1212,7 @@ public class coreTest extends OpenCVTestCase {
Mat answer = new Mat(3, 1, CvType.CV_32FC2);
answer.put(0, 0, 1, 0, -1, 2, -2, 12);
core.solvePoly(coeffs, roots, 1);
Core.solvePoly(coeffs, roots, 1);
assertMatEqual(answer, roots);
}
......@@ -1220,13 +1220,13 @@ public class coreTest extends OpenCVTestCase {
Mat submat = gray0.submat(0, gray0.rows() / 2, 0, gray0.cols() / 2);
submat.setTo(new Scalar(1.0));
core.sort(gray0, dst, 0/*TODO: CV_SORT_EVERY_ROW*/);
Core.sort(gray0, dst, 0/*TODO: CV_SORT_EVERY_ROW*/);
submat = dst.submat(0, dst.rows() / 2, dst.cols() / 2, dst.cols());
assertTrue(submat.total() == core.countNonZero(submat));
assertTrue(submat.total() == Core.countNonZero(submat));
core.sort(gray0, dst, 1/*TODO: CV_SORT_EVERY_COLUMN*/);
Core.sort(gray0, dst, 1/*TODO: CV_SORT_EVERY_COLUMN*/);
submat = dst.submat(dst.rows() / 2, dst.rows(), 0, dst.cols() / 2);
assertTrue(submat.total() == core.countNonZero(submat));
assertTrue(submat.total() == Core.countNonZero(submat));
}
public void testSortIdx() {
......@@ -1238,20 +1238,20 @@ public class coreTest extends OpenCVTestCase {
answer.put(1, 0, 0, 2, 1);
answer.put(2, 0, 0, 1, 2);
core.sortIdx(a, b, 0+0/*TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING*/);
Core.sortIdx(a, b, 0+0/*TODO: CV_SORT_EVERY_ROW + CV_SORT_ASCENDING*/);
assertMatEqual(answer, b);
}
public void testSplit() {
ArrayList<Mat> cois = new ArrayList<Mat>();
core.split(rgba0, cois);
Core.split(rgba0, cois);
for(Mat coi : cois) {
assertMatEqual(gray0, coi);
}
}
public void testSqrt() {
core.sqrt(gray9_32f, dst);
Core.sqrt(gray9_32f, dst);
assertMatEqual(gray3_32f, dst);
Mat rgba144 = new Mat(matSize, matSize, CvType.CV_32FC4);
......@@ -1259,12 +1259,12 @@ public class coreTest extends OpenCVTestCase {
rgba144.setTo(Scalar.all(144));
rgba12.setTo(Scalar.all(12));
core.sqrt(rgba144, dst);
Core.sqrt(rgba144, dst);
assertMatEqual(rgba12, dst);
}
public void testSubtractMatMatMat() {
core.subtract(gray128, gray1, dst);
Core.subtract(gray128, gray1, dst);
assertMatEqual(gray127, dst);
}
......@@ -1274,12 +1274,12 @@ public class coreTest extends OpenCVTestCase {
submask.setTo(new Scalar(1));
dst = new Mat(matSize, matSize, CvType.CV_8U, new Scalar(0));
core.subtract(gray3, gray2, dst, mask);
assertTrue(submask.total() == core.countNonZero(dst));
Core.subtract(gray3, gray2, dst, mask);
assertTrue(submask.total() == Core.countNonZero(dst));
}
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());
assertMatEqual(gray1_32f, dst);
}
......@@ -1296,7 +1296,7 @@ public class coreTest extends OpenCVTestCase {
Mat src = new Mat(2, 2, CvType.CV_32F, new Scalar(55));
Mat m = Mat.eye(2, 2, CvType.CV_32FC1);
core.transform(src, dst, m);
Core.transform(src, dst, m);
Mat answer = new Mat(2, 2, CvType.CV_32FC2, new Scalar(55, 1));
assertMatEqual(answer, dst);
}
......@@ -1306,8 +1306,8 @@ public class coreTest extends OpenCVTestCase {
Mat destination = new Mat(matSize, matSize, CvType.CV_8U); destination.setTo(new Scalar(0));
Mat subdst = destination.submat(0, destination.rows(), 0, destination.cols() / 2);
subgray0.setTo(new Scalar(1));
core.transpose(gray0, destination);
assertTrue(subdst.total() == core.countNonZero(subdst));
Core.transpose(gray0, destination);
assertTrue(subdst.total() == Core.countNonZero(subdst));
}
}
package org.opencv.test.highgui;
import org.opencv.highgui;
import org.opencv.VideoCapture;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import org.opencv.test.OpenCVTestCase;
......@@ -26,8 +26,8 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testGet() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(highgui.CV_CAP_PROP_FRAME_WIDTH);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.release();
assertTrue(0 != frameWidth);
}
......@@ -39,7 +39,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testGrabFromRealCamera() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.grab();
capture.release();
assertTrue(isSucceed);
......@@ -51,7 +51,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testIsOpenedRealCamera() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened);
......@@ -59,7 +59,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
public void testOpenInt() {
capture = new VideoCapture();
capture.open(highgui.CV_CAP_ANDROID);
capture.open(Highgui.CV_CAP_ANDROID);
isOpened = capture.isOpened();
capture.release();
assertTrue(isOpened);
......@@ -70,7 +70,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testRead() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
isSucceed = capture.read(dst);
capture.release();
assertTrue(isSucceed);
......@@ -79,13 +79,13 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testRelease() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.release();
assertFalse(capture.isOpened());
}
public void testRetrieveMat() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst);
capture.release();
......@@ -95,7 +95,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testRetrieveMatInt() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.grab();
isSucceed = capture.retrieve(dst, 1);
capture.release();
......@@ -106,9 +106,9 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testSet() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture.set(highgui.CV_CAP_PROP_FRAME_WIDTH, 640.0);
double frameWidth = capture.get(highgui.CV_CAP_PROP_FRAME_WIDTH);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640.0);
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
capture.read(dst);
capture.release();
assertEquals(640.0, frameWidth);
......@@ -121,7 +121,7 @@ public class VideoCaptureTest extends OpenCVTestCase {
}
public void testVideoCaptureInt() {
capture = new VideoCapture(highgui.CV_CAP_ANDROID);
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
assertTrue(null != capture);
isOpened = capture.isOpened();
capture.release();
......
package org.opencv.test.highgui;
import org.opencv.highgui;
import org.opencv.highgui.Highgui;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
......@@ -8,7 +8,7 @@ import org.opencv.test.OpenCVTestRunner;
public class highguiTest extends OpenCVTestCase {
public void testImreadString() {
dst = highgui.imread(OpenCVTestRunner.LENA_PATH);
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH);
assertTrue(!dst.empty());
assertEquals(3, dst.channels());
assertTrue(512 == dst.cols());
......@@ -16,7 +16,7 @@ public class highguiTest extends OpenCVTestCase {
}
public void testImreadStringInt() {
dst = highgui.imread(OpenCVTestRunner.LENA_PATH, 0);
dst = Highgui.imread(OpenCVTestRunner.LENA_PATH, 0);
assertTrue(!dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
......
......@@ -3,12 +3,12 @@ package org.opencv.test.imgproc;
import java.util.ArrayList;
import java.util.List;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Scalar;
import org.opencv.Size;
import org.opencv.core;
import org.opencv.imgproc;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.core.Core;
import org.opencv.imgproc.Imgproc;
import org.opencv.test.OpenCVTestCase;
......@@ -21,7 +21,7 @@ public class imgprocTest extends OpenCVTestCase {
//FIXME: this test crashes
//public void test_Can_Call_accumulate() {
// dst = new Mat(gray1.rows(), gray1.cols(), Mat.CvType.CV_32FC1);
// imgproc.accumulate(gray1, dst);
// Imgproc.accumulate(gray1, dst);
// assertMatEqual(gray1, dst);
//}
......@@ -80,10 +80,10 @@ public class imgprocTest extends OpenCVTestCase {
public void testBlurMatMatSize() {
Size sz = new Size(3, 3);
imgproc.blur(gray0, dst, sz);
Imgproc.blur(gray0, dst, sz);
assertMatEqual(gray0, dst);
imgproc.blur(gray255, dst, sz);
Imgproc.blur(gray255, dst, sz);
assertMatEqual(gray255, dst);
}
......@@ -105,7 +105,7 @@ public class imgprocTest extends OpenCVTestCase {
public void testBoxFilterMatMatIntSize() {
Size sz = new Size(3, 3);
imgproc.boxFilter(gray0, dst, 8, sz);
Imgproc.boxFilter(gray0, dst, 8, sz);
assertMatEqual(gray0, dst);
}
......@@ -133,13 +133,13 @@ public class imgprocTest extends OpenCVTestCase {
ranges.add(0.0f); ranges.add(256.0f);
Mat hist = new Mat();
imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
core.normalize(hist, hist);
Imgproc.calcHist(images, channels, new Mat(), hist, histSize, ranges);
Core.normalize(hist, hist);
imgproc.calcBackProject(images, channels, hist, dst, ranges, 255);
Imgproc.calcBackProject(images, channels, hist, dst, ranges, 255);
assertTrue(grayChess.size().equals(dst.size()));
assertEquals(grayChess.depth(), dst.depth());
assertTrue(0 != core.countNonZero(dst));
assertTrue(0 != Core.countNonZero(dst));
}
public void testCalcHistListOfMatListOfIntegerMatMatListOfIntegerListOfFloat() {
......@@ -157,7 +157,7 @@ public class imgprocTest extends OpenCVTestCase {
truth.put(5, 0, 100.0);
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);
}
......@@ -183,7 +183,7 @@ public class imgprocTest extends OpenCVTestCase {
truth.put(9, 5, 100.0);
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);
}
......
......@@ -2,10 +2,10 @@ package org.opencv.test.objdetect;
import java.util.ArrayList;
import org.opencv.Mat;
import org.opencv.Rect;
import org.opencv.Size;
import org.opencv.imgproc;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
......@@ -36,7 +36,7 @@ public class CascadeClassifierTest extends OpenCVTestCase {
ArrayList<Rect> faces = new ArrayList<Rect>();
Mat greyLena = new Mat();
imgproc.cvtColor(rgbLena, greyLena, imgproc.COLOR_RGB2GRAY);
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
//TODO: doesn't detect with 1.1 scale
cc.detectMultiScale(greyLena, faces, 1.09, 2, 2 /*TODO: CV_HAAR_SCALE_IMAGE*/, new Size(30, 30));
......
......@@ -2,8 +2,8 @@ package org.opencv.test.objdetect;
import java.util.ArrayList;
import org.opencv.Rect;
import org.opencv.objdetect;
import org.opencv.core.Rect;
import org.opencv.objdetect.Objdetect;
import org.opencv.test.OpenCVTestCase;
......@@ -17,7 +17,7 @@ public class objdetectTest extends OpenCVTestCase {
rects.add(r);
int groupThreshold = 1;
objdetect.groupRectangles(rects, groupThreshold);
Objdetect.groupRectangles(rects, groupThreshold);
assertEquals(1, rects.size());
}
......@@ -33,7 +33,7 @@ public class objdetectTest extends OpenCVTestCase {
int groupThreshold = 1;
double eps = 0.2;
objdetect.groupRectangles(rects, groupThreshold, eps);
Objdetect.groupRectangles(rects, groupThreshold, eps);
assertEquals(2, rects.size());
}
......
package org.opencv.test.video;
import org.opencv.CvType;
import org.opencv.Mat;
import org.opencv.Size;
import org.opencv.core;
import org.opencv.video;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.core.Core;
import org.opencv.video.Video;
import org.opencv.test.OpenCVTestCase;
......@@ -59,8 +59,8 @@ public class videoTest extends OpenCVTestCase {
Mat prevPts = new Mat(1, 3, CvType.CV_32FC2);
prevPts.put(0, 0, 1.0, 1.0, 5.0, 5.0, 10.0, 10.0);
video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err);
assertEquals(3, core.countNonZero(status));
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err);
assertEquals(3, Core.countNonZero(status));
}
public void testCalcOpticalFlowPyrLKMatMatMatMatMatMatSize() {
......@@ -68,8 +68,8 @@ public class videoTest extends OpenCVTestCase {
prevPts.put(0, 0, 1.0, 1.0, 5.0, 5.0, 10.0, 10.0);
Size sz = new Size(5, 5);
video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz);
assertEquals(0, core.countNonZero(status));
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz);
assertEquals(0, Core.countNonZero(status));
}
public void testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeInt() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment