How to find the difference of images in numpy arrays?

So, I have this code. Im trying to calculate the difference between 2 images. Im expecting an integer as my result, any idea on this?

from imageio import imread
#https://github.com/glennford49/sampleImages/blob/main/cat1.png
#https://github.com/glennford49/sampleImages/blob/main/cat2.png
img1="cat1.png" # 183X276
img2="cat2.png" # 183x276
numpyImg1=[]
numpyImg2=[]
img1=imread(img1)
img2=imread(img2)
numpyImg1.append(img1)
numpyImg2.append(img2)
diff = numpyImg1[0] - numpyImg2[0] 
result = sum(abs(diff)) 

print("difference:",result)

print:

# it prints an array of images rather than printing an interger only

target:

difference: <int>


from Recent Questions - Stack Overflow https://ift.tt/3hgflJW
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)