Last Friday I volunteered for an Hour of Code session at a high school class in Barcelona as part of my little contribution for Computer Science Education Week, December 7-13. My talk was aimed for a small group of students that had never programmed, and my goal was to introduce them to the Raspberry Pi and the Wolfram Language. The good thing is that at the end I succeeded to change the students' perception about programming. It changed from something that is over-complicated and boring to something that is accessible and even fun.
The lines of code that they enjoyed the most were these:
i=Import["http://statics.ccma.cat/multimedia/jpg/5/3/1433774407435.jpg"];
b=FindFaces[i,{Scaled[1/25],Scaled[1/7]}];
HighlightImage[i,Rectangle@@@b,Method->"Boundary"]
faces = ImageTrim[i, #] & /@ b
faces=Delete[faces,6];
celebs=Classify["NotablePerson",faces,{"TopProbabilities",5}];
pics=Partition[Thread[Rule[Keys@Flatten[celebs],Quiet[ImageTrim[#,First[FindFaces[#]]]]&/@EntityValue[Keys@Flatten[celebs],"Image"]]],5];
list={};
Table[list=Append[list,Part[Complement[i,list],2]],{i,Table[Select[i,ImageQ[#[[2]]]&],{i,pics}]}];
list
ImageAssemble@Partition[ImageResize[#,100]&/@Riffle[list[[All,2]],faces],6]
The fact that I was able to take a photo of them with my smart phone, send it to Data Drop, import it immediately to my slideshow, highlight their faces, get a direct answer to what famous persons they look like, and make a collage of their faces side by side with their famous counterparts, was a mind-blowing experience for them.
What others say about the Wolfram Language for the Hour of Code?
Go beyond the hour of code!