Java API generator changes randu/randn/inRange args to Scalar; Java tests are updated.
This commit is contained in:
parent
b7fc94c251
commit
f5008f9cdf
@ -85,10 +85,8 @@ public class OpenCVTestCase extends TestCase {
|
||||
gray_16s_1024 = new Mat(matSize, matSize, CvType.CV_16S, new Scalar(
|
||||
1024));
|
||||
|
||||
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);
|
||||
Core.randu(grayRnd, new Scalar(0), new Scalar(256));
|
||||
|
||||
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));
|
||||
@ -99,7 +97,7 @@ public class OpenCVTestCase extends TestCase {
|
||||
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);
|
||||
Core.randu(grayRnd_32f, new Scalar(0), new Scalar(256));
|
||||
|
||||
gray0_32f_1d = new Mat(1, matSize, CvType.CV_32F, new Scalar(0.0));
|
||||
|
||||
@ -116,9 +114,6 @@ public class OpenCVTestCase extends TestCase {
|
||||
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);
|
||||
|
||||
low.release();
|
||||
high.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -711,9 +711,7 @@ public class coreTest extends OpenCVTestCase {
|
||||
|
||||
public void testInRange() {
|
||||
gray0.put(1, 1, 100, 150, 200);
|
||||
Mat lo = new Mat(1, 1, CvType.CV_8UC1, new Scalar(120));
|
||||
Mat hi = new Mat(1, 1, CvType.CV_8UC1, new Scalar(160));
|
||||
Core.inRange(gray0, lo, hi, dst);
|
||||
Core.inRange(gray0, new Scalar(120), new Scalar(160), dst);
|
||||
byte vals[] = new byte[3];
|
||||
dst.get(1, 1, vals);
|
||||
assertEquals(0, vals[0]);
|
||||
@ -1169,9 +1167,7 @@ public class coreTest extends OpenCVTestCase {
|
||||
public void testPerspectiveTransform() {
|
||||
Mat src = new Mat(matSize, matSize, CvType.CV_32FC2);
|
||||
|
||||
Mat low = new Mat(1, 1, CvType.CV_32F, new Scalar(0));
|
||||
Mat high = new Mat(1, 1, CvType.CV_32F, new Scalar(256));
|
||||
Core.randu(src, low, high);
|
||||
Core.randu(src, new Scalar(0), new Scalar(256));
|
||||
|
||||
//FIXME: use Mat.diag
|
||||
Mat transformMatrix = Mat.eye(3, 3, CvType.CV_32F);
|
||||
@ -1184,9 +1180,7 @@ public class coreTest extends OpenCVTestCase {
|
||||
public void testPerspectiveTransform3D() {
|
||||
Mat src = new Mat(matSize, matSize, CvType.CV_32FC3);
|
||||
|
||||
Mat low = new Mat(1, 1, CvType.CV_32F, new Scalar(0));
|
||||
Mat high = new Mat(1, 1, CvType.CV_32F, new Scalar(256));
|
||||
Core.randu(src, low, high);
|
||||
Core.randu(src, new Scalar(0), new Scalar(256));
|
||||
|
||||
Mat transformMatrix = Mat.eye(4, 4, CvType.CV_32F);
|
||||
|
||||
@ -1286,11 +1280,8 @@ public class coreTest extends OpenCVTestCase {
|
||||
}
|
||||
|
||||
public void testRandn() {
|
||||
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);
|
||||
Core.randn(gray0, new Scalar(0), new Scalar(256));
|
||||
assertTrue(0 != Core.countNonZero(gray0));
|
||||
}
|
||||
|
||||
@ -1303,11 +1294,8 @@ public class coreTest extends OpenCVTestCase {
|
||||
}
|
||||
|
||||
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);
|
||||
Core.randu(gray0, new Scalar(0), new Scalar(256));
|
||||
assertTrue(0 != Core.countNonZero(gray0));
|
||||
}
|
||||
|
||||
|
@ -451,6 +451,15 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
|
||||
}, # Highgui
|
||||
}
|
||||
|
||||
# { class : { func : {arg_name : ctype} } }
|
||||
func_arg_fix = {
|
||||
'' : {
|
||||
'randu' : { 'low' : 'Scalar', 'high' : 'Scalar', },
|
||||
'randn' : { 'mean' : 'Scalar', 'stddev' : 'Scalar', },
|
||||
'inRange' : { 'lowerb' : 'Scalar', 'upperb' : 'Scalar', },
|
||||
}, # '', i.e. empty class
|
||||
} # func_arg_fix
|
||||
|
||||
class ConstInfo(object):
|
||||
def __init__(self, cname, name, val, addedManually=False):
|
||||
self.cname = cname
|
||||
@ -522,8 +531,11 @@ class FuncInfo(object):
|
||||
#self.jni_suffix = "__"
|
||||
#if self.classname and self.ctype and not self.static: # non-static class methods except c-tors
|
||||
# self.jni_suffix += "J" # artifical 'self'
|
||||
arg_fix_map = func_arg_fix.get(classname, {}).get(self.jname, {})
|
||||
for a in decl[3]:
|
||||
ai = ArgInfo(a)
|
||||
arg = a[:]
|
||||
arg[0] = arg_fix_map.get(arg[1], arg[0])
|
||||
ai = ArgInfo(arg)
|
||||
self.args.append(ai)
|
||||
# self.jni_suffix += ctype2j.get(ai.ctype, ["","","",""])[3]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user