Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. This is because you've simply added the values of the pixels without normalizing it, so if you had two corresponding pixels that were identical, now their value is twice as high as before. You need to normalize the image.

  2. This is because these two images are almost identical as far as I can tell, so if you subtract them, most of the values become 0.

  3. Which error? Hard to tell without you showing the error message, but if you've uploaded original images, it's because of size mismatch. You can't add/subtract two images if their height and width don't match as it is a per-element operation.

  1. This is because you've simply added the values of the pixels without normalizing it, so if you had two corresponding pixels that were identical, now their value is twice as high as before. You need to normalize the image.

  2. This is because these two images are almost identical as far as I can tell, so if you subtract them, most of the values become 0. It's like with 'normal' subtraction - subtracting equal values always results in 0.

  3. Which error? Hard to tell without you showing the error message, but if you've uploaded original images, it's because of size mismatch. You can't add/subtract two images if their height and width don't match as it is a per-element operation.

  1. This is because you've simply added the values of the pixels without normalizing it, so if you had two corresponding pixels that were identical, now their value is twice as high as before. You need to normalize the image.

  2. This is because these two images are almost identical as far as I can tell, so if you subtract them, most of the values become 0. It's like with 'normal' subtraction - subtracting equal values always results in 0.

  3. Which error? Hard to tell without you showing the error message, but if you've uploaded original images, it's because of size mismatch. You can't add/subtract two images if their height and width don't match as it is a per-element operation.

CV_32F etc. indicates the type of values that a particular Mat object uses to represent its data. Here is a nice table showing how these types corresponds to traditional variable types:

https://ninghang.blogspot.com/2012/11/list-of-mat-type-in-opencv.html

  1. This is because you've simply added the values of the pixels without normalizing it, so if you had two corresponding pixels that were identical, now their value is twice as high as before. You need to normalize the image.

  2. This is because these two images are almost identical as far as I can tell, so if you subtract them, most of the values become 0. It's like with 'normal' subtraction - subtracting equal values always results in 0.

  3. Which error? Hard to tell without you showing the error message, but if you've uploaded original images, it's because of size mismatch. You can't add/subtract two images if their height and width don't match as it is a per-element operation.operation. CV_32F has probably nothing to do with it unless you also have a type mismatch in your code (see below).

  4. If you try to add/subtract images of different types, e.g. one is grayscale, and the other one is RGB, it's type mismatch. For most operations, images have to be of the same type.

CV_32F etc. indicates the type of values that a particular Mat object uses to represent its data. The types usually have to match as mentioned at point 4. Here is a nice table showing how these types corresponds correspond to traditional variable types:

https://ninghang.blogspot.com/2012/11/list-of-mat-type-in-opencv.html