a | b | a = b ---------
--------------- a | | XX |
0 | 0 | 1 ---------
0 | 1 | 0 | XX | |
1 | 0 | 0 ---------
1 | 1 | 1 b
Thus it is seen that fuzzy equality corresponds with the following non-trivial
arithmetical expression:
$$
(a \cap b) \cup (\overline{a} \cap \overline{b}) = (a.b) \cup (1-a)(1-b) =
$$ $$
a.b + (1-a)(1-b) - a.b(1-a)(1-b) = a.b + (1-a)(1-b)(1-a.b) =
$$ $$
1 - a - b + a.b + a^2.b + a.b^2 - a^2.b^2
$$
In classical logic the intersection between $(a \cap b)$ and
$(\overline{a} \cap \overline{b})$ is zero: the sets $(a \cap b)$ and
$(\overline{a} \cap \overline{b})$ are disjoint. Thus $a.b.(1-a)(1-b) = 0$.
This means that a suitable fuzzyfication could also be given by:
$$
(a \cap b) \cup (\overline{a} \cap \overline{b}) = a.b + (1-a)(1-b)
$$
That is: a bilinear interpolation between
Programming notes. After loading the two pictures, it must be found out what pixels share the same position (approximately). This is an art in itself which shall not be described here. Having done that, all (grey-valued) pixel colors are converted to equivalent number values in the range $\,\left[0,1\right]$ , giving numbers $\,a\,$ for picture $(1)$ and numbers $\,b\,$ for picture $(2)$. These are fed into the Fuzzy Equality routine, with numbers in the same $\,\left[0,1\right]\,$ range as the output:
function Fuzzy_Equality(method : integer; a,b : double) : double;
{
Fuzzy Equality
}
var
v : double;
function max(x,y : double) : double;
var
m : double;
begin
m := x; if m < y then m := y;
max := m;
end;
function min(x,y : double) : double;
var
m : double;
begin
m := x; if m > y then m := y;
min := m;
end;
begin
v := 0;
case method of
{ Probablistic }
0 : v := a\*b + (1-a)\*(1-b)\*(1-a\*b);
{ Bilinear }
1 : v := a\*b + (1-a)\*(1-b);
{ Standard }
2 : v := max(min(a,b),min(1-a,1-b));
end;
Fuzzy_Equality := v;
end;
The outputs are converted to equivalent $\color{red}{\mbox{reddish}}$ colors:
the more unequal the pixel greys, the more reddish. In this way, the pixel
positions with most different grey values are emphasized as the most
reddish spots in the leftmost picture:
It can be shown experimentally that any version of the above Fuzzy Equalities seems to work equally well. So the fuzzyfication of boolean logic is not quite unambiguous. This is a common feature with "going back to reality", as is exemplified numerous times with e.g. Numerical Analysis: there exist many numerical approximations for the same differential equation.
Update. Maybe the picture example as stated is not (yet) the logic
as expected by the OP.
How then about the following logic (yes?) question:
How much equal are the two pictures?
An answer is produced by
the program if we add all fuzzy equality numbers together and divide by the
number of pixels. Resulting in:
8.23370043338440E-0001 : Fuzzy Logic method 0 8.28104562088338E-0001 : Fuzzy Logic method 1 8.31005249431013E-0001 : Fuzzy Logic method 2The outcomes are not much different from each other, as expected. So the two pictures are $\,82.3\%$ , $82.8\%$ , $83.1\%$ equal, dependent on the fuzzy equality method chosen.