0% found this document useful (0 votes)
6 views2 pages

538 Riddler Image Analysis Results

The document contains code that imports image files, calculates histograms for the images, and uses ImageDistance to find the closest matching image between two sets of flags based on their histograms. It performs this process for the first three images in one set to find the closest matches in the other set.

Uploaded by

John
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

538 Riddler Image Analysis Results

The document contains code that imports image files, calculates histograms for the images, and uses ImageDistance to find the closest matching image between two sets of flags based on their histograms. It performs this process for the first three images in one set to find the closest matches in the other set.

Uploaded by

John
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

538 Riddler Express 1/3/20

In[5]:= FTEfiles = FileNames["*.png", "/Users/a319557/Desktop/538Flags"];


FTEFlags = Import[#] & /@ FTEfiles;
files = FileNames["*.gif", "/Users/a319557/Desktop/Flags"];
TestFlags = Import[#] & /@ files;

In[9]:= FTEHisto = Table[ImageHistogram[FTEFlags[[i]]], {i, Length[FTEFlags]}];


TestHisto = Table[ImageHistogram[TestFlags[[i]]], {i, Length[TestFlags]}];

In[19]:= IMin = 1 000 000;


MinPic = 0;
Do[
TestDist = ImageDistance[FTEHisto[[1]], TestHisto[[i]]];
If[TestDist < IMin,
IMin = TestDist;
MinPic = i;
];
, {i, 1, Length[TestHisto]}];
Print[IMin, " ", MinPic, " ",
TestFlags[[MinPic]], " ", files[[MinPic]]];

35.9026 81 /Users/a319557/Desktop/Flags/[Link]

In[25]:= IMin = 1 000 000;


MinPic = 0;
Do[
TestDist = ImageDistance[FTEHisto[[2]], TestHisto[[i]]];
If[TestDist < IMin,
IMin = TestDist;
MinPic = i;
];
, {i, 1, Length[TestHisto]}];
Print[IMin, " ", MinPic, " ",
TestFlags[[MinPic]], " ", files[[MinPic]]];

30.6105 33 /Users/a319557/Desktop/Flags/[Link]
2 [Link]

In[22]:= IMin = 1 000 000;


MinPic = 0;
Do[
TestDist = ImageDistance[FTEHisto[[3]], TestHisto[[i]]];
If[TestDist < IMin,
IMin = TestDist;
MinPic = i;
];
, {i, 1, Length[TestHisto]}];
Print[IMin, " ", MinPic, " ",
TestFlags[[MinPic]], " ", files[[MinPic]]];

32.0312 242 /Users/a319557/Desktop/Flags/[Link]

You might also like