# Revision history [back]

### Java API - Core.add() method not working!?

When trying to add two Mat elements by using the Core.add() method, these are added only if src1 is an EXACT copy of src2 (or viceversa). As soon as I change the value of an element in one of them, the addition does not happen and the original unmodified value is returned.

Example:

Mat dst = new Mat(src1.rows(), src1.cols(), CvType.CV_32F);

The following works correctly:

src2 = src1.clone(); Core.add(src1, src2, dst);

src2 = src1.clone(); src2.put(0,0,1.0); // Changing element in position 0,0 of src2 Core.add(src1, src2, dst);

Element (0,0) of dst has the same value of element (0,0) of src1. No addition takes place.

This is true also if the two matrices (src1 and src2) are completely different, if I use a Scalar instead of a matrix, etc. I also tried using the Core.add() method with a mask but with no success either.

I am using Android 4.2.2 on ARM.

Anybody has any idea or suggestion??? Thanks!

### Java API - Core.add() method not working!?

When trying to add two Mat elements by using the Core.add() method, these are added only if src1 is an EXACT copy of src2 (or viceversa). As soon as I change the value of an element in one of them, the addition does not happen and the original unmodified value is returned.

Example:

Mat dst = new Mat(src1.rows(), src1.cols(), CvType.CV_32F);CvType.CV_32F);


The following works correctly:

src2 = src1.clone();


src2 = src1.clone();
src2.put(0,0,1.0); // Changing element in position 0,0 of src2


Element (0,0) of dst has the same value of element (0,0) of src1. No addition takes place.

This is true also if the two matrices (src1 and src2) are completely different, if I use a Scalar instead of a matrix, etc. I also tried using the Core.add() method with a mask but with no success either.

I am using Android 4.2.2 on ARM.

Anybody has any idea or suggestion??? Thanks!

### Java API - Core.add() method not working!?

When trying to add two Mat elements by using the Core.add() method, these are added only if src1 is an EXACT copy of src2 (or viceversa). As soon as I change the value of an element in one of them, the addition does not happen and the original unmodified value is returned.

Example:

Mat dst = new Mat(src1.rows(), src1.cols(), CvType.CV_32F);


The following works correctly:

src2 = src1.clone();


src2 = src1.clone();
src2.put(0,0,1.0); // Changing element in position 0,0 of src2


Element (0,0) of dst has the same value of element (0,0) of src1. No addition takes place.

This is true also if the two matrices (src1 and src2) are completely different, if I use a Scalar instead of a matrix, etc. I also tried using the Core.add() method with a mask but with no success either.

I am using Android 4.2.2 on ARM.

Anybody has any idea or suggestion??? Thanks!

### Java API - Core.add() method not working!?

When trying to add two Mat elements by using the Core.add() method, these are added only if src1 is an EXACT copy of src2 (or viceversa). As soon as I change the value of an element in one of them, the addition does not happen and the original unmodified value is returned.

Example:

Mat dst = new Mat(src1.rows(), src1.cols(), CvType.CV_32F);


The following works correctly:

src2 = src1.clone();


src2 = src1.clone();
src2.put(0,0,1.0); // Changing element in position 0,0 of src2


Element (0,0) of dst has the same value of element (0,0) of src1. No addition takes place.

This is true also if the two matrices (src1 and src2) are completely different, if I use a Scalar instead of a matrix, etc. I also tried using the Core.add() method with a mask but with no success either.

I am using Android 4.2.2 on ARM.

Anybody has any idea or suggestion??? Thanks!

### Java API - Core.add() method not working!?working!? How to add 2 Mats?

When trying to add two Mat elements by using the Core.add() method, these are added only if src1 is an EXACT copy of src2 (or viceversa). As soon as I change the value of an element in one of them, the addition does not happen and the original unmodified value is returned.

Example:

Mat dst = new Mat(src1.rows(), src1.cols(), CvType.CV_32F);


The following works correctly:

src2 = src1.clone();


src2 = src1.clone();