What better way to celebrate Pi Day than to make a circular cherry pie, and then use a Raspberry Pi with connected camera to calculate Pi based on image analysis of the cherry pie. The computer vision software recognized the cherry pie and figured out its area and radius in pixels. Then I wrote some code to back-calculate Pi using the equation for the area of a circle, i.e. Area=Pi*Radius**2. With Area and Radius obtained by image analysis of the cherry pie, the Raspberry Pi then calculated Pi=Area/Radius**2 using Python software.
I made the cherry pie using my "Super Easy No Bake Cherry Pie" recipe! The first step is to buy a graham cracker crust. Then mix one bar of cream cheese with a half tub of cool whip and half a cup of powdered sugar. Put that in the crust and then cover with cherry pie filling. It takes about 15 minutes. See photos below.
The technology portion of this project involves using a Raspberry Pi for computer vision. There's a great package called SimpleCV that does cool stuff like recognize blobs in an image. So I connected a USB Camera to my Raspberry Pi and mounted it on a tripod above the cherry pie. After centering the image, I ran my program which captured some images, pulled out the image blob of the cherry pie, and calculated Pi. By the way, "blobs" is a real technical term in image processing.
My result was Pi=3.12 based on an average over five images. I was hoping for something closer to 3.14, but less than 1% error isn't too bad considering that I didn't work on calculating Pi for hundreds of years like the ancient Greeks did.
Lastly, the cherry pie was a big hit for dessert!
Comments