Something strange happens when substracting 2 images (mat type) in opencv

Are you sure that image size are equal?

Don’t use a loop to substract images use subtract