How to use python to calculate the similarity between two pictures

I have two pictures of the same pixel, both black and white.
it"s just that there is a slight deviation between the two pictures.
was previously used to convert to an array of comparisons, but the position is a little bit off. It"s basically wrong.

is there any way to use the program to identify the degree of similarity between the two pictures?
to cope with a slight position offset, which knowledge points need to be used, please advise

https://codeshelper.com/a/11.
, the great god"s post, is dealt with in terms of color features. But what about black and white?

Mar.28,2021

combine the posts of the two bigwigs.
has finally made a temporary tool. It's just not enough.

http://www.ruanyifeng.com/blo.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36731-e564.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36731-e564.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?