Completition: Oct 2013
Collaboration: Vitamins Design
Technologies used: C++, openCV, PHP, Google Calendar API
At the end of 2013 I was approached by Vitamins to help them create a more powerful version of their LEGO calendar. They now call it Bit Planner.
About Vitamins :: Vitamins Design used to be an impressive innovation studio based in Spitalfields, East-London, UK. They have now parted and are off to new ventures.
What the LEGO Calendar does
After taking a picture of a LEGO calendar, the structure of which has been predefined, the user emails this photo to the application. The application constantly anticipates new calendar photos. When receiving a new photo, the image is being interpreted with the help of OpenCV. During this process it’s being divided into the 3 months first, then the individual days and then it looks for each team members tasks in the morning and in the afternoon. All found events are then stored or updated into a Google Calendar.
Also each day the application sends out an email to all team members, in case anyone made an update in the Google Calendar online.
Note: This project is in beta.
- Google Calendar API
- Imap for retrieving emails
- PHPMailer for sending emails
- openFrameworks v0.7.4
- MAMP for the local server
Platform: Mac OSX 10.8.5
The project is divided into 2 parts:
- The computer vision application responsible for interpreting and generating images and controlling the entire process.
- The server-side application responsible for communicating with the Google Calendar API and for sending and retrieving emails.
In the technologies list above I have provided links to all the dependencies I will mention in the following lines.
· · ·
Computer vision application — Requirements and setup
The project needs to be placed inside a working openFrameworks package. I developed it in version 0.7.4. I can’t see why it shouldn’t work in the latest version 0.8.0 as well, but I haven’t tested it.
Please check if you have the following addons in your openFrameworks addons folder:
You need to have a 32-bit/i386 version of OpenCV installed on your computer and point correctly to it from the Xcode project. It needs to be 32-bit because openFrameworks does not run on 64-bit yet.
I used the at the time of development latest version 2.4.6.
Inside the project is a
settings.xml where you need to make sure that the path settings to the server application and also to the computer vision application itself are set correct.
In there you can modify further parameter, e.g. how often the application checks for emails or at which time of the day the user is supposed to receive the email about potential updates.
· · ·
Server-side application — Requirements and setup
Since the majority of this part is written in PHP, make sure that you have a valid PHP installation. I usually use MAMP as it’s quick and easy to install. Place the files of the 02_Localhost folder in the
htdocs folder on your (local) server (for WAMP users this would be the www folder).
In order to use the Google Calendar API login to your Google account and create a client ID and secret by following the steps decribed on the Google Developer website: With the help of the API Access pane you will be able to generate Client ID and client secret for a Service Account.
Place the file containing the private key (*.p12) inside the
data folder of the PHP project and enter the path to it in
config/settingsGoogle.php. In this file also enter the generated client ID, the client secret, and the developer key for the web app, and the service client id and the service account name. Also enter the ID of your calendar where you want the events to be stored in (it looks like an email address and can be found in the calendar settings). Make sure you set the correct permissions in the calendar’s settings so the application is allowed to do modifications.
settings.php file inside the config folder check that the paths the the
CLASSES folder and the computer vision application are correct.
config/settingsVitamins.php enter the IMAP and SMTP details for the application to retrieve and send out emails. In there you call also determine the subject line the user is supposed to use when sending a photo to the application, at the moment it looks for Lego, lego and LEGO. Also edit the project names so you can identify them properly in the Google Calendar online. And, edit your team member’s names and email addresses to make sure the correct person receives the notification about potential updates.
When you open the
index.php in your browser, e.g. http://localhost:8888/PROJECTS/LegoCalendar/V3/ you can see all the settings you’ve made in settingsVitamins.php. This is a quick read-only check. For security reasons, I recommend to delete this file after you’re done with your setup so third-parties don’t get unauthorised access to your data.
… to name but a few.
Please do not hesitate to contact me in case you would like to gain access to the code.