One of the most famous photographs in all of physics was taken at the 1927 Solvay Conference, depicting for posterity the leading scientists responsible for the creation of quantum mechanics. It turns out that this image is used by WRI as an example of basic face recognition in its documentation of ImageCorrelate. As presented in the documentation, this photo can be defined as:
In[]:=
photo=
;
The goal is to use ImageCorrelate to find automatically the faces in photo. To that end, the image of a pair of eyes is used as a template, whose definition is given by:
In[]:=
eyes=
;
The crucial step in the documentation is the calculation of output, given by:
In[]:=
output=ImageCorrelate[photo,eyes,NormalizedSquaredEuclideanDistance]
Out[]=
Plot the Log of the 20 lowest pixel values.
In[]:=
ListPlot[Take[Log@Sort@Union@Flatten@ImageData@output,20],PlotRangeAll,FrameTrue,GridLinesAutomatic,ImageSize200,JoinedTrue]
Out[]=
Note that the lowest value is far smaller than any of the other values. We have:
In[]:=
lowval=First@Sort@Union@Flatten@ImageData@output
Out[]=
1.5452×
-6
10
Where in photo does this extraordinarily low value occur?. This can be done with the help of the following functions, which can be applied to a broad class of images and are also useful for other purposes:
In[]:=
xypixvals[arg_Image]:=Module{nx,ny,qx,qy},{nx,ny}=ImageDimensions@arg;qy=Reverse@Table,{n,1,ny};qx=Table,{n,1,nx};Outer[List,qy,qx]/.{a_Rational,b_}{b,a}
2n-1
2
2n-1
2
In[]:=
datxyrules[arg_Image]:=Module[{q1,q2},q1=Partition[Flatten@xypixvals[arg],2];q2=Partition[Flatten@ImageData@arg,3];Rule[#[[1]],#[[2]]]&/@Transpose@{q2,q1}]
The xy location location of the minimum can then be determined as follows:
In[]:=
xyvals={lowval,lowval,lowval}/.datxyrules@output
Out[]=
,
767
2
169
2
The location in photo is at the center of the circle shown below:
In[]:=
Show[photo,Graphics@{Yellow,Circle[xyvals,15]}]
Out[]=
This suggests that eyes was actually provided courtesy of Max Born’s image, as opposed to some independent source outside of photo. Here is a closer view of photo, in which the similarity with eyes can be seen at a pixel level.
In[]:=
Show[photo=ImageTake[photo,{79,108},{370,400}],ImageSize250]
Out[]=
A further magnification yields:
In[]:=
Show[photo2=ImageTake[photo,{13,18},{9,21}],ImageSize300]
Out[]=
Compare the image data in both eyes and photo2
In[]:=
(ImageData@eyes//Flatten)-((ImageData@photo2)/.{a_,a_,a_}a//Flatten)
Out[]=
{0.00392157,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.00392157,0.}
The two are equal (to a high degree of approximation). It is a mystery as to where the 0.00392157 came from.