1 | initial version |
// let's try: a/b=c ;
Mat a = new Mat(3,3,CvType.CV_32F,new Scalar(12));
Mat b = new Mat(3,3,CvType.CV_32F,new Scalar(2));
Mat c = new Mat();
Core.divide(a,b,c);
System.out.println( c.dump() );
[6, 6, 6;
6, 6, 6;
6, 6, 6]
2 | No.2 Revision |
// let's try: a/b=c ;
Mat a = new Mat(3,3,CvType.CV_32F,new Scalar(12));
Mat b = new Mat(3,3,CvType.CV_32F,new Scalar(2));
Mat c = new Mat();
Core.divide(a,b,c);
System.out.println( c.dump() );
[6, 6, 6;
6, 6, 6;
6, 6, 6]
note, that multiplying by 1/c like this:
Mat oob = new Mat();
Core.divide(1.0,b,oob);
Core.multiply(a,oob,c);
only works with float Mat's. (due to integer truncation)
3 | No.3 Revision |
// let's try: a/b=c ;
Mat a = new Mat(3,3,CvType.CV_32F,new Scalar(12));
Mat b = new Mat(3,3,CvType.CV_32F,new Scalar(2));
Mat c = new Mat();
Core.divide(a,b,c);
System.out.println( c.dump() );
[6, 6, 6;
6, 6, 6;
6, 6, 6]
note, that multiplying by 1/c 1/b like this:
Mat oob = new Mat();
Core.divide(1.0,b,oob);
Core.multiply(a,oob,c);
only works with float Mat's. (due to integer truncation)