import org.opencv.Mat;
import org.opencv.core;
+import org.opencv.highgui;
import android.content.Context;
import android.graphics.Bitmap;
static String LENA = "/data/data/org.opencv.test/files/lena.jpg";
static int matSize = 10;
+
+ //Naming notation: channels_[type]_[dimension]_value
+ //examples: gray0 - single channel 8U 2d Mat filled with 0
+ // grayRnd - single channel 8U 2d Mat filled with random numbers
+ // gray0_32f_1d - refactor ;)
static Mat gray0;
static Mat gray1;
static Mat gray0_64f_1d;
static Mat rgba0;
- static Mat rgba128;
+ static Mat rgba128;
+
+ static Mat rgbLena;
- static Mat dst_gray;
- static Mat dst_gray_32f;
+ static Mat dst;
@Override
protected void setUp() throws Exception {
- // Log.e(TAG, "setUp");
super.setUp();
-
- //Naming notation: channels_[type]_[dimension]_value
- //examples: gray0 - single channel 8U 2d Mat filled with 0
- // grayRnd - single channel 8U 2d Mat filled with random numbers
- // gray0_32f_1d - refactor ;)
gray0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray0.setTo(0.0);
gray1 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray1.setTo(1.0);
catch (Exception e) {
Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString());
}
+
+ rgbLena = highgui.imread(LENA);
- dst_gray = new Mat();
- assertTrue(dst_gray.empty());
- dst_gray_32f = new Mat();
- assertTrue(dst_gray_32f.empty());
+ dst = new Mat();
+ assertTrue(dst.empty());
}
public static void assertMatEqual(Mat m1, Mat m2) {
Mat lut = new Mat(1, 256, Mat.CvType.CV_8UC1);
lut.setTo(0);
- core.LUT(grayRnd, lut, dst_gray);
- assertMatEqual(gray0, dst_gray);
+ core.LUT(grayRnd, lut, dst);
+ assertMatEqual(gray0, dst);
lut.setTo(255);
- core.LUT(grayRnd, lut, dst_gray);
- assertMatEqual(gray255, dst_gray);
+ core.LUT(grayRnd, lut, dst);
+ assertMatEqual(gray255, dst);
}
public void testMahalanobis() {
}
public void testAbsdiff() {
- core.absdiff(gray128, gray255, dst_gray);
- assertMatEqual(gray127, dst_gray);
+ core.absdiff(gray128, gray255, dst);
+ assertMatEqual(gray127, dst);
}
public void testAddMatMatMatMatInt() {
}
public void testAddMatMatMat() {
- core.add(gray128, gray128, dst_gray);
- assertMatEqual(gray255, dst_gray);
+ core.add(gray128, gray128, dst);
+ assertMatEqual(gray255, dst);
}
public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
}
public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
- core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst_gray);
- assertMatEqual(gray255, dst_gray);
+ core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst);
+ assertMatEqual(gray255, dst);
}
public void testBitwise_andMatMatMatMat() {
}
public void testBitwise_andMatMatMat() {
- core.bitwise_and(gray3, gray2, dst_gray);
- assertMatEqual(gray2, dst_gray);
+ core.bitwise_and(gray3, gray2, dst);
+ assertMatEqual(gray2, dst);
}
public void testBitwise_notMatMatMat() {
public void testCompleteSymmMatBoolean() {
core.completeSymm(grayRnd_32f, true);
- core.transpose(grayRnd_32f, dst_gray_32f);
- assertMatEqual(grayRnd_32f, dst_gray_32f);
+ core.transpose(grayRnd_32f, dst);
+ assertMatEqual(grayRnd_32f, dst);
}
public void testCompleteSymmMat() {
core.completeSymm(grayRnd_32f);
- core.transpose(grayRnd_32f, dst_gray_32f);
- assertMatEqual(grayRnd_32f, dst_gray_32f);
+ core.transpose(grayRnd_32f, dst);
+ assertMatEqual(grayRnd_32f, dst);
}
public void testConvertScaleAbsMatMatDoubleDouble() {
}
public void testDctMatMat() {
- core.dct(gray0_32f_1d, dst_gray);
- assertMatEqual(gray0_32f_1d, dst_gray);
+ core.dct(gray0_32f_1d, dst);
+ assertMatEqual(gray0_32f_1d, dst);
Mat in = new Mat(1, 4, Mat.CvType.CV_32FC1);
in.put(0, 0, 135.22211, 50.811096, 102.27016, 207.6682);
Mat out = new Mat(1, 4, Mat.CvType.CV_32FC1);
out.put(0, 0, 247.98576, -61.252407, 94.904533, 14.013477);
- core.dct(in, dst_gray);
- assertMatEqual(out, dst_gray);
+ core.dct(in, dst);
+ assertMatEqual(out, dst);
}
public void testDeterminant() {
}
public void testExtractChannel() {
- core.extractChannel(rgba128, dst_gray, 0);
- assertMatEqual(gray128, dst_gray);
+ core.extractChannel(rgba128, dst, 0);
+ assertMatEqual(gray128, dst);
}
public void testFastAtan2() {
Mat eConcat = new Mat(1, 9, Mat.CvType.CV_8UC1);
e.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1);
eConcat.put(0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1);
- core.hconcat(e, dst_gray);
+ core.hconcat(e, dst);
- assertMatEqual(eConcat, dst_gray);
+ assertMatEqual(eConcat, dst);
}
public void testIdctMatMatInt() {
}
public void testMulTransposedMatMatBooleanMat() {
- core.mulTransposed(grayRnd_32f, dst_gray_32f, true, grayRnd_32f);
- assertMatEqual(gray0_32f, dst_gray_32f);
+ core.mulTransposed(grayRnd_32f, dst, true, grayRnd_32f);
+ assertMatEqual(gray0_32f, dst);
}
public void testMulTransposedMatMatBoolean() {
- core.mulTransposed(grayE_32f, dst_gray_32f, true);
- assertMatEqual(grayE_32f, dst_gray_32f);
+ core.mulTransposed(grayE_32f, dst, true);
+ assertMatEqual(grayE_32f, dst);
}
public void testMultiplyMatMatMatDoubleInt() {