Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the docs are your friend:

// 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]

the docs are your friend:

// 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)

the docs are your friend:

// 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)